Fixed grammar, unified the docstring's format and added documentation to some classes that did not have any. Closes #32.

This commit is contained in:
eichhornchen
2020-12-13 21:29:25 +01:00
parent 3f62fbaa2b
commit 646e0063be
24 changed files with 254 additions and 170 deletions

View File

@ -13,9 +13,9 @@ from .translations import gettext as _
class Settings:
"""
This class stores the settings of the game.
Settings can be get by using for example settings.TEXTURE_PACK directly.
The comment can be get by using settings.get_comment('TEXTURE_PACK').
We can define the setting by simply use settings.TEXTURE_PACK = 'new_key'
Settings can be obtained by using for example settings.TEXTURE_PACK directly.
The comment can be obtained by using settings.get_comment('TEXTURE_PACK').
We can set the setting by simply using settings.TEXTURE_PACK = 'new_key'
"""
def __init__(self):
self.KEY_UP_PRIMARY = ['z', 'Main key to move up']
@ -50,7 +50,7 @@ class Settings:
def get_comment(self, item: str) -> str:
"""
Retrieve the comment of a setting.
Retrieves the comment relative to a setting.
"""
if item in self.settings_keys:
return _(object.__getattribute__(self, item)[1])
@ -61,13 +61,13 @@ class Settings:
@property
def settings_keys(self) -> Generator[str, Any, None]:
"""
Get the list of all parameters.
Gets the list of all parameters.
"""
return (key for key in self.__dict__)
def loads_from_string(self, json_str: str) -> None:
"""
Dump settings
Loads settings.
"""
d = json.loads(json_str)
for key in d:
@ -75,7 +75,7 @@ class Settings:
def dumps_to_string(self) -> str:
"""
Dump settings
Dumps settings.
"""
d = dict()
for key in self.settings_keys: