Skip to content

Commit f53cd5c

Browse files
author
python-desert
authored
Fix lints
2 parents a155f47 + be278ba commit f53cd5c

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

docs/conf.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33

44
import os
55

6+
67
def read(*names, **kwargs):
78
with open(
8-
os.path.join(os.path.dirname(__file__), *names), encoding=kwargs.get("encoding", "utf8")
9+
os.path.join(os.path.dirname(__file__), *names),
10+
encoding=kwargs.get("encoding", "utf8"),
911
) as fh:
1012
return fh.read()
1113

1214

13-
1415
extensions = [
1516
"sphinx.ext.autodoc",
1617
"sphinx.ext.napoleon",
@@ -38,7 +39,7 @@ def read(*names, **kwargs):
3839
copyright = "{0}, {1}".format(year, author)
3940

4041
ns = {}
41-
exec(read('..', "src/desert/_version.py"), ns)
42+
exec(read("..", "src/desert/_version.py"), ns)
4243
version = release = ns["__version__"]
4344

4445

src/desert/_make.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,10 @@ class User:
5959
import dataclasses
6060
import datetime
6161
import decimal
62+
import enum
6263
import inspect
6364
import typing as t
64-
import typing
6565
import uuid
66-
import enum
6766

6867
import attr
6968
import marshmallow
@@ -106,7 +105,7 @@ def class_schema(
106105
fields = attr.fields(clazz)
107106
elif issubclass(clazz, (list, dict)):
108107
raise desert.exceptions.UnknownType(
109-
"Use parametrized generics like typing.List[int] or typing.Dict[str, int] "
108+
"Use parametrized generics like t.List[int] or t.Dict[str, int] "
110109
f"instead of list and dict. Got {clazz}."
111110
)
112111
else:
@@ -116,7 +115,7 @@ def class_schema(
116115
attributes = {k: v for k, v in inspect.getmembers(clazz) if not k.startswith("_")}
117116
# Update the schema members to contain marshmallow fields instead of dataclass fields
118117

119-
hints = typing.get_type_hints(clazz)
118+
hints = t.get_type_hints(clazz)
120119
for field in fields:
121120
if field.init:
122121
attributes[field.name] = field_for_schema(
@@ -182,7 +181,7 @@ def field_for_schema(
182181
>>> field_for_schema(enum.Enum("X", "a b c")).__class__
183182
<class 'marshmallow_enum.EnumField'>
184183
>>> import typing
185-
>>> field_for_schema(typing.Union[int,str]).__class__
184+
>>> field_for_schema(t.Union[int,str]).__class__
186185
<class 'marshmallow_union.Union'>
187186
>>> field_for_schema(t.NewType('UserId', int)).__class__
188187
<class 'marshmallow.fields.Integer'>
@@ -267,7 +266,7 @@ def field_for_schema(
267266

268267
field = marshmallow_union.Union(subfields)
269268

270-
# typing.NewType returns a function with a __supertype__ attribute
269+
# t.NewType returns a function with a __supertype__ attribute
271270
newtype_supertype = getattr(typ, "__supertype__", None)
272271
if newtype_supertype and inspect.isfunction(typ):
273272
metadata.setdefault("description", typ.__name__)

0 commit comments

Comments
 (0)