diff --git a/alembic/env.py b/alembic/env.py index 00d5ea9..67312d4 100644 --- a/alembic/env.py +++ b/alembic/env.py @@ -36,21 +36,21 @@ target_metadata = Base.metadata # this is to keep pycharm from complaining about/optimizing unused imports # noinspection PyStatementEffect -( - User, - OAuthAccount, - IndexerQueryResult, - Torrent, - Show, - Season, - Episode, - SeasonFile, - SeasonRequest, - Movie, - MovieFile, - MovieRequest, - Notification, -) +__all__ = [ + "User", + "OAuthAccount", + "IndexerQueryResult", + "Torrent", + "Show", + "Season", + "Episode", + "SeasonFile", + "SeasonRequest", + "Movie", + "MovieFile", + "MovieRequest", + "Notification", +] # other values from the config, defined by the needs of env.py, diff --git a/media_manager/movies/dependencies.py b/media_manager/movies/dependencies.py index b6b3bca..eb25370 100644 --- a/media_manager/movies/dependencies.py +++ b/media_manager/movies/dependencies.py @@ -47,7 +47,7 @@ def get_movie_by_id( raise HTTPException( status_code=404, detail=f"Movie with ID {movie_id} not found.", - ) + ) from None return movie diff --git a/media_manager/movies/repository.py b/media_manager/movies/repository.py index cbcf497..a7a799a 100644 --- a/media_manager/movies/repository.py +++ b/media_manager/movies/repository.py @@ -132,7 +132,7 @@ class MovieRepository: log.error(f"Integrity error while saving movie {movie.name}: {e}") raise ConflictError( f"Movie with this primary key or unique constraint violation: {e.orig}" - ) + ) from e except SQLAlchemyError as e: self.db.rollback() log.error(f"Database error while saving movie {movie.name}: {e}") diff --git a/media_manager/notification/repository.py b/media_manager/notification/repository.py index 577baad..4a8beca 100644 --- a/media_manager/notification/repository.py +++ b/media_manager/notification/repository.py @@ -71,7 +71,7 @@ class NotificationRepository: log.error(f"Could not save notification, Error: {e}") raise ConflictError( f"Notification with id {notification.id} already exists." - ) + ) from None return def mark_notification_as_read(self, id: NotificationId) -> None: diff --git a/media_manager/torrent/dependencies.py b/media_manager/torrent/dependencies.py index e9673b4..5f01fdf 100644 --- a/media_manager/torrent/dependencies.py +++ b/media_manager/torrent/dependencies.py @@ -39,7 +39,7 @@ def get_torrent_by_id( except NotFoundError: raise HTTPException( status_code=404, detail=f"Torrent with ID {torrent_id} not found" - ) + ) from None return torrent diff --git a/media_manager/tv/dependencies.py b/media_manager/tv/dependencies.py index 527aff3..5285982 100644 --- a/media_manager/tv/dependencies.py +++ b/media_manager/tv/dependencies.py @@ -47,7 +47,7 @@ def get_show_by_id( raise HTTPException( status_code=404, detail=f"Show with ID {show_id} not found.", - ) + ) from None return show @@ -64,7 +64,7 @@ def get_season_by_id( raise HTTPException( status_code=404, detail=f"Season with ID {season_id} not found.", - ) + ) from None return season diff --git a/ruff.toml b/ruff.toml index f351308..4b6312b 100644 --- a/ruff.toml +++ b/ruff.toml @@ -6,6 +6,7 @@ quote-style = "double" # to be enabled: A, ANN, ARG, BLE, C90, CPY, D, DOC, DTZ, FBT, G, INP, INT, N, PERF, PIE, PL, PTH, RET, RSE, SLF, SIM, TC, TRY, UP extend-select = [ "ASYNC", + "B", "COM", "E", "EXE", "F", "FA", "FIX", "FLY", "FURB", @@ -25,3 +26,6 @@ ignore = [ # lines too long "E501", ] + +[lint.flake8-bugbear] +extend-immutable-calls = ["fastapi.Depends", "fastapi.Path"]