Skip to content

Commit b7ccbed

Browse files
refactor: linting issues
1 parent 3f51c59 commit b7ccbed

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/azure-cli-core/azure/cli/core/__init__.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
import os
1010
import sys
1111
import timeit
12+
import concurrent.futures
1213
from concurrent.futures import ThreadPoolExecutor
13-
from typing import Dict, Any, Optional
1414

1515
from knack.cli import CLI
1616
from knack.commands import CLICommandsLoader
@@ -199,7 +199,7 @@ def _configure_style(self):
199199
format_styled_text.theme = theme
200200

201201

202-
class ModuleLoadResult:
202+
class ModuleLoadResult: # pylint: disable=too-few-public-methods
203203
def __init__(self, module_name, command_table, group_table, elapsed_time, error=None):
204204
self.module_name = module_name
205205
self.command_table = command_table
@@ -266,7 +266,7 @@ def _update_command_table_from_modules(args, command_modules=None):
266266
results = self._load_modules(args, command_modules)
267267

268268
count, cumulative_elapsed_time, cumulative_group_count, cumulative_command_count = \
269-
self._process_results_with_timing(results, command_modules)
269+
self._process_results_with_timing(results)
270270
# Summary line
271271
logger.debug(self.item_format_string,
272272
"Total ({})".format(count), cumulative_elapsed_time,
@@ -551,7 +551,7 @@ def _load_modules(self, args, command_modules):
551551
results = []
552552
with ThreadPoolExecutor(max_workers=MAX_WORKER_THREAD_COUNT) as executor:
553553
future_to_module = {executor.submit(self._load_single_module, mod, args): mod
554-
for mod in command_modules if mod not in BLOCKED_MODS}
554+
for mod in command_modules if mod not in BLOCKED_MODS}
555555

556556
for future in future_to_module:
557557
try:
@@ -562,8 +562,8 @@ def _load_modules(self, args, command_modules):
562562
logger.warning("Module '%s' load timeout after %s seconds", mod, MODULE_LOAD_TIMEOUT_SECONDS)
563563
future.cancel()
564564
results.append(ModuleLoadResult(mod, {}, {}, 0,
565-
Exception(f"Module '{mod}' load timeout")))
566-
except Exception as ex:
565+
Exception(f"Module '{mod}' load timeout")))
566+
except (ImportError, AttributeError, TypeError, ValueError) as ex:
567567
mod = future_to_module[future]
568568
logger.warning("Module '%s' load failed: %s", mod, ex)
569569
results.append(ModuleLoadResult(mod, {}, {}, 0, ex))
@@ -602,9 +602,9 @@ def _process_successful_load(self, result):
602602
self.command_group_table.update(result.group_table)
603603

604604
logger.debug(self.item_format_string, result.module_name, result.elapsed_time,
605-
len(result.group_table), len(result.command_table))
605+
len(result.group_table), len(result.command_table))
606606

607-
def _process_results_with_timing(self, results, command_modules):
607+
def _process_results_with_timing(self, results):
608608
"""Process pre-loaded module results with timing and progress reporting."""
609609
logger.debug("Loading command modules:")
610610
logger.debug(self.header_mod)

0 commit comments

Comments
 (0)