Updated docstrings

This commit is contained in:
Dimitris Zlatanidis 2024-05-20 22:13:52 +03:00
parent 6283c34ec4
commit 48cc76a8e4

View file

@ -16,11 +16,8 @@ from slpkg.multi_process import MultiProcess
class RemovePackages(Configs): # pylint: disable=[R0902]
"""
Removes installed packages with dependencies if they installed with
slpkg install command.
"""
"""Removes installed packages with dependencies if they
installed with slpkg install command."""
def __init__(self, packages: list, flags: list):
super(Configs, self).__init__()
@ -43,7 +40,7 @@ class RemovePackages(Configs): # pylint: disable=[R0902]
('-O', '--resolve-off'), flags)
def remove(self, upgrade: bool = False) -> None:
""" Remove packages
"""Remove packages
Args:
upgrade (bool, optional): Is packages comes from upgrade method.
@ -76,8 +73,7 @@ class RemovePackages(Configs): # pylint: disable=[R0902]
self.utils.finished_time(elapsed_time)
def add_packages_for_remove(self) -> None:
""" Add packages for remove.
"""
"""Add packages for remove."""
for package in self.packages:
installed: str = self.utils.is_package_installed(package)
if installed:
@ -90,8 +86,7 @@ class RemovePackages(Configs): # pylint: disable=[R0902]
self.dependencies.append(dep)
def find_dependent(self) -> None:
""" Find packages that depend on other packages.
"""
"""Find packages that depend on other packages."""
for package in self.packages_for_remove:
name: str = self.utils.split_package(package)['name']
for pkg, deps in self.deps_log.items():
@ -109,21 +104,19 @@ class RemovePackages(Configs): # pylint: disable=[R0902]
print(f"{'':>2}{pkg} {self.grey}{ver}{self.endc}")
def remove_doubles_dependencies(self) -> None:
""" Removes doubles packages.
"""
"""Removes doubles packages."""
self.dependencies: list = list(set(self.dependencies))
def add_installed_dependencies_to_remove(self) -> None:
""" Adds dependencies for remove.
"""
"""Adds dependencies for remove."""
for dep in self.dependencies:
installed: str = self.utils.is_package_installed(dep)
if installed:
self.packages_for_remove.append(installed)
def remove_packages(self) -> None:
""" Remove packages.
"""
"""Remove packages."""
# Remove old slpkg.log file.
if self.slpkg_log_file.is_file():
self.slpkg_log_file.unlink()
@ -141,7 +134,7 @@ class RemovePackages(Configs): # pylint: disable=[R0902]
self.deps_log_file.write_text(json.dumps(self.deps_log, indent=4), encoding='utf-8')
def choose_packages_for_remove(self, packages: list, upgrade: bool = False) -> list:
""" Choose packages via dialog utility.
"""Choose packages via dialog utility.
Args:
packages (list): Description
@ -173,7 +166,7 @@ class RemovePackages(Configs): # pylint: disable=[R0902]
return packages
def remove_question(self) -> str | None:
""" Question about remove packages.
"""Question about remove packages.
Returns:
str | None: Answer.