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 mixins.py | |
""" | |
class LoggingConfigMixin: | |
def is_logging_enabled(): | |
pass | |
def get_logging_level(): | |
pass |
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 abstracts.py | |
""" | |
from abc import ABCMeta | |
class AbstractBaseConfigHelper: | |
__metaclass__ = ABCMeta | |
def get(self, config_name): | |
pass |
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
""" | |
Package: utils.config.constants | |
after removing duplicates | |
""" | |
class ConfigHelper: | |
def get(self, config_name, default=None): | |
pass | |
def set(self, config_name, value): | |
pass | |
def _get_settings_helper(self): |
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
""" | |
Package: utils.config.helpers | |
after restructuring | |
""" | |
def get_logging_level(): | |
# This is duplicate, removing this | |
pass | |
class ConfigHelper: | |
def get(self, config_name, default=None): | |
pass |
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
""" | |
Package: utils.config.constants | |
after restructuring | |
""" | |
# Inconsistent programming construct | |
CONFIG_NAME = { | |
"ENABLE_LOGGING": "enable_logging", | |
"LOGGING_LEVEL": "logging_level", | |
} |
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
""" | |
Package: utils.config | |
before restructuring | |
""" | |
# This looks like belongs to utils.config.constants | |
CONFIG_NAME = { | |
"ENABLE_LOGGING": "enable_logging", | |
"LOGGING_LEVEL": "logging_level", | |
} |
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 tests.py | |
Simple backward compatibility test case | |
""" | |
class ConfigHelperCompatibilityTestCase(unittest.TestCase): | |
def test_backward_compatibility(self): | |
try: | |
from .config import CONFIG_NAME, LOGGING_LEVEL | |
from .config import get_logging_level | |
from .config import ConfigHelper |
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. | |
This is incomplete, we will revisit __init__.py later | |
""" | |
CONFIG_NAME = {} | |
def get_logging_level(*args, **kwargs): | |
pass |
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
""" | |
Package: utils.config | |
before restructuring | |
""" | |
CONFIG_NAME = { | |
"ENABLE_LOGGING": "enable_logging", | |
"LOGGING_LEVEL": "logging_level", | |
} | |
def get_logging_level(): | |
pass |
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
""" | |
Package: utils.tests | |
Faulty Test Cases | |
""" | |
import unittest | |
class UtilsTestCase(unittest.TestCase): | |
def setUp(self): |