Removed NoReturn

This commit is contained in:
Dimitris Zlatanidis 2023-03-02 22:06:25 +02:00
parent 5bf9460182
commit da1803bf05
6 changed files with 30 additions and 34 deletions

View file

@ -2,7 +2,6 @@
# -*- coding: utf-8 -*-
from pathlib import Path
from typing import NoReturn
from slpkg.configs import Configs
from slpkg.queries import SBoQueries
@ -18,7 +17,7 @@ class Check(Configs, Utilities):
super(Utilities, self).__init__()
@staticmethod
def exists(slackbuilds: list) -> NoReturn:
def exists(slackbuilds: list) -> None:
""" Checking if the slackbuild exists in the repository. """
not_packages: list = []
@ -31,7 +30,7 @@ class Check(Configs, Utilities):
'does not exists.\n')
@staticmethod
def unsupported(slackbuilds: list) -> NoReturn:
def unsupported(slackbuilds: list) -> None:
""" Checking for unsupported slackbuilds. """
for sbo in slackbuilds:
sources = SBoQueries(sbo).sources()
@ -57,7 +56,7 @@ class Check(Configs, Utilities):
return found
def blacklist(self, slackbuilds: list) -> NoReturn:
def blacklist(self, slackbuilds: list) -> None:
""" Checking if the packages are blacklisted. """
packages: list = []
black = Blacklist()
@ -72,7 +71,7 @@ class Check(Configs, Utilities):
f'Please edit the blacklist.toml file in '
f'{self.configs.etc_path} folder.\n')
def database(self) -> NoReturn:
def database(self) -> None:
""" Checking for empty table """
db = Path(self.db_path, self.database_name)
if not SBoQueries('').sbos() or not db.is_file():

View file

