fix: black

This commit is contained in:
egarette@silique.fr 2026-06-21 17:06:52 +02:00
parent 05eaff681b
commit d21fff4f7e
2 changed files with 23 additions and 13 deletions

View file

@ -1,7 +1,7 @@
""" """
Silique (https://www.silique.fr) Silique (https://www.silique.fr)
Copyright (C) 2022-2026 Copyright (C) 2022-2026
This program is free software: you can redistribute it and/or modify it This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by the under the terms of the GNU Lesser General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your Free Software Foundation, either version 3 of the License, or (at your
@ -28,10 +28,11 @@ from .i18n import _
from .__version__ import __version__ from .__version__ import __version__
TABULATE = {"console": "heavy_grid", TABULATE = {
"html": "unsafehtml", "console": "heavy_grid",
} "html": "unsafehtml",
ENTER = {"github": '<br/>'} }
ENTER = {"github": "<br/>"}
class RougailOutputTable: class RougailOutputTable:
@ -75,13 +76,17 @@ class RougailOutputTable:
self.output_format = TABULATE[self.output_format] self.output_format = TABULATE[self.output_format]
self.columns = self.rougailconfig["table.columns"].copy() self.columns = self.rougailconfig["table.columns"].copy()
self.first_column = self.rougailconfig["table.first_column"] self.first_column = self.rougailconfig["table.first_column"]
if self.first_column == 'namespace': if self.first_column == "namespace":
if self.support_namespace: if self.support_namespace:
self.columns.insert(0, 'namespace') self.columns.insert(0, "namespace")
else: else:
self.columns.insert(0, 'description') self.columns.insert(0, "description")
for option in self.config: for option in self.config:
if self.support_namespace and self.first_column == 'namespace' and option.group_type() is groups.namespace: if (
self.support_namespace
and self.first_column == "namespace"
and option.group_type() is groups.namespace
):
namespace = option.description() namespace = option.description()
else: else:
namespace = "" namespace = ""
@ -122,20 +127,24 @@ class RougailOutputTable:
def manage(self, option, namespace): def manage(self, option, namespace):
if option.isoptiondescription(): if option.isoptiondescription():
self.walk(option, namespace) self.walk(option, namespace)
tags = option.information.get('tags', []) tags = option.information.get("tags", [])
if not tags: if not tags:
return return
for col in self.columns: for col in self.columns:
if col in tags: if col in tags:
value = option.value.get() value = option.value.get()
if self.first_column == 'namespace': if self.first_column == "namespace":
key = namespace key = namespace
else: else:
key = option.description() key = option.description()
if isinstance(value, list): if isinstance(value, list):
self.datas.setdefault(key, {}).setdefault(col, []).extend([str(val) for val in value]) self.datas.setdefault(key, {}).setdefault(col, []).extend(
[str(val) for val in value]
)
else: else:
self.datas.setdefault(key, {}).setdefault(col, []).append(str(value)) self.datas.setdefault(key, {}).setdefault(col, []).append(
str(value)
)
self.datas[key][self.first_column] = [key] self.datas[key][self.first_column] = [key]

View file

@ -76,4 +76,5 @@ table:
"level": 60, "level": 60,
} }
__all__ = ("get_rougail_config",) __all__ = ("get_rougail_config",)