@@ -34,9 +34,9 @@ class Character(abc.Character):
3434 The name of the character.
3535
3636 deletion_date: Optional[:class:`datetime.datetime`]
37- The date where the character will be deleted.
37+ The date where the character will be deleted if it is scheduled for deletion .
3838
39- former_names: :class:`list`
39+ former_names: List[ :class:`str`]
4040 Previous names of this character.
4141
4242 sex: :class:`str`
@@ -55,7 +55,7 @@ class Character(abc.Character):
5555 The character's current world
5656
5757 former_world: Optional[:class:`str`]
58- The previous world where the character was in.
58+ The previous world where the character was in, in the last 6 months .
5959
6060 residence: :class:`str`
6161 The current hometown of the character.
@@ -70,18 +70,18 @@ class Character(abc.Character):
7070 The guild the character is a member of. The dictionary contains a key for the rank and a key for the name.
7171
7272 last_login: Optional[:class:`datetime.datetime`]
73- The last time the character logged in.
73+ The last time the character logged in. It will be None if the character has never logged in.
7474
7575 comment: Optional[:class:`str`]
7676 The displayed comment.
7777
7878 account_status: :class:`str`
7979 Whether the character's account is Premium or Free.
8080
81- achievements: :class:`list` of :class:` dict`
82- The achievement chosen to be displayed.
81+ achievements: List[ :class:`dict`]
82+ The achievements chosen to be displayed.
8383
84- deaths: :class:`list` of :class:` Death`
84+ deaths: List[ :class:`Death`]
8585 The character's recent deaths.
8686
8787 account_information: :class:`dict`
@@ -128,6 +128,17 @@ def guild_rank(self):
128128
129129 @staticmethod
130130 def _beautiful_soup (content ):
131+ """
132+ Parses HTML content into a BeautifulSoup object.
133+ Parameters
134+ ----------
135+ content: :class:`str`
136+ The HTML content.
137+
138+ Returns
139+ -------
140+ :class:`bs4.BeautifulSoup`: The parsed content.
141+ """
131142 return bs4 .BeautifulSoup (content , 'html.parser' , parse_only = bs4 .SoupStrainer ("div" , class_ = "BoxContent" ))
132143
133144 @staticmethod
@@ -143,6 +154,7 @@ def _parse(content):
143154 Returns
144155 -------
145156 :class:`dict[str, Any]`
157+ A dictionary containing all the character's information.
146158 """
147159 parsed_content = Character ._beautiful_soup (content )
148160 tables = Character ._parse_tables (parsed_content )
@@ -166,7 +178,7 @@ def _parse_account_information(char, rows):
166178 ----------
167179 char: :class:`dict`[str,Any]
168180 Dictionary where information will be stored.
169- rows: :class:`List[ bs4.Tag]`
181+ rows: List[ :class:`bs4.Tag`]
170182 A list of all rows contained in the table.
171183 """
172184 char ["account_information" ] = {}
@@ -187,7 +199,7 @@ def _parse_achievements(char, rows):
187199 ----------
188200 char: :class:`dict`[str,Any]
189201 Dictionary where information will be stored.
190- rows: :class:`List[ bs4.Tag]`
202+ rows: List[ :class:`bs4.Tag`]
191203 A list of all rows contained in the table.
192204 """
193205 achievements = []
@@ -213,7 +225,7 @@ def _parse_character_information(char, rows):
213225 ----------
214226 char: :class:`dict`[str,Any]
215227 Dictionary where information will be stored.
216- rows: :class:`List[ bs4.Tag]`
228+ rows: List[ :class:`bs4.Tag`]
217229 A list of all rows contained in the table.
218230 """
219231 int_rows = ["level" , "achievement_points" ]
@@ -274,7 +286,7 @@ def _parse_deaths(char, rows):
274286 ----------
275287 char: :class:`dict`[str,Any]
276288 Dictionary where information will be stored.
277- rows: :class:`List[ bs4.Tag]`
289+ rows: List[ :class:`bs4.Tag`]
278290 A list of all rows contained in the table.
279291 """
280292 deaths = []
@@ -328,7 +340,7 @@ def _parse_other_characters(char, rows):
328340 ----------
329341 char: :class:`dict`[str,Any]
330342 Dictionary where information will be stored.
331- rows: :class:`List[ bs4.Tag]`
343+ rows: List[ :class:`bs4.Tag`]
332344 A list of all rows contained in the table.
333345 """
334346 char ["other_characters" ] = []
@@ -394,31 +406,27 @@ def _split_list(items, separator=",", last_separator=" and "):
394406 return [e .strip () for e in items ]
395407
396408 @staticmethod
397- def parse_to_json ( content , indent = None ):
398- """Static method that creates a JSON string from the html content of the character's page .
409+ def get_url ( name ):
410+ """Gets the Tibia.com URl for a given character name .
399411
400412 Parameters
401- -------------
402- content: :class:`str`
403- The HTML content of the page.
404- indent: :class:`int`
405- The number of spaces to indent the output with.
413+ ------------
414+ name: str
415+ The name of the character
406416
407417 Returns
408- ------------
409- :class:`str`
410- A string in JSON format."""
411- char_dict = Character ._parse (content )
412- return json .dumps (char_dict , indent = indent )
418+ --------
419+ str
420+ The URL to the character's page"""
421+ return CHARACTER_URL + urllib .parse .quote (name .encode ('iso-8859-1' ))
413422
414423 @staticmethod
415424 def from_content (content ) -> Optional ['Character' ]:
416425 """Creates an instance of the class from the html content of the character's page.
417426
418-
419427 Parameters
420428 -----------
421- content: str
429+ content: :class:` str`
422430 The HTML content of the page.
423431
424432 Returns
@@ -461,19 +469,23 @@ def from_content(content) -> Optional['Character']:
461469 return char
462470
463471 @staticmethod
464- def get_url ( name ):
465- """Gets the Tibia.com URl for a given character name .
472+ def parse_to_json ( content , indent = None ):
473+ """Static method that creates a JSON string from the html content of the character's page .
466474
467475 Parameters
468- ------------
469- name: str
470- The name of the character
476+ -------------
477+ content: :class:`str`
478+ The HTML content of the page.
479+ indent: :class:`int`
480+ The number of spaces to indent the output with.
471481
472482 Returns
473- --------
474- str
475- The URL to the character's page"""
476- return CHARACTER_URL + urllib .parse .quote (name .encode ('iso-8859-1' ))
483+ ------------
484+ :class:`str`
485+ A string in JSON format.
486+ """
487+ char_dict = Character ._parse (content )
488+ return json .dumps (char_dict , indent = indent )
477489
478490
479491class Death :
0 commit comments