Skip to content

Commit 39ace8c

Browse files
Combine statements
1 parent 7459155 commit 39ace8c

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

openapi_python_client/parser/properties/model_property.py

+16-9
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from ... import schema as oai
88
from ... import utils
99
from ..errors import ParseError, PropertyError
10-
from .enum_property import EnumProperty
1110
from .property import Property
1211
from .schemas import Class, Schemas, parse_reference_path
1312

@@ -59,16 +58,24 @@ def _merge_properties(first: Property, second: Property) -> Union[Property, Prop
5958
if first != second:
6059
return PropertyError(header="Cannot merge properties", detail="Properties has conflicting values")
6160
return first
62-
elif first.__class__.__name__ == "StringProperty" and second.__class__ == EnumProperty and second.value_type == str:
61+
elif (
62+
first.__class__.__name__ == "StringProperty"
63+
and second.__class__.__name__ == "EnumProperty"
64+
and second.value_type == str
65+
or first.__class__.__name__ == "IntProperty"
66+
and second.__class__.__name__ == "EnumProperty"
67+
and second.value_type == int
68+
):
6369
second = attr.evolve(second, nullable=nullable, required=required)
6470
return second
65-
elif second.__class__.__name__ == "StringProperty" and first.__class__ == EnumProperty and first.value_type == str:
66-
first = attr.evolve(first, nullable=nullable, required=required)
67-
return first
68-
elif first.__class__.__name__ == "IntProperty" and second.__class__ == EnumProperty and second.value_type == int:
69-
second = attr.evolve(second, nullable=nullable, required=required)
70-
return second
71-
elif second.__class__.__name__ == "IntProperty" and first.__class__ == EnumProperty and first.value_type == int:
71+
elif (
72+
second.__class__.__name__ == "StringProperty"
73+
and first.__class__.__name__ == "EnumProperty"
74+
and first.value_type == str
75+
or second.__class__.__name__ == "IntProperty"
76+
and first.__class__.__name__ == "EnumProperty"
77+
and first.value_type == int
78+
):
7279
first = attr.evolve(first, nullable=nullable, required=required)
7380
return first
7481
else:

0 commit comments

Comments
 (0)