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)
Copyright (C) 2022-2026
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
Free Software Foundation, either version 3 of the License, or (at your
@ -28,10 +28,11 @@ from .i18n import _
from .__version__ import __version__
TABULATE = {"console": "heavy_grid",
"html": "unsafehtml",
}
ENTER = {"github": '<br/>'}
TABULATE = {
"console": "heavy_grid",
"html": "unsafehtml",
}
ENTER = {"github": "<br/>"}
class RougailOutputTable:
@ -75,13 +76,17 @@ class RougailOutputTable:
self.output_format = TABULATE[self.output_format]
self.columns = self.rougailconfig["table.columns"].copy()
self.first_column = self.rougailconfig["table.first_column"]
if self.first_column == 'namespace':
if self.first_column == "namespace":
if self.support_namespace:
self.columns.insert(0, 'namespace')
self.columns.insert(0, "namespace")
else:
self.columns.insert(0, 'description')
self.columns.insert(0, "description")
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()
else:
namespace = ""
@ -122,20 +127,24 @@ class RougailOutputTable:
def manage(self, option, namespace):
if option.isoptiondescription():
self.walk(option, namespace)
tags = option.information.get('tags', [])
tags = option.information.get("tags", [])
if not tags:
return
for col in self.columns:
if col in tags:
value = option.value.get()
if self.first_column == 'namespace':
if self.first_column == "namespace":
key = namespace
else:
key = option.description()
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:
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]

View file

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