Mercurial > libervia-backend
diff libervia/backend/tools/config.py @ 4270:0d7bb4df2343
Reformatted code base using black.
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 19 Jun 2024 18:44:57 +0200 |
parents | 4b842c1fb686 |
children |
line wrap: on
line diff
--- a/libervia/backend/tools/config.py Tue Jun 18 12:06:45 2024 +0200 +++ b/libervia/backend/tools/config.py Wed Jun 19 18:44:57 2024 +0200 @@ -70,9 +70,12 @@ if not silent: if option in ("passphrase",): # list here the options storing a password value = "******" - log.warning(_("Config auto-update: {option} set to {value} in the file " - "{config_file}.").format(option=option, value=value, - config_file=target_file)) + log.warning( + _( + "Config auto-update: {option} set to {value} in the file " + "{config_file}." + ).format(option=option, value=value, config_file=target_file) + ) def parse_main_conf(log_filenames=False): @@ -90,11 +93,11 @@ if filenames: log.info( _("Configuration was read from: {filenames}").format( - filenames=', '.join(filenames))) + filenames=", ".join(filenames) + ) + ) else: - log.warning( - _("No configuration file found, using default settings") - ) + log.warning(_("No configuration file found, using default settings")) return config @@ -125,9 +128,9 @@ value = os.path.expanduser(value) # thx to Brian (http://stackoverflow.com/questions/186857/splitting-a-semicolon-separated-string-to-a-dictionary-in-python/186873#186873) elif name.endswith("_list"): - value = next(csv.reader( - [value], delimiter=",", quotechar='"', skipinitialspace=True - )) + value = next( + csv.reader([value], delimiter=",", quotechar='"', skipinitialspace=True) + ) elif name.endswith("_dict"): try: value = json.loads(value) @@ -146,11 +149,7 @@ def get_conf( - conf: ConfigParser, - prefix: str, - section: str, - name: str, - default: Any + conf: ConfigParser, prefix: str, section: str, name: str, default: Any ) -> Any: """Get configuration value from environment or config file