Updated docstrings

This commit is contained in:
Dimitris Zlatanidis 2024-05-21 20:32:14 +03:00
parent 10bb95c941
commit d5218c6f52
6 changed files with 42 additions and 69 deletions

View file

@ -8,10 +8,7 @@ from slpkg.configs import Configs
class AsciiBox(Configs): # pylint: disable=[R0902]
"""
Managing the ASCII characters.
"""
"""Managing the ASCII characters."""
def __init__(self):
super(Configs, self).__init__()
@ -21,9 +18,6 @@ class AsciiBox(Configs): # pylint: disable=[R0902]
self.size_alignment: int = 9
self.repo_alignment: int = 14
# if self.package_alignment < 1:
# self.package_alignment = 1
self.package_alignment = max(self.package_alignment, 1)
self.bd_color: str = self.endc
@ -65,8 +59,7 @@ class AsciiBox(Configs): # pylint: disable=[R0902]
self.vertical_and_left: str = ''
def assign_border_color(self) -> None:
""" Assign the colors.
"""
"""Assign the colors."""
self.border_colors: dict = {
'red': self.red,
'blue': self.blue,
@ -124,20 +117,17 @@ class AsciiBox(Configs): # pylint: disable=[R0902]
f"{repo:>{self.repo_alignment}}{self.bd_color} {self.vertical_line}{self.endc}")
def draw_middle_line(self) -> None:
""" Draw the middle line
"""
"""Draw the middle line."""
print(f"{self.bd_color}{self.vertical_and_right}{self.horizontal_line * (self.columns - 2)}"
f"{self.vertical_and_left}")
def draw_dependency_line(self) -> None:
""" Draw the dependency line.
"""
"""Draw the dependency line."""
print(f"{self.bd_color}{self.vertical_line}{self.endc} Dependencies:{' ' * (self.columns - 16)}"
f"{self.bd_color}{self.vertical_line}{self.endc}")
def draw_bottom_line(self) -> None:
""" Draw the bottom line.
"""
"""Draw the bottom line."""
print(f"{self.bd_color}{self.lower_left_corner}{self.horizontal_line * (self.columns - 2)}"
f"{self.lower_right_corner}{self.endc}")

View file

@ -8,10 +8,7 @@ from slpkg.views.version import Version
class Usage(Configs):
"""
CLI Usage menu.
"""
"""CLI Usage menu."""
def __init__(self):
super(Configs, self).__init__()

View file

@ -10,10 +10,7 @@ from slpkg.repositories import Repositories
class ViewPackage(Configs): # pylint: disable=[R0902]
"""
View the packages information.
"""
"""View the packages information."""
def __init__(self, flags: list, repository: str):
super(Configs, self).__init__()
@ -80,7 +77,7 @@ class ViewPackage(Configs): # pylint: disable=[R0902]
self.readme: list = self.utils.read_text_file(path_file)
def read_the_info_file(self, path_info: Path) -> None:
""" reads the .info file.
"""Reads the .info file.
Args:
path_info (Path): Path to the file.
@ -88,13 +85,11 @@ class ViewPackage(Configs): # pylint: disable=[R0902]
self.info_file: list = self.utils.read_text_file(path_info)
def assign_the_sbo_mirror(self) -> None:
""" Assign the url for the PACKAGES.TXT file.
"""
"""Assign the url for the PACKAGES.TXT file."""
self.mirror: str = self.repos.repositories[self.repository]['mirror_packages']
def assign_the_info_file_variables(self) -> None:
""" Assign data from the .info file.
"""
"""Assign data from the .info file."""
for line in self.info_file:
if line.startswith('HOMEPAGE'):
self.homepage: str = line[10:-2].strip()

View file

@ -12,10 +12,7 @@ from slpkg.views.asciibox import AsciiBox
class ViewProcess(Configs):
"""
View the process messages.
"""
"""View the process messages."""
def __init__(self, flags: list):
super(Configs, self).__init__()
@ -30,8 +27,7 @@ class ViewProcess(Configs):
('-B', '--progress-bar'), flags)
def message(self, message: str) -> None:
""" Show spinner with message or message.
"""
"""Show spinner with message or message."""
if self.progress_bar_conf or self.option_for_progress_bar:
self.bar_process = Process(target=self.progress.progress_bar, args=(message,))
self.bar_process.start()
@ -39,8 +35,7 @@ class ViewProcess(Configs):
print(f'\r{message}... ', end='')
def done(self) -> None:
""" Show done message.
"""
"""Show done message."""
if self.progress_bar_conf or self.option_for_progress_bar:
time.sleep(0.1)
self.bar_process.terminate()
@ -51,8 +46,7 @@ class ViewProcess(Configs):
print(f'{self.bgreen}{self.ascii.done}{self.endc}')
def failed(self) -> None:
""" Show for failed message.
"""
"""Show for failed message."""
if self.progress_bar_conf or self.option_for_progress_bar:
time.sleep(0.1)
self.bar_process.terminate()

View file

@ -13,9 +13,7 @@ from slpkg.repositories import Repositories
class View(Configs): # pylint: disable=[R0902]
""" Views packages for build, install, remove or download.
"""
"""Views packages for build, install, remove or download."""
def __init__(self, flags: list = None, repository: str = None, data: dict = None):
super(Configs, self).__init__()
@ -342,8 +340,7 @@ class View(Configs): # pylint: disable=[R0902]
print()
def missing_dependencies(self, packages: list) -> None:
""" View for missing dependencies.
"""
"""View for missing dependencies."""
if self.view_missing_deps:
missing_deps: dict = {}
for package in packages: