|
7 | 7 | from ... import schema as oai
|
8 | 8 | from ... import utils
|
9 | 9 | from ..errors import ParseError, PropertyError
|
| 10 | +from .enum_property import EnumProperty |
10 | 11 | from .property import Property
|
11 | 12 | from .schemas import Class, Schemas, parse_reference_path
|
12 | 13 |
|
@@ -49,18 +50,20 @@ def get_imports(self, *, prefix: str) -> Set[str]:
|
49 | 50 |
|
50 | 51 |
|
51 | 52 | def _is_string_enum(prop: Property) -> bool:
|
52 |
| - return prop.__class__.__name__ == "EnumProperty" and prop.value_type == str |
| 53 | + return isinstance(prop, EnumProperty) and prop.value_type == str |
53 | 54 |
|
54 | 55 |
|
55 | 56 | def _is_int_enum(prop: Property) -> bool:
|
56 |
| - return prop.__class__.__name__ == "EnumProperty" and prop.value_type == int |
| 57 | + return isinstance(prop, EnumProperty) and prop.value_type == int |
57 | 58 |
|
58 | 59 |
|
59 | 60 | def _is_subtype(first: Property, second: Property) -> bool:
|
| 61 | + from . import IntProperty, StringProperty |
| 62 | + |
60 | 63 | return any(
|
61 | 64 | [
|
62 |
| - _is_string_enum(first) and second.__class__.__name__ == "StringProperty", |
63 |
| - _is_int_enum(first) and second.__class__.__name__ == "IntProperty", |
| 65 | + _is_string_enum(first) and isinstance(second, StringProperty), |
| 66 | + _is_int_enum(first) and isinstance(second, IntProperty), |
64 | 67 | _is_string_enum(first)
|
65 | 68 | and _is_string_enum(second)
|
66 | 69 | and set(first.values.items()) <= set(second.values.items()),
|
|
0 commit comments