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 @property
def repo_path(self) -> Path: def repo_path(self) -> Path:
""" """
get full path to the repository database
Returns: Returns:
Path: path to repository database Path: path to repository database
""" """

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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