mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-07-30 06:09:56 +00:00
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:
@ -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)
|
||||
|
@ -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)}"
|
||||
|
||||
|
@ -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"))
|
||||
|
||||
|
Reference in New Issue
Block a user