Update ruff config (+ fix violations)

This commit is contained in:
Adrian Moennich 2024-08-21 11:20:39 +02:00
parent a929733105
commit 72f3a96560
3 changed files with 10 additions and 7 deletions

View File

@ -79,11 +79,11 @@ class Uploader:
change_by_obj = {}
for obj, change in records.items():
by_model[type(obj)].add(obj.id)
change_by_obj[type(obj), obj.id] = change
change_by_obj[(type(obj), obj.id)] = change
rv = {}
for model, ids in by_model.items():
for obj in self.backend.get_data_query(model, ids).yield_per(5000):
rv[obj] = change_by_obj[model, obj.id]
rv[obj] = change_by_obj[(model, obj.id)]
assert len(records) == len(rv)
return rv

View File

@ -44,11 +44,11 @@ def stringify_seconds(seconds=0):
"""
seconds = int(seconds)
minutes = seconds / 60
ti = {'h': 0, 'm': 0, 's': 0}
h = m = s = 0
if seconds > 0:
ti['s'] = seconds % 60
ti['m'] = minutes % 60
ti['h'] = minutes / 60
s = seconds % 60
m = minutes % 60
h = minutes / 60
return '%dh %dm %ds' % (ti['h'], ti['m'], ti['s'])
return f'{h}h {m}m {s}s'

View File

@ -159,6 +159,9 @@ allow-dunder-method-names = [
'__clause_element__',
]
[lint.ruff]
parenthesize-tuple-in-subscript = true
[lint.per-file-ignores]
# allow stuff that's useful in tests
'*/*_test.py' = ['E221', 'E241', 'E272', 'N802', 'S105', 'S106', 'PLC1901']