瀏覽代碼

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 <alvinjia@google.com>
Auto-Submit: Joel Hockey <joelhockey@chromium.org>
Owners-Override: Joel Hockey <joelhockey@chromium.org>
Commit-Queue: Joel Hockey <joelhockey@chromium.org>
Commit-Queue: Alvin Jia <alvinjia@google.com>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Joel Hockey 1 年之前
父節點
當前提交
2c87882a7b
共有 1 個文件被更改,包括 5 次插入4 次删除
  1. 5 4
      upload_to_google_storage_first_class.py

+ 5 - 4
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
 from download_from_google_storage import GSUTIL_DEFAULT_PATH
 from download_from_google_storage import GSUTIL_DEFAULT_PATH
+from typing import List
 
 
 MISSING_GENERATION_MSG = (
 MISSING_GENERATION_MSG = (
     'missing generation number, please retrieve from Cloud Storage'
     '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"""
     """Get target(s) to upload to GCS"""
     if not args:
     if not args:
         parser.error('Missing target.')
         parser.error('Missing target.')
@@ -63,7 +64,7 @@ def get_targets(args: list[str], parser: optparse.OptionParser,
     return args
     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"""
     """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
     # tarfile name cannot have a forward slash or else an error will be
     # thrown
     # thrown
@@ -74,7 +75,7 @@ def create_archive(dirs: list[str]) -> str:
     return filename
     return filename
 
 
 
 
-def validate_archive_dirs(dirs: list[str]) -> bool:
+def validate_archive_dirs(dirs: List[str]) -> bool:
     """Validate the list of directories"""
     """Validate the list of directories"""
     for d in dirs:
     for d in dirs:
         # We don't allow .. in paths in our archives.
         # We don't allow .. in paths in our archives.