Skip to content

Commit

Permalink
refactor: rename SnowflakeT
Browse files Browse the repository at this point in the history
  • Loading branch information
THEGOLDENPRO committed Nov 25, 2024
1 parent 334fee8 commit b9ec517
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
6 changes: 3 additions & 3 deletions anmoku/clients/async_.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
if TYPE_CHECKING:
from typing import Any, Optional, Type, Dict, Tuple

from ..typing.anmoku import SnowflakeT
from ..typing.anmoku import StrOrIntT
from ..typing.jikan import SearchResultData

from .base import (
Expand Down Expand Up @@ -66,10 +66,10 @@ async def get(self, resource: Type[NoArgsResourceGenericT]) -> NoArgsResourceGen
...

@overload
async def get(self, resource: Type[ResourceGenericT], id: SnowflakeT, **kwargs) -> ResourceGenericT:
async def get(self, resource: Type[ResourceGenericT], id: StrOrIntT, **kwargs) -> ResourceGenericT:
...

async def get(self, resource: Type[ResourceGenericT], id: Optional[SnowflakeT] = None, **kwargs) -> ResourceGenericT:
async def get(self, resource: Type[ResourceGenericT], id: Optional[StrOrIntT] = None, **kwargs) -> ResourceGenericT:
"""Get's the exact resource typically by id."""
if id is not None:
kwargs["id"] = id
Expand Down
4 changes: 2 additions & 2 deletions anmoku/clients/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import Any, Mapping, TypeVar, Type, Optional

from .. import resources
from ..typing.anmoku import SnowflakeT
from ..typing.anmoku import StrOrIntT
from ..resources.helpers import SearchResult

ResourceGenericT = TypeVar(
Expand Down Expand Up @@ -70,7 +70,7 @@ def __init__(self, debug: bool = False) -> None:
super().__init__()

@abstractmethod
def get(self, resource: Type[ResourceGenericT], id: Optional[SnowflakeT] = None, **kwargs) -> ResourceGenericT:
def get(self, resource: Type[ResourceGenericT], id: Optional[StrOrIntT] = None, **kwargs) -> ResourceGenericT:
"""Get's the exact resource by id."""
...

Expand Down
6 changes: 3 additions & 3 deletions anmoku/clients/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
if TYPE_CHECKING:
from typing import Any, Optional, Type, Tuple

from ..typing.anmoku import SnowflakeT
from ..typing.anmoku import StrOrIntT
from ..typing.jikan import SearchResultData

from .base import (
Expand Down Expand Up @@ -64,10 +64,10 @@ def get(self, resource: Type[NoArgsResourceGenericT]) -> NoArgsResourceGenericT:
...

@overload
def get(self, resource: Type[ResourceGenericT], id: SnowflakeT, **kwargs) -> ResourceGenericT:
def get(self, resource: Type[ResourceGenericT], id: StrOrIntT, **kwargs) -> ResourceGenericT:
...

def get(self, resource: Type[ResourceGenericT], id: Optional[SnowflakeT] = None, **kwargs) -> ResourceGenericT:
def get(self, resource: Type[ResourceGenericT], id: Optional[StrOrIntT] = None, **kwargs) -> ResourceGenericT:
"""Get's the exact resource typically by id."""
if id is not None:
kwargs["id"] = id
Expand Down
6 changes: 4 additions & 2 deletions anmoku/typing/anmoku.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import annotations
from typing import Union

# TODO: tf, that's not what a snowflake is, what was I on. Rename this.
SnowflakeT = Union[str, int]
StrOrIntT = Union[str, int]
"""
StrOrIntT can be either a number (int) or string. Commonly used in methods that accept ID.
"""

0 comments on commit b9ec517

Please sign in to comment.