Skip to content

Commit c2f0692

Browse files
committed
dev: reformat with newer black
1 parent 31c348f commit c2f0692

19 files changed

+67
-111
lines changed

strcs/annotations.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
Callable objects will also be turned into a ``strcs.Ann`` by treating the callable
1919
object as a creator override.
2020
"""
21+
2122
import typing as tp
2223

2324
import attrs
@@ -51,8 +52,7 @@ class AdjustableMeta(tp.Protocol[T]):
5152
The new Meta will persist for any transformation that occurs below the field.
5253
"""
5354

54-
def adjusted_meta(self, meta: Meta, typ: Type[T], type_cache: TypeCache) -> Meta:
55-
...
55+
def adjusted_meta(self, meta: Meta, typ: Type[T], type_cache: TypeCache) -> Meta: ...
5656

5757

5858
@tp.runtime_checkable
@@ -85,8 +85,7 @@ def adjusted_creator(
8585
register: "CreateRegister",
8686
typ: Type[T],
8787
type_cache: TypeCache,
88-
) -> ConvertFunction[T] | None:
89-
...
88+
) -> ConvertFunction[T] | None: ...
9089

9190

9291
@attrs.define

strcs/args_extractor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
these functions. It takes in information about the function, as well as some
99
related information and returns what the function should be called with.
1010
"""
11+
1112
import inspect
1213
import typing as tp
1314

strcs/decorator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def create_thing(value: object, /) -> strcs.ConvertResponse[Thing]:
6969
and provide a ``ConvertFunction`` interface for executing them and is used
7070
by the function returned by ``strcs.CreateRegister::make_decorator``
7171
"""
72+
7273
import inspect
7374
import typing as tp
7475
from collections.abc import Mapping

strcs/disassemble/_base.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -731,16 +731,13 @@ class Disassembler(tp.Protocol):
731731
type_cache: "TypeCache"
732732

733733
@tp.overload
734-
def __call__(self, typ: type[U]) -> "Type[U]":
735-
...
734+
def __call__(self, typ: type[U]) -> "Type[U]": ...
736735

737736
@tp.overload
738-
def __call__(self, typ: Type[U]) -> "Type[U]":
739-
...
737+
def __call__(self, typ: Type[U]) -> "Type[U]": ...
740738

741739
@tp.overload
742-
def __call__(self, typ: object) -> "Type[object]":
743-
...
740+
def __call__(self, typ: object) -> "Type[object]": ...
744741

745742
def __call__(self, typ: type[U] | object) -> "Type[U] | Type[object]":
746743
"""

strcs/disassemble/_cache.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,13 @@ def __init__(self, type_cache: "TypeCache"):
1717
self.type_cache = type_cache
1818

1919
@tp.overload
20-
def __call__(self, typ: type[U]) -> "Type[U]":
21-
...
20+
def __call__(self, typ: type[U]) -> "Type[U]": ...
2221

2322
@tp.overload
24-
def __call__(self, typ: "Type[U]") -> "Type[U]":
25-
...
23+
def __call__(self, typ: "Type[U]") -> "Type[U]": ...
2624

2725
@tp.overload
28-
def __call__(self, typ: object) -> "Type[object]":
29-
...
26+
def __call__(self, typ: object) -> "Type[object]": ...
3027

3128
def __call__(self, typ: type[U] | object) -> "Type[U] | Type[object]":
3229
"""

strcs/disassemble/_extract.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ class IsAnnotated(tp.Protocol):
3939
__args__: tuple
4040
__metadata__: tuple
4141

42-
def copy_with(self, args: tuple) -> type:
43-
...
42+
def copy_with(self, args: tuple) -> type: ...
4443

4544
@classmethod
4645
def has(self, typ: object) -> tp.TypeGuard["IsAnnotated"]:

strcs/disassemble/_instance_check.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,7 @@ class Meta(InstanceCheck.Meta):
128128
check_against = (
129129
disassembled.type_alias
130130
if disassembled.is_type_alias
131-
else None
132-
if Meta.extracted is None
133-
else disassembled.origin_type
131+
else None if Meta.extracted is None else disassembled.origin_type
134132
)
135133

136134
reprstr = repr(check_against)

strcs/disassemble/_score.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,7 @@ def for_display(self, indent=" ") -> str:
156156
lines: list[str] = []
157157

158158
class WithDisplay(tp.Protocol):
159-
def for_display(self, indent="") -> str:
160-
...
159+
def for_display(self, indent="") -> str: ...
161160

162161
def extend(displayable: WithDisplay, extra: tp.Callable[[int], str]) -> None:
163162
for i, line in enumerate(displayable.for_display(indent=indent).split("\n")):

strcs/errors.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88

99

1010
@attrs.define
11-
class StructuresError(Exception):
12-
...
11+
class StructuresError(Exception): ...
1312

1413

1514
@attrs.define

strcs/hints.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
.. autofunction:: strcs.resolve_types
99
1010
"""
11+
1112
import dataclasses
1213
import functools
1314
import operator
@@ -47,8 +48,7 @@ class WithCopyWith(tp.Protocol[T]):
4748

4849
__args__: tuple
4950

50-
def copy_with(self, args: tuple) -> T:
51-
...
51+
def copy_with(self, args: tuple) -> T: ...
5252

5353
@classmethod
5454
def has(self, obj: T) -> tp.TypeGuard["WithCopyWith"]:
@@ -88,8 +88,7 @@ class WithClassGetItem(tp.Protocol[C]):
8888
__origin__: type[C]
8989

9090
@classmethod
91-
def __class_getitem__(self, item: tuple) -> type[C]:
92-
...
91+
def __class_getitem__(self, item: tuple) -> type[C]: ...
9392

9493
@classmethod
9594
def has(self, obj: T, origin: type[C]) -> tp.TypeGuard["WithClassGetItem"]:
@@ -146,11 +145,9 @@ class AnnotationUpdater(tp.Protocol):
146145
Protocol for an object that can change the annotations on an object
147146
"""
148147

149-
def __contains__(self, name: object) -> bool:
150-
...
148+
def __contains__(self, name: object) -> bool: ...
151149

152-
def update(self, name: str, typ: object) -> None:
153-
...
150+
def update(self, name: str, typ: object) -> None: ...
154151

155152

156153
class FromAnnotations(AnnotationUpdater):
@@ -192,7 +189,7 @@ def resolve_types(
192189
globalns: dict[str, object] | None = None,
193190
localns: dict[str, object] | None = None,
194191
*,
195-
type_cache: tp.Union["CreateRegister", "TypeCache"]
192+
type_cache: tp.Union["CreateRegister", "TypeCache"],
196193
) -> C:
197194
"""
198195
Resolve any strings and forward annotations in type annotations.

0 commit comments

Comments
 (0)