From 871a0932f53b2b46c28cfd03ac72247d3ffaf55853eec2572bc3c9c29411af6a Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Fri, 10 Jul 2026 18:51:26 +0200 Subject: [PATCH] fix: black --- src/rougail/output_environment/__init__.py | 1 - src/rougail/output_environment/config.py | 15 +++++--- src/rougail/output_environment/export.py | 43 +++++++++++++++++----- 3 files changed, 42 insertions(+), 17 deletions(-) diff --git a/src/rougail/output_environment/__init__.py b/src/rougail/output_environment/__init__.py index b036e2c..04012c6 100644 --- a/src/rougail/output_environment/__init__.py +++ b/src/rougail/output_environment/__init__.py @@ -24,4 +24,3 @@ RougailOutput = RougailOutputEnvironment __all__ = ("RougailOutputEnvironment", "__version__") - diff --git a/src/rougail/output_environment/config.py b/src/rougail/output_environment/config.py index fe52a4d..ec02c35 100644 --- a/src/rougail/output_environment/config.py +++ b/src/rougail/output_environment/config.py @@ -16,7 +16,6 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . """ - from .i18n import _ @@ -24,7 +23,8 @@ def get_rougail_config( *, backward_compatibility=True, ) -> dict: - options = [f""" + options = [ + f""" environment: exists: true redefine: true @@ -36,7 +36,8 @@ environment: return_type: boolean description: >- {_('if environment is not in "step.output" and not in "step.user_data"')} -""", f""" +""", + f""" environment: exists: false type: family @@ -51,7 +52,8 @@ environment: variable: step.output when_not: environment propertyerror: false -""", f""" +""", + f""" environment: output: @@ -117,8 +119,9 @@ environment: {{% endif %}} description: >- {_('if "_.multi_in_array" the value is ";" otherwise the value is ","')} -"""] - +""", + ] + return { "name": "environment", "process": "output", diff --git a/src/rougail/output_environment/export.py b/src/rougail/output_environment/export.py index a4d9682..e11dab1 100644 --- a/src/rougail/output_environment/export.py +++ b/src/rougail/output_environment/export.py @@ -67,15 +67,23 @@ class RougailOutputEnvironment: else: self.booleans = {True: 1, False: 0} self.upper = self.rougailconfig["environment.output.upper"] - self.path_is_variable_name = self.rougailconfig["environment.output.path_is_variable_name"] + self.path_is_variable_name = self.rougailconfig[ + "environment.output.path_is_variable_name" + ] if self.path_is_variable_name: - self.custom_separator = self.rougailconfig["environment.output.custom_separator"] + self.custom_separator = self.rougailconfig[ + "environment.output.custom_separator" + ] else: self.custom_separator = None self.multi_in_array = self.rougailconfig["environment.output.multi_in_array"] if not self.multi_in_array: - self.multi_separator = self.rougailconfig["environment.output.multi_separator"] - self.submulti_separator = self.rougailconfig["environment.output.submulti_separator"] + self.multi_separator = self.rougailconfig[ + "environment.output.multi_separator" + ] + self.submulti_separator = self.rougailconfig[ + "environment.output.submulti_separator" + ] ret = self.exporter() if isinstance(self.dico, str): value = self.dico @@ -157,8 +165,10 @@ class RougailOutputEnvironment: def set_value(self, name, values): if name in self.dico: - raise ExtensionError(_('The variable name "{0}" is duplicated').format(name)) - self.dico[name] = f'{name}={self.conv_values(name, values)}' + raise ExtensionError( + _('The variable name "{0}" is duplicated').format(name) + ) + self.dico[name] = f"{name}={self.conv_values(name, values)}" def conv_values(self, name, values): if isinstance(values, list): @@ -175,12 +185,20 @@ class RougailOutputEnvironment: for value in values: value = self.conv_to_string(value) if self.submulti_separator in value: - raise ExtensionError(_('the character "{0}" is a sub multi separator, this character must not in the "{1}" value').format(self.submulti_separator, name)) + raise ExtensionError( + _( + 'the character "{0}" is a sub multi separator, this character must not in the "{1}" value' + ).format(self.submulti_separator, name) + ) new_values.append(value) values = self.submulti_separator.join(new_values) values = self.conv_to_string(values) if not self.multi_in_array and self.multi_separator in values: - raise ExtensionError(_('the character "{0}" is a multi separator, this character must not in the "{1}" value').format(self.multi_separator, name)) + raise ExtensionError( + _( + 'the character "{0}" is a multi separator, this character must not in the "{1}" value' + ).format(self.multi_separator, name) + ) return quote(values) def conv_to_string(self, values): @@ -207,10 +225,15 @@ class RougailOutputEnvironment: if not follower_name: follower_name = self.get_name(follower) followers_name[follower_path] = follower_name - followers_data.setdefault(follower_name, {})[follower.index()] = follower.value.get() + followers_data.setdefault(follower_name, {})[ + follower.index() + ] = follower.value.get() leader_len = len(leader_values) for name, values in followers_data.items(): - self.set_value(name, [values[idx] if idx in values else "" for idx in range(leader_len)]) + self.set_value( + name, + [values[idx] if idx in values else "" for idx in range(leader_len)], + ) RougailOutput = RougailOutputEnvironment