From d75250f436a05846cd0845460d8bfb9f4c85c9c3 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Tue, 2 Nov 2021 12:39:53 +0100 Subject: [PATCH] Linting --- .../management/commands/migrate_to_new_format.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/media/management/commands/migrate_to_new_format.py b/media/management/commands/migrate_to_new_format.py index c574ef8..da0a60a 100644 --- a/media/management/commands/migrate_to_new_format.py +++ b/media/management/commands/migrate_to_new_format.py @@ -1,10 +1,9 @@ from django.core.management import BaseCommand from django.db import transaction from django.utils.translation import gettext_lazy as _ -from tqdm import tqdm - from media.models import CD, Comic, Game, Manga, Novel, Review, Vinyl, \ OldCD, OldComic, OldGame, OldManga, OldNovel, OldReview, OldVinyl +from tqdm import tqdm class Command(BaseCommand): @@ -17,7 +16,7 @@ class Command(BaseCommand): help="Actually do the mogration.") @transaction.atomic - def handle(self, *args, **options): + def handle(self, *args, **options): # noqa: C901 # Migrate books for old_book_class, book_class in [(OldComic, Comic), (OldManga, Manga), @@ -39,7 +38,7 @@ class Command(BaseCommand): ) new_book.authors.set(book.authors.all()) new_book.save() - except: + except Exception: self.stderr.write(f"There was an error with {name} " f"{book} ({book.pk})") raise @@ -57,7 +56,7 @@ class Command(BaseCommand): ) new_cd.authors.set(cd.authors.all()) new_cd.save() - except: + except Exception: self.stderr.write(f"There was an error with {cd} ({cd.pk})") raise @@ -74,7 +73,7 @@ class Command(BaseCommand): ) new_vinyl.authors.set(vinyl.authors.all()) new_vinyl.save() - except: + except Exception: self.stderr.write(f"There was an error with {vinyl} " f"({vinyl.pk})") raise @@ -94,7 +93,7 @@ class Command(BaseCommand): double=review.double, present=review.present, ) - except: + except Exception: self.stderr.write(f"There was an error with {review} " f"({review.pk})") raise @@ -113,7 +112,7 @@ class Command(BaseCommand): players_max=game.players_max, comment=game.comment, ) - except: + except Exception: self.stderr.write(f"There was an error with {game} " f"({game.pk})") raise