2727import urllib .request
2828import urllib .parse
2929import zipfile
30-
31-
30+ import typing
3231#
3332# Initial setup
3433#
@@ -288,7 +287,7 @@ def console_tee(text, skip_logging=False):
288287@dataclasses .dataclass
289288class Requirement :
290289 key : str
291- cmd : tuple [str , ...]
290+ cmd : tuple [typing . Union [ str , pathlib . Path ] , ...]
292291 fail_msg : tuple [str , ...]
293292
294293 def check_availability (self , action , args ):
@@ -316,9 +315,9 @@ class CommandFailed(Exception):
316315
317316 def __init__ (
318317 self ,
319- idx : int | None = None ,
320- cmd : str | None = None ,
321- ret_code : int | None = None ,
318+ idx : typing . Union [ int , None ] = None ,
319+ cmd : typing . Union [ str , None ] = None ,
320+ ret_code : typing . Union [ int , None ] = None ,
322321 ):
323322 if any ((idx , cmd , ret_code )) and not all ((idx , cmd )):
324323 raise ValueError (f"{ self .__class__ .__name__ } requires 'idx' and 'cmd' to be set unless all args are None." )
@@ -344,7 +343,7 @@ def __init__(self, action, args):
344343 self .action = action
345344 self .args = args
346345
347- def _hash_value (self , value : bytes | str , digest_size : int = 8 ) -> str :
346+ def _hash_value (self , value : typing . Union [ bytes , str ] , digest_size : int = 8 ) -> str :
348347 if isinstance (value , str ):
349348 value = value .encode ()
350349 return hashlib .blake2b (value , salt = self .get_instance_id ().encode (), digest_size = digest_size ).hexdigest ()
@@ -527,7 +526,7 @@ def configure_logging(self, debug=False):
527526
528527 def _get_failed_cmd_log_file_path (
529528 self , exception : Exception
530- ) -> tuple [CommandFailed , pathlib .Path ] | tuple [None , None ]:
529+ ) -> typing . Union [ tuple [CommandFailed , pathlib .Path ], tuple [None , None ] ]:
531530 while exception :
532531 if isinstance (exception , CommandFailed ):
533532 break
@@ -2439,7 +2438,7 @@ def run_installer(args):
24392438 "Disable sending analytics data" ,
24402439 key = "send_analytics_data" ,
24412440 value = "--no-analytics" ,
2442- msg = "Sending analytcs data has been disabled for this session." ,
2441+ msg = "Sending analytics data has been disabled for this session." ,
24432442 )
24442443 cfg_menu .add_option (
24452444 "Enable sending analytics data" ,
0 commit comments