refactor: fix warnings and typos, cleanup code

This commit is contained in:
2023-12-28 16:53:45 +02:00
parent c3dacd6883
commit f3e9fbf9d0
20 changed files with 35 additions and 37 deletions

View File

@ -34,9 +34,6 @@ from ahriman.models.worker import Worker
class Updater(LazyLogging):
"""
updater handler interface
Attributes:
split_method(Callable[[Iterable[Package]], list[list[Package]]]): method to split packages into chunks
"""
@staticmethod

View File

@ -170,7 +170,7 @@ class Handler:
# extract repository names first
if (from_args := args.repository) is not None:
repositories: Iterable[str] = [from_args]
elif (from_filesystem := RepositoryPaths.known_repositories(root)):
elif from_filesystem := RepositoryPaths.known_repositories(root):
repositories = from_filesystem
else: # try to read configuration now
repositories = [configuration.get("repository", "name")]

View File

@ -344,7 +344,7 @@ class Sources(LazyLogging):
str: HEAD commit hash
"""
# we might want to parse git files instead though
return check_output("git", "rev-parse", ref_name, cwd=sources_dir)
return check_output("git", "rev-parse", ref_name, cwd=sources_dir, logger=self.logger)
def move(self, pkgbuild_dir: Path, sources_dir: Path) -> None:
"""

View File

@ -38,7 +38,7 @@ class Task(LazyLogging):
archbuild_flags(list[str]): command flags for archbuild command
architecture(str): repository architecture
build_command(str): build command
makechroootpkg_flags(list[str]): command flags for makechrootpkg command
makechrootpkg_flags(list[str]): command flags for makechrootpkg command
makepkg_flags(list[str]): command flags for makepkg command
package(Package): package definitions
paths(RepositoryPaths): repository paths instance

View File

@ -41,7 +41,7 @@ class Client:
load client from settings
Args:
repository_id(RepositoryId): repository unqiue identifier
repository_id(RepositoryId): repository unique identifier
configuration(Configuration): configuration instance
report(bool): force enable or disable reporting

View File

@ -276,8 +276,8 @@ class Tree:
unprocessed = sorted(self.leaves, key=lambda leaf: leaf.package.base)
while unprocessed:
# pick one and append it to the most free partition and build chunk
leaf = unprocessed.pop()
chunk = [leaf]
first_leaf = unprocessed.pop()
chunk = [first_leaf]
while True: # python doesn't allow to use walrus operator to unpack tuples
# get packages which depend on packages in chunk

View File

@ -46,7 +46,7 @@ class Result:
default constructor
Args:
addded(Iterable[Package] | None, optional): initial list of successfully added packages
added(Iterable[Package] | None, optional): initial list of successfully added packages
(Default value = None)
updated(Iterable[Package] | None, optional): initial list of successfully updated packages
(Default value = None)