diff --git a/scripts/wk/hw/smart.py b/scripts/wk/hw/smart.py index 11163f9b..79e95df7 100644 --- a/scripts/wk/hw/smart.py +++ b/scripts/wk/hw/smart.py @@ -237,7 +237,10 @@ def get_smart_self_test_last_result(dev) -> str: result = 'Unknown' # Parse SMART data - data = dev.raw_smartctl.get('ata_smart_self_test_log', {}).get('standard', {}).get('table', []) + data = dev.raw_smartctl.get( + 'ata_smart_self_test_log', {}).get( + 'standard', {}).get( + 'table', []) if not data: # No results found return result diff --git a/scripts/wk/std.py b/scripts/wk/std.py index cea6b2e1..85ae3f93 100644 --- a/scripts/wk/std.py +++ b/scripts/wk/std.py @@ -6,6 +6,8 @@ import platform import re import time +from typing import Union + # STATIC VARIABLES LOG = logging.getLogger(__name__) @@ -73,7 +75,7 @@ def bytes_to_string(size, decimals=0, use_binary=True): return size_str -def sleep(seconds=2): +def sleep(seconds: Union[int, float] = 2) -> None: """Simple wrapper for time.sleep.""" time.sleep(seconds) diff --git a/scripts/wk/ui/cli.py b/scripts/wk/ui/cli.py index 3fb7c173..c2f19292 100644 --- a/scripts/wk/ui/cli.py +++ b/scripts/wk/ui/cli.py @@ -12,6 +12,7 @@ import traceback from collections import OrderedDict from prompt_toolkit import prompt from prompt_toolkit.validation import Validator, ValidationError +from typing import Tuple try: from functools import cache @@ -234,10 +235,10 @@ class Menu(): # Done return valid_answers - def _resolve_selection(self, selection): + def _resolve_selection(self, selection) -> Tuple[str, dict]: """Get menu item based on user selection, returns tuple.""" offset = 1 - resolved_selection = None + resolved_selection = tuple() if selection.isnumeric(): # Enumerate over numbered entries entries = [ @@ -367,7 +368,7 @@ class Menu(): details['Selected'] = details.get('Selected', False) self.toggles[name] = details - def advanced_select(self, prompt_msg='Please make a selection: '): + def advanced_select(self, prompt_msg='Please make a selection: ') -> Tuple[str, dict]: """Display menu and make multiple selections, returns tuple. NOTE: Menu is displayed until an action entry is selected. @@ -414,7 +415,8 @@ class Menu(): # Done return selected_entry - def simple_select(self, prompt_msg='Please make a selection: ', update=True): + def simple_select( + self, prompt_msg='Please make a selection: ', update=True) -> Tuple[str, dict]: """Display menu and make a single selection, returns tuple.""" if update: self._update()