diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f39f04944..7ac2cc657 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,7 +19,7 @@ repos: hooks: - id: shellcheck - repo: https://github.com/astral-sh/ruff-pre-commit - rev: a56c0b927e6465d37cae3e97d35d4d18ab2b96cd # frozen: v0.16.9 + rev: f12be1ebaa5351c1fc76472de98db2c3446c8253 # frozen: v0.16.10 hooks: - id: ruff args: ["--exit-non-zero-on-fix"] @@ -32,7 +32,7 @@ repos: files: ^docs/ - repo: https://github.com/crate-ci/typos - rev: 4141ff14cb566df76c473c786332c186a4fd71d1 # frozen: v1.50.3 + rev: dd369349b73c245acd4dd4154a4bdf771d052150 # frozen: typos-dict-v0.14.2 hooks: - id: typos - repo: https://github.com/codespell-project/codespell diff --git a/returns/contrib/hypothesis/laws.py b/returns/contrib/hypothesis/laws.py index 611fe4002..b8a74e8b9 100644 --- a/returns/contrib/hypothesis/laws.py +++ b/returns/contrib/hypothesis/laws.py @@ -1,6 +1,6 @@ import dataclasses import inspect -from collections.abc import Callable, Iterator +from collections.abc import Callable, Generator from contextlib import ExitStack, contextmanager from typing import Any, Self, TypeVar, final, overload @@ -198,7 +198,7 @@ def type_vars_factory(thing: type[object]) -> StrategyFactory: @contextmanager -def clean_plugin_context() -> Iterator[None]: +def clean_plugin_context() -> Generator[None]: """ We register a lot of types in `_entrypoint.py`, we need to clean them. diff --git a/returns/contrib/hypothesis/type_resolver.py b/returns/contrib/hypothesis/type_resolver.py index 0a574a4cd..363d15a7e 100644 --- a/returns/contrib/hypothesis/type_resolver.py +++ b/returns/contrib/hypothesis/type_resolver.py @@ -1,6 +1,6 @@ """Make `hypothesis` resolve types to the right strategies.""" -from collections.abc import Callable, Iterator, Mapping +from collections.abc import Callable, Generator, Mapping from contextlib import contextmanager from typing import TypeAlias, TypeVar @@ -18,7 +18,7 @@ @contextmanager def strategies_for_types( mapping: Mapping[type[object], StrategyFactory], -) -> Iterator[None]: +) -> Generator[None]: """ Temporarily register strategies with `hypothesis`. diff --git a/returns/contrib/pytest/plugin.py b/returns/contrib/pytest/plugin.py index b08a16aea..f7c4fb9fb 100644 --- a/returns/contrib/pytest/plugin.py +++ b/returns/contrib/pytest/plugin.py @@ -1,10 +1,18 @@ import inspect import sys -from collections.abc import Callable, Iterator +from collections.abc import Callable, Generator, Iterator from contextlib import ExitStack, contextmanager from functools import partial, wraps from types import FrameType, MappingProxyType -from typing import TYPE_CHECKING, Any, Final, TypeAlias, TypeVar, Union, final +from typing import ( + TYPE_CHECKING, + Any, + Final, + TypeAlias, + TypeVar, + Union, + final, +) from unittest import mock import pytest @@ -62,7 +70,7 @@ def is_error_handled(self, container) -> bool: def assert_trace( # noqa: WPS602 trace_type: _ReturnsResultType, function_to_search: _FunctionType, - ) -> Iterator[None]: + ) -> Generator[None]: """ Ensures that a given function was called during execution. @@ -135,7 +143,7 @@ def returns() -> Iterator[ReturnsAsserts]: @contextmanager -def _spy_error_handling() -> Iterator[_ErrorsHandled]: +def _spy_error_handling() -> Generator[_ErrorsHandled]: """Track error handling of containers.""" errs: _ErrorsHandled = {} with ExitStack() as cleanup: diff --git a/returns/primitives/tracing.py b/returns/primitives/tracing.py index 4354e7d17..b0a130c47 100644 --- a/returns/primitives/tracing.py +++ b/returns/primitives/tracing.py @@ -1,5 +1,5 @@ import types -from collections.abc import Callable, Iterator +from collections.abc import Callable, Generator from contextlib import AbstractContextManager, contextmanager from inspect import FrameInfo, stack from typing import TypeVar, overload @@ -59,7 +59,7 @@ def collect_traces( """ @contextmanager - def factory() -> Iterator[None]: + def factory() -> Generator[None]: unpatched_get_trace = getattr(Failure, '_get_trace') # noqa: B009 substitute_get_trace = types.MethodType(_get_trace, Failure) setattr(Failure, '_get_trace', substitute_get_trace) # noqa: B010