api: Update typehints

This commit is contained in:
TheOnlyWayUp
2025-06-09 22:06:05 +00:00
parent 8c95632894
commit 86ae5eac21
3 changed files with 5 additions and 11 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
from __future__ import annotations from __future__ import annotations
from io import BytesIO from io import BytesIO
from typing import Optional, Tuple from typing import Optional
import backoff import backoff
from aiohttp import ClientResponseError from aiohttp import ClientResponseError
@@ -63,7 +63,7 @@ async def fetch_cookies(username: str, password: str) -> dict:
@backoff.on_exception(backoff.expo, ClientResponseError, max_time=15) @backoff.on_exception(backoff.expo, ClientResponseError, max_time=15)
async def fetch_story_from_partId( async def fetch_story_from_partId(
part_id: int, cookies: Optional[dict] = None part_id: int, cookies: Optional[dict] = None
) -> Tuple[int, Story]: ) -> tuple[int, Story]:
"""Fetch Story metadata from a Part ID.""" """Fetch Story metadata from a Part ID."""
with start_action(action_type="api_fetch_storyFromPartId"): with start_action(action_type="api_fetch_storyFromPartId"):
async with CachedSession( async with CachedSession(
+3 -3
View File
@@ -1,4 +1,4 @@
from typing import List, Optional, TypedDict from typing import Optional, TypedDict
class CopyrightData(TypedDict): class CopyrightData(TypedDict):
@@ -34,9 +34,9 @@ class Story(TypedDict):
description: str description: str
cover: str cover: str
completed: bool completed: bool
tags: List[str] tags: list[str]
mature: bool mature: bool
url: str url: str
parts: List[Part] parts: list[Part]
isPaywalled: bool isPaywalled: bool
copyright: int copyright: int
-6
View File
@@ -1,11 +1,5 @@
import re import re
import unicodedata import unicodedata
from typing import cast
import bs4
from bs4 import BeautifulSoup
from .models import Part
def slugify(value, allow_unicode=False) -> str: def slugify(value, allow_unicode=False) -> str: