Skip to content

Instantly share code, notes, and snippets.

@melvinkcx
Last active June 30, 2019 04:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save melvinkcx/c7a84f573382edaeb21abfd94d437948 to your computer and use it in GitHub Desktop.
Save melvinkcx/c7a84f573382edaeb21abfd94d437948 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
"""
Package: utils.config
before restructuring
"""
# This looks like belongs to utils.config.constants
CONFIG_NAME = {
"ENABLE_LOGGING": "enable_logging",
"LOGGING_LEVEL": "logging_level",
}
# This looks like a helper function, goes to utils.config.helpers
def get_logging_level():
# This looks like a duplicate method
pass
# This looks like a helper class, goes to utils.config.helpers
class ConfigHelper:
def get(self, config_name, default=None):
pass
def set(self, config_name, value):
pass
def _get_settings_helper(self):
pass
def get_logging_level():
# This looks like a duplicate method
pass
def is_logging_enabled():
pass
# This looks like another constant, goes to utils.config.constants
class LOGGING_LEVEL:
VERBOSE = "verbose"
STANDARD = "standard"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment