-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Revert "{Core} using threads to build command table for performance" #32694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1134,17 +1134,22 @@ def _load_command_loader(loader, args, name, prefix): | |
| logger.debug("Module '%s' is missing `get_command_loader` entry.", name) | ||
|
|
||
| command_table = {} | ||
| command_loader = None | ||
|
|
||
| if loader_cls: | ||
| command_loader = loader_cls(cli_ctx=loader.cli_ctx) | ||
| loader.loaders.append(command_loader) # This will be used by interactive | ||
| if command_loader.supported_resource_type(): | ||
| command_table = command_loader.load_command_table(args) | ||
| if command_table: | ||
| for cmd in list(command_table.keys()): | ||
| # TODO: If desired to for extension to patch module, this can be uncommented | ||
| # if loader.cmd_to_loader_map.get(cmd): | ||
| # loader.cmd_to_loader_map[cmd].append(command_loader) | ||
| # else: | ||
| loader.cmd_to_loader_map[cmd] = [command_loader] | ||
| else: | ||
| logger.debug("Module '%s' is missing `COMMAND_LOADER_CLS` entry.", name) | ||
|
|
||
| group_table = command_loader.command_group_table if command_loader else {} | ||
| return command_table, group_table, command_loader | ||
| return command_table, command_loader.command_group_table | ||
|
||
|
|
||
|
|
||
| def _load_extension_command_loader(loader, args, ext): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -230,7 +230,7 @@ def load_command_table(self, args): | |
| if command_table: | ||
| module_command_table.update(command_table) | ||
| loader.loaders.append(command_loader) # this will be used later by the load_arguments method | ||
| return module_command_table, command_loader.command_group_table, command_loader | ||
| return module_command_table, command_loader.command_group_table | ||
|
||
|
|
||
| expected_command_index = {'hello': ['azure.cli.command_modules.hello', 'azext_hello2', 'azext_hello1'], | ||
| 'extra': ['azure.cli.command_modules.extra']} | ||
|
|
@@ -432,12 +432,12 @@ def test_command_index_positional_argument(self): | |
| # Test command index is built for command with positional argument | ||
| cmd_tbl = loader.load_command_table(["extra", "extra", "positional_argument"]) | ||
| self.assertDictEqual(INDEX[CommandIndex._COMMAND_INDEX], self.expected_command_index) | ||
| self.assertSetEqual(set(cmd_tbl), {'hello mod-only', 'hello overridden', 'extra final', 'hello ext-only'}) | ||
| self.assertEqual(list(cmd_tbl), ['hello mod-only', 'hello overridden', 'extra final', 'hello ext-only']) | ||
|
||
|
|
||
| # Test command index is used by command with positional argument | ||
| cmd_tbl = loader.load_command_table(["hello", "mod-only", "positional_argument"]) | ||
| self.assertDictEqual(INDEX[CommandIndex._COMMAND_INDEX], self.expected_command_index) | ||
| self.assertSetEqual(set(cmd_tbl), {'hello mod-only', 'hello overridden', 'hello ext-only'}) | ||
| self.assertEqual(list(cmd_tbl), ['hello mod-only', 'hello overridden', 'hello ext-only']) | ||
|
||
|
|
||
| # Test command index is used by command with positional argument | ||
| cmd_tbl = loader.load_command_table(["extra", "final", "positional_argument2"]) | ||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -188,7 +188,7 @@ def load_command_table(self, args): | |
| if command_table: | ||
| module_command_table.update(command_table) | ||
| loader.loaders.append(command_loader) # this will be used later by the load_arguments method | ||
| return module_command_table, command_loader.command_group_table, command_loader | ||
| return module_command_table, command_loader.command_group_table | ||
|
||
|
|
||
| @mock.patch('importlib.import_module', _mock_import_lib) | ||
| @mock.patch('pkgutil.iter_modules', _mock_iter_modules) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammar issue in TODO comment. The phrase "If desired to for extension to patch module" should be corrected to either "If desired for extension to patch module" or "If it's desired to allow extension to patch module".