docs: restore docs for the view

This commit is contained in:
Evgenii Alekseev 2023-12-15 14:45:07 +02:00
parent e784032bc6
commit 58e702213d
11 changed files with 30 additions and 10 deletions

View File

@ -38,6 +38,14 @@ ahriman.web.views.static module
:no-undoc-members: :no-undoc-members:
:show-inheritance: :show-inheritance:
ahriman.web.views.status\_view\_guard module
--------------------------------------------
.. automodule:: ahriman.web.views.status_view_guard
:members:
:no-undoc-members:
:show-inheritance:
Module contents Module contents
--------------- ---------------

View File

@ -590,6 +590,15 @@ _set_new_action() {
# ${!x} -> ${hello} -> "world" # ${!x} -> ${hello} -> "world"
_shtab_ahriman() { _shtab_ahriman() {
local completing_word="${COMP_WORDS[COMP_CWORD]}" local completing_word="${COMP_WORDS[COMP_CWORD]}"
local completed_positional_actions
local current_action
local current_action_args_start_index
local current_action_choices
local current_action_compgen
local current_action_is_positional
local current_action_nargs
local current_option_strings
local sub_parsers
COMPREPLY=() COMPREPLY=()
local prefix=_shtab_ahriman local prefix=_shtab_ahriman

View File

@ -117,7 +117,7 @@ class Application(ApplicationPackages, ApplicationRepository):
Returns: Returns:
list[Package]: updated packages list. Packager for dependencies will be copied from list[Package]: updated packages list. Packager for dependencies will be copied from
original package original package
""" """
def missing_dependencies(source: Iterable[Package]) -> dict[str, str | None]: def missing_dependencies(source: Iterable[Package]) -> dict[str, str | None]:
# append list of known packages with packages which are in current sources # append list of known packages with packages which are in current sources

View File

@ -79,7 +79,7 @@ class Patch(Handler):
Returns: Returns:
tuple[str, PkgbuildPatch]: package base and created PKGBUILD patch based on the diff from master HEAD tuple[str, PkgbuildPatch]: package base and created PKGBUILD patch based on the diff from master HEAD
to current files to current files
""" """
package = Package.from_build(sources_dir, architecture, None) package = Package.from_build(sources_dir, architecture, None)
patch = Sources.patch_create(sources_dir, *track) patch = Sources.patch_create(sources_dir, *track)

View File

@ -125,7 +125,7 @@ class Validate(Handler):
Returns: Returns:
dict[str, Any]: schema with added elements from source schema if they were set before and not presented dict[str, Any]: schema with added elements from source schema if they were set before and not presented
in the new one. Note, that schema will be modified in-place in the new one. Note, that schema will be modified in-place
""" """
for key, value in source.items(): for key, value in source.items():
if key not in schema: if key not in schema:

View File

@ -184,7 +184,7 @@ class Tree:
Returns: Returns:
list[list[Package]]: list of packages lists based on their dependencies. The amount of elements in each list[list[Package]]: list of packages lists based on their dependencies. The amount of elements in each
sublist is less or equal to ``count`` sublist is less or equal to ``count``
Raises: Raises:
PartitionError: in case if it is impossible to divide tree by specified amount of partitions PartitionError: in case if it is impossible to divide tree by specified amount of partitions

View File

@ -505,7 +505,7 @@ class Package(LazyLogging):
Returns: Returns:
bool: True in case if package was built after the specified date and False otherwise. In case if build date bool: True in case if package was built after the specified date and False otherwise. In case if build date
is not set by any of packages, it returns False is not set by any of packages, it returns False
""" """
return any( return any(
package.build_date > timestamp package.build_date > timestamp

View File

@ -75,7 +75,7 @@ class RepositoryPaths(LazyLogging):
Returns: Returns:
Path: relative path which contains only architecture segment in case if legacy tree is used and repository Path: relative path which contains only architecture segment in case if legacy tree is used and repository
name and architecture otherwise name and architecture otherwise
""" """
if not self._force_current_tree: if not self._force_current_tree:
if (self._repository_root / self.repository_id.architecture).is_dir(): if (self._repository_root / self.repository_id.architecture).is_dir():
@ -181,7 +181,7 @@ class RepositoryPaths(LazyLogging):
Returns: Returns:
set[str]: list of repository names for which there is created tree. Returns empty set in case if repository set[str]: list of repository names for which there is created tree. Returns empty set in case if repository
is loaded in legacy mode is loaded in legacy mode
""" """
# simply walk through the root. In case if there are subdirectories, emit the name # simply walk through the root. In case if there are subdirectories, emit the name
def walk(paths: RepositoryPaths) -> Generator[str, None, None]: def walk(paths: RepositoryPaths) -> Generator[str, None, None]:

View File

@ -49,7 +49,7 @@ class Waiter:
Returns: Returns:
bool: True in case current monotonic time is more than :attr:`start_time` and :attr:`wait_timeout` bool: True in case current monotonic time is more than :attr:`start_time` and :attr:`wait_timeout`
doesn't equal to 0 doesn't equal to 0
""" """
since_start: float = time.monotonic() - self.start_time since_start: float = time.monotonic() - self.start_time
return self.wait_timeout != 0 and since_start > self.wait_timeout return self.wait_timeout != 0 and since_start > self.wait_timeout

View File

@ -125,7 +125,7 @@ class BaseView(View, CorsViewMixin):
Returns: Returns:
list[str]: list of routes defined for the view. By default, it tries to read :attr:`ROUTES` option if set list[str]: list of routes defined for the view. By default, it tries to read :attr:`ROUTES` option if set
and returns empty list otherwise and returns empty list otherwise
""" """
del configuration del configuration
return cls.ROUTES return cls.ROUTES

View File

@ -21,6 +21,9 @@ from ahriman.core.configuration import Configuration
class StatusViewGuard: class StatusViewGuard:
"""
helper for check if status routes are enabled
"""
ROUTES: list[str] ROUTES: list[str]
@ -34,7 +37,7 @@ class StatusViewGuard:
Returns: Returns:
list[str]: list of routes defined for the view. By default, it tries to read :attr:`ROUTES` option if set list[str]: list of routes defined for the view. By default, it tries to read :attr:`ROUTES` option if set
and returns empty list otherwise and returns empty list otherwise
""" """
if configuration.getboolean("web", "service_only", fallback=False): if configuration.getboolean("web", "service_only", fallback=False):
return [] return []