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

This commit is contained in:
Evgenii Alekseev 2022-04-17 19:30:50 +03:00
parent 2414686f3c
commit 58e7ede744
14 changed files with 77 additions and 9 deletions

View File

@ -59,6 +59,8 @@ class Repo:
@property
def repo_path(self) -> Path:
"""
get full path to the repository database
Returns:
Path: path to repository database
"""

View File

@ -64,6 +64,8 @@ class OAuth(Mapping):
@property
def auth_control(self) -> str:
"""
get authorization html control
Returns:
str: login control as html code to insert
"""

View File

@ -65,6 +65,8 @@ class Configuration(configparser.RawConfigParser):
@property
def include(self) -> Path:
"""
get full path to include directory
Returns:
Path: path to directory with configuration includes
"""
@ -73,6 +75,8 @@ class Configuration(configparser.RawConfigParser):
@property
def logging_path(self) -> Path:
"""
get full path to logging configuration
Returns:
Path: path to logging configuration
"""
@ -81,6 +85,8 @@ class Configuration(configparser.RawConfigParser):
@property
def repository_paths(self) -> RepositoryPaths:
"""
construct RepositoryPaths instance based on the configuration
Returns:
RepositoryPaths: repository paths instance
"""

View File

@ -59,6 +59,8 @@ class GPG:
@property
def repository_sign_args(self) -> List[str]:
"""
get command line arguments based on settings
Returns:
List[str]: command line arguments for repo-add command to sign database
"""

View File

@ -63,6 +63,8 @@ class Watcher:
@property
def packages(self) -> List[Tuple[Package, BuildStatus]]:
"""
get current known packages list
Returns:
List[Tuple[Package, BuildStatus]]: list of packages together with their statuses
"""

View File

@ -60,6 +60,8 @@ class WebClient(Client):
@property
def _ahriman_url(self) -> str:
"""
get url for the service status api
Returns:
str: full url for web service for ahriman service itself
"""
@ -68,6 +70,8 @@ class WebClient(Client):
@property
def _login_url(self) -> str:
"""
get url for the login api
Returns:
str: full url for web service to login
"""
@ -76,6 +80,8 @@ class WebClient(Client):
@property
def _status_url(self) -> str:
"""
get url for the status api
Returns:
str: full url for web service for status
"""

View File

@ -50,6 +50,8 @@ class Leaf:
@property
def items(self) -> Iterable[str]:
"""
extract all packages from the leaf
Returns:
Iterable[str]: packages containing in this leaf
"""

View File

@ -57,6 +57,8 @@ class AuthSettings(Enum):
@property
def is_enabled(self) -> bool:
"""
get enabled flag
Returns:
bool: False in case if authorization is disabled and True otherwise
"""

View File

@ -38,11 +38,10 @@ class MigrationResult:
@property
def is_outdated(self) -> bool:
"""
check migration and check if there are pending migrations
Returns:
bool: True in case if it requires migrations and False otherwise
Raises:
MigrationError: if old version is newer than new one or negative
"""
self.validate()
return self.new_version > self.old_version
@ -50,6 +49,9 @@ class MigrationResult:
def validate(self) -> None:
"""
perform version validation
Raises:
MigrationError: if old version is newer than new one or negative
"""
if self.old_version < 0 or self.old_version > self.new_version:
raise MigrationError(f"Invalid current schema version, expected less or equal to {self.new_version}, "

View File

@ -60,14 +60,18 @@ class Package:
@property
def depends(self) -> List[str]:
"""
get package base dependencies
Returns:
List[str]: sum of dependencies per arch package
List[str]: sum of dependencies per each package
"""
return sorted(set(sum([package.depends for package in self.packages.values()], start=[])))
@property
def git_url(self) -> str:
"""
get git clone url
Returns:
str: package git url to clone
"""
@ -76,6 +80,8 @@ class Package:
@property
def groups(self) -> List[str]:
"""
get package base groups
Returns:
List[str]: sum of groups per each package
"""
@ -84,6 +90,8 @@ class Package:
@property
def is_single_package(self) -> bool:
"""
is it possible to transform package base to single package or not
Returns:
bool: true in case if this base has only one package with the same name
"""
@ -92,8 +100,10 @@ class Package:
@property
def is_vcs(self) -> bool:
"""
get VCS flag based on the package base
Returns:
bool: True in case if package base looks like VCS package and false otherwise
bool: True in case if package base looks like VCS package and False otherwise
"""
return self.base.endswith("-bzr") \
or self.base.endswith("-csv")\
@ -105,6 +115,8 @@ class Package:
@property
def licenses(self) -> List[str]:
"""
get package base licenses
Returns:
List[str]: sum of licenses per each package
"""
@ -113,6 +125,8 @@ class Package:
@property
def web_url(self) -> str:
"""
get package url which can be used to see package in web
Returns:
str: package AUR url
"""

View File

@ -61,6 +61,8 @@ class PackageDescription:
@property
def filepath(self) -> Optional[Path]:
"""
wrapper for filename, convert it to Path object
Returns:
Optional[Path]: path object for current filename
"""

View File

@ -45,16 +45,20 @@ class RepositoryPaths:
@property
def cache(self) -> Path:
"""
get directory for packages cache (mainly used for VCS packages)
Returns:
Path: directory for packages cache (mainly used for VCS packages)
Path: full path to cache directory
"""
return self.root / "cache"
@property
def chroot(self) -> Path:
"""
get directory for devtools chroot
Returns:
Path: directory for devtools chroot
Path: full patch to devtools chroot directory
"""
# for the chroot directory devtools will create own tree, and we don"t have to specify architecture here
return self.root / "chroot"
@ -62,22 +66,28 @@ class RepositoryPaths:
@property
def packages(self) -> Path:
"""
get directory for built packages
Returns:
Path: directory for built packages
Path: full path to built packages directory
"""
return self.root / "packages" / self.architecture
@property
def repository(self) -> Path:
"""
get repository directory
Returns:
Path: repository directory
Path: full path to the repository directory
"""
return self.root / "repository" / self.architecture
@property
def root_owner(self) -> Tuple[int, int]:
"""
get UID and GID of the root directory
Returns:
Tuple[int, int]: owner user and group of the root directory
"""

View File

@ -46,6 +46,8 @@ class Result:
@property
def failed(self) -> List[Package]:
"""
get list of failed packages
Returns:
List[Package]: list of packages which were failed
"""
@ -54,6 +56,8 @@ class Result:
@property
def is_empty(self) -> bool:
"""
get if build result is empty or not
Returns:
bool: True in case if success list is empty and False otherwise
"""
@ -62,6 +66,8 @@ class Result:
@property
def success(self) -> List[Package]:
"""
get list of success builds
Returns:
List[Package]: list of packages with success result
"""

View File

@ -38,6 +38,8 @@ class BaseView(View):
@property
def configuration(self) -> Configuration:
"""
get configuration instance
Returns:
Configuration: configuration instance
"""
@ -47,6 +49,8 @@ class BaseView(View):
@property
def database(self) -> SQLite:
"""
get database instance
Returns:
SQLite: database instance
"""
@ -56,6 +60,8 @@ class BaseView(View):
@property
def service(self) -> Watcher:
"""
get status watcher instance
Returns:
Watcher: build status watcher instance
"""
@ -65,6 +71,8 @@ class BaseView(View):
@property
def spawner(self) -> Spawn:
"""
get process spawner instance
Returns:
Spawn: external process spawner instance
"""
@ -74,6 +82,8 @@ class BaseView(View):
@property
def validator(self) -> Auth:
"""
get authorization instance
Returns:
Auth: authorization service instance
"""