Skip to content

Commit 12abd4e

Browse files
dstansbyd-v-b
andauthored
Remove unused mypy ignore comments (#1602)
Co-authored-by: Davis Bennett <[email protected]>
1 parent 4d79cfc commit 12abd4e

File tree

6 files changed

+15
-14
lines changed

6 files changed

+15
-14
lines changed

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,10 @@ exclude = '''
120120
'''
121121

122122
[tool.mypy]
123-
python_version = "3.8"
124123
ignore_missing_imports = true
125-
follow_imports = "silent"
124+
warn_unused_configs = true
125+
warn_redundant_casts = true
126+
warn_unused_ignores = true
126127

127128
[tool.pytest.ini_options]
128129
doctest_optionflags = [

zarr/_storage/store.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -642,10 +642,10 @@ def _rmdir_from_keys_v3(store: StoreV3, path: str = "") -> None:
642642
sfx = _get_metadata_suffix(store)
643643
array_meta_file = meta_dir + ".array" + sfx
644644
if array_meta_file in store:
645-
store.erase(array_meta_file) # type: ignore
645+
store.erase(array_meta_file)
646646
group_meta_file = meta_dir + ".group" + sfx
647647
if group_meta_file in store:
648-
store.erase(group_meta_file) # type: ignore
648+
store.erase(group_meta_file)
649649

650650

651651
def _listdir_from_keys(store: BaseStore, path: Optional[str] = None) -> List[str]:

zarr/_storage/v3_storage_transformers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ def erase_prefix(self, prefix):
351351

352352
def rmdir(self, path=None):
353353
path = normalize_storage_path(path)
354-
_rmdir_from_keys_v3(self, path) # type: ignore
354+
_rmdir_from_keys_v3(self, path)
355355

356356
def __contains__(self, key):
357357
if self._is_data_key(key):

zarr/meta.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ def decode_fill_value(cls, v: Any, dtype: np.dtype, object_codec: Any = None) ->
234234
return np.array(v, dtype=dtype)[()]
235235
elif dtype.kind in "c":
236236
v = (
237-
cls.decode_fill_value(v[0], dtype.type().real.dtype), # type: ignore
238-
cls.decode_fill_value(v[1], dtype.type().imag.dtype), # type: ignore
237+
cls.decode_fill_value(v[0], dtype.type().real.dtype),
238+
cls.decode_fill_value(v[1], dtype.type().imag.dtype),
239239
)
240240
v = v[0] + 1j * v[1]
241241
return np.array(v, dtype=dtype)[()]

zarr/storage.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def rmdir(store: StoreLike, path: Path = None):
206206
store_version = getattr(store, "_store_version", 2)
207207
if hasattr(store, "rmdir") and store.is_erasable(): # type: ignore
208208
# pass through
209-
store.rmdir(path) # type: ignore
209+
store.rmdir(path)
210210
else:
211211
# slow version, delete one key at a time
212212
if store_version == 2:
@@ -236,7 +236,7 @@ def listdir(store: BaseStore, path: Path = None):
236236
path = normalize_storage_path(path)
237237
if hasattr(store, "listdir"):
238238
# pass through
239-
return store.listdir(path) # type: ignore
239+
return store.listdir(path)
240240
else:
241241
# slow version, iterate through all keys
242242
warnings.warn(
@@ -289,7 +289,7 @@ def getsize(store: BaseStore, path: Path = None) -> int:
289289
if hasattr(store, "getsize"):
290290
# pass through
291291
path = normalize_storage_path(path)
292-
return store.getsize(path) # type: ignore
292+
return store.getsize(path)
293293
elif isinstance(store, MutableMapping):
294294
return _getsize(store, path)
295295
else:
@@ -627,7 +627,7 @@ def _init_array_metadata(
627627

628628
key = _prefix_to_array_key(store, _path_to_prefix(path))
629629
if hasattr(store, "_metadata_class"):
630-
store[key] = store._metadata_class.encode_array_metadata(meta) # type: ignore
630+
store[key] = store._metadata_class.encode_array_metadata(meta)
631631
else:
632632
store[key] = encode_array_metadata(meta)
633633

@@ -730,10 +730,10 @@ def _init_group_metadata(
730730
if store_version == 3:
731731
meta = {"attributes": {}} # type: ignore
732732
else:
733-
meta = {} # type: ignore
733+
meta = {}
734734
key = _prefix_to_group_key(store, _path_to_prefix(path))
735735
if hasattr(store, "_metadata_class"):
736-
store[key] = store._metadata_class.encode_group_metadata(meta) # type: ignore
736+
store[key] = store._metadata_class.encode_group_metadata(meta)
737737
else:
738738
store[key] = encode_group_metadata(meta)
739739

zarr/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def normalize_chunks(chunks: Any, shape: Tuple[int, ...], typesize: int) -> Tupl
183183
def normalize_dtype(dtype: Union[str, np.dtype], object_codec) -> Tuple[np.dtype, Any]:
184184
# convenience API for object arrays
185185
if inspect.isclass(dtype):
186-
dtype = dtype.__name__ # type: ignore
186+
dtype = dtype.__name__
187187
if isinstance(dtype, str):
188188
# allow ':' to delimit class from codec arguments
189189
tokens = dtype.split(":")

0 commit comments

Comments
 (0)