Skip to content

Commit 3a9d968

Browse files
dstansbyd-v-b
andauthored
Remove unused typing ignore comments (#1781)
Co-authored-by: Davis Bennett <[email protected]>
1 parent 3a73950 commit 3a9d968

File tree

6 files changed

+17
-12
lines changed

6 files changed

+17
-12
lines changed

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@ python_version = "3.8"
152152
ignore_missing_imports = true
153153
namespace_packages = false
154154

155+
warn_unused_configs = true
156+
warn_redundant_casts = true
157+
warn_unused_ignores = true
158+
159+
155160
[tool.pytest.ini_options]
156161
doctest_optionflags = [
157162
"NORMALIZE_WHITESPACE",

src/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]:

src/zarr/_storage/v3_storage_transformers.py

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

368368
def rmdir(self, path=None):
369369
path = normalize_storage_path(path)
370-
_rmdir_from_keys_v3(self, path) # type: ignore
370+
_rmdir_from_keys_v3(self, path)
371371

372372
def __contains__(self, key):
373373
if self._is_data_key(key):

src/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)[()]

src/zarr/storage.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def rmdir(store: StoreLike, path: Path = None):
205205
store_version = getattr(store, "_store_version", 2)
206206
if hasattr(store, "rmdir") and store.is_erasable(): # type: ignore
207207
# pass through
208-
store.rmdir(path) # type: ignore
208+
store.rmdir(path)
209209
else:
210210
# slow version, delete one key at a time
211211
if store_version == 2:
@@ -235,7 +235,7 @@ def listdir(store: BaseStore, path: Path = None):
235235
path = normalize_storage_path(path)
236236
if hasattr(store, "listdir"):
237237
# pass through
238-
return store.listdir(path) # type: ignore
238+
return store.listdir(path)
239239
else:
240240
# slow version, iterate through all keys
241241
warnings.warn(
@@ -288,7 +288,7 @@ def getsize(store: BaseStore, path: Path = None) -> int:
288288
if hasattr(store, "getsize"):
289289
# pass through
290290
path = normalize_storage_path(path)
291-
return store.getsize(path) # type: ignore
291+
return store.getsize(path)
292292
elif isinstance(store, MutableMapping):
293293
return _getsize(store, path)
294294
else:
@@ -626,7 +626,7 @@ def _init_array_metadata(
626626

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

@@ -729,10 +729,10 @@ def _init_group_metadata(
729729
if store_version == 3:
730730
meta = {"attributes": {}} # type: ignore
731731
else:
732-
meta = {} # type: ignore
732+
meta = {}
733733
key = _prefix_to_group_key(store, _path_to_prefix(path))
734734
if hasattr(store, "_metadata_class"):
735-
store[key] = store._metadata_class.encode_group_metadata(meta) # type: ignore
735+
store[key] = store._metadata_class.encode_group_metadata(meta)
736736
else:
737737
store[key] = encode_group_metadata(meta)
738738

src/zarr/util.py

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

0 commit comments

Comments
 (0)