Skip to content

Commit d55f169

Browse files
committed
fix(mypy): address tensorstore issues
1 parent cc79081 commit d55f169

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

tests/unit/layer/volumetric/tensorstore/test_backend.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# pylint: disable=missing-docstring,redefined-outer-name,unused-argument,pointless-statement,line-too-long,protected-access,too-few-public-methods
2+
# mypy: disable-error-code="misc,method-assign,attr-defined"
23
import os
34
import pathlib
45
from copy import deepcopy

zetta_utils/layer/volumetric/tensorstore/backend.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,11 +309,15 @@ def with_changes(self, **kwargs) -> TSBackend:
309309

310310
def get_voxel_offset(self, resolution: Vec3D) -> Vec3D[int]:
311311
ts = _get_ts_at_resolution(self.path, self.cache_bytes_limit, str(list(resolution)))
312-
return Vec3D[int](*ts.chunk_layout.grid_origin[0:3])
312+
grid_origin = ts.chunk_layout.grid_origin
313+
assert grid_origin is not None
314+
return Vec3D[int](*grid_origin[0:3])
313315

314316
def get_chunk_size(self, resolution: Vec3D) -> Vec3D[int]:
315317
ts = _get_ts_at_resolution(self.path, self.cache_bytes_limit, str(list(resolution)))
316-
return Vec3D[int](*ts.chunk_layout.read_chunk.shape[0:3])
318+
chunk_shape = ts.chunk_layout.read_chunk.shape
319+
assert chunk_shape is not None
320+
return Vec3D[int](*chunk_shape[0:3])
317321

318322
def get_dataset_size(self, resolution: Vec3D) -> Vec3D[int]:
319323
ts = _get_ts_at_resolution(self.path, self.cache_bytes_limit, str(list(resolution)))

zetta_utils/layer/volumetric/tensorstore/deprecated/backend.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,11 +294,15 @@ def with_changes(self, **kwargs) -> TSBackend:
294294

295295
def get_voxel_offset(self, resolution: Vec3D) -> Vec3D[int]:
296296
ts = _get_ts_at_resolution(self.path, self.cache_bytes_limit, str(list(resolution)))
297-
return Vec3D[int](*ts.chunk_layout.grid_origin[0:3])
297+
grid_origin = ts.chunk_layout.grid_origin
298+
assert grid_origin is not None
299+
return Vec3D[int](*grid_origin[0:3])
298300

299301
def get_chunk_size(self, resolution: Vec3D) -> Vec3D[int]:
300302
ts = _get_ts_at_resolution(self.path, self.cache_bytes_limit, str(list(resolution)))
301-
return Vec3D[int](*ts.chunk_layout.read_chunk.shape[0:3])
303+
chunk_shape = ts.chunk_layout.read_chunk.shape
304+
assert chunk_shape is not None
305+
return Vec3D[int](*chunk_shape[0:3])
302306

303307
def get_dataset_size(self, resolution: Vec3D) -> Vec3D[int]:
304308
ts = _get_ts_at_resolution(self.path, self.cache_bytes_limit, str(list(resolution)))

0 commit comments

Comments
 (0)