Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docstrings to all places applicable #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions pypokedex/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,26 @@

@lru_cache(maxsize=None)
def get(**kwargs) -> Pokemon:
"""Get a Pokemon object based on exactly ONE of the criteria specified
in the keyword argument ``kwargs``

:key name: The name of the Pokemon
:type name: str:

:key dex: The national Pokedex number of the Pokemon
:type name: int:

:raises TypeError: if exactly one argument isn't passed, ``dex`` or ``name``
are of the wrong types, or if they aren't prresent
:raises PyPokedexHTTPError: if an non-success HTTP status code is returned
from PokeAPI while retrieving Pokemon data
:raises PyPokedexError: if an unexpected HTTP error occurs while retrieving
Pokemon data

:return: An instance of a :class:`Pokemon` fitting the passed criteria
if no errors occurred
"""

if len(kwargs) != 1:
raise TypeError("pypokedex.get() expects expects only 1 argument!")

Expand Down