style: adopt ruff (format + lint) at 88, replacing black/isort/flake8
Format-only: Python files are AST-identical apart from import order. pre-commit end-of-file/trailing-whitespace fixes applied repo-wide. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4,13 +4,13 @@ import os
|
||||
|
||||
import appdirs
|
||||
|
||||
from ._util import ServiceNotFound, NoCommandSpecified, get_root_asset
|
||||
from . import log
|
||||
from .cfg import Config
|
||||
from .cli import CommandTree
|
||||
|
||||
# Application scaffolding:
|
||||
from ._bootstrap import _bootstrap_logger
|
||||
from ._util import NoCommandSpecified, ServiceNotFound, get_root_asset
|
||||
from .cfg import Config
|
||||
from .cli import CommandTree
|
||||
|
||||
# These two variables affect the directory paths for
|
||||
# config files and logging.
|
||||
@@ -189,5 +189,3 @@ class ApplicationContainer:
|
||||
def usage(self):
|
||||
pass
|
||||
# Applications need a default usage
|
||||
|
||||
|
||||
|
||||
@@ -217,9 +217,9 @@ class Config:
|
||||
try:
|
||||
_bootstrap_logger.info("cfg - Validating config file against spec")
|
||||
val = validate.Validator()
|
||||
assert isinstance(
|
||||
self._config_obj, configobj.ConfigObj
|
||||
), "expecting configobj.ConfigObj, received %s" % type(self._config_obj)
|
||||
assert isinstance(self._config_obj, configobj.ConfigObj), (
|
||||
"expecting configobj.ConfigObj, received %s" % type(self._config_obj)
|
||||
)
|
||||
# NOTE(MG) copy arg below instructs configobj to use defaults from spec file
|
||||
test_results = self._config_obj.validate(
|
||||
val, copy=True, preserve_errors=True
|
||||
|
||||
+10
-11
@@ -3,8 +3,8 @@ import inspect
|
||||
import re
|
||||
import sys
|
||||
|
||||
from ._util import NoCommandSpecified
|
||||
from ._bootstrap import _bootstrap_logger
|
||||
from ._util import NoCommandSpecified
|
||||
|
||||
# If explicit fail is enabled, any command with at least one unknown
|
||||
# argument will be rejected entirely. If not enabled, unknown arguments
|
||||
@@ -233,22 +233,21 @@ class CommandTree:
|
||||
# the CommandTree with no SubMenu (submenu will be disabled
|
||||
# in this case):
|
||||
if self._cmd_tree_is_single_command:
|
||||
assert (
|
||||
self._cmd_tree_is_single_command is True
|
||||
), "corrupt data structure in CommandMenu"
|
||||
assert self._cmd_tree_is_single_command is True, (
|
||||
"corrupt data structure in CommandMenu"
|
||||
)
|
||||
assert self._entries is None, "corrupt data structure in CommandMenu"
|
||||
assert isinstance(
|
||||
self._single_command, CommandEntry
|
||||
), "corrupt data structure in CommandMenu"
|
||||
assert isinstance(self._single_command, CommandEntry), (
|
||||
"corrupt data structure in CommandMenu"
|
||||
)
|
||||
return self._single_command
|
||||
|
||||
# There is at least one submenu we need to go down:
|
||||
else:
|
||||
|
||||
assert self._single_command is None, "corrupt data structure in CommandMenu"
|
||||
assert (
|
||||
self._cmd_tree_is_single_command is False
|
||||
), "corrupt data structure in CommandMenu"
|
||||
assert self._cmd_tree_is_single_command is False, (
|
||||
"corrupt data structure in CommandMenu"
|
||||
)
|
||||
|
||||
# Key or variable name used by argparse to store the submenu options
|
||||
argparse_param = self.submenu_param # e.g.: submenu_root
|
||||
|
||||
Reference in New Issue
Block a user