Skip to content

Commit

Permalink
Fix deprecation and cleanup code
Browse files Browse the repository at this point in the history
  • Loading branch information
hv0905 committed Jan 21, 2024
1 parent b74274c commit 94621de
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
8 changes: 2 additions & 6 deletions app/Models/query_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,18 @@ def __init__(
categories: Annotated[str | None, Query(
description="The categories whitelist of the image. Image with **any of** the given categories will "
"be included. The entries should be seperated by comma.",
example="stickers, cg")] = None,
examples=["stickers, cg"])] = None,
categories_negative: Annotated[
str | None, Query(
description="The categories blacklist of the image. Image with **any of** the given categories "
"will be ignored. The entries should be seperated by comma.",
example="stickers, cg")] = None,
examples=["stickers, cg"])] = None,
):
self.preferred_ratio = preferred_ratio
self.ratio_tolerance = ratio_tolerance
self.min_width = min_width
self.min_height = min_height
self.starred = starred
# self.categories = categories if categories is not None and len(categories) > 0 else None
# self.categories_negative = categories_negative if categories_negative is not None and len(
# categories_negative) > 0 else None
bool("fff")
self.categories = [t.strip() for t in categories.split(',') if t.strip()] if categories else None
self.categories_negative = [t.strip() for t in categories_negative.split(',') if
t.strip()] if categories_negative else None
Expand Down
3 changes: 1 addition & 2 deletions scripts/db_migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,5 @@ async def migrate(from_version: int):
await migrate_v1_v2()
case 2:
logger.info("Already up to date.")
pass
case _:
raise Exception(f"Unknown version {from_version}")
raise ValueError(f"Unknown version {from_version}")

0 comments on commit 94621de

Please sign in to comment.