543
543
'name' : 'progress-multiline' ,
544
544
'dest' : 'progress_multiline' ,
545
545
'action' : 'store_true' ,
546
- 'help_text' : (
547
- 'Show progress on multiple lines.'
548
- ),
546
+ 'help_text' : ('Show progress on multiple lines.' ),
549
547
}
550
548
551
549
@@ -738,7 +736,7 @@ class ListCommand(S3Command):
738
736
]
739
737
740
738
def _run_main (self , parsed_args , parsed_globals ):
741
- super (ListCommand , self )._run_main (parsed_args , parsed_globals )
739
+ super ()._run_main (parsed_args , parsed_globals )
742
740
self ._empty_result = False
743
741
self ._at_first_page = True
744
742
self ._size_accumulator = 0
@@ -881,7 +879,7 @@ def _make_last_mod_str(self, last_mod):
881
879
str (last_mod .minute ).zfill (2 ),
882
880
str (last_mod .second ).zfill (2 ),
883
881
)
884
- last_mod_str = "%s-%s-%s %s:%s:%s" % last_mod_tup
882
+ last_mod_str = "%s-%s-%s %s:%s:%s" % last_mod_tup # noqa: UP031
885
883
return last_mod_str .ljust (19 , ' ' )
886
884
887
885
def _make_size_str (self , size ):
@@ -923,7 +921,7 @@ class WebsiteCommand(S3Command):
923
921
]
924
922
925
923
def _run_main (self , parsed_args , parsed_globals ):
926
- super (WebsiteCommand , self )._run_main (parsed_args , parsed_globals )
924
+ super ()._run_main (parsed_args , parsed_globals )
927
925
bucket = self ._get_bucket_name (parsed_args .paths [0 ])
928
926
website_configuration = self ._build_website_configuration (parsed_args )
929
927
self .client .put_bucket_website (
@@ -981,7 +979,7 @@ class PresignCommand(S3Command):
981
979
]
982
980
983
981
def _run_main (self , parsed_args , parsed_globals ):
984
- super (PresignCommand , self )._run_main (parsed_args , parsed_globals )
982
+ super ()._run_main (parsed_args , parsed_globals )
985
983
path = parsed_args .path
986
984
if path .startswith ('s3://' ):
987
985
path = path [5 :]
@@ -998,7 +996,7 @@ def _run_main(self, parsed_args, parsed_globals):
998
996
999
997
class S3TransferCommand (S3Command ):
1000
998
def _run_main (self , parsed_args , parsed_globals ):
1001
- super (S3TransferCommand , self )._run_main (parsed_args , parsed_globals )
999
+ super ()._run_main (parsed_args , parsed_globals )
1002
1000
register_feature_id ('S3_TRANSFER' )
1003
1001
self ._convert_path_args (parsed_args )
1004
1002
params = self ._get_params (parsed_args , parsed_globals , self ._session )
@@ -1161,11 +1159,11 @@ class MbCommand(S3Command):
1161
1159
ARG_TABLE = [{'name' : 'path' , 'positional_arg' : True , 'synopsis' : USAGE }]
1162
1160
1163
1161
def _run_main (self , parsed_args , parsed_globals ):
1164
- super (MbCommand , self )._run_main (parsed_args , parsed_globals )
1162
+ super ()._run_main (parsed_args , parsed_globals )
1165
1163
1166
1164
if not parsed_args .path .startswith ('s3://' ):
1167
1165
raise ParamValidationError (
1168
- "%s \n Error: Invalid argument type" % self . USAGE
1166
+ f" { self . USAGE } \n Error: Invalid argument type"
1169
1167
)
1170
1168
bucket , _ = split_s3_bucket_key (parsed_args .path )
1171
1169
@@ -1182,11 +1180,11 @@ def _run_main(self, parsed_args, parsed_globals):
1182
1180
# TODO: Consolidate how we handle return codes and errors
1183
1181
try :
1184
1182
self .client .create_bucket (** params )
1185
- uni_print ("make_bucket: %s \n " % bucket )
1183
+ uni_print (f "make_bucket: { bucket } \n " )
1186
1184
return 0
1187
1185
except Exception as e :
1188
1186
uni_print (
1189
- "make_bucket failed: %s %s \n " % ( parsed_args .path , e ) ,
1187
+ f "make_bucket failed: { parsed_args .path } { e } \n " ,
1190
1188
sys .stderr ,
1191
1189
)
1192
1190
return 1
@@ -1208,30 +1206,30 @@ class RbCommand(S3Command):
1208
1206
]
1209
1207
1210
1208
def _run_main (self , parsed_args , parsed_globals ):
1211
- super (RbCommand , self )._run_main (parsed_args , parsed_globals )
1209
+ super ()._run_main (parsed_args , parsed_globals )
1212
1210
1213
1211
if not parsed_args .path .startswith ('s3://' ):
1214
1212
raise ParamValidationError (
1215
- "%s \n Error: Invalid argument type" % self . USAGE
1213
+ f" { self . USAGE } \n Error: Invalid argument type"
1216
1214
)
1217
1215
bucket , key = split_s3_bucket_key (parsed_args .path )
1218
1216
1219
1217
if key :
1220
1218
raise ParamValidationError (
1221
1219
'Please specify a valid bucket name only. '
1222
- 'E.g. s3://%s' % bucket
1220
+ f 'E.g. s3://{ bucket } '
1223
1221
)
1224
1222
1225
1223
if parsed_args .force :
1226
1224
self ._force (parsed_args .path , parsed_globals )
1227
1225
1228
1226
try :
1229
1227
self .client .delete_bucket (Bucket = bucket )
1230
- uni_print ("remove_bucket: %s \n " % bucket )
1228
+ uni_print (f "remove_bucket: { bucket } \n " )
1231
1229
return 0
1232
1230
except Exception as e :
1233
1231
uni_print (
1234
- "remove_bucket failed: %s %s \n " % ( parsed_args .path , e ) ,
1232
+ f "remove_bucket failed: { parsed_args .path } { e } \n " ,
1235
1233
sys .stderr ,
1236
1234
)
1237
1235
return 1
@@ -1637,7 +1635,7 @@ def _validate_path_args(self):
1637
1635
if 'locals3' == params ['paths_type' ] and not params ['is_stream' ]:
1638
1636
if not os .path .exists (params ['src' ]):
1639
1637
raise RuntimeError (
1640
- 'The user-provided path %s does not exist.' % params [ 'src' ]
1638
+ f 'The user-provided path { params [ 'src' ] } does not exist.'
1641
1639
)
1642
1640
# If the operation is downloading to a directory that does not exist,
1643
1641
# create the directories so no warnings are thrown during the syncing
@@ -1764,7 +1762,7 @@ def check_path_type(self, paths):
1764
1762
'locallocal' : [],
1765
1763
}
1766
1764
paths_type = ''
1767
- usage = "usage: aws s3 %s %s" % ( self .cmd , self .usage )
1765
+ usage = f "usage: aws s3 { self .cmd } { self .usage } "
1768
1766
for i in range (len (paths )):
1769
1767
if paths [i ].startswith ('s3://' ):
1770
1768
paths_type = paths_type + 's3'
@@ -1774,7 +1772,7 @@ def check_path_type(self, paths):
1774
1772
self .parameters ['paths_type' ] = paths_type
1775
1773
else :
1776
1774
raise ParamValidationError (
1777
- "%s \n Error: Invalid argument type" % usage
1775
+ f" { usage } \n Error: Invalid argument type"
1778
1776
)
1779
1777
1780
1778
def add_region (self , parsed_globals ):
@@ -1814,14 +1812,14 @@ def _validate_sse_c_arg(self, sse_c_type='sse_c'):
1814
1812
if self .parameters .get (sse_c_type ):
1815
1813
if not self .parameters .get (sse_c_key_type ):
1816
1814
raise ParamValidationError (
1817
- 'If %s is specified, %s must be specified '
1818
- 'as well.' % ( sse_c_type_param , sse_c_key_type_param )
1815
+ f 'If { sse_c_type_param } is specified, { sse_c_key_type_param } must be specified '
1816
+ 'as well.'
1819
1817
)
1820
1818
if self .parameters .get (sse_c_key_type ):
1821
1819
if not self .parameters .get (sse_c_type ):
1822
1820
raise ParamValidationError (
1823
- 'If %s is specified, %s must be specified '
1824
- 'as well.' % ( sse_c_key_type_param , sse_c_type_param )
1821
+ f 'If { sse_c_key_type_param } is specified, { sse_c_type_param } must be specified '
1822
+ 'as well.'
1825
1823
)
1826
1824
1827
1825
def _validate_sse_c_copy_source_for_paths (self ):
0 commit comments