massive refactoring to switch from camelCase to snake_case:

historically, Libervia (SàT before) was using camelCase as allowed by PEP8 when using a
pre-PEP8 code, to use the same coding style as in Twisted.

However, snake_case is more readable and it's better to follow PEP8 best practices, so it
has been decided to move on full snake_case. Because Libervia has a huge codebase, this
ended with a ugly mix of camelCase and snake_case.

To fix that, this patch does a big refactoring by renaming every function and method
(including bridge) that are not coming from Twisted or Wokkel, to use fully snake_case.

This is a massive change, and may result in some bugs.
This commit is contained in:
Goffi 2023-04-08 13:54:42 +02:00
commit 6a6f15707a

View file

@ -34,7 +34,7 @@ from sat.core import exceptions
log = getLogger(__name__)
def fixConfigOption(section, option, value, silent=True):
def fix_config_option(section, option, value, silent=True):
"""Force a configuration option value
the option will be written in the first found user config file, a new user
@ -75,7 +75,7 @@ def fixConfigOption(section, option, value, silent=True):
config_file=target_file))
def parseMainConf(log_filenames=False):
def parse_main_conf(log_filenames=False):
"""Look for main .ini configuration file, and parse it
@param log_filenames(bool): if True, log filenames of read config files
@ -99,7 +99,7 @@ def parseMainConf(log_filenames=False):
return config
def getConfig(config, section, name, default=None):
def config_get(config, section, name, default=None):
"""Get a configuration option
@param config (ConfigParser): the configuration instance
@ -145,7 +145,7 @@ def getConfig(config, section, name, default=None):
return value
def getConf(
def get_conf(
conf: ConfigParser,
prefix: str,
section: str,
@ -168,4 +168,4 @@ def getConf(
"""
# XXX: This is a temporary method until parameters are refactored
value = os.getenv(f"LIBERVIA_{prefix}_{name}".upper())
return value or getConfig(conf, section, f"{prefix}_{name}", default)
return value or config_get(conf, section, f"{prefix}_{name}", default)