@@ -53,32 +53,33 @@ def upload_files_to_s3(local_dir: str, bucket_name: str, s3_prefix: str):
5353 :param s3_prefix: Префикс (путь внутри бакета)
5454 """
5555 for root , _ , files in os .walk (local_dir ):
56- for file in files :
57- if file .endswith (".zip" ):
58- local_path = os .path .join (root , file )
59- s3_path = s3_prefix + file
56+ for filename in files :
57+ if filename .endswith (".zip" ):
58+ local_path = os .path .join (root , filename )
59+ s3_path = s3_prefix + filename
6060
6161 if file_exists_in_s3 (bucket_name , s3_path ):
6262 print (
63- f"Файл { file } уже загружен на s3://{ bucket_name } /{ s3_path } . "
63+ f"Файл { filename } уже загружен на s3://{ bucket_name } /{ s3_path } . "
6464 f"Пропускаем загрузку."
6565 )
6666 else :
6767 s3 .upload_file (local_path , bucket_name , s3_path )
68- print (f"Uploaded { file } to s3://{ bucket_name } /{ s3_path } " )
68+ print (f"Uploaded { filename } to s3://{ bucket_name } /{ s3_path } " )
6969
7070
7171def upload_file_on_s3 (file_path : str , bucket_name : str , s3_prefix : str = "cvat/input/" ):
72- file_name = os .path .basename (file_path )
73- s3_path = s3_prefix + file_name
72+ filename = os .path .basename (file_path )
73+ s3_path = s3_prefix + filename
7474
7575 if file_exists_in_s3 (bucket_name , s3_path ):
7676 print (
77- f"File { file_name } already exists in s3://{ bucket_name } /{ s3_path } . Skipping upload."
77+ f"Файл { filename } уже загружен на s3://{ bucket_name } /{ s3_path } . "
78+ f"Пропускаем загрузку."
7879 )
7980 else :
8081 s3 .upload_file (file_path , bucket_name , s3_path )
81- print (f"Uploaded { file_name } to s3://{ bucket_name } /{ s3_path } " )
82+ print (f"{ filename } загружен на s3://{ bucket_name } /{ s3_path } " )
8283
8384
8485def download_files_from_s3 (
0 commit comments