From 430812b7325a8c64faecc0296d877391c41d8556 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 20 Jul 2026 21:09:47 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/woodruffw/zizmor-pre-commit: v1.26.1 → v1.27.0](https://github.com/woodruffw/zizmor-pre-commit/compare/v1.26.1...v1.27.0) - [github.com/astral-sh/ruff-pre-commit: v0.15.21 → v0.15.22](https://github.com/astral-sh/ruff-pre-commit/compare/v0.15.21...v0.15.22) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5b8502ce..1d9bdcd0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,7 +10,7 @@ repos: hooks: - id: actionlint - repo: https://github.com/woodruffw/zizmor-pre-commit - rev: v1.26.1 + rev: v1.27.0 hooks: - id: zizmor args: ["--no-progress", "--fix"] @@ -19,7 +19,7 @@ repos: hooks: - id: shellcheck - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.15.21 + rev: v0.15.22 hooks: - id: ruff args: ["--exit-non-zero-on-fix"] From 4175172287058ec5982283ee6e4c89211064cf94 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 20 Jul 2026 21:09:57 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- docs/conf.py | 2 +- returns/_internal/futures/_future.py | 8 +++--- returns/_internal/futures/_future_result.py | 18 ++++++------- .../futures/_reader_future_result.py | 8 +++--- returns/context/requires_context_ioresult.py | 2 +- returns/contrib/hypothesis/_entrypoint.py | 19 +++++++++----- returns/contrib/hypothesis/containers.py | 9 +++++-- returns/contrib/hypothesis/laws.py | 10 ++++--- returns/contrib/hypothesis/type_resolver.py | 10 ++++--- returns/contrib/pytest/plugin.py | 20 ++++++++++---- returns/future.py | 20 +++++++------- returns/interfaces/specific/reader.py | 4 +-- .../specific/reader_future_result.py | 4 +-- .../interfaces/specific/reader_ioresult.py | 4 +-- returns/interfaces/specific/reader_result.py | 4 +-- returns/io.py | 26 +++++++++---------- returns/methods/cond.py | 6 ++--- returns/pointfree/cond.py | 2 +- returns/primitives/asserts.py | 7 +++-- returns/primitives/container.py | 2 +- returns/primitives/tracing.py | 6 ++--- returns/result.py | 2 +- returns/trampolines.py | 2 +- returns/unsafe.py | 2 +- .../test_requires_context_ioresult_bind.py | 4 ++- .../test_requires_context_result_bind.py | 4 ++- .../test_laws/test_custom_type_applicative.py | 2 +- .../test_laws/test_user_specified_strategy.py | 2 +- .../test_hypothesis/test_type_resolution.py | 6 ++--- .../test_pytest/test_plugin_error_handler.py | 8 +++--- tests/test_converters/test_flatten.py | 4 +-- .../test_context/test_reader_future_result.py | 2 +- .../test_future/test_future_result.py | 2 +- .../test_future_result_units.py | 2 +- .../test_impure_safe.py | 6 ++--- tests/test_maybe/test_maybe_equality.py | 18 ++++++++----- tests/test_maybe/test_nothing_singleton.py | 2 +- .../test_base_container/test_pickle.py | 4 +-- .../test_pickle_backward_deserialization.py | 4 +-- .../test_pickle_unwrap_failed_error.py | 6 ++--- .../test_lawful/test_laws_resolution.py | 4 +-- tests/test_result/test_result_equality.py | 8 +++--- 42 files changed, 160 insertions(+), 125 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index bb98b56a..ae6030d2 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -28,7 +28,7 @@ def _get_project_meta(): pkg_meta = _get_project_meta() project = str(pkg_meta['name']) -copyright = '2019, dry-python team' # noqa: A001 +copyright = '2019, dry-python team' # ruff:ignore[builtin-variable-shadowing] author = 'dry-python team' # The short X.Y version diff --git a/returns/_internal/futures/_future.py b/returns/_internal/futures/_future.py index 99a6660c..96d2d2f6 100644 --- a/returns/_internal/futures/_future.py +++ b/returns/_internal/futures/_future.py @@ -24,7 +24,7 @@ async def async_apply( inner_value: Awaitable[_ValueType_co], ) -> _NewValueType: """Async applies a container with function over a value.""" - return (await container)._inner_value(await inner_value) # noqa: SLF001 + return (await container)._inner_value(await inner_value) # ruff:ignore[private-member-access] async def async_bind( @@ -32,7 +32,7 @@ async def async_bind( inner_value: Awaitable[_ValueType_co], ) -> _NewValueType: """Async binds a container over a value.""" - return (await dekind(function(await inner_value)))._inner_value # noqa: SLF001 + return (await dekind(function(await inner_value)))._inner_value # ruff:ignore[private-member-access] async def async_bind_awaitable( @@ -51,7 +51,7 @@ async def async_bind_async( inner_value: Awaitable[_ValueType_co], ) -> _NewValueType: """Async binds a coroutine with container over a value.""" - inner_io = dekind(await function(await inner_value))._inner_value # noqa: SLF001 + inner_io = dekind(await function(await inner_value))._inner_value # ruff:ignore[private-member-access] return await inner_io @@ -60,4 +60,4 @@ async def async_bind_io( inner_value: Awaitable[_ValueType_co], ) -> _NewValueType: """Async binds a container over a value.""" - return function(await inner_value)._inner_value # noqa: SLF001 + return function(await inner_value)._inner_value # ruff:ignore[private-member-access] diff --git a/returns/_internal/futures/_future_result.py b/returns/_internal/futures/_future_result.py index 0778a331..5f326b37 100644 --- a/returns/_internal/futures/_future_result.py +++ b/returns/_internal/futures/_future_result.py @@ -39,7 +39,7 @@ async def async_apply( inner_value: Awaitable[Result[_ValueType_co, _ErrorType_co]], ) -> Result[_NewValueType, _ErrorType_co]: """Async maps a function over a value.""" - return (await inner_value).apply((await container)._inner_value) # noqa: SLF001 + return (await inner_value).apply((await container)._inner_value) # ruff:ignore[private-member-access] async def async_bind( @@ -52,7 +52,7 @@ async def async_bind( """Async binds a container over a value.""" container = await inner_value if isinstance(container, Success): - return (await dekind(function(container.unwrap())))._inner_value # noqa: SLF001 + return (await dekind(function(container.unwrap())))._inner_value # ruff:ignore[private-member-access] return container # type: ignore[return-value] @@ -77,7 +77,7 @@ async def async_bind_async( """Async binds a coroutine with container over a value.""" container = await inner_value if isinstance(container, Success): - return await dekind(await function(container.unwrap()))._inner_value # noqa: SLF001 + return await dekind(await function(container.unwrap()))._inner_value # ruff:ignore[private-member-access] return container # type: ignore[return-value] @@ -96,7 +96,7 @@ async def async_bind_ioresult( """Async binds a container returning ``IOResult`` over a value.""" container = await inner_value if isinstance(container, Success): - return function(container.unwrap())._inner_value # noqa: SLF001 + return function(container.unwrap())._inner_value # ruff:ignore[private-member-access] return container # type: ignore[return-value] @@ -107,7 +107,7 @@ async def async_bind_io( """Async binds a container returning ``IO`` over a value.""" container = await inner_value if isinstance(container, Success): - return Success(function(container.unwrap())._inner_value) # noqa: SLF001 + return Success(function(container.unwrap())._inner_value) # ruff:ignore[private-member-access] return container # type: ignore[return-value] @@ -155,21 +155,21 @@ async def async_lash( container = await inner_value if isinstance(container, Success): return container - return (await dekind(function(container.failure())))._inner_value # noqa: SLF001 + return (await dekind(function(container.failure())))._inner_value # ruff:ignore[private-member-access] async def async_from_success( container: Future[_NewValueType], ) -> Result[_NewValueType, Any]: """Async success unit factory.""" - return Success((await container)._inner_value) # noqa: SLF001 + return Success((await container)._inner_value) # ruff:ignore[private-member-access] async def async_from_failure( container: Future[_NewErrorType], ) -> Result[Any, _NewErrorType]: """Async failure unit factory.""" - return Failure((await container)._inner_value) # noqa: SLF001 + return Failure((await container)._inner_value) # ruff:ignore[private-member-access] async def async_compose_result( @@ -180,4 +180,4 @@ async def async_compose_result( inner_value: Awaitable[Result[_ValueType_co, _ErrorType_co]], ) -> Result[_NewValueType, _ErrorType_co]: """Async composes ``Result`` based function.""" - return (await dekind(function(await inner_value)))._inner_value # noqa: SLF001 + return (await dekind(function(await inner_value)))._inner_value # ruff:ignore[private-member-access] diff --git a/returns/_internal/futures/_reader_future_result.py b/returns/_internal/futures/_reader_future_result.py index 57ff789a..b006f010 100644 --- a/returns/_internal/futures/_reader_future_result.py +++ b/returns/_internal/futures/_reader_future_result.py @@ -33,9 +33,9 @@ async def async_bind_async( deps: _EnvType, ) -> Result[_NewValueType, _ErrorType_co]: """Async binds a coroutine with container over a value.""" - inner_value = await container(deps)._inner_value # noqa: SLF001 + inner_value = await container(deps)._inner_value # ruff:ignore[private-member-access] if isinstance(inner_value, Success): - return await dekind( # noqa: SLF001 + return await dekind( # ruff:ignore[private-member-access] await function(inner_value.unwrap()), )(deps)._inner_value return inner_value # type: ignore[return-value] @@ -57,5 +57,5 @@ async def async_compose_result( deps: _EnvType, ) -> Result[_NewValueType, _ErrorType_co]: """Async composes ``Result`` based function.""" - new_container = dekind(function((await container(deps))._inner_value)) # noqa: SLF001 - return (await new_container(deps))._inner_value # noqa: SLF001 + new_container = dekind(function((await container(deps))._inner_value)) # ruff:ignore[private-member-access] + return (await new_container(deps))._inner_value # ruff:ignore[private-member-access] diff --git a/returns/context/requires_context_ioresult.py b/returns/context/requires_context_ioresult.py index 17a7b192..ca6b3ac5 100644 --- a/returns/context/requires_context_ioresult.py +++ b/returns/context/requires_context_ioresult.py @@ -591,7 +591,7 @@ def compose_result( """ return RequiresContextIOResult( lambda deps: dekind( - function(self(deps)._inner_value), # noqa: SLF001 + function(self(deps)._inner_value), # ruff:ignore[private-member-access] )(deps), ) diff --git a/returns/contrib/hypothesis/_entrypoint.py b/returns/contrib/hypothesis/_entrypoint.py index d611eb45..43340aaf 100644 --- a/returns/contrib/hypothesis/_entrypoint.py +++ b/returns/contrib/hypothesis/_entrypoint.py @@ -20,24 +20,29 @@ def _setup_hook() -> None: - from hypothesis import strategies as st # noqa: PLC0415 + from hypothesis import ( + strategies as st, + ) - from returns.context import ( # noqa: PLC0415 + from returns.context import ( # ruff:ignore[import-outside-top-level] RequiresContext, RequiresContextFutureResult, RequiresContextIOResult, RequiresContextResult, ) - from returns.future import Future, FutureResult # noqa: PLC0415 - from returns.io import IO, IOResult # noqa: PLC0415 - from returns.maybe import Maybe # noqa: PLC0415 - from returns.result import Result # noqa: PLC0415 + from returns.future import ( # ruff:ignore[import-outside-top-level] + Future, + FutureResult, + ) + from returns.io import IO, IOResult # ruff:ignore[import-outside-top-level] + from returns.maybe import Maybe # ruff:ignore[import-outside-top-level] + from returns.result import Result # ruff:ignore[import-outside-top-level] def factory( container_type: type[_Inst], ) -> Callable[[Any], st.SearchStrategy[_Inst]]: def decorator(thing: Any) -> st.SearchStrategy[_Inst]: - from returns.contrib.hypothesis.containers import ( # noqa: PLC0415 + from returns.contrib.hypothesis.containers import ( # ruff:ignore[import-outside-top-level] strategy_from_container, ) diff --git a/returns/contrib/hypothesis/containers.py b/returns/contrib/hypothesis/containers.py index 949beecb..83da5cb8 100644 --- a/returns/contrib/hypothesis/containers.py +++ b/returns/contrib/hypothesis/containers.py @@ -32,8 +32,13 @@ def strategy_from_container( will produce any value for success cases and only exceptions for failure cases. """ - from returns.interfaces.applicative import ApplicativeN # noqa: PLC0415 - from returns.interfaces.specific import maybe, result # noqa: PLC0415 + from returns.interfaces.applicative import ( + ApplicativeN, + ) + from returns.interfaces.specific import ( # ruff:ignore[import-outside-top-level] + maybe, + result, + ) def factory(type_: type) -> st.SearchStrategy: value_type, error_type = _get_type_vars(type_) diff --git a/returns/contrib/hypothesis/laws.py b/returns/contrib/hypothesis/laws.py index 54d2674b..d7271b21 100644 --- a/returns/contrib/hypothesis/laws.py +++ b/returns/contrib/hypothesis/laws.py @@ -8,7 +8,9 @@ from hypothesis import given from hypothesis import settings as hypothesis_settings from hypothesis import strategies as st -from hypothesis.strategies._internal import types # noqa: PLC2701 +from hypothesis.strategies._internal import ( + types, +) from returns.contrib.hypothesis.containers import strategy_from_container from returns.contrib.hypothesis.type_resolver import ( @@ -205,7 +207,7 @@ def clean_plugin_context() -> Iterator[None]: Otherwise, some types might be messed up. """ saved_stategies = {} - for strategy_key, strategy in types._global_type_lookup.items(): # noqa: SLF001 + for strategy_key, strategy in types._global_type_lookup.items(): # ruff:ignore[private-member-access] if isinstance( # type: ignore[redundant-expr, unused-ignore] strategy_key, type, @@ -213,7 +215,7 @@ def clean_plugin_context() -> Iterator[None]: saved_stategies.update({strategy_key: strategy}) for key_to_remove in saved_stategies: - types._global_type_lookup.pop(key_to_remove) # noqa: SLF001 + types._global_type_lookup.pop(key_to_remove) # ruff:ignore[private-member-access] _clean_caches() try: @@ -224,7 +226,7 @@ def clean_plugin_context() -> Iterator[None]: def _clean_caches() -> None: - st.from_type.__clear_cache() # type: ignore[attr-defined] # noqa: SLF001 + st.from_type.__clear_cache() # type: ignore[attr-defined] # ruff:ignore[private-member-access] def _create_law_test_case( diff --git a/returns/contrib/hypothesis/type_resolver.py b/returns/contrib/hypothesis/type_resolver.py index 0a574a4c..f1c7d0b5 100644 --- a/returns/contrib/hypothesis/type_resolver.py +++ b/returns/contrib/hypothesis/type_resolver.py @@ -5,7 +5,9 @@ from typing import TypeAlias, TypeVar from hypothesis import strategies as st -from hypothesis.strategies._internal import types # noqa: PLC2701 +from hypothesis.strategies._internal import ( + types, +) Example_co = TypeVar('Example_co', covariant=True) @@ -51,14 +53,14 @@ def look_up_strategy( type_: type[Example_co], ) -> StrategyFactory[Example_co] | None: """Return the strategy used by `hypothesis`.""" - return types._global_type_lookup.get(type_) # noqa: SLF001 + return types._global_type_lookup.get(type_) # ruff:ignore[private-member-access] def _remove_strategy( type_: type[object], ) -> None: """Remove the strategy registered for `type_`.""" - types._global_type_lookup.pop(type_) # noqa: SLF001 + types._global_type_lookup.pop(type_) # ruff:ignore[private-member-access] _clean_caches() @@ -72,4 +74,4 @@ def apply_strategy( def _clean_caches() -> None: - st.from_type.__clear_cache() # type: ignore[attr-defined] # noqa: SLF001 + st.from_type.__clear_cache() # type: ignore[attr-defined] # ruff:ignore[private-member-access] diff --git a/returns/contrib/pytest/plugin.py b/returns/contrib/pytest/plugin.py index 046c96aa..aca25a26 100644 --- a/returns/contrib/pytest/plugin.py +++ b/returns/contrib/pytest/plugin.py @@ -49,7 +49,9 @@ def assert_equal( # noqa: WPS602 backend: str = 'asyncio', ) -> None: """Can compare two containers even with extra calling and awaiting.""" - from returns.primitives.asserts import assert_equal # noqa: PLC0415 + from returns.primitives.asserts import ( + assert_equal, + ) assert_equal(first, second, deps=deps, backend=backend) @@ -153,14 +155,22 @@ def _spy_error_handling() -> Iterator[_ErrorsHandled]: # delayed imports are needed to prevent messing up coverage def _containers_to_patch() -> list: - from returns.context import ( # noqa: PLC0415 + from returns.context import ( # ruff:ignore[import-outside-top-level] RequiresContextFutureResult, RequiresContextIOResult, RequiresContextResult, ) - from returns.future import FutureResult # noqa: PLC0415 - from returns.io import IOFailure, IOSuccess # noqa: PLC0415 - from returns.result import Failure, Success # noqa: PLC0415 + from returns.future import ( + FutureResult, + ) + from returns.io import ( # ruff:ignore[import-outside-top-level] + IOFailure, + IOSuccess, + ) + from returns.result import ( # ruff:ignore[import-outside-top-level] + Failure, + Success, + ) return [ Success, diff --git a/returns/future.py b/returns/future.py index f2f53f10..0ffca8b6 100644 --- a/returns/future.py +++ b/returns/future.py @@ -43,7 +43,7 @@ # Public composition helpers: -async def async_identity(instance: _FirstType) -> _FirstType: # noqa: RUF029 +async def async_identity(instance: _FirstType) -> _FirstType: # ruff:ignore[unused-async] """ Async function that returns its argument. @@ -441,7 +441,7 @@ def from_io(cls, inner_value: IO[_NewValueType]) -> 'Future[_NewValueType]': >>> assert anyio.run(main) is True """ - return Future(async_identity(inner_value._inner_value)) # noqa: SLF001 + return Future(async_identity(inner_value._inner_value)) # ruff:ignore[private-member-access] @classmethod def from_future_result( @@ -464,7 +464,7 @@ def from_future_result( >>> assert anyio.run(container.awaitable) == IO(Success(1)) """ - return Future(inner_value._inner_value) # noqa: SLF001 + return Future(inner_value._inner_value) # ruff:ignore[private-member-access] # Decorators: @@ -539,7 +539,7 @@ def asyncify( """ @wraps(function) - async def decorator( # noqa: RUF029 + async def decorator( # ruff:ignore[unused-async] *args: _FuncParams.args, **kwargs: _FuncParams.kwargs, ) -> _ValueType_co: @@ -1245,7 +1245,7 @@ def from_typecast( >>> anyio.run(main) """ - return FutureResult(inner_value._inner_value) # noqa: SLF001 + return FutureResult(inner_value._inner_value) # ruff:ignore[private-member-access] @classmethod def from_future( @@ -1342,7 +1342,7 @@ def from_io( >>> anyio.run(main) """ - return FutureResult.from_value(inner_value._inner_value) # noqa: SLF001 + return FutureResult.from_value(inner_value._inner_value) # ruff:ignore[private-member-access] @classmethod def from_failed_io( @@ -1366,7 +1366,7 @@ def from_failed_io( >>> anyio.run(main) """ - return FutureResult.from_failure(inner_value._inner_value) # noqa: SLF001 + return FutureResult.from_failure(inner_value._inner_value) # ruff:ignore[private-member-access] @classmethod def from_ioresult( @@ -1393,7 +1393,7 @@ def from_ioresult( >>> anyio.run(main) """ - return FutureResult(async_identity(inner_value._inner_value)) # noqa: SLF001 + return FutureResult(async_identity(inner_value._inner_value)) # ruff:ignore[private-member-access] @classmethod def from_result( @@ -1472,7 +1472,7 @@ def from_failure( return FutureResult(async_identity(Failure(inner_value))) -def FutureSuccess( # noqa: N802 +def FutureSuccess( # ruff:ignore[invalid-function-name] inner_value: _NewValueType, ) -> FutureResult[_NewValueType, Any]: """ @@ -1493,7 +1493,7 @@ def FutureSuccess( # noqa: N802 return FutureResult.from_value(inner_value) -def FutureFailure( # noqa: N802 +def FutureFailure( # ruff:ignore[invalid-function-name] inner_value: _NewErrorType, ) -> FutureResult[Any, _NewErrorType]: """ diff --git a/returns/interfaces/specific/reader.py b/returns/interfaces/specific/reader.py index 65e2b297..f57670f4 100644 --- a/returns/interfaces/specific/reader.py +++ b/returns/interfaces/specific/reader.py @@ -232,9 +232,9 @@ def asking_law( env: _SecondType, ) -> None: """Asking for an env, always returns the env.""" - assert container.ask().__call__( # noqa: PLC2801 + assert container.ask().__call__( # ruff:ignore[unnecessary-dunder-call] env, - ) == container.from_value(env).__call__(env) # noqa: PLC2801 + ) == container.from_value(env).__call__(env) # ruff:ignore[unnecessary-dunder-call] class ReaderBased2( diff --git a/returns/interfaces/specific/reader_future_result.py b/returns/interfaces/specific/reader_future_result.py index 65b60eb5..c1f1cb75 100644 --- a/returns/interfaces/specific/reader_future_result.py +++ b/returns/interfaces/specific/reader_future_result.py @@ -114,8 +114,8 @@ def asking_law( ) -> None: """Asking for an env, always returns the env.""" assert_equal( - container.ask().__call__(env), # noqa: PLC2801 - container.from_value(env).__call__(env), # noqa: PLC2801 + container.ask().__call__(env), # ruff:ignore[unnecessary-dunder-call] + container.from_value(env).__call__(env), # ruff:ignore[unnecessary-dunder-call] ) diff --git a/returns/interfaces/specific/reader_ioresult.py b/returns/interfaces/specific/reader_ioresult.py index 93309271..db3c280a 100644 --- a/returns/interfaces/specific/reader_ioresult.py +++ b/returns/interfaces/specific/reader_ioresult.py @@ -84,9 +84,9 @@ def asking_law( env: _ThirdType, ) -> None: """Asking for an env, always returns the env.""" - assert container.ask().__call__( # noqa: PLC2801 + assert container.ask().__call__( # ruff:ignore[unnecessary-dunder-call] env, - ) == container.from_value(env).__call__(env) # noqa: PLC2801 + ) == container.from_value(env).__call__(env) # ruff:ignore[unnecessary-dunder-call] class ReaderIOResultBasedN( diff --git a/returns/interfaces/specific/reader_result.py b/returns/interfaces/specific/reader_result.py index 1be4e32e..16e7cd48 100644 --- a/returns/interfaces/specific/reader_result.py +++ b/returns/interfaces/specific/reader_result.py @@ -100,9 +100,9 @@ def asking_law( env: _ThirdType, ) -> None: """Asking for an env, always returns the env.""" - assert container.ask().__call__( # noqa: PLC2801 + assert container.ask().__call__( # ruff:ignore[unnecessary-dunder-call] env, - ) == container.from_value(env).__call__(env) # noqa: PLC2801 + ) == container.from_value(env).__call__(env) # ruff:ignore[unnecessary-dunder-call] class ReaderResultBasedN( diff --git a/returns/io.py b/returns/io.py index 53933157..6097da8c 100644 --- a/returns/io.py +++ b/returns/io.py @@ -125,7 +125,7 @@ def apply( >>> assert IO('b').apply(IO('a').apply(IO(appliable))) == IO('ab') """ - return self.map(dekind(container)._inner_value) # noqa: SLF001 + return self.map(dekind(container)._inner_value) # ruff:ignore[private-member-access] def bind( self, @@ -226,7 +226,7 @@ def from_ioresult( Is the reverse of :meth:`returns.io.IOResult.from_typecast`. """ - return IO(inner_value._inner_value) # noqa: SLF001 + return IO(inner_value._inner_value) # ruff:ignore[private-member-access] # Helper functions: @@ -435,7 +435,7 @@ def apply( if isinstance(container, IOSuccess): return self.from_result( self._inner_value.map( - container.unwrap()._inner_value, # noqa: SLF001 + container.unwrap()._inner_value, # ruff:ignore[private-member-access] ), ) return container # type: ignore @@ -641,7 +641,7 @@ def compose_result( def __iter__(self) -> Iterator[_ValueType_co]: """API for :ref:`do-notation`.""" # We also unwrap `IO` here. - yield self.unwrap()._inner_value # noqa: SLF001 + yield self.unwrap()._inner_value # ruff:ignore[private-member-access] @classmethod def do( @@ -697,7 +697,7 @@ def from_typecast( Can be reverted via :meth:`returns.io.IO.from_ioresult` method. """ - return cls.from_result(inner_value._inner_value) # noqa: SLF001 + return cls.from_result(inner_value._inner_value) # ruff:ignore[private-member-access] @classmethod def from_failed_io( @@ -714,7 +714,7 @@ def from_failed_io( >>> assert IOResult.from_failed_io(container) == IOFailure(1) """ - return IOFailure(inner_value._inner_value) # noqa: SLF001 + return IOFailure(inner_value._inner_value) # ruff:ignore[private-member-access] @classmethod def from_io( @@ -731,7 +731,7 @@ def from_io( >>> assert IOResult.from_io(container) == IOSuccess(1) """ - return IOSuccess(inner_value._inner_value) # noqa: SLF001 + return IOSuccess(inner_value._inner_value) # ruff:ignore[private-member-access] @classmethod def from_result( @@ -751,8 +751,8 @@ def from_result( """ if isinstance(inner_value, Success): - return IOSuccess(inner_value._inner_value) # noqa: SLF001 - return IOFailure(inner_value._inner_value) # type: ignore[arg-type] # noqa: SLF001 + return IOSuccess(inner_value._inner_value) # ruff:ignore[private-member-access] + return IOFailure(inner_value._inner_value) # type: ignore[arg-type] # ruff:ignore[private-member-access] @classmethod def from_ioresult( @@ -833,7 +833,7 @@ def bind(self, function): """Does nothing for ``IOFailure``.""" return self - #: Alias for `bind_ioresult` method. Part of the `IOResultBasedN` interface. # noqa: E501 + #: Alias for `bind_ioresult` method. Part of the `IOResultBasedN` interface. # ruff:ignore[line-too-long] bind_ioresult = bind def bind_result(self, function): @@ -845,7 +845,7 @@ def bind_io(self, function): return self def lash(self, function): - """Composes this container with a function returning ``IOResult``.""" # noqa: E501 + """Composes this container with a function returning ``IOResult``.""" # ruff:ignore[line-too-long] return function(self._inner_value.failure()) @@ -864,10 +864,10 @@ def __init__(self, inner_value: _ValueType_co) -> None: if not TYPE_CHECKING: # noqa: WPS604 # pragma: no branch def bind(self, function): - """Composes this container with a function returning ``IOResult``.""" # noqa: E501 + """Composes this container with a function returning ``IOResult``.""" # ruff:ignore[line-too-long] return function(self._inner_value.unwrap()) - #: Alias for `bind_ioresult` method. Part of the `IOResultBasedN` interface. # noqa: E501 + #: Alias for `bind_ioresult` method. Part of the `IOResultBasedN` interface. # ruff:ignore[line-too-long] bind_ioresult = bind def bind_result(self, function): diff --git a/returns/methods/cond.py b/returns/methods/cond.py index 432a6f17..a44cdf32 100644 --- a/returns/methods/cond.py +++ b/returns/methods/cond.py @@ -14,7 +14,7 @@ @overload def internal_cond( container_type: type[_SingleFailableKind], - is_success: bool, # noqa: FBT001 + is_success: bool, # ruff:ignore[boolean-type-hint-positional-argument] success_value: _ValueType, ) -> KindN[_SingleFailableKind, _ValueType, _ErrorType, NoDeps]: ... @@ -22,7 +22,7 @@ def internal_cond( @overload def internal_cond( container_type: type[_DiverseFailableKind], - is_success: bool, # noqa: FBT001 + is_success: bool, # ruff:ignore[boolean-type-hint-positional-argument] success_value: _ValueType, error_value: _ErrorType, ) -> KindN[_DiverseFailableKind, _ValueType, _ErrorType, NoDeps]: ... @@ -30,7 +30,7 @@ def internal_cond( def internal_cond( container_type: (type[_SingleFailableKind] | type[_DiverseFailableKind]), - is_success: bool, # noqa: FBT001 + is_success: bool, # ruff:ignore[boolean-type-hint-positional-argument] success_value: _ValueType, error_value: _ErrorType | None = None, ): diff --git a/returns/pointfree/cond.py b/returns/pointfree/cond.py index 1d71e722..f5e21109 100644 --- a/returns/pointfree/cond.py +++ b/returns/pointfree/cond.py @@ -70,7 +70,7 @@ def cond( """ - def factory(is_success: bool): # noqa: FBT001 + def factory(is_success: bool): # ruff:ignore[boolean-type-hint-positional-argument] return internal_cond( container_type, is_success, diff --git a/returns/primitives/asserts.py b/returns/primitives/asserts.py index cf03c7f2..22616bec 100644 --- a/returns/primitives/asserts.py +++ b/returns/primitives/asserts.py @@ -35,10 +35,13 @@ def assert_equal( def _convert(container, *, deps, backend: str): - from returns.interfaces.specific import future, reader # noqa: PLC0415 + from returns.interfaces.specific import ( # ruff:ignore[import-outside-top-level] + future, + reader, + ) if isinstance(container, future.AwaitableFutureN): - import anyio # noqa: PLC0415 + import anyio # ruff:ignore[import-outside-top-level] return _convert( anyio.run(container.awaitable, backend=backend), diff --git a/returns/primitives/container.py b/returns/primitives/container.py index a95568ae..55ec09a6 100644 --- a/returns/primitives/container.py +++ b/returns/primitives/container.py @@ -81,5 +81,5 @@ def container_equality( if type(self) != type(other): # noqa: WPS516, E721 return False return bool( - self._inner_value == other._inner_value, # type: ignore # noqa: SLF001 + self._inner_value == other._inner_value, # type: ignore # ruff:ignore[private-member-access] ) diff --git a/returns/primitives/tracing.py b/returns/primitives/tracing.py index 4354e7d1..426a6daf 100644 --- a/returns/primitives/tracing.py +++ b/returns/primitives/tracing.py @@ -60,13 +60,13 @@ def collect_traces( @contextmanager def factory() -> Iterator[None]: - unpatched_get_trace = getattr(Failure, '_get_trace') # noqa: B009 + unpatched_get_trace = getattr(Failure, '_get_trace') # ruff:ignore[get-attr-with-constant] substitute_get_trace = types.MethodType(_get_trace, Failure) - setattr(Failure, '_get_trace', substitute_get_trace) # noqa: B010 + setattr(Failure, '_get_trace', substitute_get_trace) # ruff:ignore[set-attr-with-constant] try: # noqa: WPS501 yield finally: - setattr(Failure, '_get_trace', unpatched_get_trace) # noqa: B010 + setattr(Failure, '_get_trace', unpatched_get_trace) # ruff:ignore[set-attr-with-constant] return factory()(function) if function else factory() diff --git a/returns/result.py b/returns/result.py index 1007f2da..f06902c1 100644 --- a/returns/result.py +++ b/returns/result.py @@ -363,7 +363,7 @@ def __init__(self, inner_value: _ErrorType_co) -> None: if not TYPE_CHECKING: # noqa: WPS604 # pragma: no branch def alt(self, function): - """Composes failed container with a pure function to modify failure.""" # noqa: E501 + """Composes failed container with a pure function to modify failure.""" # ruff:ignore[line-too-long] return Failure(function(self._inner_value)) def map(self, function): diff --git a/returns/trampolines.py b/returns/trampolines.py index b446e63b..be98ae5c 100644 --- a/returns/trampolines.py +++ b/returns/trampolines.py @@ -91,5 +91,5 @@ def decorator( trampoline_result = trampoline_result() return trampoline_result - decorator._orig_func = func # type: ignore[attr-defined] # noqa: SLF001 + decorator._orig_func = func # type: ignore[attr-defined] # ruff:ignore[private-member-access] return decorator diff --git a/returns/unsafe.py b/returns/unsafe.py index 454f0e0f..bc1d1b4f 100644 --- a/returns/unsafe.py +++ b/returns/unsafe.py @@ -28,4 +28,4 @@ def unsafe_perform_io(wrapped_in_io: IO[_ValueType]) -> _ValueType: - https://github.com/seddonym/import-linter """ - return wrapped_in_io._inner_value # noqa: SLF001 + return wrapped_in_io._inner_value # ruff:ignore[private-member-access] diff --git a/tests/test_context/test_requires_context_ioresult/test_requires_context_ioresult_bind.py b/tests/test_context/test_requires_context_ioresult/test_requires_context_ioresult_bind.py index 57bf4a07..ea1e7e09 100644 --- a/tests/test_context/test_requires_context_ioresult/test_requires_context_ioresult_bind.py +++ b/tests/test_context/test_requires_context_ioresult/test_requires_context_ioresult_bind.py @@ -1,5 +1,7 @@ from returns.context import RequiresContext, RequiresContextResult -from returns.context import RequiresContextIOResult as RCR # noqa: N814 +from returns.context import ( + RequiresContextIOResult as RCR, # ruff:ignore[camelcase-imported-as-constant] +) from returns.io import IOFailure, IOResult, IOSuccess from returns.result import Failure, Result, Success diff --git a/tests/test_context/test_requires_context_result/test_requires_context_result_bind.py b/tests/test_context/test_requires_context_result/test_requires_context_result_bind.py index 520404e6..0d65a019 100644 --- a/tests/test_context/test_requires_context_result/test_requires_context_result_bind.py +++ b/tests/test_context/test_requires_context_result/test_requires_context_result_bind.py @@ -1,5 +1,7 @@ from returns.context import RequiresContext -from returns.context import RequiresContextResult as RCR # noqa: N817 +from returns.context import ( + RequiresContextResult as RCR, # ruff:ignore[camelcase-imported-as-acronym] +) from returns.result import Failure, Result, Success diff --git a/tests/test_contrib/test_hypothesis/test_laws/test_custom_type_applicative.py b/tests/test_contrib/test_hypothesis/test_laws/test_custom_type_applicative.py index 34fad9e7..3c0124a2 100644 --- a/tests/test_contrib/test_hypothesis/test_laws/test_custom_type_applicative.py +++ b/tests/test_contrib/test_hypothesis/test_laws/test_custom_type_applicative.py @@ -30,7 +30,7 @@ def apply( self, container: Kind1['_Wrapper', Callable[[_ValueType], _NewValueType]], ) -> '_Wrapper[_NewValueType]': - function = container._inner_value # noqa: SLF001 + function = container._inner_value # ruff:ignore[private-member-access] return _Wrapper(function(self._inner_value)) @classmethod diff --git a/tests/test_contrib/test_hypothesis/test_laws/test_user_specified_strategy.py b/tests/test_contrib/test_hypothesis/test_laws/test_user_specified_strategy.py index f1799210..98ce8335 100644 --- a/tests/test_contrib/test_hypothesis/test_laws/test_user_specified_strategy.py +++ b/tests/test_contrib/test_hypothesis/test_laws/test_user_specified_strategy.py @@ -3,7 +3,7 @@ from returns.contrib.hypothesis.laws import check_all_laws -container_type = test_custom_type_applicative._Wrapper # noqa: SLF001 +container_type = test_custom_type_applicative._Wrapper # ruff:ignore[private-member-access] check_all_laws( container_type, diff --git a/tests/test_contrib/test_hypothesis/test_type_resolution.py b/tests/test_contrib/test_hypothesis/test_type_resolution.py index 4ec629ee..40b0d824 100644 --- a/tests/test_contrib/test_hypothesis/test_type_resolution.py +++ b/tests/test_contrib/test_hypothesis/test_type_resolution.py @@ -17,7 +17,7 @@ ) from returns.contrib.hypothesis.laws import ( Settings, - _types_to_strategies, # noqa: PLC2701 + _types_to_strategies, # ruff:ignore[import-private-name] default_settings, ) from returns.contrib.hypothesis.type_resolver import ( @@ -179,7 +179,7 @@ def test_merge_use_init() -> None: def test_types_to_strategies_default() -> None: # noqa: WPS210 """Check the default strategies for types.""" - container_type = test_custom_type_applicative._Wrapper # noqa: SLF001 + container_type = test_custom_type_applicative._Wrapper # ruff:ignore[private-member-access] # NOTE: There is a type error because `Callable` is a # special form, not a type. callable_type: type[object] = Callable # type: ignore[assignment] @@ -225,7 +225,7 @@ def test_types_to_strategies_default() -> None: # noqa: WPS210 def test_types_to_strategies_overrides() -> None: # noqa: WPS210 """Check that we allow the user to override all strategies.""" - container_type = test_custom_type_applicative._Wrapper # noqa: SLF001 + container_type = test_custom_type_applicative._Wrapper # ruff:ignore[private-member-access] # NOTE: There is a type error because `Callable` is a # special form, not a type. callable_type: type[object] = Callable # type: ignore[assignment] diff --git a/tests/test_contrib/test_pytest/test_plugin_error_handler.py b/tests/test_contrib/test_pytest/test_plugin_error_handler.py index 57e989fa..7babe93a 100644 --- a/tests/test_contrib/test_pytest/test_plugin_error_handler.py +++ b/tests/test_contrib/test_pytest/test_plugin_error_handler.py @@ -47,14 +47,14 @@ def _under_test( ) def test_error_handled(returns: ReturnsAsserts, container, kwargs): """Demo on how to use ``pytest`` helpers to work with error handling.""" - assert not returns._errors_handled # noqa: SLF001 + assert not returns._errors_handled # ruff:ignore[private-member-access] error_handled = _under_test(container, **kwargs) assert returns.is_error_handled(error_handled) assert returns.is_error_handled(error_handled.map(identity)) assert returns.is_error_handled(error_handled.alt(identity)) - assert returns._errors_handled # noqa: SLF001 + assert returns._errors_handled # ruff:ignore[private-member-access] @pytest.mark.parametrize( @@ -74,7 +74,7 @@ def test_error_handled(returns: ReturnsAsserts, container, kwargs): ) def test_error_not_handled(returns: ReturnsAsserts, container): """Demo on how to use ``pytest`` helpers to work with error handling.""" - assert not returns._errors_handled # noqa: SLF001 + assert not returns._errors_handled # ruff:ignore[private-member-access] error_handled = _under_test(container) assert not returns.is_error_handled(container) @@ -82,7 +82,7 @@ def test_error_not_handled(returns: ReturnsAsserts, container): assert not returns.is_error_handled(error_handled.map(identity)) assert not returns.is_error_handled(error_handled.alt(identity)) - assert not returns._errors_handled # noqa: SLF001 + assert not returns._errors_handled # ruff:ignore[private-member-access] @pytest.mark.anyio diff --git a/tests/test_converters/test_flatten.py b/tests/test_converters/test_flatten.py index cc4470e6..cdf80006 100644 --- a/tests/test_converters/test_flatten.py +++ b/tests/test_converters/test_flatten.py @@ -110,7 +110,7 @@ async def test_non_flatten_future(subtests): for cont in futures: with subtests.test(container=cont): assert isinstance( - (await flatten(cont)).failure()._inner_value, # noqa: SLF001 + (await flatten(cont)).failure()._inner_value, # ruff:ignore[private-member-access] cont.__class__, ) @@ -132,6 +132,6 @@ async def test_non_flatten_context_future_result(subtests): with subtests.test(container=cont): inner = await flatten(cont)(...) assert isinstance( - inner.failure()._inner_value, # noqa: SLF001 + inner.failure()._inner_value, # ruff:ignore[private-member-access] cont.__class__, ) diff --git a/tests/test_examples/test_context/test_reader_future_result.py b/tests/test_examples/test_context/test_reader_future_result.py index 5641fd42..f11c6aee 100644 --- a/tests/test_examples/test_context/test_reader_future_result.py +++ b/tests/test_examples/test_context/test_reader_future_result.py @@ -54,7 +54,7 @@ def _fetch_post( def _show_titles( number_of_posts: int, ) -> RequiresContextFutureResultE[Sequence[str], httpx.AsyncClient]: - def factory(post: _Post) -> str: # noqa: FURB118 + def factory(post: _Post) -> str: # ruff:ignore[reimplemented-operator] return post['title'] titles = [ diff --git a/tests/test_examples/test_future/test_future_result.py b/tests/test_examples/test_future/test_future_result.py index 7b0c27a2..3f2ef34b 100644 --- a/tests/test_examples/test_future/test_future_result.py +++ b/tests/test_examples/test_future/test_future_result.py @@ -31,7 +31,7 @@ async def _fetch_post(post_id: int) -> _Post: def _show_titles( number_of_posts: int, ) -> Sequence[FutureResult[str, Exception]]: - def factory(post: _Post) -> str: # noqa: FURB118 + def factory(post: _Post) -> str: # ruff:ignore[reimplemented-operator] return post['title'] return [ diff --git a/tests/test_future/test_future_result/test_future_result_units.py b/tests/test_future/test_future_result/test_future_result_units.py index 15c07c0d..c507ef9b 100644 --- a/tests/test_future/test_future_result/test_future_result_units.py +++ b/tests/test_future/test_future_result/test_future_result_units.py @@ -27,4 +27,4 @@ async def test_inner_value(subtests): for container in containers: with subtests.test(container=container): result_inst = await container - assert result_inst._inner_value._inner_value == 1 # noqa: SLF001 + assert result_inst._inner_value._inner_value == 1 # ruff:ignore[private-member-access] diff --git a/tests/test_io/test_ioresult_container/test_ioresult_functions/test_impure_safe.py b/tests/test_io/test_ioresult_container/test_ioresult_functions/test_impure_safe.py index 0ad153a2..9e3ce0da 100644 --- a/tests/test_io/test_ioresult_container/test_ioresult_functions/test_impure_safe.py +++ b/tests/test_io/test_ioresult_container/test_ioresult_functions/test_impure_safe.py @@ -29,7 +29,7 @@ def test_safe_iofailure(): """Ensures that safe decorator works correctly for IOFailure case.""" failed = _function(0) assert isinstance( - failed.failure()._inner_value, # noqa: SLF001 + failed.failure()._inner_value, # ruff:ignore[private-member-access] ZeroDivisionError, ) @@ -38,13 +38,13 @@ def test_safe_failure_with_expected_error(): """Ensures that safe decorator works correctly for Failure case.""" failed = _function_two(0) assert isinstance( - failed.failure()._inner_value, # noqa: SLF001 + failed.failure()._inner_value, # ruff:ignore[private-member-access] ZeroDivisionError, ) failed2 = _function_three(0) assert isinstance( - failed2.failure()._inner_value, # noqa: SLF001 + failed2.failure()._inner_value, # ruff:ignore[private-member-access] ZeroDivisionError, ) diff --git a/tests/test_maybe/test_maybe_equality.py b/tests/test_maybe/test_maybe_equality.py index 0555277f..cb76b200 100644 --- a/tests/test_maybe/test_maybe_equality.py +++ b/tests/test_maybe/test_maybe_equality.py @@ -2,7 +2,11 @@ import pytest -from returns.maybe import Nothing, Some, _Nothing # noqa: PLC2701 +from returns.maybe import ( + Nothing, + Some, + _Nothing, +) from returns.primitives.exceptions import ImmutableStateError @@ -33,8 +37,8 @@ def test_equality(): def test_nonequality(): """Ensures that containers are not compared to regular values.""" assert Nothing is not None - assert Nothing != None # noqa: E711 - assert _Nothing(None) != None # noqa: E711 + assert Nothing != None # ruff:ignore[none-comparison] + assert _Nothing(None) != None # ruff:ignore[none-comparison] assert Some(5) != 5 assert Some(3) is not Some(3) @@ -50,7 +54,7 @@ def test_is_compare(): def test_immutability_failure(): """Ensures that Failure container is immutable.""" with pytest.raises(ImmutableStateError): - Nothing._inner_state = 1 # noqa: SLF001 + Nothing._inner_state = 1 # ruff:ignore[private-member-access] with pytest.raises(ImmutableStateError): Nothing.missing = 2 @@ -59,13 +63,13 @@ def test_immutability_failure(): del Nothing._inner_state # type: ignore # noqa: SLF001, WPS420 with pytest.raises(AttributeError): - Nothing.missing # type: ignore # noqa: B018 + Nothing.missing # type: ignore # ruff:ignore[useless-expression] def test_immutability_success(): """Ensures that Success container is immutable.""" with pytest.raises(ImmutableStateError): - Some(0)._inner_state = 1 # noqa: SLF001 + Some(0)._inner_state = 1 # ruff:ignore[private-member-access] with pytest.raises(ImmutableStateError): Some(1).missing = 2 @@ -74,7 +78,7 @@ def test_immutability_success(): del Some(0)._inner_state # type: ignore # noqa: SLF001, WPS420 with pytest.raises(AttributeError): - Some(1).missing # type: ignore # noqa: B018 + Some(1).missing # type: ignore # ruff:ignore[useless-expression] def test_success_immutable_copy(): diff --git a/tests/test_maybe/test_nothing_singleton.py b/tests/test_maybe/test_nothing_singleton.py index f7d9e232..5cebcdcb 100644 --- a/tests/test_maybe/test_nothing_singleton.py +++ b/tests/test_maybe/test_nothing_singleton.py @@ -1,4 +1,4 @@ -from returns.maybe import _Nothing # noqa: PLC2701 +from returns.maybe import _Nothing # ruff:ignore[import-private-name] def test_nothing_singleton(): diff --git a/tests/test_primitives/test_container/test_base_container/test_pickle.py b/tests/test_primitives/test_container/test_base_container/test_pickle.py index 453ae430..e4bc483a 100644 --- a/tests/test_primitives/test_container/test_base_container/test_pickle.py +++ b/tests/test_primitives/test_container/test_base_container/test_pickle.py @@ -1,4 +1,4 @@ -import pickle # noqa: S403 +import pickle # ruff:ignore[suspicious-pickle-import] from typing import Any from hypothesis import example, given @@ -36,4 +36,4 @@ def __hash__(self) -> int: def test_pickle(container_value: Any): """Ensures custom pickle protocol works as expected.""" container = BaseContainer(container_value) - assert pickle.loads(pickle.dumps(container)) == container # noqa: S301 + assert pickle.loads(pickle.dumps(container)) == container # ruff:ignore[suspicious-pickle-usage] diff --git a/tests/test_primitives/test_container/test_base_container/test_pickle_backward_deserialization.py b/tests/test_primitives/test_container/test_base_container/test_pickle_backward_deserialization.py index 5b7341c2..cb106ba9 100644 --- a/tests/test_primitives/test_container/test_base_container/test_pickle_backward_deserialization.py +++ b/tests/test_primitives/test_container/test_base_container/test_pickle_backward_deserialization.py @@ -1,4 +1,4 @@ -import pickle # noqa: S403 +import pickle # ruff:ignore[suspicious-pickle-import] from returns.primitives.container import BaseContainer @@ -11,4 +11,4 @@ def test_pickle_backward_deserialization(): + b'returns.primitives.container\x94\x8c\rBaseContainer' + b'\x94\x93\x94)\x81\x94K\x01b.' ) - assert pickle.loads(serialized_container) == BaseContainer(1) # noqa: S301 + assert pickle.loads(serialized_container) == BaseContainer(1) # ruff:ignore[suspicious-pickle-usage] diff --git a/tests/test_primitives/test_exceptions/test_pickle_unwrap_failed_error.py b/tests/test_primitives/test_exceptions/test_pickle_unwrap_failed_error.py index 6dda4b9a..e002de48 100644 --- a/tests/test_primitives/test_exceptions/test_pickle_unwrap_failed_error.py +++ b/tests/test_primitives/test_exceptions/test_pickle_unwrap_failed_error.py @@ -1,4 +1,4 @@ -import pickle # noqa: S403 +import pickle # ruff:ignore[suspicious-pickle-import] from returns.maybe import Nothing from returns.primitives.exceptions import UnwrapFailedError @@ -13,7 +13,7 @@ def test_pickle_unwrap_failed_error_from_maybe(): except UnwrapFailedError as error: serialized = pickle.dumps(error) - deserialized_error = pickle.loads(serialized) # noqa: S301 + deserialized_error = pickle.loads(serialized) # ruff:ignore[suspicious-pickle-usage] assert deserialized_error.halted_container == Nothing @@ -25,5 +25,5 @@ def test_pickle_unwrap_failed_error_from_result(): except UnwrapFailedError as error: serialized = pickle.dumps(error) - deserialized_error = pickle.loads(serialized) # noqa: S301 + deserialized_error = pickle.loads(serialized) # ruff:ignore[suspicious-pickle-usage] assert deserialized_error.halted_container == Failure('error') diff --git a/tests/test_primitives/test_laws/test_lawful/test_laws_resolution.py b/tests/test_primitives/test_laws/test_lawful/test_laws_resolution.py index 665cfa2a..78e7fe1a 100644 --- a/tests/test_primitives/test_laws/test_lawful/test_laws_resolution.py +++ b/tests/test_primitives/test_laws/test_lawful/test_laws_resolution.py @@ -58,7 +58,7 @@ def test_container_defined_in_returns() -> None: def test_container_defined_outside_returns() -> None: """Check container defined outside `returns`.""" - result = test_custom_type_applicative._Wrapper.laws() # noqa: SLF001 + result = test_custom_type_applicative._Wrapper.laws() # ruff:ignore[private-member-access] assert sorted(str(interface) for interface in result) == [ "", @@ -68,7 +68,7 @@ def test_container_defined_outside_returns() -> None: def test_interface_defined_outside_returns() -> None: """Check container with interface defined outside `returns`.""" - result = test_custom_interface_with_laws._Wrapper.laws() # noqa: SLF001 + result = test_custom_interface_with_laws._Wrapper.laws() # ruff:ignore[private-member-access] assert sorted(str(interface) for interface in result) == [ ( diff --git a/tests/test_result/test_result_equality.py b/tests/test_result/test_result_equality.py index b1338b27..30b71cfd 100644 --- a/tests/test_result/test_result_equality.py +++ b/tests/test_result/test_result_equality.py @@ -48,7 +48,7 @@ def test_is_compare(): def test_immutability_failure(): """Ensures that Failure container is immutable.""" with pytest.raises(ImmutableStateError): - Failure(0)._inner_state = 1 # noqa: SLF001 + Failure(0)._inner_state = 1 # ruff:ignore[private-member-access] with pytest.raises(ImmutableStateError): Failure(1).missing = 2 @@ -57,13 +57,13 @@ def test_immutability_failure(): del Failure(0)._inner_state # type: ignore # noqa: SLF001, WPS420 with pytest.raises(AttributeError): - Failure(1).missing # type: ignore # noqa: B018 + Failure(1).missing # type: ignore # ruff:ignore[useless-expression] def test_immutability_success(): """Ensures that Success container is immutable.""" with pytest.raises(ImmutableStateError): - Success(0)._inner_state = 1 # noqa: SLF001 + Success(0)._inner_state = 1 # ruff:ignore[private-member-access] with pytest.raises(ImmutableStateError): Success(1).missing = 2 @@ -72,7 +72,7 @@ def test_immutability_success(): del Success(0)._inner_state # type: ignore # noqa: SLF001, WPS420 with pytest.raises(AttributeError): - Success(1).missing # type: ignore # noqa: B018 + Success(1).missing # type: ignore # ruff:ignore[useless-expression] def test_success_immutable_copy():