From 2c87882a7bacebf523a3df6a76432d0bc47badf8 Mon Sep 17 00:00:00 2001 From: Joel Hockey Date: Tue, 30 Apr 2024 01:33:57 +0000 Subject: [PATCH] Use typing List to work in cros python 3.8 Bug: 337720659 Change-Id: I7953bc95c6e8fb1d9ff794935811464a31d804a4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5499917 Reviewed-by: Alvin Jia Auto-Submit: Joel Hockey Owners-Override: Joel Hockey Commit-Queue: Joel Hockey Commit-Queue: Alvin Jia Reviewed-by: Mike Frysinger --- upload_to_google_storage_first_class.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/upload_to_google_storage_first_class.py b/upload_to_google_storage_first_class.py index 3bcbfd9fd..949a8b806 100755 --- a/upload_to_google_storage_first_class.py +++ b/upload_to_google_storage_first_class.py @@ -16,6 +16,7 @@ import tarfile from download_from_google_storage import Gsutil from download_from_google_storage import GSUTIL_DEFAULT_PATH +from typing import List MISSING_GENERATION_MSG = ( 'missing generation number, please retrieve from Cloud Storage' @@ -47,8 +48,8 @@ find . -name .svn -prune -o -size +1000k -type f -print0 | """ -def get_targets(args: list[str], parser: optparse.OptionParser, - use_null_terminator: bool) -> list[str]: +def get_targets(args: List[str], parser: optparse.OptionParser, + use_null_terminator: bool) -> List[str]: """Get target(s) to upload to GCS""" if not args: parser.error('Missing target.') @@ -63,7 +64,7 @@ def get_targets(args: list[str], parser: optparse.OptionParser, return args -def create_archive(dirs: list[str]) -> str: +def create_archive(dirs: List[str]) -> str: """Given a list of directories, compress them all into one tar file""" # tarfile name cannot have a forward slash or else an error will be # thrown @@ -74,7 +75,7 @@ def create_archive(dirs: list[str]) -> str: return filename -def validate_archive_dirs(dirs: list[str]) -> bool: +def validate_archive_dirs(dirs: List[str]) -> bool: """Validate the list of directories""" for d in dirs: # We don't allow .. in paths in our archives.