Skip to content

Commit 920e8a5

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 97bdaff commit 920e8a5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

mypy/plugins/enums.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,9 @@
2727
LiteralType,
2828
ProperType,
2929
Type,
30+
UnionType,
3031
get_proper_type,
3132
is_named_instance,
32-
UnionType,
33-
LiteralType,
3433
)
3534

3635
ENUM_NAME_ACCESS: Final = {f"{prefix}.name" for prefix in ENUM_BASES} | {
@@ -65,7 +64,9 @@ def enum_name_callback(ctx: mypy.plugin.AttributeContext) -> Type:
6564

6665
# Or `field: SomeEnum = SomeEnum.field; field.name` case,
6766
# Or `field: Literal[Some.A, Some.B]; field.name` case:
68-
enum_names = _extract_enum_names_from_type(ctx.type) or _extract_enum_names_from_literal_union(ctx.type)
67+
enum_names = _extract_enum_names_from_type(ctx.type) or _extract_enum_names_from_literal_union(
68+
ctx.type
69+
)
6970
if enum_names:
7071
str_type = ctx.api.named_generic_type("builtins.str", [])
7172
return make_simplified_union(

0 commit comments

Comments
 (0)