-
-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use the class name in the __repr__
implementations
#465
Conversation
0e18a54
to
6e226a6
Compare
Thanks @dlax for the PR. I left a comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution. Instead, let's change the implementation of InitSettingsSource.__repr__
to:
def __repr__(self) -> str:
return f'{self.__class__.__name__}(init_kwargs={self.init_kwargs!r})'
Then we will have |
Ah yes, well in this case probably best to keep it as is, but use |
Ah yes, well in this case probably best to keep it as is, but use `self.__class__.__name__` for each `__repr__` implementation to keep the class name and repr in sync
I agree in general; but that's unrelated to this "fix" PR, in which I
instead tried to conform to pre-existing patterns.
|
@dlax Please can you change all the |
__repr__
implementations
Please can you change all the `__repr__` to and use `self.__class__.__name__`?
Done through a separate commit.
|
Previously, the __repr__() method of those settings source classes was inherited from InitSettingsSource's thus returning a misleading 'InitSettingsSource(init_kwargs={})'. We here define a specific __repr__() method implementation for classes using a config file (json, toml, yaml).
Thanks @dlax |
Previously, the
__repr__()
method of those settings source classes was inherited from InitSettingsSource's thus returning a misleading 'InitSettingsSource(init_kwargs={})'. We here define a specific__repr__()
method implementation for classes using a config file (json, toml, yaml).