ruff: Enable B lint

This commit is contained in:
Marcel Hellwig
2026-01-04 14:03:06 +01:00
parent 0f272052b3
commit 2c36adfd75
7 changed files with 25 additions and 21 deletions

View File

@@ -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,

View File

@@ -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

View File

@@ -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}")

View File

@@ -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:

View File

@@ -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

View File

@@ -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

View File

@@ -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"]