From 5f9c79664f772fcdba162ab953df1339f1b3918c Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Fri, 1 Nov 2024 09:45:54 +0100 Subject: [PATCH] fix: black --- src/rougail/annotator/variable.py | 6 +++++- src/rougail/config.py | 6 ++++-- src/rougail/convert.py | 14 +++++++++----- src/rougail/i18n.py | 2 +- src/rougail/structural_commandline/annotator.py | 10 ++++++---- src/rougail/utils.py | 6 +++--- 6 files changed, 28 insertions(+), 16 deletions(-) diff --git a/src/rougail/annotator/variable.py b/src/rougail/annotator/variable.py index c95982dd4..0568b17d1 100644 --- a/src/rougail/annotator/variable.py +++ b/src/rougail/annotator/variable.py @@ -259,5 +259,9 @@ class Annotator(Walk): # pylint: disable=R0903 if value not in choices: msg = _( 'the variable "{0}" has an unvalid default value "{1}" should be in {2}' - ).format(variable.path, value, display_list(choices, separator="or", add_quote=True)) + ).format( + variable.path, + value, + display_list(choices, separator="or", add_quote=True), + ) raise DictConsistencyError(msg, 26, variable.xmlfiles) diff --git a/src/rougail/config.py b/src/rougail/config.py index ed2091503..e7cd3e10c 100644 --- a/src/rougail/config.py +++ b/src/rougail/config.py @@ -403,7 +403,7 @@ suffix: disabled: variable: upgrade""" for process in processes: - if processes[process] or process == 'output': + if processes[process] or process == "output": objects = processes[process] rougail_process += """ {NAME}: @@ -435,7 +435,9 @@ suffix: rougail_process += """ {% if _.output == 'NAME' %} Cannot load user data for NAME output {% endif %} -""".replace("NAME", hidden_output) +""".replace( + "NAME", hidden_output + ) elif objects: rougail_process += " default: {DEFAULT}".format( DEFAULT=objects[0]["name"] diff --git a/src/rougail/convert.py b/src/rougail/convert.py index d924e881e..aae1a88a2 100644 --- a/src/rougail/convert.py +++ b/src/rougail/convert.py @@ -467,11 +467,15 @@ class ParserVariable: extra_keys = set(obj) - self.variable_attrs if not extra_keys: for key, value in obj.items(): - if isinstance(value, dict) and key != 'params' and not self.is_calculation( - key, - value, - self.variable_calculations, - False, + if ( + isinstance(value, dict) + and key != "params" + and not self.is_calculation( + key, + value, + self.variable_calculations, + False, + ) ): break else: diff --git a/src/rougail/i18n.py b/src/rougail/i18n.py index f94076230..38f2fb6f1 100644 --- a/src/rougail/i18n.py +++ b/src/rougail/i18n.py @@ -27,6 +27,6 @@ along with this program. If not, see . from gettext import translation from pathlib import Path -t = translation('rougail', str(Path(__file__).parent / 'locale'), fallback=True) +t = translation("rougail", str(Path(__file__).parent / "locale"), fallback=True) _ = t.gettext diff --git a/src/rougail/structural_commandline/annotator.py b/src/rougail/structural_commandline/annotator.py index 4cda66c83..e3e9cab91 100644 --- a/src/rougail/structural_commandline/annotator.py +++ b/src/rougail/structural_commandline/annotator.py @@ -64,12 +64,14 @@ class Annotator(Walk): for letter in alternative_name: all_letters += letter if all_letters == "h": - msg = _('alternative_name "{0}" conflict with "--help"').format(alternative_name) + msg = _('alternative_name "{0}" conflict with "--help"').format( + alternative_name + ) raise DictConsistencyError(msg, 202, variable.xmlfiles) if all_letters in self.alternative_names: - msg = _( - 'conflict alternative_name "{0}": "{1}" and "{2}"' - ).format(alternative_name, variable_path, self.alternative_names[all_letters]) + msg = _('conflict alternative_name "{0}": "{1}" and "{2}"').format( + alternative_name, variable_path, self.alternative_names[all_letters] + ) raise DictConsistencyError(msg, 202, variable.xmlfiles) self.alternative_names[alternative_name] = variable_path diff --git a/src/rougail/utils.py b/src/rougail/utils.py index e87ec7686..ba242c3cc 100644 --- a/src/rougail/utils.py +++ b/src/rougail/utils.py @@ -114,9 +114,9 @@ def get_jinja_variable_to_param( for g in parsed_content.find_all(Getattr): variables.add(recurse_getattr(g)) except TemplateSyntaxError as err: - msg = _( - 'error in jinja "{0}" for the variable "{1}": {2}' - ).format(jinja_text, current_path, err) + msg = _('error in jinja "{0}" for the variable "{1}": {2}').format( + jinja_text, current_path, err + ) raise DictConsistencyError(msg, 39, xmlfiles) from err variables = list(variables) variables.sort(reverse=True)