All models in models.py have the same code:
def __init__(self, **kwargs): # type: (Any) -> None super(Directory, self).__init__(**kwargs) for key, default in Directory._valid_properties.items(): key = key.replace("-", "_") setattr(self, key, kwargs.get(key, default))
Here, this is the constructor of the Directory class.
That code can be moved to the parent class, Model, using the type(self) "trick":
for key, default in type(self)_valid_properties.items(): key = key.replace("-", "_") setattr(self, key, kwargs.get(key, default))