mirror of
https://github.com/kennethreitz/pydantic.git
synced 2026-06-05 23:00:18 +00:00
61c8ca2f30
* Re-enable nested model init calls while still allowing self This commit enables nested model `__init__` statements to be executed while still allowing `self` as an argument. Effectively reverses the changes from #632 while still enabling the feature it implemented. In theory, there will still be a collision if someone ever tried to use `pydantic_base_model/settings_init` as an arg, but I don't know how to engineer a case where a collision would *never* happen, I'm not sure there is one. This commit also added a test for both BaseModel` and `BaseSettings` for both the `self`-as-a-parameter and the nested `__init__` features since `BaseSettings` now has the same issue as `BaseModel` since it invoked an `__init__` with self. I have added a comment under the `__init__` for both `BaseModel` and `BaseSetting` since not having `self` as the first arg is such a rarity within Python that it will likely confuse future developers who encounter it. The actual name of the variable referencing the class itself can be up for debate. * Please Lint * Please Black * Update from comments