@ -5,7 +5,7 @@ import os
import subprocess
from pathlib import Path
from urllib.parse import unquote
from typing import Union, NoReturn
from typing import Union
from multiprocessing import Process
from slpkg.configs import Configs
@ -41,7 +41,7 @@ class Downloader(Configs, Utilities):
self.bred: str = f'{self.bold}{self.red}'
self.flag_no_silent: list = ['-n', '--no-silent']
def transfer_tools(self) -> NoReturn:
def transfer_tools(self) -> None:
""" Downloader tools.
wget, curl and lftp works with SBo repository.
@ -77,7 +77,7 @@ class Downloader(Configs, Utilities):
if self.output != 0:
raise SystemExit(self.output)
def check_if_downloaded(self) -> NoReturn:
def check_if_downloaded(self) -> None:
""" Checks if the file downloaded. """
if 'ponce' not in self.url:
url: str = unquote(self.url)

View file

@ -3,7 +3,6 @@
import os
import sys
from typing import NoReturn
from slpkg.checks import Check
from slpkg.upgrade import Upgrade
@ -280,7 +279,7 @@ class Argparse(Configs):
self.args.remove(opt)
self.flags.append(opt)
def is_dialog_enabled(self) -> NoReturn:
def is_dialog_enabled(self) -> None:
""" Checking if the dialog box is enabled. """
if (not self.dialogbox and self.utils.is_option(self.flag_searches, self.flags) or
not self.dialogbox.dialog and 'configs' in self.args):
@ -364,21 +363,21 @@ class Argparse(Configs):
self.usage.help(0)
self.usage.help(1)
def version(self) -> NoReturn:
def version(self) -> None:
if len(self.args) == 1:
version = Version()
version.view()
raise SystemExit()
self.usage.help(1)
def update(self) -> NoReturn:
def update(self) -> None:
if len(self.args) == 1:
update = UpdateRepository(self.flags)
update.repository()
raise SystemExit()
self.usage.help(1)
def upgrade(self) -> NoReturn:
def upgrade(self) -> None:
command = Argparse.upgrade.__name__
if len(self.args) == 1:
@ -398,7 +397,7 @@ class Argparse(Configs):
raise SystemExit()
self.usage.help(1)
def check_updates(self) -> NoReturn:
def check_updates(self) -> None:
if len(self.args) == 1:
self.check.database()
@ -407,13 +406,13 @@ class Argparse(Configs):
raise SystemExit()
self.usage.help(1)
def edit_configs(self) -> NoReturn:
def edit_configs(self) -> None:
if len(self.args) == 1:
self.form_configs.edit()
raise SystemExit()
self.usage.help(1)
def clean_logs(self) -> NoReturn:
def clean_logs(self) -> None:
if len(self.args) == 1:
self.check.database()
@ -422,7 +421,7 @@ class Argparse(Configs):
raise SystemExit()
self.usage.help(1)
def clean_tmp(self) -> NoReturn:
def clean_tmp(self) -> None:
if len(self.args) == 1:
self.utils.remove_folder_if_exists(path=self.tmp_path, folder=self.prog_name)
@ -432,7 +431,7 @@ class Argparse(Configs):
self.usage.help(1)
def build(self) -> NoReturn:
def build(self) -> None:
command = Argparse.build.__name__
if len(self.args) >= 2:
@ -450,7 +449,7 @@ class Argparse(Configs):
raise SystemExit()
self.usage.help(1)
def install(self) -> NoReturn:
def install(self) -> None:
command = Argparse.install.__name__
if len(self.args) >= 2:
@ -468,7 +467,7 @@ class Argparse(Configs):
raise SystemExit()
self.usage.help(1)
def download(self) -> NoReturn:
def download(self) -> None:
command = Argparse.download.__name__
if len(self.args) >= 2:
@ -484,7 +483,7 @@ class Argparse(Configs):
raise SystemExit()
self.usage.help(1)
def remove(self) -> NoReturn:
def remove(self) -> None:
command = Argparse.remove.__name__
if len(self.args) >= 2:
@ -501,7 +500,7 @@ class Argparse(Configs):
raise SystemExit()
self.usage.help(1)
def find(self) -> NoReturn:
def find(self) -> None:
command = Argparse.find.__name__
if len(self.args) >= 2:
@ -517,7 +516,7 @@ class Argparse(Configs):
raise SystemExit()
self.usage.help(1)
def view(self) -> NoReturn:
def view(self) -> None:
command = Argparse.view.__name__
if len(self.args) >= 2:
@ -534,7 +533,7 @@ class Argparse(Configs):
raise SystemExit()
self.usage.help(1)
def search(self) -> NoReturn:
def search(self) -> None:
command = Argparse.search.__name__
if len(self.args) >= 2:
@ -550,7 +549,7 @@ class Argparse(Configs):
raise SystemExit()
self.usage.help(1)
def dependees(self) -> NoReturn:
def dependees(self) -> None:
command = Argparse.dependees.__name__
if len(self.args) >= 2:
@ -567,7 +566,7 @@ class Argparse(Configs):
raise SystemExit()
self.usage.help(1)
def tracking(self) -> NoReturn:
def tracking(self) -> None:
command = Argparse.tracking.__name__
if len(self.args) >= 2:

View file

@ -3,7 +3,6 @@
import time
import subprocess
from typing import NoReturn
from multiprocessing import Process
from slpkg.configs import Configs
@ -124,14 +123,14 @@ class RemovePackages(Configs):
self.print_error()
def process(self, command: str) -> NoReturn:
def process(self, command: str) -> None:
""" Processes execution. """
self.output = subprocess.call(command, shell=True,
stderr=self.stderr, stdout=self.stdout)
if self.output != 0:
raise SystemExit(self.output)
def print_error(self) -> NoReturn:
def print_error(self) -> None:
""" Stop the process and print the error message. """
if self.output != 0:
raise SystemExit(f"\n{self.red}FAILED {self.stderr}:{self.endc} package '{self.remove_pkg}' to remove.\n")

View file

@ -4,7 +4,6 @@
import os
import time
import subprocess
from typing import NoReturn
from pathlib import Path
from collections import OrderedDict
@ -318,14 +317,14 @@ class Slackbuilds(Configs):
self.print_error()
def process(self, command: str) -> NoReturn:
def process(self, command: str) -> None:
""" Processes execution. """
self.output = subprocess.call(command, shell=True,
stderr=self.stderr, stdout=self.stdout)
if self.output != 0:
raise SystemExit(self.output)
def print_error(self) -> NoReturn:
def print_error(self) -> None:
""" Stop the process and print the error message. """
if self.output != 0:
raise SystemExit(f"\n{self.red}FAILED {self.output}:{self.endc} {self.process_message}.\n")

View file

@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
import os
from typing import Any, NoReturn
from typing import Any
from slpkg.configs import Configs
from slpkg.views.ascii import Ascii
@ -229,7 +229,7 @@ class ViewMessage(Configs):
print('Note: After cleaning you should remove them one by one.')
def question(self) -> NoReturn:
def question(self) -> None:
""" Manage to proceed. """
if not self.utils.is_option(self.flag_yes, self.flags):
answer: str = input('\nDo you want to continue? [y/N] ')