Skip to content

Docstring corrections and lint modernization#168

Merged
d-v-b merged 3 commits into
zarr-developers:mainfrom
d-v-b:chore/docstring-and-lint-fixes
Jun 19, 2026
Merged

Docstring corrections and lint modernization#168
d-v-b merged 3 commits into
zarr-developers:mainfrom
d-v-b:chore/docstring-and-lint-fixes

Conversation

@d-v-b

@d-v-b d-v-b commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

Part of the review in #165. No behavior changes.

Docstring fixes

  • v3.ArraySpec.from_zarr example (v3.py): replaced a copy-pasted Zarr v2 repr with a correct Zarr v3 example (verified by running the snippet).
  • to_flat docstrings (v2.py and v3.py, method and module-level):
    • Fixed missing comma: to_flat(g1 root_path='baz')to_flat(g1, root_path='baz').
    • Fixed wrong import alias: from pydantic_zarr.v{2,3} import flattenimport to_flat.
    • Fixed zarr_format=2 in a v3 example output.
    • Made method docstrings (GroupSpec.to_flat) self-consistent by using method-call style (g1.to_flat()).
    • Updated example output strings to match actual repr (includes node_type= field in v3, corrected key ordering).
  • "codices" → "codecs" in v3.py and experimental/v3.py.
  • "Compare am" → "Compare an" in v2.py, v3.py, experimental/v2.py, experimental/v3.py.
  • Truncated sentence in v2.py module-level to_zarr docstring: "Additional keyword arguments will be" → "…will be passed to member to_zarr calls and zarr.create."
  • V2ChunkKeyEncoding type (v3.py line ~120): was using DefaultChunkKeyEncodingConfig (the wrong config class); changed to V2ChunkKeyEncodingConfig which is defined immediately above and is structurally identical — no runtime change.

Lint modernization

  • FURB171 (v3.py, experimental/v3.py): kind in ["f"] / kind in ["c"]kind == "f" / kind == "c".
  • dict(data).copy()dict(data) in from_flat_group in v2.py, v3.py, experimental/v2.py, experimental/v3.py.
  • ensure_key_no_path (core.py, experimental/core.py): list comprehension used for side effects converted to a plain for loop.
  • RUF043 (tests/): added raw-string prefix or re.escape-style escaping to pytest.raises(match=…) patterns that contained regex metacharacters (. and /).

🤖 Generated with Claude Code

d-v-b and others added 2 commits June 14, 2026 22:49
Fix docstring rot (v2/v3 examples, codices→codecs, Compare am→an, truncated
sentence, invalid to_flat import alias), use V2ChunkKeyEncodingConfig in
V2ChunkKeyEncoding, convert list-comp side effects to for loops, drop redundant
.copy(), replace single-item membership tests with equality, and fix RUF043
pytest.raises regex patterns. No behavior changes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@d-v-b d-v-b marked this pull request as ready for review June 19, 2026 10:53
@d-v-b d-v-b merged commit 97a991e into zarr-developers:main Jun 19, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant