Skip to content

Commit cb399b7

Browse files
chore(deps-dev): bump ruff from 0.1.3 to 0.4.2 (#253)
* chore(deps-dev): bump ruff from 0.1.3 to 0.4.2 Bumps [ruff](https://github.com/astral-sh/ruff) from 0.1.3 to 0.4.2. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](astral-sh/ruff@v0.1.3...v0.4.2) --- updated-dependencies: - dependency-name: ruff dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * fixup: format --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Michael Cousins <[email protected]>
1 parent 53ad39d commit cb399b7

39 files changed

+185
-57
lines changed

decoy/__init__.py

+9-15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Decoy stubbing and spying library."""
2+
23
from typing import Any, Callable, Coroutine, Generic, Optional, Union, overload
34

45
from . import errors, matchers, warnings
@@ -40,16 +41,13 @@ def __init__(self) -> None:
4041
self._core = DecoyCore()
4142

4243
@overload
43-
def mock(self, *, cls: Callable[..., ClassT]) -> ClassT:
44-
...
44+
def mock(self, *, cls: Callable[..., ClassT]) -> ClassT: ...
4545

4646
@overload
47-
def mock(self, *, func: FuncT) -> FuncT:
48-
...
47+
def mock(self, *, func: FuncT) -> FuncT: ...
4948

5049
@overload
51-
def mock(self, *, name: str, is_async: bool = False) -> Any:
52-
...
50+
def mock(self, *, name: str, is_async: bool = False) -> Any: ...
5351

5452
def mock(
5553
self,
@@ -255,29 +253,25 @@ def then_do(
255253
def then_enter_with(
256254
self: "Stub[ContextManager[ContextValueT]]",
257255
value: ContextValueT,
258-
) -> None:
259-
...
256+
) -> None: ...
260257

261258
@overload
262259
def then_enter_with(
263260
self: "Stub[AsyncContextManager[ContextValueT]]",
264261
value: ContextValueT,
265-
) -> None:
266-
...
262+
) -> None: ...
267263

268264
@overload
269265
def then_enter_with(
270266
self: "Stub[GeneratorContextManager[ContextValueT]]",
271267
value: ContextValueT,
272-
) -> None:
273-
...
268+
) -> None: ...
274269

275270
@overload
276271
def then_enter_with(
277272
self: "Stub[AsyncGeneratorContextManager[ContextValueT]]",
278273
value: ContextValueT,
279-
) -> None:
280-
...
274+
) -> None: ...
281275

282276
def then_enter_with(
283277
self: Union[
@@ -347,4 +341,4 @@ def delete(self) -> None:
347341
self._core.delete()
348342

349343

350-
__all__ = ["Decoy", "Stub", "Prop", "matchers", "warnings", "errors"]
344+
__all__ = ["Decoy", "Prop", "Stub", "errors", "matchers", "warnings"]

decoy/call_handler.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Spy call handling."""
2+
23
from typing import Any, NamedTuple, Optional
34

45
from .spy_log import SpyLog

decoy/context_managers.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Wrappers around contextlib types and fallbacks."""
2+
23
from typing import Any, AsyncContextManager, ContextManager, Generic, TypeVar
34

45
from contextlib import (
@@ -44,6 +45,6 @@ async def __aexit__(self, *args: Any, **kwargs: Any) -> Any:
4445
"AsyncContextManager",
4546
"AsyncGeneratorContextManager",
4647
"ContextManager",
47-
"GeneratorContextManager",
4848
"ContextWrapper",
49+
"GeneratorContextManager",
4950
]

decoy/core.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Decoy implementation logic."""
2+
23
import inspect
34
from typing import Any, Callable, Optional
45

decoy/errors.py

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
55
[errors guide]: usage/errors-and-warnings.md#errors
66
"""
7+
78
from typing import Optional, Sequence
89

910
from .spy_events import SpyEvent, VerifyRehearsal

decoy/matchers.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,18 @@ def test_logger_called(decoy: Decoy):
2626
Identity comparisons (`is`) will not work with matchers. Decoy only uses
2727
equality comparisons (`==`) for stubbing and verification.
2828
"""
29+
2930
from re import compile as compile_re
3031
from typing import cast, Any, List, Mapping, Optional, Pattern, Type, TypeVar
3132

3233

3334
__all__ = [
3435
"Anything",
36+
"Captor",
37+
"ErrorMatching",
3538
"IsA",
3639
"IsNot",
3740
"StringMatching",
38-
"ErrorMatching",
39-
"Captor",
4041
]
4142

4243

@@ -270,7 +271,7 @@ def __init__(self, error: Type[BaseException], match: Optional[str] = None) -> N
270271

271272
def __eq__(self, target: object) -> bool:
272273
"""Return true if target is not self._reject_value."""
273-
error_match = type(target) == self._error_type
274+
error_match = type(target) is self._error_type
274275
message_match = (
275276
str(target) == self._string_matcher
276277
if self._string_matcher is not None

decoy/mypy/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Decoy mypy plugin entrypoint."""
2+
23
from .plugin import plugin
34

45
__all__ = ["plugin"]

decoy/mypy/plugin.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Decoy mypy plugin."""
2+
23
from typing import Callable, Optional, Type as ClassType
34

45
from mypy.errorcodes import FUNC_RETURNS_VALUE

decoy/pytest_plugin.py

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
fixture without modifying any other pytest behavior. Its usage is optional
55
but highly recommended.
66
"""
7+
78
from typing import Iterable
89

910
import pytest

decoy/spy.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Classes in this module are heavily inspired by the
44
[unittest.mock library](https://docs.python.org/3/library/unittest.mock.html).
55
"""
6+
67
import inspect
78
from types import TracebackType
89
from typing import Any, ContextManager, Dict, Optional, Type, Union, cast, overload
@@ -186,14 +187,12 @@ def __init__(self, call_handler: CallHandler) -> None:
186187
self._decoy_spy_call_handler = call_handler
187188

188189
@overload
189-
def create(self, *, core: SpyCore) -> AnySpy:
190-
...
190+
def create(self, *, core: SpyCore) -> AnySpy: ...
191191

192192
@overload
193193
def create(
194194
self, *, spec: Optional[object], name: Optional[str], is_async: bool
195-
) -> AnySpy:
196-
...
195+
) -> AnySpy: ...
197196

198197
def create(
199198
self,

decoy/spy_core.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Core spy logic."""
2+
23
import inspect
34
import functools
45
import warnings

decoy/spy_events.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Spy interaction event value objects."""
2+
23
import enum
34
from typing import Any, Dict, NamedTuple, Optional, Tuple, Union
45

decoy/spy_log.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Spy activity log."""
2+
23
from typing import List, Sequence
34

45
from .errors import MissingRehearsalError

decoy/stringify.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Message string generation."""
2+
23
import os
34
from typing import Sequence
45

decoy/stub_store.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Stub creation and storage."""
2+
23
from typing import Any, Callable, List, NamedTuple, Optional, Union
34

45
from .spy_events import SpyEvent, WhenRehearsal, match_event

decoy/types.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Common type definitions."""
2+
23
from typing import Any, Callable, TypeVar
34

45
FuncT = TypeVar("FuncT", bound=Callable[..., Any])

decoy/verifier.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Spy call verification."""
2+
23
from typing import Optional, Sequence
34

45
from .spy_events import SpyEvent, VerifyRehearsal, match_event

decoy/warning_checker.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Warning checker."""
2+
23
from collections import defaultdict
34
from itertools import groupby
45
from typing import Dict, List, NamedTuple, Sequence

decoy/warnings.py

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
55
[warnings guide]: usage/errors-and-warnings.md#warnings
66
"""
7+
78
import os
89
from typing import Sequence
910

0 commit comments

Comments
 (0)