Skip to content

Commit e08cbaf

Browse files
theyoshgithub-actions[bot]
authored andcommitted
Python code is blacked
1 parent 5dd014f commit e08cbaf

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

contrib/db_cleanup.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def __init__(self, database="../data/terrariumpi.db", period=timedelta(weeks=60)
3838
f"This script will cleanup your terrariumpi.db file. We will keep {period.days} days of data from now. If you want to make a backup first, please enter no and make your backup."
3939
)
4040

41-
self.cleanup_tables = ["Button","Sensor"]
41+
self.cleanup_tables = ["Button", "Sensor"]
4242
self.progress_amount = 100000
4343
self.total_to_keep = 0
4444
self.counter = 0
@@ -105,7 +105,7 @@ def get_records_to_delete(self, table):
105105
def __sql_progress(self):
106106
self.counter += 1
107107
# f-string format not working here
108-
print("{}".format(['|','/','-','\\'][self.counter % 4]), end="\r")
108+
print("{}".format(["|", "/", "-", "\\"][self.counter % 4]), end="\r")
109109
return 0 # Return 0 to continue, non-zero to abort
110110

111111
def __vacuum(self):
@@ -138,7 +138,9 @@ def __clean_up_by_deleting(self):
138138
totals = self.get_total_records(table)
139139
print(" Getting records to delete ...", end="\r")
140140
cleanup = self.get_records_to_delete(table)
141-
print(f"Table {table} contains {totals[0]} records, of which being deleted {cleanup[0]} records {cleanup[0]/totals[0]*100:.2f}%.")
141+
print(
142+
f"Table {table} contains {totals[0]} records, of which being deleted {cleanup[0]} records {cleanup[0]/totals[0]*100:.2f}%."
143+
)
142144

143145
sql = f"DELETE FROM `{table}` WHERE timestamp < ?"
144146
parameters = (self.time_limit,)

0 commit comments

Comments
 (0)