diff --git a/.flake8 b/.flake8 index 151418804..4c1b8ea79 100644 --- a/.flake8 +++ b/.flake8 @@ -44,7 +44,6 @@ per-file-ignores = tests/e2e/test_partial_clone.py: IMR241, tests/e2e/test_sync_modes.py: IMR241, tests/e2e/test_workflows.py: IMR241, - tests/test_error.py: IMR241, tests/test_main.py: IMR241, tests/test_subcmds_sync.py: IMR241, extend-ignore = diff --git a/main.py b/main.py index b7accefd5..e0ae8c5cf 100755 --- a/main.py +++ b/main.py @@ -53,7 +53,7 @@ import git_trace2_event_log import manifest_xml import pager import repo_trace -from subcmds import all_commands +import subcmds from subcmds.version import Version import wrapper @@ -181,7 +181,7 @@ global_options.add_option( class _Repo: def __init__(self, repodir): self.repodir = repodir - self.commands = all_commands + self.commands = subcmds.all_commands def _PrintHelp(self, short: bool = False, all_commands: bool = False): """Show --help screen.""" diff --git a/subcmds/help.py b/subcmds/help.py index 2d5c2e4f5..dfdce4eea 100644 --- a/subcmds/help.py +++ b/subcmds/help.py @@ -20,7 +20,7 @@ import color from command import MirrorSafeCommand from command import PagedCommand import error -from subcmds import all_commands +import subcmds import wrapper @@ -46,7 +46,7 @@ Displays detailed usage information about a command. fmt = " %%-%ds %%s" % maxlen for name in commandNames: - command = all_commands[name]() + command = subcmds.all_commands[name]() try: summary = command.helpSummary.strip() except AttributeError: @@ -59,7 +59,7 @@ Displays detailed usage information about a command. def PrintAllCommandsBody(self): print("The complete list of recognized repo commands is:") - commandNames = sorted(all_commands) + commandNames = sorted(subcmds.all_commands) self._PrintCommands(commandNames) print( "See 'repo help ' for more information on a " @@ -75,7 +75,7 @@ Displays detailed usage information about a command. print("The most commonly used repo commands are:") commandNames = sorted( - name for name, command in all_commands.items() if command.COMMON + name for name, cmd in subcmds.all_commands.items() if cmd.COMMON ) self._PrintCommands(commandNames) @@ -146,8 +146,8 @@ Displays detailed usage information about a command. out._PrintSection("Description", "helpDescription") def _PrintAllCommandHelp(self): - for name in sorted(all_commands): - cmd = all_commands[name](manifest=self.manifest) + for name in sorted(subcmds.all_commands): + cmd = subcmds.all_commands[name](manifest=self.manifest) self._PrintCommandHelp(cmd, header_prefix=f"[{name}] ") def _Options(self, p): @@ -178,7 +178,7 @@ Displays detailed usage information about a command. name = args[0] try: - cmd = all_commands[name](manifest=self.manifest) + cmd = subcmds.all_commands[name](manifest=self.manifest) except KeyError: print( "repo: '%s' is not a repo command." % name, file=sys.stderr diff --git a/tests/test_error.py b/tests/test_error.py index 3eb82835e..b683b1417 100644 --- a/tests/test_error.py +++ b/tests/test_error.py @@ -25,10 +25,10 @@ import error import fetch import git_command import project -from subcmds import all_modules +import subcmds -_IMPORTS = all_modules + [ +_IMPORTS = subcmds.all_modules + [ error, project, git_command,