Skip to content

Commit

Permalink
docs: update booleans in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
arcan1s committed Sep 4, 2024
1 parent 264aeb7 commit 950b9e4
Show file tree
Hide file tree
Showing 39 changed files with 75 additions and 72 deletions.
4 changes: 2 additions & 2 deletions src/ahriman/application/handlers/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def call(cls, args: argparse.Namespace, repository_id: RepositoryId) -> bool:
repository_id(RepositoryId): repository unique identifier
Returns:
bool: True on success, False otherwise
bool: ``True`` on success, ``False`` otherwise
"""
try:
configuration = Configuration.from_path(args.configuration, repository_id)
Expand Down Expand Up @@ -129,7 +129,7 @@ def check_if_empty(enabled: bool, predicate: bool) -> None:
check condition and flag and raise ExitCode exception in case if it is enabled and condition match
Args:
enabled(bool): if False no check will be performed
enabled(bool): if ``False`` no check will be performed
predicate(bool): indicates condition on which exception should be thrown
Raises:
Expand Down
6 changes: 3 additions & 3 deletions src/ahriman/application/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def perform_lock(fd: int) -> bool:
fd(int): file descriptor:
Returns:
bool: True in case if file is locked and False otherwise
bool: ``True`` in case if file is locked and ``False`` otherwise
"""
try:
fcntl.flock(fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
Expand All @@ -121,7 +121,7 @@ def _watch(self) -> bool:
watch until lock disappear
Returns:
bool: True in case if file is locked and False otherwise
bool: ``True`` in case if file is locked and ``False`` otherwise
"""
# there are reasons why we are not using inotify here. First of all, if we would use it, it would bring to
# race conditions because multiple processes will be notified at the same time. Secondly, it is good library,
Expand Down Expand Up @@ -225,7 +225,7 @@ def __exit__(self, exc_type: type[Exception] | None, exc_val: Exception | None,
exc_tb(TracebackType): exception traceback if any
Returns:
Literal[False]: always False (do not suppress any exception)
Literal[False]: always ``False`` (do not suppress any exception)
"""
self.clear()
status = BuildStatusEnum.Success if exc_val is None else BuildStatusEnum.Failed
Expand Down
2 changes: 1 addition & 1 deletion src/ahriman/core/alpm/pacman_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def is_outdated(self, url: str, local_path: Path) -> bool:
local_path(Path): path to locally stored file
Returns:
bool: True in case if remote file is newer than local file
bool: ``True`` in case if remote file is newer than local file
Raises:
PacmanError: in case if no last-modified header was found
Expand Down
6 changes: 3 additions & 3 deletions src/ahriman/core/auth/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ async def check_credentials(self, username: str, password: str | None) -> bool:
password(str | None): entered password
Returns:
bool: True in case if password matches, False otherwise
bool: ``True`` in case if password matches, ``False`` otherwise
"""
del username, password
return True
Expand All @@ -109,7 +109,7 @@ async def known_username(self, username: str) -> bool:
username(str): username
Returns:
bool: True in case if user is known and can be authorized and False otherwise
bool: ``True`` in case if user is known and can be authorized and ``False`` otherwise
"""
del username
return True
Expand All @@ -124,7 +124,7 @@ async def verify_access(self, username: str, required: UserAccess, context: str
context(str | None): URI request path
Returns:
bool: True in case if user is allowed to do this request and False otherwise
bool: ``True`` in case if user is allowed to do this request and ``False`` otherwise
"""
del username, required, context
return True
8 changes: 4 additions & 4 deletions src/ahriman/core/auth/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async def authorized_userid(*args: Any, **kwargs: Any) -> Any:
**kwargs(Any): named argument list as provided by authorized_userid function
Returns:
Any: None in case if no aiohttp_security module found and function call otherwise
Any: ``None`` in case if no aiohttp_security module found and function call otherwise
"""
if _has_aiohttp_security:
return await aiohttp_security.authorized_userid(*args, **kwargs) # pylint: disable=no-value-for-parameter
Expand All @@ -54,7 +54,7 @@ async def check_authorized(*args: Any, **kwargs: Any) -> Any:
**kwargs(Any): named argument list as provided by authorized_userid function
Returns:
Any: None in case if no aiohttp_security module found and function call otherwise
Any: ``None`` in case if no aiohttp_security module found and function call otherwise
"""
if _has_aiohttp_security:
return await aiohttp_security.check_authorized(*args, **kwargs) # pylint: disable=no-value-for-parameter
Expand All @@ -70,7 +70,7 @@ async def forget(*args: Any, **kwargs: Any) -> Any:
**kwargs(Any): named argument list as provided by authorized_userid function
Returns:
Any: None in case if no aiohttp_security module found and function call otherwise
Any: ``None`` in case if no aiohttp_security module found and function call otherwise
"""
if _has_aiohttp_security:
return await aiohttp_security.forget(*args, **kwargs) # pylint: disable=no-value-for-parameter
Expand All @@ -86,7 +86,7 @@ async def remember(*args: Any, **kwargs: Any) -> Any:
**kwargs(Any): named argument list as provided by authorized_userid function
Returns:
Any: None in case if no aiohttp_security module found and function call otherwise
Any: ``None`` in case if no aiohttp_security module found and function call otherwise
"""
if _has_aiohttp_security:
return await aiohttp_security.remember(*args, **kwargs) # pylint: disable=no-value-for-parameter
Expand Down
8 changes: 4 additions & 4 deletions src/ahriman/core/auth/mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ async def check_credentials(self, username: str, password: str | None) -> bool:
password(str | None): entered password
Returns:
bool: True in case if password matches, False otherwise
bool: ``True`` in case if password matches, ``False`` otherwise
"""
if password is None:
return False # invalid data supplied
Expand All @@ -72,7 +72,7 @@ def get_user(self, username: str) -> User | None:
username(str): username
Returns:
User | None: user descriptor if username is known and None otherwise
User | None: user descriptor if username is known and ``None`` otherwise
"""
return self.database.user_get(username)

Expand All @@ -84,7 +84,7 @@ async def known_username(self, username: str) -> bool:
username(str): username
Returns:
bool: True in case if user is known and can be authorized and False otherwise
bool: ``True`` in case if user is known and can be authorized and ``False`` otherwise
"""
return username is not None and self.get_user(username) is not None

Expand All @@ -98,7 +98,7 @@ async def verify_access(self, username: str, required: UserAccess, context: str
context(str | None): URI request path
Returns:
bool: True in case if user is allowed to do this request and False otherwise
bool: ``True`` in case if user is allowed to do this request and ``False`` otherwise
"""
user = self.get_user(username)
return user is not None and user.verify_access(required)
6 changes: 3 additions & 3 deletions src/ahriman/core/auth/pam.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ async def check_credentials(self, username: str, password: str | None) -> bool:
password(str | None): entered password
Returns:
bool: True in case if password matches, False otherwise
bool: ``True`` in case if password matches, ``False`` otherwise
"""
if password is None:
return False # invalid data supplied
Expand All @@ -101,7 +101,7 @@ async def known_username(self, username: str) -> bool:
username(str): username
Returns:
bool: True in case if user is known and can be authorized and False otherwise
bool: ``True`` in case if user is known and can be authorized and ``False`` otherwise
"""
try:
_ = getpwnam(username)
Expand All @@ -119,7 +119,7 @@ async def verify_access(self, username: str, required: UserAccess, context: str
context(str | None): URI request path
Returns:
bool: True in case if user is allowed to do this request and False otherwise
bool: ``True`` in case if user is allowed to do this request and ``False`` otherwise
"""
# this method is basically inverted, first we check overrides in database and then fallback to the PAM logic
if (user := self.get_user(username)) is not None:
Expand Down
6 changes: 3 additions & 3 deletions src/ahriman/core/build_tools/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def has_remotes(sources_dir: Path) -> bool:
sources_dir(Path): local path to git repository
Returns:
bool: True in case if there is any remote and false otherwise
bool: ``True`` in case if there is any remote and false otherwise
"""
instance = Sources()
remotes = check_output(*instance.git(), "remote", cwd=sources_dir, logger=instance.logger)
Expand Down Expand Up @@ -261,7 +261,7 @@ def commit(self, sources_dir: Path, message: str | None = None,
commit_author(tuple[str, str] | None, optional): optional commit author if any (Default value = None)
Returns:
bool: True in case if changes have been committed and False otherwise
bool: ``True`` in case if changes have been committed and ``False`` otherwise
"""
if not self.has_changes(sources_dir):
return False # nothing to commit
Expand Down Expand Up @@ -351,7 +351,7 @@ def has_changes(self, sources_dir: Path) -> bool:
sources_dir(Path): local path to git repository
Returns:
bool: True if there are uncommitted changes and False otherwise
bool: ``True`` if there are uncommitted changes and ``False`` otherwise
"""
# there is --exit-code argument to diff, however, there might be other process errors
changes = check_output(*self.git(), "diff", "--cached", "--name-only", cwd=sources_dir, logger=self.logger)
Expand Down
2 changes: 1 addition & 1 deletion src/ahriman/core/configuration/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def _validate_path_exists(self, constraint: bool, field: str, value: Path) -> No
check if paths exists
Args:
constraint(bool): True in case if path must exist and False otherwise
constraint(bool): ``True`` in case if path must exist and ``False`` otherwise
field(str): field name to be checked
value(Path): value to be checked
Expand Down
2 changes: 1 addition & 1 deletion src/ahriman/core/database/operations/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def with_connection(self, query: Callable[[sqlite3.Connection], T], *, commit: b
Args:
query(Callable[[Connection], T]): function to be called with connection
commit(bool, optional): if True commit() will be called on success (Default value = False)
commit(bool, optional): if ``True`` commit() will be called on success (Default value = False)
Returns:
T: result of the ``query`` call
Expand Down
4 changes: 2 additions & 2 deletions src/ahriman/core/formatters/build_printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(self, package: Package, is_success: bool, use_utf: bool) -> None:
Args:
package(Package): built package
is_success(bool): True in case if build has success status and False otherwise
is_success(bool): ``True`` in case if build has success status and ``False`` otherwise
use_utf(bool): use utf instead of normal symbols
"""
StringPrinter.__init__(self, f"{self.sign(is_success, use_utf)} {package.base}")
Expand All @@ -43,7 +43,7 @@ def sign(is_success: bool, use_utf: bool) -> str:
generate sign according to settings
Args:
is_success(bool): True in case if build has success status and False otherwise
is_success(bool): ``True`` in case if build has success status and ``False`` otherwise
use_utf(bool): use utf instead of normal symbols
Returns:
Expand Down
2 changes: 1 addition & 1 deletion src/ahriman/core/formatters/changes_printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def title(self) -> str | None:
generate entry title from content
Returns:
str | None: content title if it can be generated and None otherwise
str | None: content title if it can be generated and ``None`` otherwise
"""
if self.changes.is_empty:
return None
Expand Down
2 changes: 1 addition & 1 deletion src/ahriman/core/formatters/printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def title(self) -> str | None:
generate entry title from content
Returns:
str | None: content title if it can be generated and None otherwise
str | None: content title if it can be generated and ``None`` otherwise
"""
return None

Expand Down
2 changes: 1 addition & 1 deletion src/ahriman/core/formatters/string_printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ def title(self) -> str | None:
generate entry title from content
Returns:
str | None: content title if it can be generated and None otherwise
str | None: content title if it can be generated and ``None`` otherwise
"""
return self.content
2 changes: 1 addition & 1 deletion src/ahriman/core/http/sync_http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def exception_response_text(exception: requests.RequestException) -> str:
exception(requests.RequestException): exception raised
Returns:
str: text of the response if it is not None and empty string otherwise
str: text of the response if it is not ``None`` and empty string otherwise
"""
result: str = exception.response.text if exception.response is not None else ""
return result
Expand Down
4 changes: 2 additions & 2 deletions src/ahriman/core/report/jinja_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ class JinjaTemplate:
* homepage - link to homepage, string, optional
* link_path - prefix fo packages to download, string, required
* has_package_signed - True in case if package sign enabled, False otherwise, required
* has_repo_signed - True in case if repository database sign enabled, False otherwise, required
* has_package_signed - ``True`` in case if package sign enabled, ``False`` otherwise, required
* has_repo_signed - ``True`` in case if repository database sign enabled, ``False`` otherwise, required
* packages - sorted list of packages properties, required
* architecture, string
* archive_size, pretty printed size, string
Expand Down
2 changes: 1 addition & 1 deletion src/ahriman/core/report/remote_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def is_process_alive(self, process_id: str) -> bool:
process_id(str): remote process id
Returns:
bool: True in case if remote process is alive and False otherwise
bool: ``True`` in case if remote process is alive and ``False`` otherwise
"""
try:
response = self.client.make_request("GET", f"{self.client.address}/api/v1/service/process/{process_id}")
Expand Down
4 changes: 2 additions & 2 deletions src/ahriman/core/spawn.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def boolean_action_argument(name: str, value: bool) -> str:
value(bool): command line argument value
Returns:
str: if ``value`` is True, then returns positive flag and negative otherwise
str: if ``value`` is ``True``, then returns positive flag and negative otherwise
"""
return name if value else f"no-{name}"

Expand Down Expand Up @@ -153,7 +153,7 @@ def has_process(self, process_id: str) -> bool:
process_id(str): process id to be checked as returned by :func:`_spawn_process()`
Returns:
bool: True in case if process still counts as active and False otherwise
bool: ``True`` in case if process still counts as active and ``False`` otherwise
"""
with self._lock:
return process_id in self.active
Expand Down
4 changes: 2 additions & 2 deletions src/ahriman/core/status/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def package_logs_remove(self, package_base: str, version: str | None) -> None:
Args:
package_base(str): package base
version(str | None): package version to remove logs. If None set, all logs will be removed
version(str | None): package version to remove logs. If ``None`` is set, all logs will be removed
Raises:
NotImplementedError: not implemented method
Expand Down Expand Up @@ -245,7 +245,7 @@ def package_patches_remove(self, package_base: str, variable: str | None) -> Non
Args:
package_base(str): package base to update
variable(str | None): patch name. If None set, all patches will be removed
variable(str | None): patch name. If ``None`` is set, all patches will be removed
Raises:
NotImplementedError: not implemented method
Expand Down
4 changes: 2 additions & 2 deletions src/ahriman/core/status/local_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def package_logs_remove(self, package_base: str, version: str | None) -> None:
Args:
package_base(str): package base
version(str | None): package version to remove logs. If None set, all logs will be removed
version(str | None): package version to remove logs. If ``None`` is set, all logs will be removed
"""
self.database.logs_remove(package_base, version, self.repository_id)

Expand All @@ -188,7 +188,7 @@ def package_patches_remove(self, package_base: str, variable: str | None) -> Non
Args:
package_base(str): package base to update
variable(str | None): patch name. If None set, all patches will be removed
variable(str | None): patch name. If ``None`` is set, all patches will be removed
"""
variables = [variable] if variable is not None else None
self.database.patches_remove(package_base, variables)
Expand Down
4 changes: 2 additions & 2 deletions src/ahriman/core/status/web_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ def package_logs_remove(self, package_base: str, version: str | None) -> None:
Args:
package_base(str): package base
version(str | None): package version to remove logs. If None set, all logs will be removed
version(str | None): package version to remove logs. If ``None`` is set, all logs will be removed
"""
query = self.repository_id.query()
if version is not None:
Expand Down Expand Up @@ -373,7 +373,7 @@ def package_patches_remove(self, package_base: str, variable: str | None) -> Non
Args:
package_base(str): package base to update
variable(str | None): patch name. If None set, all patches will be removed
variable(str | None): patch name. If ``None`` is set, all patches will be removed
"""
with contextlib.suppress(Exception):
self.make_request("DELETE", self._patches_url(package_base, variable or ""))
Expand Down
4 changes: 2 additions & 2 deletions src/ahriman/core/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def is_dependency(self, packages: Iterable[Leaf]) -> bool:
packages(Iterable[Leaf]): list of known leaves
Returns:
bool: True in case if package is dependency of others and False otherwise
bool: ``True`` in case if package is dependency of others and ``False`` otherwise
"""
for leaf in packages:
if leaf.dependencies.intersection(self.items):
Expand All @@ -79,7 +79,7 @@ def is_root(self, packages: Iterable[Leaf]) -> bool:
packages(Iterable[Leaf]): list of known leaves
Returns:
bool: True if any of packages is dependency of the leaf, False otherwise
bool: ``True`` if any of packages is dependency of the leaf, ``False`` otherwise
"""
for leaf in packages:
if self.dependencies.intersection(leaf.items):
Expand Down
2 changes: 1 addition & 1 deletion src/ahriman/core/upload/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def release_get(self) -> dict[str, Any] | None:
get release object if any
Returns:
dict[str, Any] | None: GitHub API release object if release found and None otherwise
dict[str, Any] | None: GitHub API release object if release found and ``None`` otherwise
"""
url = f"https://api.github.com/repos/{self.github_owner}/{
self.github_repository}/releases/tags/{self.github_release_tag}"
Expand Down
Loading

0 comments on commit 950b9e4

Please sign in to comment.