add comment to dicts in _legacy.py

This commit is contained in:
Damien Elmes 2021-10-20 17:44:10 +10:00
parent 54df350cda
commit de301256e8

View File

@ -40,12 +40,14 @@ def _print_warning(old: str, doc: str) -> None:
class DeprecatedNamesMixin: class DeprecatedNamesMixin:
"Expose instance methods/vars as camelCase for legacy callers." "Expose instance methods/vars as camelCase for legacy callers."
# deprecated name -> new name
_deprecated_aliases: dict[str, str] = {}
# deprecated name -> [new internal name, new name shown to user]
_deprecated_attributes: dict[str, tuple[str, str]] = {}
# the @no_type_check lines are required to prevent mypy allowing arbitrary # the @no_type_check lines are required to prevent mypy allowing arbitrary
# attributes on the consuming class # attributes on the consuming class
_deprecated_aliases: dict[str, str] = {}
_deprecated_attributes: dict[str, tuple[str, str]] = {}
@no_type_check @no_type_check
def __getattr__(self, name: str) -> Any: def __getattr__(self, name: str) -> Any:
if some_tuple := self._deprecated_attributes.get(name): if some_tuple := self._deprecated_attributes.get(name):