Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions returns/contrib/hypothesis/laws.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions returns/contrib/hypothesis/type_resolver.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -18,7 +18,7 @@
@contextmanager
def strategies_for_types(
mapping: Mapping[type[object], StrategyFactory],
) -> Iterator[None]:
) -> Generator[None]:
"""
Temporarily register strategies with `hypothesis`.

Expand Down
16 changes: 12 additions & 4 deletions returns/contrib/pytest/plugin.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions returns/primitives/tracing.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading