fix: black
This commit is contained in:
parent
05eaff681b
commit
d21fff4f7e
2 changed files with 23 additions and 13 deletions
|
|
@ -28,10 +28,11 @@ from .i18n import _
|
||||||
from .__version__ import __version__
|
from .__version__ import __version__
|
||||||
|
|
||||||
|
|
||||||
TABULATE = {"console": "heavy_grid",
|
TABULATE = {
|
||||||
|
"console": "heavy_grid",
|
||||||
"html": "unsafehtml",
|
"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]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,4 +76,5 @@ table:
|
||||||
"level": 60,
|
"level": 60,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
__all__ = ("get_rougail_config",)
|
__all__ = ("get_rougail_config",)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue