Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused typing ignore comments #1781

Merged
merged 2 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ python_version = "3.8"
ignore_missing_imports = true
namespace_packages = false

warn_unused_configs = true
warn_redundant_casts = true
warn_unused_ignores = true


[tool.pytest.ini_options]
doctest_optionflags = [
"NORMALIZE_WHITESPACE",
Expand Down
4 changes: 2 additions & 2 deletions src/zarr/_storage/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,10 +642,10 @@ def _rmdir_from_keys_v3(store: StoreV3, path: str = "") -> None:
sfx = _get_metadata_suffix(store)
array_meta_file = meta_dir + ".array" + sfx
if array_meta_file in store:
store.erase(array_meta_file) # type: ignore
store.erase(array_meta_file)
group_meta_file = meta_dir + ".group" + sfx
if group_meta_file in store:
store.erase(group_meta_file) # type: ignore
store.erase(group_meta_file)


def _listdir_from_keys(store: BaseStore, path: Optional[str] = None) -> List[str]:
Expand Down
2 changes: 1 addition & 1 deletion src/zarr/_storage/v3_storage_transformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ def erase_prefix(self, prefix):

def rmdir(self, path=None):
path = normalize_storage_path(path)
_rmdir_from_keys_v3(self, path) # type: ignore
_rmdir_from_keys_v3(self, path)

def __contains__(self, key):
if self._is_data_key(key):
Expand Down
4 changes: 2 additions & 2 deletions src/zarr/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ def decode_fill_value(cls, v: Any, dtype: np.dtype, object_codec: Any = None) ->
return np.array(v, dtype=dtype)[()]
elif dtype.kind in "c":
v = (
cls.decode_fill_value(v[0], dtype.type().real.dtype), # type: ignore
cls.decode_fill_value(v[1], dtype.type().imag.dtype), # type: ignore
cls.decode_fill_value(v[0], dtype.type().real.dtype),
cls.decode_fill_value(v[1], dtype.type().imag.dtype),
)
v = v[0] + 1j * v[1]
return np.array(v, dtype=dtype)[()]
Expand Down
12 changes: 6 additions & 6 deletions src/zarr/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def rmdir(store: StoreLike, path: Path = None):
store_version = getattr(store, "_store_version", 2)
if hasattr(store, "rmdir") and store.is_erasable(): # type: ignore
# pass through
store.rmdir(path) # type: ignore
store.rmdir(path)
else:
# slow version, delete one key at a time
if store_version == 2:
Expand Down Expand Up @@ -235,7 +235,7 @@ def listdir(store: BaseStore, path: Path = None):
path = normalize_storage_path(path)
if hasattr(store, "listdir"):
# pass through
return store.listdir(path) # type: ignore
return store.listdir(path)
else:
# slow version, iterate through all keys
warnings.warn(
Expand Down Expand Up @@ -288,7 +288,7 @@ def getsize(store: BaseStore, path: Path = None) -> int:
if hasattr(store, "getsize"):
# pass through
path = normalize_storage_path(path)
return store.getsize(path) # type: ignore
return store.getsize(path)
elif isinstance(store, MutableMapping):
return _getsize(store, path)
else:
Expand Down Expand Up @@ -626,7 +626,7 @@ def _init_array_metadata(

key = _prefix_to_array_key(store, _path_to_prefix(path))
if hasattr(store, "_metadata_class"):
store[key] = store._metadata_class.encode_array_metadata(meta) # type: ignore
store[key] = store._metadata_class.encode_array_metadata(meta)
else:
store[key] = encode_array_metadata(meta)

Expand Down Expand Up @@ -729,10 +729,10 @@ def _init_group_metadata(
if store_version == 3:
meta = {"attributes": {}} # type: ignore
else:
meta = {} # type: ignore
meta = {}
key = _prefix_to_group_key(store, _path_to_prefix(path))
if hasattr(store, "_metadata_class"):
store[key] = store._metadata_class.encode_group_metadata(meta) # type: ignore
store[key] = store._metadata_class.encode_group_metadata(meta)
else:
store[key] = encode_group_metadata(meta)

Expand Down
2 changes: 1 addition & 1 deletion src/zarr/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def normalize_chunks(chunks: Any, shape: Tuple[int, ...], typesize: int) -> Tupl
def normalize_dtype(dtype: Union[str, np.dtype], object_codec) -> Tuple[np.dtype, Any]:
# convenience API for object arrays
if inspect.isclass(dtype):
dtype = dtype.__name__ # type: ignore
dtype = dtype.__name__
if isinstance(dtype, str):
# allow ':' to delimit class from codec arguments
tokens = dtype.split(":")
Expand Down
Loading