Updated for code style

This commit is contained in:
Dimitris Zlatanidis 2023-03-15 19:16:14 +02:00
parent 3bd5e2b5e4
commit 9687c3937b
3 changed files with 28 additions and 28 deletions

View file

@ -29,7 +29,7 @@ class Check(Configs, Utilities):
if self.ponce_repo:
self.repo_path = self.ponce_repo_path
def exists(self, slackbuilds: list) -> list:
def is_package_exists(self, slackbuilds: list) -> list:
""" Checking if the slackbuild exists in the repository. """
not_packages: list = []
@ -52,7 +52,7 @@ class Check(Configs, Utilities):
return slackbuilds
def unsupported(self, slackbuilds: list) -> None:
def is_package_unsupported(self, slackbuilds: list) -> None:
""" Checking for unsupported slackbuilds. """
for sbo in slackbuilds:
sources = SBoQueries(sbo).sources()
@ -79,7 +79,7 @@ class Check(Configs, Utilities):
return found
def blacklist(self, slackbuilds: list) -> None:
def is_blacklist(self, slackbuilds: list) -> None:
""" Checking if the packages are blacklisted. """
packages: list = []
@ -93,7 +93,7 @@ class Check(Configs, Utilities):
f"Please edit the blacklist.toml file in "
f"{self.etc_path} folder.\n")
def database(self) -> None:
def is_empty_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

@ -55,7 +55,7 @@ class Argparse(Configs):
if len(self.args) == 0:
self.usage.help_short()
self.check.blacklist(self.args)
self.check.is_blacklist(self.args)
self.flag_yes: str = '--yes'
self.flag_short_yes: str = '-y'
@ -418,7 +418,7 @@ class Argparse(Configs):
command = Argparse.upgrade.__name__
if len(self.args) == 1:
self.check.database()
self.check.is_empty_database()
upgrade = Upgrade(self.file_pattern)
packages: list = list(upgrade.packages())
@ -436,7 +436,7 @@ class Argparse(Configs):
def check_updates(self) -> None:
if len(self.args) == 1:
self.check.database()
self.check.is_empty_database()
check = CheckUpdates()
check.updates()
raise SystemExit()
@ -450,7 +450,7 @@ class Argparse(Configs):
def clean_logs(self) -> None:
if len(self.args) == 1:
self.check.database()
self.check.is_empty_database()
logs = CleanLogsDependencies(self.flags)
logs.clean()
@ -490,9 +490,9 @@ class Argparse(Configs):
if self.utils.is_option(self.flag_searches, self.flags):
packages: list = self.choose_packages(packages, command)
self.check.database()
packages: list = self.check.exists(packages)
self.check.unsupported(packages)
self.check.is_empty_database()
packages: list = self.check.is_package_exists(packages)
self.check.is_package_unsupported(packages)
build = Slackbuilds(packages, self.flags, self.file_pattern, mode=command)
build.execute()
@ -509,9 +509,9 @@ class Argparse(Configs):
if self.utils.is_option(self.flag_searches, self.flags):
packages: list = self.choose_packages(packages, command)
self.check.database()
packages: list = self.check.exists(packages)
self.check.unsupported(packages)
self.check.is_empty_database()
packages: list = self.check.is_package_exists(packages)
self.check.is_package_unsupported(packages)
install = Slackbuilds(packages, self.flags, self.file_pattern, mode=command)
install.execute()
@ -528,8 +528,8 @@ class Argparse(Configs):
if self.utils.is_option(self.flag_searches, self.flags):
packages: list = self.choose_packages(packages, command)
self.check.database()
packages: list = self.check.exists(packages)
self.check.is_empty_database()
packages: list = self.check.is_package_exists(packages)
download = Download(self.directory, self.flags)
download.packages(packages)
raise SystemExit()
@ -545,7 +545,7 @@ class Argparse(Configs):
if self.utils.is_option(self.flag_searches, self.flags):
packages: list = self.choose_packages(packages, command)
self.check.database()
self.check.is_empty_database()
packages: list = self.check.is_installed(packages, self.file_pattern)
remove = RemovePackages(packages, self.flags, self.file_pattern)
@ -563,7 +563,7 @@ class Argparse(Configs):
if self.utils.is_option(self.flag_searches, self.flags):
packages: list = self.choose_packages(packages, command)
self.check.database()
self.check.is_empty_database()
find = FindInstalled()
find.find(packages, self.file_pattern)
@ -580,8 +580,8 @@ class Argparse(Configs):
if self.utils.is_option(self.flag_searches, self.flags):
packages: list = self.choose_packages(packages, command)
self.check.database()
packages: list = self.check.exists(packages)
self.check.is_empty_database()
packages: list = self.check.is_package_exists(packages)
view = ViewPackage(self.flags)
view.package(packages)
@ -598,7 +598,7 @@ class Argparse(Configs):
if self.utils.is_option(self.flag_searches, self.flags):
packages: list = self.choose_packages(packages, command)
self.check.database()
self.check.is_empty_database()
search = SearchPackage()
search.package(packages)
@ -615,8 +615,8 @@ class Argparse(Configs):
if self.utils.is_option(self.flag_searches, self.flags):
packages: list = self.choose_packages(packages, command)
self.check.database()
packages: list = self.check.exists(packages)
self.check.is_empty_database()
packages: list = self.check.is_package_exists(packages)
dependees = Dependees(packages, self.flags)
dependees.slackbuilds()
@ -633,8 +633,8 @@ class Argparse(Configs):
if self.utils.is_option(self.flag_searches, self.flags):
packages: list = self.choose_packages(packages, command)
self.check.database()
packages: list = self.check.exists(packages)
self.check.is_empty_database()
packages: list = self.check.is_package_exists(packages)
tracking = Tracking(self.flags)
tracking.packages(packages)

View file

@ -12,16 +12,16 @@ class TestPkgInstalled(unittest.TestCase):
self.packages = ['fish', 'ranger', 'pycharm']
def test_check_exists(self):
self.assertIsNone(self.check.exists(self.packages))
self.assertIsNone(self.check.is_package_exists(self.packages))
def test_check_unsupported(self):
self.assertIsNone(self.check.unsupported(self.packages))
self.assertIsNone(self.check.is_package_unsupported(self.packages))
def test_check_installed(self):
self.assertListEqual(self.packages, self.check.is_installed(self.packages, self.file_pattern))
def test_check_blacklist(self):
self.assertIsNone(self.check.blacklist(self.packages))
self.assertIsNone(self.check.is_blacklist(self.packages))
if __name__ == "__main__":