Skip to content

Commit

Permalink
fix: fix type hint
Browse files Browse the repository at this point in the history
  • Loading branch information
Ravencentric committed Jul 7, 2024
1 parent 7311099 commit 3da1569
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 76 deletions.
2 changes: 1 addition & 1 deletion docs/api-reference/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
options:
members: true
::: pyanilist._types.FuzzyDateInt
::: pyanilist._types.Iterable
::: pyanilist._types.CollectionOf
74 changes: 37 additions & 37 deletions src/pyanilist/_clients/_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from .._models import Media
from .._parser import post_process_response
from .._query import query_string
from .._types import FuzzyDateInt, Iterable
from .._types import CollectionOf, FuzzyDateInt
from .._utils import to_anilist_case


Expand Down Expand Up @@ -100,23 +100,23 @@ async def get(
country_of_origin: str | None = None,
is_licensed: bool | None = None,
id_not: int | None = None,
id_in: Iterable[int] | None = None,
id_not_in: Iterable[int] | None = None,
id_in: CollectionOf[int] | None = None,
id_not_in: CollectionOf[int] | None = None,
id_mal_not: int | None = None,
id_mal_in: Iterable[int] | None = None,
id_mal_not_in: Iterable[int] | None = None,
id_mal_in: CollectionOf[int] | None = None,
id_mal_not_in: CollectionOf[int] | None = None,
start_date_greater: FuzzyDateInt | None = None,
start_date_lesser: FuzzyDateInt | None = None,
start_date_like: str | None = None,
end_date_greater: FuzzyDateInt | None = None,
end_date_lesser: FuzzyDateInt | None = None,
end_date_like: str | None = None,
format_in: Iterable[MediaFormat] | None = None,
format_in: CollectionOf[MediaFormat] | None = None,
format_not: MediaFormat | None = None,
format_not_in: Iterable[MediaFormat] | None = None,
status_in: Iterable[MediaStatus] | None = None,
format_not_in: CollectionOf[MediaFormat] | None = None,
status_in: CollectionOf[MediaStatus] | None = None,
status_not: MediaStatus | None = None,
status_not_in: Iterable[MediaStatus] | None = None,
status_not_in: CollectionOf[MediaStatus] | None = None,
episodes_greater: int | None = None,
episodes_lesser: int | None = None,
duration_greater: int | None = None,
Expand All @@ -125,22 +125,22 @@ async def get(
chapters_lesser: int | None = None,
volumes_greater: int | None = None,
volumes_lesser: int | None = None,
genre_in: Iterable[str] | None = None,
genre_not_in: Iterable[str] | None = None,
tag_in: Iterable[str] | None = None,
tag_not_in: Iterable[str] | None = None,
tag_category_in: Iterable[str] | None = None,
tag_category_not_in: Iterable[str] | None = None,
licensed_by_in: Iterable[str] | None = None,
licensed_by_id_in: Iterable[int] | None = None,
genre_in: CollectionOf[str] | None = None,
genre_not_in: CollectionOf[str] | None = None,
tag_in: CollectionOf[str] | None = None,
tag_not_in: CollectionOf[str] | None = None,
tag_category_in: CollectionOf[str] | None = None,
tag_category_not_in: CollectionOf[str] | None = None,
licensed_by_in: CollectionOf[str] | None = None,
licensed_by_id_in: CollectionOf[int] | None = None,
average_score_not: int | None = None,
average_score_greater: int | None = None,
average_score_lesser: int | None = None,
popularity_not: int | None = None,
popularity_greater: int | None = None,
popularity_lesser: int | None = None,
source_in: Iterable[MediaSource] | None = None,
sort: Iterable[MediaSort] | None = None,
source_in: CollectionOf[MediaSource] | None = None,
sort: CollectionOf[MediaSort] | None = None,
) -> Media:
"""
Search for media on AniList based on the provided parameters.
Expand Down Expand Up @@ -201,15 +201,15 @@ async def get(
If the media is officially licensed or a self-published doujin release
id_not : int, optional
Filter by the media id
id_in : Iterable[int], optional
id_in : CollectionOf[int], optional
Filter by the media id
id_not_in : Iterable[int], optional
id_not_in : CollectionOf[int], optional
Filter by the media id
id_mal_not : int, optional
Filter by the media's MyAnimeList id
id_mal_in : Iterable[int], optional
id_mal_in : CollectionOf[int], optional
Filter by the media's MyAnimeList id
id_mal_not_in : Iterable[int], optional
id_mal_not_in : CollectionOf[int], optional
Filter by the media's MyAnimeList id
start_date_greater : FuzzyDateInt, optional
Filter by the start date of the media
Expand All @@ -223,17 +223,17 @@ async def get(
Filter by the end date of the media
end_date_like : str, optional
Filter by the end date of the media
format_in : Iterable[MediaFormat], optional
format_in : CollectionOf[MediaFormat], optional
Filter by the media's format
format_not : MediaFormat, optional
Filter by the media's format
format_not_in : Iterable[MediaFormat], optional
format_not_in : CollectionOf[MediaFormat], optional
Filter by the media's format
status_in : Iterable[MediaStatus], optional
status_in : CollectionOf[MediaStatus], optional
Filter by the media's current release status
status_not : MediaStatus, optional
Filter by the media's current release status
status_not_in : Iterable[MediaStatus], optional
status_not_in : CollectionOf[MediaStatus], optional
Filter by the media's current release status
episodes_greater : int, optional
Filter by amount of episodes the media has
Expand All @@ -251,21 +251,21 @@ async def get(
Filter by the media's volume count
volumes_lesser : int, optional
Filter by the media's volume count
genre_in : Iterable[str], optional
genre_in : CollectionOf[str], optional
Filter by the media's genres
genre_not_in : Iterable[str], optional
genre_not_in : CollectionOf[str], optional
Filter by the media's genres
tag_in : Iterable[str], optional
tag_in : CollectionOf[str], optional
Filter by the media's tags
tag_not_in : Iterable[str], optional
tag_not_in : CollectionOf[str], optional
Filter by the media's tags
tag_category_in : Iterable[str], optional
tag_category_in : CollectionOf[str], optional
Filter by the media's tags with in a tag category
tag_category_not_in : Iterable[str], optional
tag_category_not_in : CollectionOf[str], optional
Filter by the media's tags with in a tag category
licensed_by_in : Iterable[str], optional
licensed_by_in : CollectionOf[str], optional
Filter media by sites name with a online streaming or reading license
licensed_by_id_in : Iterable[int], optional
licensed_by_id_in : CollectionOf[int], optional
Filter media by sites id with a online streaming or reading license
average_score_not : int, optional
Filter by the media's average score
Expand All @@ -279,9 +279,9 @@ async def get(
Filter by the number of users with this media on their list
popularity_lesser : int, optional
Filter by the number of users with this media on their list
source_in : Iterable[MediaSource], optional
source_in : CollectionOf[MediaSource], optional
Filter by the source type of the media
sort : Iterable[MediaSort], optional
sort : CollectionOf[MediaSort], optional
The order the results will be returned in
Raises
Expand Down
74 changes: 37 additions & 37 deletions src/pyanilist/_clients/_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from .._models import Media
from .._parser import post_process_response
from .._query import query_string
from .._types import FuzzyDateInt, Iterable
from .._types import CollectionOf, FuzzyDateInt
from .._utils import to_anilist_case


Expand Down Expand Up @@ -99,23 +99,23 @@ def get(
country_of_origin: str | None = None,
is_licensed: bool | None = None,
id_not: int | None = None,
id_in: Iterable[int] | None = None,
id_not_in: Iterable[int] | None = None,
id_in: CollectionOf[int] | None = None,
id_not_in: CollectionOf[int] | None = None,
id_mal_not: int | None = None,
id_mal_in: Iterable[int] | None = None,
id_mal_not_in: Iterable[int] | None = None,
id_mal_in: CollectionOf[int] | None = None,
id_mal_not_in: CollectionOf[int] | None = None,
start_date_greater: FuzzyDateInt | None = None,
start_date_lesser: FuzzyDateInt | None = None,
start_date_like: str | None = None,
end_date_greater: FuzzyDateInt | None = None,
end_date_lesser: FuzzyDateInt | None = None,
end_date_like: str | None = None,
format_in: Iterable[MediaFormat] | None = None,
format_in: CollectionOf[MediaFormat] | None = None,
format_not: MediaFormat | None = None,
format_not_in: Iterable[MediaFormat] | None = None,
status_in: Iterable[MediaStatus] | None = None,
format_not_in: CollectionOf[MediaFormat] | None = None,
status_in: CollectionOf[MediaStatus] | None = None,
status_not: MediaStatus | None = None,
status_not_in: Iterable[MediaStatus] | None = None,
status_not_in: CollectionOf[MediaStatus] | None = None,
episodes_greater: int | None = None,
episodes_lesser: int | None = None,
duration_greater: int | None = None,
Expand All @@ -124,22 +124,22 @@ def get(
chapters_lesser: int | None = None,
volumes_greater: int | None = None,
volumes_lesser: int | None = None,
genre_in: Iterable[str] | None = None,
genre_not_in: Iterable[str] | None = None,
tag_in: Iterable[str] | None = None,
tag_not_in: Iterable[str] | None = None,
tag_category_in: Iterable[str] | None = None,
tag_category_not_in: Iterable[str] | None = None,
licensed_by_in: Iterable[str] | None = None,
licensed_by_id_in: Iterable[int] | None = None,
genre_in: CollectionOf[str] | None = None,
genre_not_in: CollectionOf[str] | None = None,
tag_in: CollectionOf[str] | None = None,
tag_not_in: CollectionOf[str] | None = None,
tag_category_in: CollectionOf[str] | None = None,
tag_category_not_in: CollectionOf[str] | None = None,
licensed_by_in: CollectionOf[str] | None = None,
licensed_by_id_in: CollectionOf[int] | None = None,
average_score_not: int | None = None,
average_score_greater: int | None = None,
average_score_lesser: int | None = None,
popularity_not: int | None = None,
popularity_greater: int | None = None,
popularity_lesser: int | None = None,
source_in: Iterable[MediaSource] | None = None,
sort: Iterable[MediaSort] | None = None,
source_in: CollectionOf[MediaSource] | None = None,
sort: CollectionOf[MediaSort] | None = None,
) -> Media:
"""
Search for media on AniList based on the provided parameters.
Expand Down Expand Up @@ -200,15 +200,15 @@ def get(
If the media is officially licensed or a self-published doujin release
id_not : int, optional
Filter by the media id
id_in : Iterable[int], optional
id_in : CollectionOf[int], optional
Filter by the media id
id_not_in : Iterable[int], optional
id_not_in : CollectionOf[int], optional
Filter by the media id
id_mal_not : int, optional
Filter by the media's MyAnimeList id
id_mal_in : Iterable[int], optional
id_mal_in : CollectionOf[int], optional
Filter by the media's MyAnimeList id
id_mal_not_in : Iterable[int], optional
id_mal_not_in : CollectionOf[int], optional
Filter by the media's MyAnimeList id
start_date_greater : FuzzyDateInt, optional
Filter by the start date of the media
Expand All @@ -222,17 +222,17 @@ def get(
Filter by the end date of the media
end_date_like : str, optional
Filter by the end date of the media
format_in : Iterable[MediaFormat], optional
format_in : CollectionOf[MediaFormat], optional
Filter by the media's format
format_not : MediaFormat, optional
Filter by the media's format
format_not_in : Iterable[MediaFormat], optional
format_not_in : CollectionOf[MediaFormat], optional
Filter by the media's format
status_in : Iterable[MediaStatus], optional
status_in : CollectionOf[MediaStatus], optional
Filter by the media's current release status
status_not : MediaStatus, optional
Filter by the media's current release status
status_not_in : Iterable[MediaStatus], optional
status_not_in : CollectionOf[MediaStatus], optional
Filter by the media's current release status
episodes_greater : int, optional
Filter by amount of episodes the media has
Expand All @@ -250,21 +250,21 @@ def get(
Filter by the media's volume count
volumes_lesser : int, optional
Filter by the media's volume count
genre_in : Iterable[str], optional
genre_in : CollectionOf[str], optional
Filter by the media's genres
genre_not_in : Iterable[str], optional
genre_not_in : CollectionOf[str], optional
Filter by the media's genres
tag_in : Iterable[str], optional
tag_in : CollectionOf[str], optional
Filter by the media's tags
tag_not_in : Iterable[str], optional
tag_not_in : CollectionOf[str], optional
Filter by the media's tags
tag_category_in : Iterable[str], optional
tag_category_in : CollectionOf[str], optional
Filter by the media's tags with in a tag category
tag_category_not_in : Iterable[str], optional
tag_category_not_in : CollectionOf[str], optional
Filter by the media's tags with in a tag category
licensed_by_in : Iterable[str], optional
licensed_by_in : CollectionOf[str], optional
Filter media by sites name with a online streaming or reading license
licensed_by_id_in : Iterable[int], optional
licensed_by_id_in : CollectionOf[int], optional
Filter media by sites id with a online streaming or reading license
average_score_not : int, optional
Filter by the media's average score
Expand All @@ -278,9 +278,9 @@ def get(
Filter by the number of users with this media on their list
popularity_lesser : int, optional
Filter by the number of users with this media on their list
source_in : Iterable[MediaSource], optional
source_in : CollectionOf[MediaSource], optional
Filter by the source type of the media
sort : Iterable[MediaSort], optional
sort : CollectionOf[MediaSort], optional
The order the results will be returned in
Raises
Expand Down
2 changes: 1 addition & 1 deletion src/pyanilist/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# to stop pydantic from converting them to ValidatorIterator
# https://github.com/pydantic/pydantic/issues/9541
T = TypeVar("T")
Iterable: TypeAlias = Union[set[T], tuple[T, ...], list[T]]
CollectionOf: TypeAlias = Union[set[T], tuple[T, ...], list[T]]


class YearsActive(NamedTuple):
Expand Down

0 comments on commit 3da1569

Please sign in to comment.