Skip to content

Commit e3776eb

Browse files
committed
fixup: format
1 parent 5e98671 commit e3776eb

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

decoy/spy_core.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,17 @@
22
import inspect
33
import functools
44
import warnings
5-
from typing import Any, Dict, NamedTuple, Optional, Tuple, Type, Union, Sequence, get_type_hints
5+
from typing import (
6+
Any,
7+
Dict,
8+
NamedTuple,
9+
Optional,
10+
Tuple,
11+
Type,
12+
Union,
13+
Sequence,
14+
get_type_hints,
15+
)
616

717
from .spy_events import SpyInfo
818
from .warnings import IncorrectCallWarning, MissingSpecAttributeWarning
@@ -221,14 +231,15 @@ def _get_type_hints(obj: Any) -> Dict[str, Any]:
221231
except Exception:
222232
return {}
223233

234+
224235
def _unwrap_optional(source: Any) -> Any:
225236
"""Return the source's base type if it's a optional.
226237
227238
If the type is a union of more than just T | None,
228239
bail out and return None to avoid potentially false warnings.
229240
"""
230-
origin = getattr(source, '__origin__', None)
231-
args: Sequence[Any] = getattr(source, '__args__', ())
241+
origin = getattr(source, "__origin__", None)
242+
args: Sequence[Any] = getattr(source, "__args__", ())
232243

233244
# TODO(mc, 2025-03-19): support larger unions? might be a lot of work for little payoff
234245
if origin is Union:

tests/fixtures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def optional_child(self) -> Optional[SomeClass]:
5959
raise NotImplementedError()
6060

6161
@property
62-
def union_child(self) -> Union[SomeClass, 'SomeAsyncClass']:
62+
def union_child(self) -> Union[SomeClass, "SomeAsyncClass"]:
6363
"""Get the child instance."""
6464
raise NotImplementedError()
6565

0 commit comments

Comments
 (0)