Skip to content

Commit 70d663a

Browse files
Fix bug
1 parent f50fd2b commit 70d663a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

openapi_python_client/parser/properties/model_property.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from itertools import chain
2-
from typing import ClassVar, Dict, List, NamedTuple, Optional, Set, Tuple, Union
2+
from typing import ClassVar, Dict, List, NamedTuple, Optional, Set, Tuple, Union, cast
33

44
import attr
55

@@ -69,8 +69,12 @@ def _is_subtype(first: Property, second: Property) -> bool:
6969
[
7070
_is_string_enum(first) and isinstance(second, StringProperty),
7171
_is_int_enum(first) and isinstance(second, IntProperty),
72-
_is_string_enum(first) and _is_string_enum(second) and values_are_subset(first, second),
73-
_is_int_enum(first) and _is_int_enum(second) and values_are_subset(first, second),
72+
_is_string_enum(first) and _is_string_enum(second)
73+
# cast because MyPy fails to deduce type
74+
and values_are_subset(cast(EnumProperty, first), cast(EnumProperty, second)),
75+
_is_int_enum(first) and _is_int_enum(second)
76+
# cast because MyPy fails to deduce type
77+
and values_are_subset(cast(EnumProperty, first), cast(EnumProperty, second)),
7478
]
7579
)
7680

0 commit comments

Comments
 (0)