Restore typing for S3Helper

This commit is contained in:
Mikhail f. Shiryaev 2022-12-02 22:49:26 +01:00
parent 8d9dbda7f2
commit 8d53d558bd
No known key found for this signature in database
GPG Key ID: 4B02ED204C7D93F4

View File

@ -46,7 +46,7 @@ class S3Helper:
self.host = host self.host = host
self.download_host = download_host self.download_host = download_host
def _upload_file_to_s3(self, bucket_name, file_path, s3_path): def _upload_file_to_s3(self, bucket_name: str, file_path: str, s3_path: str) -> str:
logging.debug( logging.debug(
"Start uploading %s to bucket=%s path=%s", file_path, bucket_name, s3_path "Start uploading %s to bucket=%s path=%s", file_path, bucket_name, s3_path
) )
@ -110,7 +110,7 @@ class S3Helper:
url = f"{self.download_host}/{bucket_name}/{s3_path}" url = f"{self.download_host}/{bucket_name}/{s3_path}"
return url.replace("+", "%2B").replace(" ", "%20") return url.replace("+", "%2B").replace(" ", "%20")
def upload_test_report_to_s3(self, file_path, s3_path): def upload_test_report_to_s3(self, file_path: str, s3_path: str) -> str:
if CI: if CI:
return self._upload_file_to_s3(S3_TEST_REPORTS_BUCKET, file_path, s3_path) return self._upload_file_to_s3(S3_TEST_REPORTS_BUCKET, file_path, s3_path)
else: else:
@ -296,7 +296,7 @@ class S3Helper:
return False return False
@staticmethod @staticmethod
def copy_file_to_local(bucket_name, file_path, s3_path): def copy_file_to_local(bucket_name: str, file_path: str, s3_path: str) -> str:
local_path = os.path.abspath( local_path = os.path.abspath(
os.path.join(RUNNER_TEMP, "s3", bucket_name, s3_path) os.path.join(RUNNER_TEMP, "s3", bucket_name, s3_path)
) )