Skip to content

Commit

Permalink
Merge pull request #34 from lasersPew/spelling
Browse files Browse the repository at this point in the history
Fix grammatical, spelling and formatting errors  in the codebase.
  • Loading branch information
EMACC99 committed Apr 8, 2024
2 parents c89bd41 + 4b189ce commit 9ffb689
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 74 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Anyone is free to contribute to this proyect, just try to follow the codestyle (desired but not obligaded).
Anyone is free to contribute to this project, just try to follow the code style (desired but not obligated).
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ Get your manga follow list!

### Get Logged User Followed Groups

Get the list of the Scanlination group you follow!
Get the list of the Scanlation group you follow!

```py
>>> scangroups_followlist = api.get_my_followed_groups()
Expand Down
109 changes: 54 additions & 55 deletions mangadex/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def get_manga_list(self, **kwargs) -> List[Manga]:
Parameters
-------------
This parameters may be used by ohter methods
This parameters may be used by other methods
### QueryParams:
limit : `int`
Expand All @@ -94,7 +94,7 @@ def get_manga_list(self, **kwargs) -> List[Manga]:
includedTags : `List[Tag.id]`
includedTagsMode: `str`. Default `"AND"`. Enum: `"AND"` `"OR"`
excludedTags : `List[Tag.id]`
exludedTagsMode : `str`. Default `"AND"`, Enum : `"AND"`, `"OR"`
excludedTagsMode : `str`. Default `"AND"`, Enum : `"AND"`, `"OR"`
status : `List[str]`. Items Enum : `"ongoing"`, `"completed"`, `"hiatus"`, `"cancelled"`
originalLanguage : `List[str]`
publicationDemographic : `List[str]`. Items Enum: `"shounen"` `"shoujo"` `"josei"` `"seinen"` `"none"`
Expand Down Expand Up @@ -166,7 +166,7 @@ def create_manga(self, title: str, **kwargs) -> Manga:
description : `Dict[str,str]`. The alt titles in different languages
authors : `List[str]`. The list of author id's
artists : `List[str]`. The list of artist id's
links : `Dict[str,str]`. The links in differents sites (al, ap, bw, mu, etc).
links : `Dict[str,str]`. The links in different sites (al, ap, bw, mu, etc.).
Please refer to the [documentation](https://api.mangadex.org/docs.html#section/Static-data/Manga-links-data)
originalLanguage : `str`. The original Language
lastVolume : `str`. The last volume
Expand Down Expand Up @@ -210,7 +210,7 @@ def get_manga_volumes_and_chapters(self, manga_id: str, **kwargs) -> Dict[str, s
return resp["volumes"]

def update_manga(
self, manga_id: str, ObjReturn: bool = False, **kwargs
self, manga_id: str, ObjReturn: bool = False, **kwargs
) -> Union[Manga, None]:
"""
Updates a manga parameters
Expand All @@ -228,7 +228,7 @@ def update_manga(
description : `Dict[str,str]`. The alt titles in different languages
authors : `List[str]`. The list of author id's
artists : `List[str]`. The list of artist id's
links : `Dict[str,str]`. The links in differents sites (al, ap, bw, mu, etc). Please refer to the [documentation](https://api.mangadex.org/docs.html#section/Static-data/Manga-links-data)
links : `Dict[str,str]`. The links in different sites (al, ap, bw, mu, etc.). Please refer to the [documentation](https://api.mangadex.org/docs.html#section/Static-data/Manga-links-data)
originalLanguage : `str`. The original Language
lastVolume : `str`. The last volume
lastChapter : `str`. The last chapter
Expand Down Expand Up @@ -256,15 +256,15 @@ def delete_manga(self, manga_id: str) -> None:
Parameters
------------
id : `str`. The manga id
manga_id : `str`. The manga id
"""
url = f"{self.URL}/manga{manga_id}"
URLRequest.request_url(url, "DELETE", headers=self.bearer, timeout=self.timeout)

def get_manga_read_markes(self, manga_id: str) -> List[Chapter]:
def get_manga_read_markers(self, manga_id: str) -> List[Chapter]:
# this needs a performance update
"""
A list of Chapter Id's That are marked fro the given manga Id
A list of Chapter ids That are marked from the given manga id
Parameters
------------
Expand Down Expand Up @@ -309,7 +309,7 @@ def manga_feed(self, manga_id: str, **kwargs) -> List[Chapter]:
limit : `int`
offset : `int`
translatedLanguage : `List[str]`. The translated laguages to query
translatedLanguage : `List[str]`. The translated languages to query
createdAtSince : `str`. Datetime String with the following format YYYY-MM-DDTHH:MM:SS
updatedAtSince : `str`. Datetime String with the following format YYYY-MM-DDTHH:MM:SS
Expand Down Expand Up @@ -340,7 +340,7 @@ def __parse_chapter_list_args(params: Dict[str, str]) -> Dict[str, str]:
def chapter_list(self, **kwargs) -> List[Chapter]:
"""
The list of chapters.
To get the chpaters of a specific manga the manga parameter must be provided
To get the chapters of a specific manga the manga parameter must be provided
Parameters
-----------
Expand All @@ -361,7 +361,7 @@ def chapter_list(self, **kwargs) -> List[Chapter]:
Returns
----------
`List[Chpater]` A list of Chpater Objects
`List[Chapter]` A list of Chapter Objects
Raises
-------------
Expand All @@ -378,7 +378,7 @@ def get_chapter(self, chapter_id: str) -> Chapter:
Parameters
------------
id : `str` The chapter id
chapter_id : `str` The chapter id
Returns
------------
Expand Down Expand Up @@ -420,7 +420,7 @@ def get_author(self, **kwargs) -> List[Author]:

def get_author_by_id(self, author_id: str) -> Author:
"""
Get's an author by its id
Requests the author by its id
Parameters
-------------
Expand All @@ -439,7 +439,7 @@ def get_author_by_id(self, author_id: str) -> Author:
return Author.author_from_dict(resp)

def create_author(
self, name: str, version: int, ObjReturn: bool = False
self, name: str, version: int, ObjReturn: bool = False
) -> Union[Author, None]:
"""
Creates an Author
Expand All @@ -448,7 +448,7 @@ def create_author(
--------------
name : `str`. The author name
version : `int`. The version of the author
ObjReturn : `bool`. `True` if you want a Author Object return
ObjReturn : `bool`. `True` if you want to return an Author Object
Returns
--------------
Expand All @@ -463,12 +463,12 @@ def create_author(
return Author.author_from_dict(resp)

def update_author(
self,
*,
author_id: str,
version: int,
name: Union[str, None] = None,
ObjReturn: bool = False,
self,
*,
author_id: str,
version: int,
name: Union[str, None] = None,
ObjReturn: bool = False,
) -> Union[Author, None]:
"""
Updates an Author
Expand All @@ -478,7 +478,7 @@ def update_author(
author_id : `str`. Required. The author id
version : `int`. Required
name : `str`.
ObjReturn : `bool`. `True` if you want a Author Object return
ObjReturn : `bool`. `True` if you want to return an Author Object
Returns
-----------
Expand Down Expand Up @@ -528,12 +528,12 @@ def get_user(self, user_id: str) -> User:
return User.user_from_dict(resp)

def scanlation_group_list(
self,
*,
limit: Union[None, int] = None,
offset: Union[None, int] = None,
group_ids: Union[None, List[str]] = None,
name: Union[str, None] = None,
self,
*,
limit: Union[None, int] = None,
offset: Union[None, int] = None,
group_ids: Union[None, List[str]] = None,
name: Union[str, None] = None,
) -> List[ScanlationGroup]:
"""
Get the scanlation groups list
Expand Down Expand Up @@ -580,6 +580,7 @@ def login(self, username: str, password: str):
"""
self.__auth_handler(json_payload={"username": username, "password": password})


def me(self) -> User:
"""
Get your user info
Expand Down Expand Up @@ -615,7 +616,7 @@ def get_my_mangalist(self, **kwargs) -> List[Manga]:

def get_my_followed_groups(self, **kwargs) -> List[ScanlationGroup]:
"""
Get the Scanlination Groups you follow
Get the Scanlation Groups you follow
Parameters
-------------
Expand Down Expand Up @@ -673,7 +674,7 @@ def get_manga_reading_status(self, manga_id: Union[str, int]) -> str:
return resp["status"]

def get_all_manga_reading_status(
self, status: Union[str, None] = None
self, status: Union[str, None] = None
) -> Dict[str, str]:
"""
Get all Manga followed by the user reading status
Expand Down Expand Up @@ -728,7 +729,7 @@ def unfollow_manga(self, manga_id: str) -> None:

def update_manga_reading_status(self, manga_id: str, status: str) -> None:
"""
Update the reading stauts of a manga
Update the reading status of a manga
Parameters
-------------
Expand All @@ -754,8 +755,8 @@ def add_manga_to_customlist(self, manga_id: str, list_id: str) -> None:
Parameters
--------------
id : `str`. The manga id.
listId : `str`. The list id.
manga_id : `str`. The manga id.
list_id : `str`. The list id.
"""
url = f"{self.URL}/{manga_id}/list{list_id}"
URLRequest.request_url(url, "POST", headers=self.bearer, timeout=self.timeout)
Expand All @@ -766,18 +767,18 @@ def remove_manga_from_customlist(self, manga_id: str, list_id: str) -> None:
Parameters
------------
id : `str`. The manga id
listId : `str`. The list id
manga_id : `str`. The manga id
list_id : `str`. The list id
"""
url = f"{self.URL}/manga/{manga_id}/list/{list_id}"
URLRequest.request_url(url, "DELETE", headers=self.bearer, timeout=self.timeout)

def create_customlist(
self,
name: str,
visibility: str = "public",
manga: Union[List[str], None] = None,
version: int = 1,
self,
name: str,
visibility: str = "public",
manga: Union[List[str], None] = None,
version: int = 1,
) -> None:
"""
Creates a custom list
Expand All @@ -791,9 +792,7 @@ def create_customlist(
manga : `List[str]`. List of manga ids
"""
url = f"{self.URL}/list"
params = {"name": name, "version": version}
params["visibility"] = visibility
params["manga[]"] = manga
params = {"name": name, "version": version, "visibility": visibility, "manga[]": manga}
URLRequest.request_url(url, "POST", params=params, timeout=self.timeout)

def get_customlist(self, customlist_id: str, **kwargs) -> CustomList:
Expand Down Expand Up @@ -860,7 +859,7 @@ def get_my_customlists(self, **kwargs) -> List[CustomList]:
------------
### QueryParams:
limit : `int`. The limit of custom lists to return
offset : `int`. The amout of offset
offset : `int`. The amount of offset
Returns
----------
Expand All @@ -882,7 +881,7 @@ def get_user_customlists(self, user_id: str, **kwargs) -> List[CustomList]:
### QueryParams:
limit : `int`. The limit of custom lists to return
offset : `int`. The amout of offset
offset : `int`. The amount of offset
Returns
----------
Expand Down Expand Up @@ -911,8 +910,8 @@ def get_coverart_list(self, **kwargs):
Optional parameters
-------------------------
manga : List[str]. Manga ids
ids : List[str]. Cover ids
manga_ids : List[str]. Manga ids
chapter_ids : List[str]. Cover ids
uploaders : List[str]. User ids
"""
params = Api.__parse_coverart_params(kwargs)
Expand All @@ -922,7 +921,7 @@ def get_coverart_list(self, **kwargs):

def get_cover(self, cover_id: str) -> CoverArt:
"""
Gets a cover image
Requests a cover image
Parameters
--------------
Expand All @@ -937,7 +936,7 @@ def get_cover(self, cover_id: str) -> CoverArt:
return CoverArt.cover_from_dict(resp)

def upload_cover(
self, manga_id: str, filename: str, ObjReturn: bool = False
self, manga_id: str, filename: str, ObjReturn: bool = False
) -> Union[CoverArt, None]:
"""
Uploads a cover
Expand Down Expand Up @@ -966,12 +965,12 @@ def upload_cover(
return CoverArt.cover_from_dict(resp) if ObjReturn else None

def edit_cover(
self,
cover_id: str,
description: str,
volume: Union[str, None] = None,
version: Union[int, None] = None,
ObjReturn: bool = False,
self,
cover_id: str,
description: str,
volume: Union[str, None] = None,
version: Union[int, None] = None,
ObjReturn: bool = False,
) -> Union[None, CoverArt]:
"""
Edit a cover parameters
Expand Down
6 changes: 3 additions & 3 deletions mangadex/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def manga_from_dict(cls, data: dict):
pass

if data["type"] != "manga" or not data:
raise MangaError(data=data, message="The data probvided is not a Manga")
raise MangaError(data=data, message="The data provided is not a Manga")

attributes = data["attributes"]

Expand Down Expand Up @@ -400,7 +400,7 @@ def __init__(self) -> None:
@classmethod
def author_from_dict(cls, data: dict):
"""
Creates Autho from JSON
Creates Author from JSON
"""
try:
data = data["data"]
Expand Down Expand Up @@ -628,7 +628,7 @@ def fetch_cover_image(self, quality: str = "source") -> str:
"""
Returns the url of a cover art
Parametes
Parameters
-------------
quality : `str`. Values : `medium`, `small`
Expand Down
8 changes: 4 additions & 4 deletions mangadex/url_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,27 @@ def request_url(
try:
resp = requests.get(url, headers=headers, timeout=timeout)
except requests.RequestException as e:
print(f"An error has occured: {e}")
print(f"An error has occurred: {e}")
raise
elif method == "POST":
try:
resp = requests.post(url, json=params, headers=headers, timeout=timeout)
except requests.RequestException as e:
print(f"An error has occured: {e}")
print(f"An error has occurred: {e}")
raise
elif method == "DELETE":
try:
resp = requests.delete(url, headers=headers, timeout=timeout)
except requests.RequestException as e:
print(f"An error has occured: {e}")
print(f"An error has occurred: {e}")
raise
elif method == "PUT":
try:
resp = requests.put(
url, headers=headers, params=params, timeout=timeout
)
except requests.RequestException as e:
print(f"An error has occured: {e}")
print(f"An error has occurred: {e}")
raise
else:
raise ValueError(f"Method {method} is invalid")
Expand Down
Loading

0 comments on commit 9ffb689

Please sign in to comment.