Skip to content

Commit 1576043

Browse files
committed
Black reformat
1 parent d717af0 commit 1576043

29 files changed

+228
-578
lines changed

docs/conf.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -212,13 +212,7 @@
212212
# (source start file, target name, title, author, documentclass
213213
# [howto/manual]).
214214
latex_documents = [
215-
(
216-
"index",
217-
"cattrs.tex",
218-
u"cattrs Documentation",
219-
u"Tin Tvrtković",
220-
"manual",
221-
)
215+
("index", "cattrs.tex", u"cattrs Documentation", u"Tin Tvrtković", "manual")
222216
]
223217

224218
# The name of an image file (relative to this directory) to place at
@@ -246,9 +240,7 @@
246240

247241
# One entry per manual page. List of tuples
248242
# (source start file, name, description, authors, manual section).
249-
man_pages = [
250-
("index", "cattrs", u"cattrs Documentation", [u"Tin Tvrtković"], 1)
251-
]
243+
man_pages = [("index", "cattrs", u"cattrs Documentation", [u"Tin Tvrtković"], 1)]
252244

253245
# If true, show URL addresses after external links.
254246
# man_show_urls = False

pyproject.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
[tool.black]
2-
line-length = 79
32
skip-magic-trailing-comma = true
43

54
[tool.isort]
65
profile = "black"
7-
line_length = 79
86
known_first_party = ["cattr"]
97

108
[tool.poetry]

src/cattr/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,4 @@
2323
register_structure_hook = global_converter.register_structure_hook
2424
register_structure_hook_func = global_converter.register_structure_hook_func
2525
register_unstructure_hook = global_converter.register_unstructure_hook
26-
register_unstructure_hook_func = (
27-
global_converter.register_unstructure_hook_func
28-
)
26+
register_unstructure_hook_func = global_converter.register_unstructure_hook_func

src/cattr/_compat.py

Lines changed: 10 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ def get_origin(cl):
4141

4242

4343
def has(cls):
44-
return hasattr(cls, "__attrs_attrs__") or hasattr(
45-
cls, "__dataclass_fields__"
46-
)
44+
return hasattr(cls, "__attrs_attrs__") or hasattr(cls, "__dataclass_fields__")
4745

4846

4947
def has_with_generic(cls):
@@ -127,15 +125,12 @@ def is_annotated(_):
127125

128126
def is_tuple(type):
129127
return type in (Tuple, tuple) or (
130-
type.__class__ is _GenericAlias
131-
and issubclass(type.__origin__, Tuple)
128+
type.__class__ is _GenericAlias and issubclass(type.__origin__, Tuple)
132129
)
133130

134131
def is_union_type(obj):
135132
return (
136-
obj is Union
137-
or isinstance(obj, _GenericAlias)
138-
and obj.__origin__ is Union
133+
obj is Union or isinstance(obj, _GenericAlias) and obj.__origin__ is Union
139134
)
140135

141136
def is_sequence(type: Any) -> bool:
@@ -150,14 +145,12 @@ def is_sequence(type: Any) -> bool:
150145

151146
def is_mutable_set(type):
152147
return type is set or (
153-
type.__class__ is _GenericAlias
154-
and issubclass(type.__origin__, MutableSet)
148+
type.__class__ is _GenericAlias and issubclass(type.__origin__, MutableSet)
155149
)
156150

157151
def is_frozenset(type):
158152
return type is frozenset or (
159-
type.__class__ is _GenericAlias
160-
and issubclass(type.__origin__, FrozenSet)
153+
type.__class__ is _GenericAlias and issubclass(type.__origin__, FrozenSet)
161154
)
162155

163156
def is_mapping(type):
@@ -189,9 +182,7 @@ def is_counter(type):
189182
from typing import Literal
190183

191184
def is_literal(type) -> bool:
192-
return (
193-
type.__class__ is _GenericAlias and type.__origin__ is Literal
194-
)
185+
return type.__class__ is _GenericAlias and type.__origin__ is Literal
195186

196187
else:
197188
# No literals in 3.7.
@@ -252,10 +243,7 @@ def is_annotated(type) -> bool:
252243
def is_tuple(type):
253244
return (
254245
type in (Tuple, tuple)
255-
or (
256-
type.__class__ is _GenericAlias
257-
and issubclass(type.__origin__, Tuple)
258-
)
246+
or (type.__class__ is _GenericAlias and issubclass(type.__origin__, Tuple))
259247
or (getattr(type, "__origin__", None) is tuple)
260248
)
261249

@@ -266,10 +254,7 @@ def is_union_type(obj):
266254

267255
return (
268256
obj is Union
269-
or (
270-
isinstance(obj, _UnionGenericAlias)
271-
and obj.__origin__ is Union
272-
)
257+
or (isinstance(obj, _UnionGenericAlias) and obj.__origin__ is Union)
273258
or isinstance(obj, UnionType)
274259
)
275260

@@ -314,10 +299,7 @@ def is_mutable_set(type):
314299
type.__class__ is _GenericAlias
315300
and issubclass(type.__origin__, TypingMutableSet)
316301
)
317-
or (
318-
getattr(type, "__origin__", None)
319-
in (set, AbcMutableSet, AbcSet)
320-
)
302+
or (getattr(type, "__origin__", None) in (set, AbcMutableSet, AbcSet))
321303
)
322304

323305
def is_frozenset(type):
@@ -337,14 +319,7 @@ def is_bare(type):
337319

338320
def is_mapping(type):
339321
return (
340-
type
341-
in (
342-
TypingMapping,
343-
Dict,
344-
TypingMutableMapping,
345-
dict,
346-
AbcMutableMapping,
347-
)
322+
type in (TypingMapping, Dict, TypingMutableMapping, dict, AbcMutableMapping)
348323
or (
349324
type.__class__ is _GenericAlias
350325
and issubclass(type.__origin__, TypingMapping)

0 commit comments

Comments
 (0)