Skip to content

Commit

Permalink
ci(pre-commit.ci): autoupdate (#344)
Browse files Browse the repository at this point in the history
* ci(pre-commit.ci): autoupdate

updates:
- [github.com/crate-ci/typos: typos-dict-v0.11.35 → dictgen-v0.3.1](crate-ci/typos@typos-dict-v0.11.35...dictgen-v0.3.1)
- [github.com/astral-sh/ruff-pre-commit: v0.7.3 → v0.8.6](astral-sh/ruff-pre-commit@v0.7.3...v0.8.6)
- [github.com/abravalheri/validate-pyproject: v0.22 → v0.23](abravalheri/validate-pyproject@v0.22...v0.23)
- [github.com/pre-commit/mirrors-mypy: v1.13.0 → v1.14.1](pre-commit/mirrors-mypy@v1.13.0...v1.14.1)

* style(pre-commit.ci): auto fixes [...]

* fix pre-commit

* pin mypy build

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Talley Lambert <[email protected]>
  • Loading branch information
pre-commit-ci[bot] and tlambert03 authored Jan 24, 2025
1 parent 6db5219 commit 1863f7d
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 36 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@ exclude: .asv

repos:
- repo: https://github.com/crate-ci/typos
rev: typos-dict-v0.11.35
rev: dictgen-v0.3.1
hooks:
- id: typos

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.3
rev: v0.9.3
hooks:
- id: ruff
args: [--fix, --unsafe-fixes]
- id: ruff-format

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.22
rev: v0.23
hooks:
- id: validate-pyproject

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.13.0
rev: v1.14.1
hooks:
- id: mypy
exclude: tests|_throttler.pyi
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.PHONY: build check clean benchmark-all benchmark-compare typetest

build:
HATCH_BUILD_HOOKS_ENABLE=1 pip install -e .
HATCH_BUILD_HOOKS_ENABLE=1 uv pip install -e . --force-reinstall

check:
pre-commit run --all-files
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ enable-by-default = false
require-runtime-dependencies = true
dependencies = [
"hatch-mypyc>=0.13.0",
"mypy>=0.991",
# FIXME: something happened in 1.14.0 that broke the build
# https://github.com/pyapp-kit/psygnal/issues/350
"mypy==1.13.0",
"mypy_extensions >=0.4.2",
"pydantic!=2.10.0",
"types-attrs",
Expand Down
16 changes: 8 additions & 8 deletions src/psygnal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from typing import TYPE_CHECKING, Any

if TYPE_CHECKING:
from ._evented_model import EventedModel # noqa: TCH004
from ._evented_model import EventedModel # noqa: TC004


try:
Expand All @@ -19,20 +19,20 @@
__email__ = "[email protected]"

__all__ = [
"__version__",
"_compiled",
"debounced",
"EmissionInfo",
"emit_queued",
"EmitLoopError",
"evented",
"EventedModel",
"get_evented_namespace",
"is_evented",
"Signal",
"SignalGroup",
"SignalGroupDescriptor",
"SignalInstance",
"__version__",
"_compiled",
"debounced",
"emit_queued",
"evented",
"get_evented_namespace",
"is_evented",
"throttled",
]

Expand Down
2 changes: 1 addition & 1 deletion src/psygnal/_evented_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ def enums_as_values(self, as_values: bool = True) -> Iterator[None]:

@classmethod
@contextmanager
def enums_as_values(
def enums_as_values( # type: ignore [misc] # Incompatible redefinition
cls, as_values: bool = True
) -> Iterator[None]: # pragma: no cover
"""Temporarily override how enums are retrieved.
Expand Down
12 changes: 6 additions & 6 deletions src/psygnal/_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

if TYPE_CHECKING:
import threading
from collections.abc import Iterable, Iterator, Mapping
from collections.abc import Container, Iterable, Iterator, Mapping
from contextlib import AbstractContextManager

from psygnal._signal import F, ReducerFunc
Expand Down Expand Up @@ -155,11 +155,11 @@ def _inner(slot: Callable) -> Callable:

return _inner if slot is None else _inner(slot)

def block(self, exclude: Iterable[str | SignalInstance] = ()) -> None:
def block(self, exclude: Container[str | SignalInstance] = ()) -> None:
"""Block this signal and all emitters from emitting."""
super().block()
for name, sig in self._signals.items():
if exclude and sig in exclude or name in exclude:
if name in exclude or sig in exclude:
continue
self._sig_was_blocked[name] = sig._is_blocked
sig.block()
Expand All @@ -172,7 +172,7 @@ def unblock(self) -> None:
sig.unblock()

def blocked(
self, exclude: Iterable[str | SignalInstance] = ()
self, exclude: Container[str | SignalInstance] = ()
) -> AbstractContextManager[None]:
"""Context manager to temporarily block all emitters in this group.
Expand Down Expand Up @@ -516,14 +516,14 @@ def connect_direct(
def disconnect(self, slot: Callable | None = None, missing_ok: bool = True) -> None:
return self._psygnal_relay.disconnect(slot=slot, missing_ok=missing_ok)

def block(self, exclude: Iterable[str | SignalInstance] = ()) -> None:
def block(self, exclude: Container[str | SignalInstance] = ()) -> None:
return self._psygnal_relay.block(exclude=exclude)

def unblock(self) -> None:
return self._psygnal_relay.unblock()

def blocked(
self, exclude: Iterable[str | SignalInstance] = ()
self, exclude: Container[str | SignalInstance] = ()
) -> AbstractContextManager[None]:
return self._psygnal_relay.blocked(exclude=exclude)

Expand Down
5 changes: 2 additions & 3 deletions src/psygnal/_group_descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
EqOperator: TypeAlias = Callable[[Any, Any], bool]
FieldAliasFunc: TypeAlias = Callable[[str], Optional[str]]

__all__ = ["is_evented", "get_evented_namespace", "SignalGroupDescriptor"]
__all__ = ["SignalGroupDescriptor", "get_evented_namespace", "is_evented"]


T = TypeVar("T", bound=type)
Expand Down Expand Up @@ -526,8 +526,7 @@ def __init__(
grp_cls = signal_group_class or SignalGroup
if not (isinstance(grp_cls, type) and issubclass(grp_cls, SignalGroup)):
raise TypeError( # pragma: no cover
f"'signal_group_class' must be a subclass of SignalGroup, "
f"not {grp_cls}"
f"'signal_group_class' must be a subclass of SignalGroup, not {grp_cls}"
)
if not collect_fields:
if grp_cls is SignalGroup:
Expand Down
11 changes: 5 additions & 6 deletions src/psygnal/_signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def ensure_at_least_20(val: int):
)

if TYPE_CHECKING:
from collections.abc import Iterable, Iterator
from collections.abc import Container, Iterable, Iterator

from ._group import EmissionInfo
from ._weak_callback import RefErrorChoice
Expand Down Expand Up @@ -1057,7 +1057,7 @@ def _check_nargs(
slot_sig = _get_signature_possibly_qt(slot)
except ValueError as e:
warnings.warn(
f"{e}. To silence this warning, connect with " "`check_nargs=False`",
f"{e}. To silence this warning, connect with `check_nargs=False`",
stacklevel=4,
)
return None, None, False
Expand Down Expand Up @@ -1228,8 +1228,7 @@ def emit_fast(self, *args: Any) -> None:
caller.cb(args)
except RecursionError as e:
raise RecursionError(
f"RecursionError when "
f"emitting signal {self.name!r} with args {args}"
f"RecursionError when emitting signal {self.name!r} with args {args}"
) from e
except EmitLoopError as e: # pragma: no cover
raise e
Expand Down Expand Up @@ -1309,7 +1308,7 @@ def _run_emit_loop_queued(self) -> None:
raise RecursionError
i += 1

def block(self, exclude: Iterable[str | SignalInstance] = ()) -> None:
def block(self, exclude: Container[str | SignalInstance] = ()) -> None:
"""Block this signal from emitting.
NOTE: the `exclude` argument is only for SignalGroup subclass, but we
Expand Down Expand Up @@ -1493,7 +1492,7 @@ class _SignalBlocker:
"""Context manager to block and unblock a signal."""

def __init__(
self, signal: SignalInstance, exclude: Iterable[str | SignalInstance] = ()
self, signal: SignalInstance, exclude: Container[str | SignalInstance] = ()
) -> None:
self._signal = signal
self._exclude = exclude
Expand Down
2 changes: 1 addition & 1 deletion src/psygnal/_weak_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

RefErrorChoice: TypeAlias = Literal["raise", "warn", "ignore"]

__all__ = ["weak_callback", "WeakCallback"]
__all__ = ["WeakCallback", "weak_callback"]
_T = TypeVar("_T")
_R = TypeVar("_R") # return type of cb

Expand Down
2 changes: 1 addition & 1 deletion src/psygnal/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
if TYPE_CHECKING:
from collections.abc import Generator, Iterator

__all__ = ["monitor_events", "iter_signal_instances"]
__all__ = ["iter_signal_instances", "monitor_events"]


def _default_event_monitor(info: EmissionInfo) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_evented_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ def d(self, value):
],
)
def test_evented_model_reemission(mode: Union[str, dict]) -> None:
err = mode == "err" or isinstance(mode, dict) and "err" in mode.values()
err = mode == "err" or (isinstance(mode, dict) and "err" in mode.values())
with (
pytest.raises(ValueError, match="Invalid reemission") if err else nullcontext()
):
Expand Down
6 changes: 3 additions & 3 deletions tests/test_psygnal.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def boom(v: int) -> None:
import re

error_re = re.compile(
"signal 'tests.test_psygnal.Emitter.one_int'" f".*{re.escape(__file__)}",
f"signal 'tests.test_psygnal.Emitter.one_int'.*{re.escape(__file__)}",
re.DOTALL,
)
with pytest.raises(EmitLoopError, match=error_re):
Expand Down Expand Up @@ -199,7 +199,7 @@ def bad_cb(a, b, c): ...
import re

error_re = re.compile(
"signal 'tests.test_psygnal.Emitter.one_int'" f".*{re.escape(__file__)}",
f"signal 'tests.test_psygnal.Emitter.one_int'.*{re.escape(__file__)}",
re.DOTALL,
)
with pytest.raises(EmitLoopError, match=error_re) as e:
Expand Down Expand Up @@ -554,7 +554,7 @@ def test_connect_validation(func_name, sig_name, mode, typed):
signal: SignalInstance = getattr(e, sig_name)
bad_count = COUNT_INCOMPATIBLE[sig_name]
bad_sig = SIG_INCOMPATIBLE[sig_name]
if func_name in bad_count or check_types and func_name in bad_sig:
if func_name in bad_count or (check_types and func_name in bad_sig):
with pytest.raises(ValueError) as er:
signal.connect(func, check_types=check_types)
assert "Accepted signature:" in str(er)
Expand Down

0 comments on commit 1863f7d

Please sign in to comment.