refactor: upgrade code to >=python3.7 (pre-commit)
Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2189>
This commit is contained in:
parent
7768ea77a4
commit
8d9946d35a
143 changed files with 454 additions and 582 deletions
|
|
@ -13,7 +13,7 @@ MODELS = [
|
|||
|
||||
def main(command, **kwargs):
|
||||
for model, attribute, key_set in MODELS:
|
||||
qs = model.objects.exclude(**{"{}__isnull".format(attribute): True})
|
||||
qs = model.objects.exclude(**{f"{attribute}__isnull": True})
|
||||
qs = qs.exclude(**{attribute: ""})
|
||||
warmer = VersatileImageFieldWarmer(
|
||||
instance_or_queryset=qs,
|
||||
|
|
@ -21,10 +21,8 @@ def main(command, **kwargs):
|
|||
image_attr=attribute,
|
||||
verbose=True,
|
||||
)
|
||||
command.stdout.write(
|
||||
"Creating images for {} / {}".format(model.__name__, attribute)
|
||||
)
|
||||
command.stdout.write(f"Creating images for {model.__name__} / {attribute}")
|
||||
num_created, failed_to_create = warmer.warm()
|
||||
command.stdout.write(
|
||||
" {} created, {} in error".format(num_created, len(failed_to_create))
|
||||
f" {num_created} created, {len(failed_to_create)} in error"
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue