@@ -122,7 +122,7 @@ def download_with_wget(remote_file, local_file):
122
122
return result .returncode == 0 , result .stdout .decode ().rstrip ()
123
123
124
124
125
- def download_lines_with_urllib (url ) -> t . Tuple [bool , t . List [str ]]:
125
+ def download_lines_with_urllib (url ) -> tuple [bool , list [str ]]:
126
126
"""Get (success, text lines of a file) over HTTP."""
127
127
try :
128
128
return (True , [
@@ -138,7 +138,7 @@ def verify_with_gpg(
138
138
filename ,
139
139
signature_filename ,
140
140
output_filename : t .Optional [str ] = None
141
- ) -> t . Tuple [int , str ]:
141
+ ) -> tuple [int , str ]:
142
142
with tempfile .NamedTemporaryFile () as status_file :
143
143
args = [
144
144
'gpg' , '--yes' , '--verify' , '--verify-options' , 'show-primary-uid-only' , "--status-file" , status_file .name ,
@@ -177,12 +177,12 @@ def __repr__(self):
177
177
178
178
179
179
def parse_gpg_result (
180
- output : t . List [str ]
181
- ) -> t . Tuple [ t . List [SigData ], t . List [SigData ], t . List [SigData ]]:
180
+ output : list [str ]
181
+ ) -> tuple [ list [SigData ], list [SigData ], list [SigData ]]:
182
182
"""Returns good, unknown, and bad signatures from GPG stdout."""
183
- good_sigs : t . List [SigData ] = []
184
- unknown_sigs : t . List [SigData ] = []
185
- bad_sigs : t . List [SigData ] = []
183
+ good_sigs : list [SigData ] = []
184
+ unknown_sigs : list [SigData ] = []
185
+ bad_sigs : list [SigData ] = []
186
186
total_resolved_sigs = 0
187
187
188
188
# Ensure that all lines we match on include a prefix that prevents malicious input
@@ -265,7 +265,7 @@ def files_are_equal(filename1, filename2):
265
265
266
266
267
267
def get_files_from_hosts_and_compare (
268
- hosts : t . List [str ], path : str , filename : str , require_all : bool = False
268
+ hosts : list [str ], path : str , filename : str , require_all : bool = False
269
269
) -> ReturnCode :
270
270
"""
271
271
Retrieve the same file from a number of hosts and ensure they have the same contents.
@@ -326,7 +326,7 @@ def join_url(host: str) -> str:
326
326
return ReturnCode .SUCCESS
327
327
328
328
329
- def check_multisig (sums_file : str , sigfilename : str , args : argparse .Namespace ) -> t . Tuple [int , str , t . List [SigData ], t . List [SigData ], t . List [SigData ]]:
329
+ def check_multisig (sums_file : str , sigfilename : str , args : argparse .Namespace ) -> tuple [int , str , list [SigData ], list [SigData ], list [SigData ]]:
330
330
# check signature
331
331
#
332
332
# We don't write output to a file because this command will almost certainly
@@ -365,8 +365,8 @@ def prompt_yn(prompt) -> bool:
365
365
366
366
def verify_shasums_signature (
367
367
signature_file_path : str , sums_file_path : str , args : argparse .Namespace
368
- ) -> t . Tuple [
369
- ReturnCode , t . List [SigData ], t . List [SigData ], t . List [SigData ], t . List [SigData ]
368
+ ) -> tuple [
369
+ ReturnCode , list [SigData ], list [SigData ], list [SigData ], list [SigData ]
370
370
]:
371
371
min_good_sigs = args .min_good_sigs
372
372
gpg_allowed_codes = [0 , 2 ] # 2 is returned when untrusted signatures are present.
@@ -429,14 +429,14 @@ def verify_shasums_signature(
429
429
return (ReturnCode .SUCCESS , good_trusted , good_untrusted , unknown , bad )
430
430
431
431
432
- def parse_sums_file (sums_file_path : str , filename_filter : t . List [str ]) -> t . List [ t . List [str ]]:
432
+ def parse_sums_file (sums_file_path : str , filename_filter : list [str ]) -> list [ list [str ]]:
433
433
# extract hashes/filenames of binaries to verify from hash file;
434
434
# each line has the following format: "<hash> <binary_filename>"
435
435
with open (sums_file_path , 'r' , encoding = 'utf8' ) as hash_file :
436
436
return [line .split ()[:2 ] for line in hash_file if len (filename_filter ) == 0 or any (f in line for f in filename_filter )]
437
437
438
438
439
- def verify_binary_hashes (hashes_to_verify : t . List [ t . List [str ]]) -> t . Tuple [ReturnCode , t . Dict [str , str ]]:
439
+ def verify_binary_hashes (hashes_to_verify : list [ list [str ]]) -> tuple [ReturnCode , dict [str , str ]]:
440
440
offending_files = []
441
441
files_to_hashes = {}
442
442
0 commit comments