mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-18 10:26:29 +01:00
Updated for coding style
This commit is contained in:
parent
1e2f63409e
commit
335d3644b1
12 changed files with 21 additions and 21 deletions
|
@ -41,7 +41,7 @@ class Dependees(Configs, Utilities):
|
|||
if self.ponce_repo:
|
||||
self.sbo_table = PonceTable
|
||||
|
||||
def slackbuilds(self):
|
||||
def slackbuilds(self) -> None:
|
||||
""" Collecting the dependees. """
|
||||
print(f"The list below shows the "
|
||||
f"packages that dependees on '{', '.join([p for p in self.packages])}':\n")
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
import locale
|
||||
from dialog import Dialog
|
||||
from pathlib import Path
|
||||
from typing import Union
|
||||
from typing import Union, Tuple
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.views.version import Version
|
||||
|
@ -22,7 +22,7 @@ class DialogBox(Configs):
|
|||
self.d.set_background_title(f'{self.prog_name} {Version().version} - Software Package Manager')
|
||||
|
||||
def checklist(self, text: str, packages: list, title: str, height: int, width: int,
|
||||
list_height: int, choices: list):
|
||||
list_height: int, choices: list) -> Tuple[bool, list]:
|
||||
""" Display a checklist box. """
|
||||
more_kwargs: dict = {}
|
||||
|
||||
|
@ -37,7 +37,7 @@ class DialogBox(Configs):
|
|||
|
||||
return code, tags
|
||||
|
||||
def mixedform(self, text: str, title: str, elements: list, height: int, width: int):
|
||||
def mixedform(self, text: str, title: str, elements: list, height: int, width: int) -> Tuple[bool, list]:
|
||||
""" Display a mixedform box. """
|
||||
more_kwargs: dict = {}
|
||||
|
||||
|
@ -54,12 +54,12 @@ class DialogBox(Configs):
|
|||
|
||||
return code, tags
|
||||
|
||||
def msgbox(self, text: str, height: int, width: int):
|
||||
def msgbox(self, text: str, height: int, width: int) -> None:
|
||||
""" Display a message box. """
|
||||
if self.dialog:
|
||||
self.d.msgbox(text, height, width)
|
||||
|
||||
def textbox(self, text: Union[str, Path], height: int, width: int):
|
||||
def textbox(self, text: Union[str, Path], height: int, width: int) -> None:
|
||||
""" Display a text box. """
|
||||
if self.dialog:
|
||||
self.d.textbox(text, height, width)
|
||||
|
|
|
@ -22,7 +22,7 @@ class Downloader(Configs):
|
|||
|
||||
self.flag_parallel: list = ['-P', '--parallel']
|
||||
|
||||
def download(self):
|
||||
def download(self) -> None:
|
||||
""" Starting the processing for downloading. """
|
||||
process: list = []
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ class FormConfigs(Configs):
|
|||
self.orig_configs: list = []
|
||||
self.config_file = Path(self.etc_path, f'{self.prog_name}.toml')
|
||||
|
||||
def is_dialog_enabled(self):
|
||||
def is_dialog_enabled(self) -> None:
|
||||
""" Checking if the dialog box is enabled by the user. """
|
||||
if not self.dialog:
|
||||
self.utils.raise_error_message(f"You should enable the dialog "
|
||||
|
|
|
@ -266,7 +266,7 @@ class Argparse(Configs):
|
|||
self.move_options()
|
||||
self.invalid_options()
|
||||
|
||||
def invalid_options(self):
|
||||
def invalid_options(self) -> None:
|
||||
""" Checks for invalid options. """
|
||||
invalid: list = []
|
||||
commands: list = []
|
||||
|
@ -295,7 +295,7 @@ class Argparse(Configs):
|
|||
|
||||
# Fixed for correct options by command.
|
||||
try:
|
||||
options = self.commands[self.args[0]]
|
||||
options: list = self.commands[self.args[0]]
|
||||
for opt in self.flags:
|
||||
if opt not in options:
|
||||
invalid.append(opt)
|
||||
|
@ -361,9 +361,9 @@ class Argparse(Configs):
|
|||
else:
|
||||
new_args.append(opt)
|
||||
|
||||
self.args = new_args
|
||||
self.args: list = new_args
|
||||
|
||||
def is_file_list_packages(self):
|
||||
def is_file_list_packages(self) -> list:
|
||||
""" Checks if the arg is filelist.pkgs. """
|
||||
if self.args[1].endswith(self.file_list_suffix):
|
||||
file = Path(self.args[1])
|
||||
|
|
|
@ -84,7 +84,7 @@ class RemovePackages(Configs):
|
|||
LogsDependencies.name == pkg).delete()
|
||||
self.session.commit()
|
||||
|
||||
def multi_process(self, command: str, package: str):
|
||||
def multi_process(self, command: str, package: str) -> None:
|
||||
""" Starting multiprocessing remove process. """
|
||||
if self.silent_mode and not self.utils.is_option(self.flag_no_silent, self.flags):
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ class Slackbuilds(Configs):
|
|||
|
||||
self.view_message.question()
|
||||
|
||||
def is_not_for_skipped(self, sbo) -> Literal[True]:
|
||||
def is_not_for_skipped(self, sbo: str) -> Literal[True]:
|
||||
""" Condition to check if slackbuild is for skipped. """
|
||||
return (not self.utils.is_package_installed(sbo, self.file_pattern) or
|
||||
self.utils.is_package_upgradeable(sbo, self.file_pattern) or
|
||||
|
|
|
@ -44,7 +44,7 @@ class Tracking(Configs, Utilities):
|
|||
how_many: int = len(requires)
|
||||
|
||||
if not requires:
|
||||
requires = ['No dependencies']
|
||||
requires: list = ['No dependencies']
|
||||
|
||||
print(pkg)
|
||||
print(char, end='')
|
||||
|
|
|
@ -81,7 +81,7 @@ class UpdateRepository(Configs):
|
|||
data = CreateData()
|
||||
data.install_sbo_table()
|
||||
|
||||
def check(self, q) -> None:
|
||||
def check(self, queue) -> None:
|
||||
check_updates = CheckUpdates()
|
||||
is_update: int = 0
|
||||
if not check_updates.check():
|
||||
|
@ -91,7 +91,7 @@ class UpdateRepository(Configs):
|
|||
print(f'\n\n{self.bgreen}There are new updates available!{self.endc}')
|
||||
is_update: int = 1
|
||||
|
||||
return q.put(is_update)
|
||||
return queue.put(is_update)
|
||||
|
||||
def repository(self) -> None:
|
||||
""" Starting multiprocessing download process. """
|
||||
|
|
|
@ -169,7 +169,7 @@ class Utilities:
|
|||
with open(file, 'r', encoding='utf-8') as f:
|
||||
return f.readlines()
|
||||
|
||||
def process(self, command: str, stderr=None, stdout=None):
|
||||
def process(self, command: str, stderr=None, stdout=None) -> None:
|
||||
""" Handle the processes. """
|
||||
try:
|
||||
output = subprocess.call(command, shell=True, stderr=stderr, stdout=stdout)
|
||||
|
|
|
@ -17,9 +17,9 @@ class Usage(Configs):
|
|||
self.yellow: str = color['yellow']
|
||||
self.endc: str = color['endc']
|
||||
|
||||
def help_minimal(self):
|
||||
def help_minimal(self) -> NoReturn:
|
||||
""" Prints the minimal help menu. """
|
||||
args = (
|
||||
args: str = (
|
||||
f'\nUsage: {self.prog_name} [{self.yellow}OPTIONS{self.endc}] [{self.cyan}COMMAND{self.endc}] '
|
||||
f'[FILELIST|PACKAGES...]\n'
|
||||
f"\nTry '{self.prog_name} --help' for more options.\n")
|
||||
|
|
|
@ -40,7 +40,7 @@ class ViewMessage(Configs):
|
|||
self.file_pattern: str = f'*{self.repo_tag}'
|
||||
self.all_installed: list = list(self.utils.all_installed_names(self.file_pattern))
|
||||
|
||||
def view_packages(self, package, version, mode):
|
||||
def view_packages(self, package: str, version: str, mode: str) -> None:
|
||||
""" Printing the main packages. """
|
||||
color: str = self.red
|
||||
|
||||
|
|
Loading…
Reference in a new issue