@@ -301,7 +301,7 @@ def do_archive(archive_type, dump_path):
301301 return False , None
302302
303303
304- def get_table_name_matches (conn , table_name_wildcard , separator ):
304+ def get_table_name_matches (conn , table_name_wildcard ):
305305 """
306306 Find tables to backup
307307 """
@@ -447,7 +447,6 @@ def delete_table(conn, sleep_interval: int, table_name: str):
447447 time .sleep (sleep_interval )
448448 except conn .exceptions .ResourceNotFoundException :
449449 logging .info (table_name + " table deleted." )
450- pass
451450 except conn .exceptions .ClientError as e :
452451 logging .exception (e )
453452 sys .exit (1 )
@@ -461,9 +460,7 @@ def mkdir_p(path):
461460 try :
462461 os .makedirs (path )
463462 except OSError as exc :
464- if exc .errno == errno .EEXIST and os .path .isdir (path ):
465- pass
466- else :
463+ if not (exc .errno == errno .EEXIST and os .path .isdir (path )):
467464 raise
468465
469466
@@ -1104,13 +1101,13 @@ def main():
11041101 parser .add_argument (
11051102 "-a" ,
11061103 "--archive" ,
1107- help = "Type of compressed archive to create." " If unset, don't create archive" ,
1104+ help = "Type of compressed archive to create. If unset, don't create archive" ,
11081105 choices = ["zip" , "tar" ],
11091106 )
11101107 parser .add_argument (
11111108 "-b" ,
11121109 "--bucket" ,
1113- help = "S3 bucket in which to store or retrieve backups." " [must already exist]" ,
1110+ help = "S3 bucket in which to store or retrieve backups. [must already exist]" ,
11141111 )
11151112 parser .add_argument (
11161113 "-m" ,
@@ -1133,10 +1130,10 @@ def main():
11331130 "--port" , help = "Port of local DynamoDB [required only for local]"
11341131 )
11351132 parser .add_argument (
1136- "--accessKey" , help = "Access key of local DynamoDB " " [required only for local]"
1133+ "--accessKey" , help = "Access key of local DynamoDB [required only for local]"
11371134 )
11381135 parser .add_argument (
1139- "--secretKey" , help = "Secret key of local DynamoDB " " [required only for local]"
1136+ "--secretKey" , help = "Secret key of local DynamoDB [required only for local]"
11401137 )
11411138 parser .add_argument (
11421139 "-p" ,
@@ -1160,7 +1157,7 @@ def main():
11601157 )
11611158 parser .add_argument (
11621159 "--prefixSeparator" ,
1163- help = "Specify a different prefix separator, " " e.g. '.' [optional]" ,
1160+ help = "Specify a different prefix separator, e.g. '.' [optional]" ,
11641161 )
11651162 parser .add_argument (
11661163 "--noSeparator" ,
@@ -1230,7 +1227,7 @@ def main():
12301227 default = str (PROVISIONED_BILLING_MODE ),
12311228 )
12321229 parser .add_argument (
1233- "--log" , help = "Logging level - DEBUG|INFO|WARNING|ERROR|CRITICAL " " [optional]"
1230+ "--log" , help = "Logging level - DEBUG|INFO|WARNING|ERROR|CRITICAL [optional]"
12341231 )
12351232 parser .add_argument (
12361233 "-f" ,
@@ -1313,9 +1310,7 @@ def main():
13131310 args .profile , args .region , args .tag
13141311 )
13151312 elif args .srcTable .find ("*" ) != - 1 :
1316- matching_backup_tables = get_table_name_matches (
1317- conn , args .srcTable , prefix_separator
1318- )
1313+ matching_backup_tables = get_table_name_matches (conn , args .srcTable )
13191314 elif args .srcTable :
13201315 matching_backup_tables .append (args .srcTable )
13211316
@@ -1351,7 +1346,7 @@ def main():
13511346 q = Queue ()
13521347 threads = []
13531348
1354- for i in range (MAX_NUMBER_BACKUP_WORKERS ):
1349+ for _ in range (MAX_NUMBER_BACKUP_WORKERS ):
13551350 t = threading .Thread (
13561351 target = do_backup ,
13571352 args = (conn , args .readCapacity ),
@@ -1366,7 +1361,7 @@ def main():
13661361
13671362 q .join ()
13681363
1369- for i in range (MAX_NUMBER_BACKUP_WORKERS ):
1364+ for _ in range (MAX_NUMBER_BACKUP_WORKERS ):
13701365 q .put (None )
13711366 for t in threads :
13721367 t .join ()
@@ -1410,9 +1405,7 @@ def main():
14101405 )
14111406
14121407 if dest_table .find ("*" ) != - 1 :
1413- matching_destination_tables = get_table_name_matches (
1414- conn , dest_table , prefix_separator
1415- )
1408+ matching_destination_tables = get_table_name_matches (conn , dest_table )
14161409 delete_str = ": " if args .dataOnly else " to be deleted: "
14171410 logging .info (
14181411 "Found "
@@ -1505,9 +1498,7 @@ def main():
15051498 )
15061499 elif args .mode == "empty" :
15071500 if args .srcTable .find ("*" ) != - 1 :
1508- matching_backup_tables = get_table_name_matches (
1509- conn , args .srcTable , prefix_separator
1510- )
1501+ matching_backup_tables = get_table_name_matches (conn , args .srcTable )
15111502 logging .info (
15121503 "Found "
15131504 + str (len (matching_backup_tables ))
0 commit comments