diff --git a/main.py b/main.py index 326c459..221c143 100644 --- a/main.py +++ b/main.py @@ -62,19 +62,19 @@ if errors: echo.r("Not imported games: ") - for e in sorted(errors, key=lambda x: x.name): - echo.r(f"- {e.name}") + for error in sorted(errors, key=lambda x: x.name): + echo.r(f"- {error.name}") echo.g(f"Imported: {imported}/{len(game_list)}\n") -except ServiceError as e: - echo(e) +except ServiceError as err: + echo(err) if DEBUG: - raise e + raise err soft_exit(1) -except (Exception, KeyboardInterrupt) as e: - echo(f"\n{e.__class__.__name__}: {e}", file=sys.stderr) +except (Exception, KeyboardInterrupt) as err: + echo(f"\n{err.__class__.__name__}: {err}", file=sys.stderr) if DEBUG: - raise e + raise err soft_exit(1) echo.m("Completed!") diff --git a/ngl/client.py b/ngl/client.py index 6c052f1..ebeed66 100644 --- a/ngl/client.py +++ b/ngl/client.py @@ -93,13 +93,12 @@ def _parse_date(date_str: tp.Optional[str]): if not date_str: return None check_date_formats = (r"%d %b, %Y", r"%b %d, %Y", r"%b %Y") - e = None for fmt in check_date_formats: try: return datetime.strptime(date_str, fmt).date() - except ValueError as e: + except ValueError: pass - raise ServiceError(msg="time data '{}' does not match any of formats '{}'".format(date_str, "', '".join(check_date_formats)), error=e) + raise ServiceError(msg="time data '{}' does not match any of formats '{}'".format(date_str, "', '".join(check_date_formats))) def add_game(self, game: GameInfo, game_page: CollectionViewPageBlock, use_bg_as_cover: bool = False) -> bool: row_data = {"title": game.name, "platforms": game.platforms, "release_date": self._parse_date(game.release_date), "notes": f"Playtime: {game.playtime}"}