[cleanup] Misc fixes and cleanup

Closes #3780, Closes #3853, Closes #3850
This commit is contained in:
pukkandan
2022-05-27 04:36:23 +05:30
parent 8246f8402b
commit 8a82af3511
16 changed files with 103 additions and 84 deletions

View File

@@ -9,8 +9,13 @@ from .compat_utils import passthrough_module
# XXX: Implement this the same way as other DeprecationWarnings without circular import
passthrough_module(__name__, '._legacy', callback=lambda attr: warnings.warn(
DeprecationWarning(f'{__name__}.{attr} is deprecated'), stacklevel=2))
try:
passthrough_module(__name__, '._legacy', callback=lambda attr: warnings.warn(
DeprecationWarning(f'{__name__}.{attr} is deprecated'), stacklevel=2))
HAS_LEGACY = True
except ModuleNotFoundError:
# Keep working even without _legacy module
HAS_LEGACY = False
del passthrough_module