Skip to content

Commit a286d27

Browse files
authored
fix: fix sonarcloud python:S117 (#172)
1 parent 97fc66e commit a286d27

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

dynamodump/dynamodump.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -643,17 +643,19 @@ def do_empty(dynamo, table_name, billing_mode):
643643
)
644644

645645

646-
def do_backup(dynamo, read_capacity, tableQueue=None, srcTable=None, filterOption=None):
646+
def do_backup(
647+
dynamo, read_capacity, table_queue=None, src_table=None, filter_option=None
648+
):
647649
"""
648-
Connect to DynamoDB and perform the backup for srcTable or each table in tableQueue
650+
Connect to DynamoDB and perform the backup for src_table or each table in table_queue
649651
"""
650652

651-
if srcTable:
652-
table_name = srcTable
653+
if src_table:
654+
table_name = src_table
653655

654-
if tableQueue:
656+
if table_queue:
655657
while True:
656-
table_name = tableQueue.get()
658+
table_name = table_queue.get()
657659
if table_name is None:
658660
break
659661

@@ -700,8 +702,8 @@ def do_backup(dynamo, read_capacity, tableQueue=None, srcTable=None, filterOptio
700702
optional_args = {}
701703
if last_evaluated_key is not None:
702704
optional_args["ExclusiveStartKey"] = last_evaluated_key
703-
if filterOption is not None:
704-
optional_args.update(filterOption)
705+
if filter_option is not None:
706+
optional_args.update(filter_option)
705707
scanned_table = dynamo.scan(
706708
TableName=table_name, **optional_args
707709
)
@@ -711,7 +713,7 @@ def do_backup(dynamo, read_capacity, tableQueue=None, srcTable=None, filterOptio
711713
+ table_name
712714
+ ". BACKUP FOR IT IS USELESS."
713715
)
714-
tableQueue.task_done()
716+
table_queue.task_done()
715717

716718
f = open(
717719
args.dumpPath
@@ -755,7 +757,7 @@ def do_backup(dynamo, read_capacity, tableQueue=None, srcTable=None, filterOptio
755757
+ str(datetime.datetime.now().replace(microsecond=0) - start_time)
756758
)
757759

758-
tableQueue.task_done()
760+
table_queue.task_done()
759761

760762

761763
def prepare_provisioned_throughput_for_restore(provisioned_throughput):
@@ -1330,15 +1332,15 @@ def main():
13301332
do_backup(
13311333
conn,
13321334
args.read_capacity,
1333-
tableQueue=None,
1334-
filterOption=filter_option,
1335+
table_queue=None,
1336+
filter_option=filter_option,
13351337
)
13361338
else:
13371339
do_backup(
13381340
conn,
13391341
args.read_capacity,
13401342
matching_backup_tables,
1341-
filterOption=filter_option,
1343+
filter_option=filter_option,
13421344
)
13431345
except AttributeError:
13441346
# Didn't specify srcTable if we get here
@@ -1350,7 +1352,7 @@ def main():
13501352
t = threading.Thread(
13511353
target=do_backup,
13521354
args=(conn, args.readCapacity),
1353-
kwargs={"tableQueue": q, "filterOption": filter_option},
1355+
kwargs={"table_queue": q, "filter_option": filter_option},
13541356
)
13551357
t.start()
13561358
threads.append(t)

0 commit comments

Comments
 (0)