Skip to content

Commit 00fd471

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 02c7e03 commit 00fd471

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

mypy/plugins/dataclasses.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -118,18 +118,20 @@ def __init__(
118118
self.is_neither_frozen_nor_nonfrozen = is_neither_frozen_nor_nonfrozen
119119
self._api = api
120120

121-
def to_argument(self, current_info: TypeInfo, *, of: Literal['__init__', 'replace', '__post_init__']) -> Argument:
121+
def to_argument(
122+
self, current_info: TypeInfo, *, of: Literal["__init__", "replace", "__post_init__"]
123+
) -> Argument:
122124
arg_kind = ARG_POS
123-
if of == '__init__':
125+
if of == "__init__":
124126
if self.kw_only and self.has_default:
125127
arg_kind = ARG_NAMED_OPT
126128
elif self.kw_only and not self.has_default:
127129
arg_kind = ARG_NAMED
128130
elif not self.kw_only and self.has_default:
129131
arg_kind = ARG_OPT
130-
elif of == 'replace':
132+
elif of == "replace":
131133
arg_kind = ARG_NAMED if self.is_init_var and not self.has_default else ARG_NAMED_OPT
132-
elif of == '__post_init__':
134+
elif of == "__post_init__":
133135
# We always use `ARG_POS` without a default value, because it is practical.
134136
# Consider this case:
135137
#
@@ -253,7 +255,7 @@ def transform(self) -> bool:
253255
and attributes
254256
):
255257
args = [
256-
attr.to_argument(info, of='__init__')
258+
attr.to_argument(info, of="__init__")
257259
for attr in attributes
258260
if attr.is_in_init and not self._is_kw_only_type(attr.type)
259261
]
@@ -1093,7 +1095,7 @@ def check_post_init(api: TypeChecker, defn: FuncItem, info: TypeInfo) -> None:
10931095
ideal_sig = ideal_sig_method.type
10941096
assert isinstance(ideal_sig, ProperType) # we set it ourselves
10951097
assert isinstance(ideal_sig, CallableType)
1096-
ideal_sig = ideal_sig.copy_modified(name='__post_init__')
1098+
ideal_sig = ideal_sig.copy_modified(name="__post_init__")
10971099

10981100
api.check_override(
10991101
override=defn.type,

0 commit comments

Comments
 (0)