Skip to content

Consider removing deprecated config api #125

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

Closed
ferrine opened this issue Dec 13, 2022 · 0 comments · Fixed by #111
Closed

Consider removing deprecated config api #125

ferrine opened this issue Dec 13, 2022 · 0 comments · Fixed by #111

Comments

@ferrine
Copy link
Member

ferrine commented Dec 13, 2022

THe deprecation was introduced by @michaelosthege

class _SectionRedirect:
"""Functions as a mock property on the PyTensorConfigParser.
It redirects attribute access (to config subsectinos) to the
new config variable properties that use "__" in their name.
"""
def __init__(self, root, section_name):
self._root = root
self._section_name = section_name
super().__init__()
def __getattr__(self, attr):
warnings.warn(
f"Accessing section '{attr}' through old .-based API. "
f"This will be removed. Use 'config.{self._section_name}__{attr}' instead.",
DeprecationWarning,
)
return getattr(self._root, f"{self._section_name}__{attr}")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant