Docstring update (#58)

* migrate docstrings from reST to google format

* add raises note

Also change behaviour of the `from_option` method to fallback to
disabled instead of raising exception on unknown option

* fix part of warnings for sphinx

* make identation a bit more readable

* review fixes

* add verbose description for properties to make them parsed by sphinx extenstion

* add demo sphinx generator
This commit is contained in:
2022-04-17 20:25:28 +03:00
committed by GitHub
parent 06bd29b78d
commit 4daff81d5f
203 changed files with 5246 additions and 1636 deletions

View File

@ -11,7 +11,14 @@ from ahriman.web.middlewares.auth_handler import AuthorizationPolicy
def authorization_policy(configuration: Configuration, database: SQLite, user: User) -> AuthorizationPolicy:
"""
fixture for authorization policy
:return: authorization policy fixture
Args:
configuration(Configuration): configuration fixture
database(SQLite): database fixture
user(User): user fixture
Returns:
AuthorizationPolicy: authorization policy fixture
"""
configuration.set_option("auth", "target", "configuration")
validator = Auth.load(configuration, database)

View File

@ -14,8 +14,12 @@ from ahriman.web.middlewares.auth_handler import auth_handler, AuthorizationPoli
def _identity(username: str) -> str:
"""
generate identity from user
:param username: name of the user
:return: user identity string
Args:
username(str): name of the user
Returns:
str: user identity string
"""
return f"{username} {UserIdentity.expire_when(60)}"

View File

@ -13,8 +13,12 @@ from ahriman.web.middlewares.exception_handler import exception_handler
def _extract_body(response: Any) -> Any:
"""
extract json body from given object
:param response: response (any actually) object
:return: body key from the object converted to json
Args:
response(Any): response (any actually) object
Returns:
Any: body key from the object converted to json
"""
return json.loads(getattr(response, "body"))