Skip to content
This repository has been archived by the owner on Sep 6, 2024. It is now read-only.

Commit

Permalink
♻️ Fix stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Paillat-dev committed Jul 21, 2024
1 parent 79d4400 commit 9533061
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions src/tvdb/client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from abc import ABC, abstractmethod
from typing import ClassVar, Literal, overload, override
from typing import ClassVar, Literal, final, overload, override

import aiohttp
from yarl import URL
Expand Down Expand Up @@ -96,21 +96,15 @@ def id(self) -> int:
def id(self, value: int | str) -> None: # pyright: ignore[reportPropertyTypeMismatch]
self._id = parse_media_id(value)

@classmethod
@abstractmethod
@classmethod
async def fetch(cls, media_id: int | str, *, client: "TvdbClient", extended: bool = False) -> "_Media": ...


@final
class Movie(_Media):
"""Class to interact with the TVDB API for movies."""

@overload
@classmethod
async def fetch(cls, media_id: int | str, client: "TvdbClient", *, extended: Literal[False]) -> "Movie": ...
@overload
@classmethod
async def fetch(cls, media_id: int | str, client: "TvdbClient", *, extended: Literal[True]) -> "Movie": ...

@override
@classmethod
async def fetch(cls, media_id: int | str, client: "TvdbClient", *, extended: bool = False) -> "Movie":
Expand All @@ -127,16 +121,10 @@ async def fetch(cls, media_id: int | str, client: "TvdbClient", *, extended: boo
return cls(client, response.data)


@final
class Series(_Media):
"""Class to interact with the TVDB API for series."""

@overload
@classmethod
async def fetch(cls, media_id: int | str, client: "TvdbClient", *, extended: Literal[False]) -> "Series": ...
@overload
@classmethod
async def fetch(cls, media_id: int | str, client: "TvdbClient", *, extended: Literal[True]) -> "Series": ...

@override
@classmethod
async def fetch(cls, media_id: int | str, client: "TvdbClient", *, extended: bool = False) -> "Series":
Expand Down

0 comments on commit 9533061

Please sign in to comment.