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 io import BytesIO
from typing import Optional, Tuple
from typing import Optional
import backoff
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)
async def fetch_story_from_partId(
part_id: int, cookies: Optional[dict] = None
) -> Tuple[int, Story]:
) -> tuple[int, Story]:
"""Fetch Story metadata from a Part ID."""
with start_action(action_type="api_fetch_storyFromPartId"):
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):
@@ -34,9 +34,9 @@ class Story(TypedDict):
description: str
cover: str
completed: bool
tags: List[str]
tags: list[str]
mature: bool
url: str
parts: List[Part]
parts: list[Part]
isPaywalled: bool
copyright: int
-6
View File
@@ -1,11 +1,5 @@
import re
import unicodedata
from typing import cast
import bs4
from bs4 import BeautifulSoup
from .models import Part
def slugify(value, allow_unicode=False) -> str: