Last active
June 30, 2019 03:59
-
-
Save melvinkcx/704d4e9316885e88459508a80e68b248 to your computer and use it in GitHub Desktop.
Snippet for "Why Refactoring? How to Refactor/Restructure Python Package?" https://hackernoon.com/why-refactoring-how-to-restructure-python-package-51b89aa91987
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
in __init__.py | |
This is where backward compatibility code lives. | |
This is to ensure the refactored package supports | |
old way of import. | |
""" | |
from .constants import CONFIG_NAME, LOGGING_LEVEL | |
from .helpers import ConfigHelper as _ConfigHelper | |
@refactored('get_logging_level() is refactored and deprecated.') | |
def get_logging_level(*args, **kwargs): | |
return _ConfigHelper().get_logging_level() | |
@refactored_class('config.ConfigHelper is refactored and deprecated. Please use config.helpers.ConfigHelper') | |
class ConfigHelper(_ConfigHelper): | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment