Skip to content
Open
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
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ default_language_version:
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -20,18 +20,18 @@ repos:
- id: sort-simple-yaml
- id: trailing-whitespace
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
rev: v2.4.3
hooks:
- id: codespell
additional_dependencies: ["tomli"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.8
rev: v0.16.0
hooks:
- id: ruff
args: [ --fix ]
- id: ruff-format
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.22
rev: 1.0.0
hooks:
- id: mdformat
args: ["--wrap=80"]
11 changes: 4 additions & 7 deletions znfields/__init__.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
import dataclasses
import functools
from typing import Any, Callable, Optional
from collections.abc import Callable
from typing import Any, Optional


class _ZNFIELDS_GETTER_TYPE:
"""Sentinel class to identify the getter type."""

pass


class _ZNFIELDS_SETTER_TYPE:
"""Sentinel class used to identify the setter type."""

pass


# Sentinels to identify the getter and setter types
ZNFIELDS_GETTER_TYPE = _ZNFIELDS_GETTER_TYPE()
Expand Down Expand Up @@ -85,8 +82,8 @@ def __setattr__(self, name: str, value: Any) -> None:
@functools.wraps(dataclasses.field)
def field(
*,
getter: Optional[Callable[[Any, str], Any]] = None,
setter: Optional[Callable[[Any, str, Any], None]] = None,
getter: Callable[[Any, str], Any] | None = None,
setter: Callable[[Any, str, Any], None] | None = None,
**kwargs,
) -> dataclasses.Field:
"""Wrapper around `dataclasses.field` to allow for defining custom
Expand Down
Loading