From c375f948d07d871405286574fc25df76fd0deffe Mon Sep 17 00:00:00 2001 From: "Mikhail f. Shiryaev" Date: Wed, 10 May 2023 22:56:13 +0200 Subject: [PATCH] Fix typing in S3Helper.fast_parallel_upload_dir --- tests/ci/s3_helper.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/ci/s3_helper.py b/tests/ci/s3_helper.py index 0b182ecb09e..9ee0a431294 100644 --- a/tests/ci/s3_helper.py +++ b/tests/ci/s3_helper.py @@ -6,6 +6,8 @@ import re import shutil import time from multiprocessing.dummy import Pool +from pathlib import Path +from typing import List, Union import boto3 # type: ignore import botocore # type: ignore @@ -128,7 +130,9 @@ class S3Helper: else: return S3Helper.copy_file_to_local(S3_BUILDS_BUCKET, file_path, s3_path) - def fast_parallel_upload_dir(self, dir_path, s3_dir_path, bucket_name): + def fast_parallel_upload_dir( + self, dir_path: Union[str, Path], s3_dir_path: str, bucket_name: str + ) -> List[str]: all_files = [] for root, _, files in os.walk(dir_path): @@ -141,12 +145,12 @@ class S3Helper: t = time.time() sum_time = 0 - def upload_task(file_path): + def upload_task(file_path: str) -> str: nonlocal counter nonlocal t nonlocal sum_time try: - s3_path = file_path.replace(dir_path, s3_dir_path) + s3_path = file_path.replace(str(dir_path), s3_dir_path) metadata = {} if s3_path.endswith("html"): metadata["ContentType"] = "text/html; charset=utf-8"