diff --git a/pyproject.toml b/pyproject.toml index 3dc46a0f9c..9430b0a783 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -207,23 +207,24 @@ extend-exclude = [ [tool.ruff.lint] extend-select = [ - "ANN", # flake8-annotations - "B", # flake8-bugbear - "C4", # flake8-comprehensions - "FLY", # flynt - "G", # flake8-logging-format - "I", # isort - "ISC", # flake8-implicit-str-concat - "PGH", # pygrep-hooks - "PT", # flake8-pytest-style - "PYI", # flake8-pyi - "RSE", # flake8-raise - "RET", # flake8-return + "ANN", # flake8-annotations + "B", # flake8-bugbear + "C4", # flake8-comprehensions + "FLY", # flynt + "G", # flake8-logging-format + "I", # isort + "ISC", # flake8-implicit-str-concat + "PERF", # Perflint + "PGH", # pygrep-hooks + "PT", # flake8-pytest-style + "PYI", # flake8-pyi + "RSE", # flake8-raise + "RET", # flake8-return "RUF", - "TCH", # flake8-type-checking - "TRY", # tryceratops - "UP", # pyupgrade - "W", # pycodestyle warnings + "TCH", # flake8-type-checking + "TRY", # tryceratops + "UP", # pyupgrade + "W", # pycodestyle warnings ] ignore = [ "ANN003", diff --git a/src/zarr/core/array.py b/src/zarr/core/array.py index 0e73d44563..da477056ee 100644 --- a/src/zarr/core/array.py +++ b/src/zarr/core/array.py @@ -2873,13 +2873,7 @@ def chunks_initialized( store_contents = list( collect_aiterator(array.store_path.store.list_prefix(prefix=array.store_path.path)) ) - out: list[str] = [] - - for chunk_key in array._iter_chunk_keys(): - if chunk_key in store_contents: - out.append(chunk_key) - - return tuple(out) + return tuple(chunk_key for chunk_key in array._iter_chunk_keys() if chunk_key in store_contents) def _build_parents( diff --git a/src/zarr/core/metadata/v3.py b/src/zarr/core/metadata/v3.py index b85932ef82..8aedd2b7b6 100644 --- a/src/zarr/core/metadata/v3.py +++ b/src/zarr/core/metadata/v3.py @@ -77,10 +77,7 @@ def validate_codecs(codecs: tuple[Codec, ...], dtype: DataType) -> None: """Check that the codecs are valid for the given dtype""" # ensure that we have at least one ArrayBytesCodec - abcs: list[ArrayBytesCodec] = [] - for codec in codecs: - if isinstance(codec, ArrayBytesCodec): - abcs.append(codec) + abcs: list[ArrayBytesCodec] = [codec for codec in codecs if isinstance(codec, ArrayBytesCodec)] if len(abcs) == 0: raise ValueError("At least one ArrayBytesCodec is required.") elif len(abcs) > 1: