fix: black

This commit is contained in:
egarette@silique.fr 2026-06-21 17:09:52 +02:00
parent 782a4bf7e2
commit ae2e30ebb7

View file

@ -27,7 +27,12 @@ from gettext import gettext as _
# try: # try:
from tiramisu import Config from tiramisu import Config
from tiramisu.error import PropertiesOptionError, LeadershipError, ConfigError, AttributeOptionError from tiramisu.error import (
PropertiesOptionError,
LeadershipError,
ConfigError,
AttributeOptionError,
)
def get_choice_list(config, properties, display): def get_choice_list(config, properties, display):
@ -336,7 +341,9 @@ class TiramisuCmdlineParser(ArgumentParser):
self.fullpath = fullpath self.fullpath = fullpath
self.config = config self.config = config
config_properties = config.property.get() config_properties = config.property.get()
self.config_frozen = "frozen" in config_properties or "everything_frozen" in config_properties self.config_frozen = (
"frozen" in config_properties or "everything_frozen" in config_properties
)
self.root = root self.root = root
self.remove_empty_od = remove_empty_od self.remove_empty_od = remove_empty_od
self.unrestraint = unrestraint self.unrestraint = unrestraint
@ -361,7 +368,9 @@ class TiramisuCmdlineParser(ArgumentParser):
else: else:
subconfig = subconfig.option(self.root) subconfig = subconfig.option(self.root)
self.namespace = TiramisuNamespace(self.config, self.root) self.namespace = TiramisuNamespace(self.config, self.root)
super().__init__(*args, add_help=add_help, exit_on_error=exit_on_error, **kwargs) super().__init__(
*args, add_help=add_help, exit_on_error=exit_on_error, **kwargs
)
self.register("action", "help", _TiramisuHelpAction) self.register("action", "help", _TiramisuHelpAction)
self._config_to_argparser( self._config_to_argparser(
_forhelp, _forhelp,
@ -692,7 +701,11 @@ class TiramisuCmdlineParser(ArgumentParser):
kwargs["type"] = float kwargs["type"] = float
else: else:
pass pass
if not _forhelp and option.type() != "boolean" and "nargs" not in kwargs.kwargs: if (
not _forhelp
and option.type() != "boolean"
and "nargs" not in kwargs.kwargs
):
kwargs["nargs"] = "?" kwargs["nargs"] = "?"
actions.setdefault(kwargs.ga_name, []).append(kwargs) actions.setdefault(kwargs.ga_name, []).append(kwargs)
@ -705,9 +718,11 @@ class TiramisuCmdlineParser(ArgumentParser):
group.add_argument(*args, **kwargs) group.add_argument(*args, **kwargs)
def parse_args(self, *args, valid_mandatory=True, **kwargs): def parse_args(self, *args, valid_mandatory=True, **kwargs):
namespaces, unknown = self.parse_known_args(*args, valid_mandatory=valid_mandatory, **kwargs) namespaces, unknown = self.parse_known_args(
*args, valid_mandatory=valid_mandatory, **kwargs
)
if unknown: if unknown:
msg_unknown = 'unrecognized arguments: %s' % ' '.join(unknown) msg_unknown = "unrecognized arguments: %s" % " ".join(unknown)
if self.exit_on_error: if self.exit_on_error:
self.error(msg_unknown) self.error(msg_unknown)
else: else: