Skip to content

Commit

Permalink
Update utils/generator.py
Browse files Browse the repository at this point in the history
Co-authored-by: Quentin Pradet <[email protected]>
  • Loading branch information
miguelgrinberg and pquentin authored Sep 11, 2024
1 parent 3eeaacd commit 6d16048
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions utils/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,19 +475,19 @@ def interface_to_python_class(self, interface, interfaces):
raise RuntimeError(f"Type {interface} is not an interface")
k = {"name": interface, "args": []}
while True:
if "inherits" not in type_ or "type" not in type_["inherits"]:
break

for arg in type_["properties"]:
schema.add_attribute(k, arg, for_types_py=True)
if "inherits" in type_ and "type" in type_["inherits"]:
if "parent" not in k:
k["parent"] = type_["inherits"]["type"]["name"]
if type_["inherits"]["type"]["name"] not in interfaces:
interfaces.append(type_["inherits"]["type"]["name"])
type_ = schema.find_type(
type_["inherits"]["type"]["name"],
type_["inherits"]["type"]["namespace"],
)
else:
break
if "parent" not in k:
k["parent"] = type_["inherits"]["type"]["name"]
if type_["inherits"]["type"]["name"] not in interfaces:
interfaces.append(type_["inherits"]["type"]["name"])
type_ = schema.find_type(
type_["inherits"]["type"]["name"],
type_["inherits"]["type"]["namespace"],
)
return k


Expand Down

0 comments on commit 6d16048

Please sign in to comment.