mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-12-28 09:58:21 +01:00
Updated for code style
This commit is contained in:
parent
3bd5e2b5e4
commit
9687c3937b
3 changed files with 28 additions and 28 deletions
|
@ -29,7 +29,7 @@ class Check(Configs, Utilities):
|
||||||
if self.ponce_repo:
|
if self.ponce_repo:
|
||||||
self.repo_path = self.ponce_repo_path
|
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. """
|
""" Checking if the slackbuild exists in the repository. """
|
||||||
not_packages: list = []
|
not_packages: list = []
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ class Check(Configs, Utilities):
|
||||||
|
|
||||||
return slackbuilds
|
return slackbuilds
|
||||||
|
|
||||||
def unsupported(self, slackbuilds: list) -> None:
|
def is_package_unsupported(self, slackbuilds: list) -> None:
|
||||||
""" Checking for unsupported slackbuilds. """
|
""" Checking for unsupported slackbuilds. """
|
||||||
for sbo in slackbuilds:
|
for sbo in slackbuilds:
|
||||||
sources = SBoQueries(sbo).sources()
|
sources = SBoQueries(sbo).sources()
|
||||||
|
@ -79,7 +79,7 @@ class Check(Configs, Utilities):
|
||||||
|
|
||||||
return found
|
return found
|
||||||
|
|
||||||
def blacklist(self, slackbuilds: list) -> None:
|
def is_blacklist(self, slackbuilds: list) -> None:
|
||||||
""" Checking if the packages are blacklisted. """
|
""" Checking if the packages are blacklisted. """
|
||||||
packages: list = []
|
packages: list = []
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ class Check(Configs, Utilities):
|
||||||
f"Please edit the blacklist.toml file in "
|
f"Please edit the blacklist.toml file in "
|
||||||
f"{self.etc_path} folder.\n")
|
f"{self.etc_path} folder.\n")
|
||||||
|
|
||||||
def database(self) -> None:
|
def is_empty_database(self) -> None:
|
||||||
""" Checking for empty table """
|
""" Checking for empty table """
|
||||||
db = Path(self.db_path, self.database_name)
|
db = Path(self.db_path, self.database_name)
|
||||||
if not SBoQueries('').sbos() or not db.is_file():
|
if not SBoQueries('').sbos() or not db.is_file():
|
||||||
|
|
|
@ -55,7 +55,7 @@ class Argparse(Configs):
|
||||||
if len(self.args) == 0:
|
if len(self.args) == 0:
|
||||||
self.usage.help_short()
|
self.usage.help_short()
|
||||||
|
|
||||||
self.check.blacklist(self.args)
|
self.check.is_blacklist(self.args)
|
||||||
|
|
||||||
self.flag_yes: str = '--yes'
|
self.flag_yes: str = '--yes'
|
||||||
self.flag_short_yes: str = '-y'
|
self.flag_short_yes: str = '-y'
|
||||||
|
@ -418,7 +418,7 @@ class Argparse(Configs):
|
||||||
command = Argparse.upgrade.__name__
|
command = Argparse.upgrade.__name__
|
||||||
|
|
||||||
if len(self.args) == 1:
|
if len(self.args) == 1:
|
||||||
self.check.database()
|
self.check.is_empty_database()
|
||||||
|
|
||||||
upgrade = Upgrade(self.file_pattern)
|
upgrade = Upgrade(self.file_pattern)
|
||||||
packages: list = list(upgrade.packages())
|
packages: list = list(upgrade.packages())
|
||||||
|
@ -436,7 +436,7 @@ class Argparse(Configs):
|
||||||
|
|
||||||
def check_updates(self) -> None:
|
def check_updates(self) -> None:
|
||||||
if len(self.args) == 1:
|
if len(self.args) == 1:
|
||||||
self.check.database()
|
self.check.is_empty_database()
|
||||||
check = CheckUpdates()
|
check = CheckUpdates()
|
||||||
check.updates()
|
check.updates()
|
||||||
raise SystemExit()
|
raise SystemExit()
|
||||||
|
@ -450,7 +450,7 @@ class Argparse(Configs):
|
||||||
|
|
||||||
def clean_logs(self) -> None:
|
def clean_logs(self) -> None:
|
||||||
if len(self.args) == 1:
|
if len(self.args) == 1:
|
||||||
self.check.database()
|
self.check.is_empty_database()
|
||||||
|
|
||||||
logs = CleanLogsDependencies(self.flags)
|
logs = CleanLogsDependencies(self.flags)
|
||||||
logs.clean()
|
logs.clean()
|
||||||
|
@ -490,9 +490,9 @@ class Argparse(Configs):
|
||||||
if self.utils.is_option(self.flag_searches, self.flags):
|
if self.utils.is_option(self.flag_searches, self.flags):
|
||||||
packages: list = self.choose_packages(packages, command)
|
packages: list = self.choose_packages(packages, command)
|
||||||
|
|
||||||
self.check.database()
|
self.check.is_empty_database()
|
||||||
packages: list = self.check.exists(packages)
|
packages: list = self.check.is_package_exists(packages)
|
||||||
self.check.unsupported(packages)
|
self.check.is_package_unsupported(packages)
|
||||||
|
|
||||||
build = Slackbuilds(packages, self.flags, self.file_pattern, mode=command)
|
build = Slackbuilds(packages, self.flags, self.file_pattern, mode=command)
|
||||||
build.execute()
|
build.execute()
|
||||||
|
@ -509,9 +509,9 @@ class Argparse(Configs):
|
||||||
if self.utils.is_option(self.flag_searches, self.flags):
|
if self.utils.is_option(self.flag_searches, self.flags):
|
||||||
packages: list = self.choose_packages(packages, command)
|
packages: list = self.choose_packages(packages, command)
|
||||||
|
|
||||||
self.check.database()
|
self.check.is_empty_database()
|
||||||
packages: list = self.check.exists(packages)
|
packages: list = self.check.is_package_exists(packages)
|
||||||
self.check.unsupported(packages)
|
self.check.is_package_unsupported(packages)
|
||||||
|
|
||||||
install = Slackbuilds(packages, self.flags, self.file_pattern, mode=command)
|
install = Slackbuilds(packages, self.flags, self.file_pattern, mode=command)
|
||||||
install.execute()
|
install.execute()
|
||||||
|
@ -528,8 +528,8 @@ class Argparse(Configs):
|
||||||
if self.utils.is_option(self.flag_searches, self.flags):
|
if self.utils.is_option(self.flag_searches, self.flags):
|
||||||
packages: list = self.choose_packages(packages, command)
|
packages: list = self.choose_packages(packages, command)
|
||||||
|
|
||||||
self.check.database()
|
self.check.is_empty_database()
|
||||||
packages: list = self.check.exists(packages)
|
packages: list = self.check.is_package_exists(packages)
|
||||||
download = Download(self.directory, self.flags)
|
download = Download(self.directory, self.flags)
|
||||||
download.packages(packages)
|
download.packages(packages)
|
||||||
raise SystemExit()
|
raise SystemExit()
|
||||||
|
@ -545,7 +545,7 @@ class Argparse(Configs):
|
||||||
if self.utils.is_option(self.flag_searches, self.flags):
|
if self.utils.is_option(self.flag_searches, self.flags):
|
||||||
packages: list = self.choose_packages(packages, command)
|
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)
|
packages: list = self.check.is_installed(packages, self.file_pattern)
|
||||||
|
|
||||||
remove = RemovePackages(packages, self.flags, 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):
|
if self.utils.is_option(self.flag_searches, self.flags):
|
||||||
packages: list = self.choose_packages(packages, command)
|
packages: list = self.choose_packages(packages, command)
|
||||||
|
|
||||||
self.check.database()
|
self.check.is_empty_database()
|
||||||
|
|
||||||
find = FindInstalled()
|
find = FindInstalled()
|
||||||
find.find(packages, self.file_pattern)
|
find.find(packages, self.file_pattern)
|
||||||
|
@ -580,8 +580,8 @@ class Argparse(Configs):
|
||||||
if self.utils.is_option(self.flag_searches, self.flags):
|
if self.utils.is_option(self.flag_searches, self.flags):
|
||||||
packages: list = self.choose_packages(packages, command)
|
packages: list = self.choose_packages(packages, command)
|
||||||
|
|
||||||
self.check.database()
|
self.check.is_empty_database()
|
||||||
packages: list = self.check.exists(packages)
|
packages: list = self.check.is_package_exists(packages)
|
||||||
|
|
||||||
view = ViewPackage(self.flags)
|
view = ViewPackage(self.flags)
|
||||||
view.package(packages)
|
view.package(packages)
|
||||||
|
@ -598,7 +598,7 @@ class Argparse(Configs):
|
||||||
if self.utils.is_option(self.flag_searches, self.flags):
|
if self.utils.is_option(self.flag_searches, self.flags):
|
||||||
packages: list = self.choose_packages(packages, command)
|
packages: list = self.choose_packages(packages, command)
|
||||||
|
|
||||||
self.check.database()
|
self.check.is_empty_database()
|
||||||
|
|
||||||
search = SearchPackage()
|
search = SearchPackage()
|
||||||
search.package(packages)
|
search.package(packages)
|
||||||
|
@ -615,8 +615,8 @@ class Argparse(Configs):
|
||||||
if self.utils.is_option(self.flag_searches, self.flags):
|
if self.utils.is_option(self.flag_searches, self.flags):
|
||||||
packages: list = self.choose_packages(packages, command)
|
packages: list = self.choose_packages(packages, command)
|
||||||
|
|
||||||
self.check.database()
|
self.check.is_empty_database()
|
||||||
packages: list = self.check.exists(packages)
|
packages: list = self.check.is_package_exists(packages)
|
||||||
|
|
||||||
dependees = Dependees(packages, self.flags)
|
dependees = Dependees(packages, self.flags)
|
||||||
dependees.slackbuilds()
|
dependees.slackbuilds()
|
||||||
|
@ -633,8 +633,8 @@ class Argparse(Configs):
|
||||||
if self.utils.is_option(self.flag_searches, self.flags):
|
if self.utils.is_option(self.flag_searches, self.flags):
|
||||||
packages: list = self.choose_packages(packages, command)
|
packages: list = self.choose_packages(packages, command)
|
||||||
|
|
||||||
self.check.database()
|
self.check.is_empty_database()
|
||||||
packages: list = self.check.exists(packages)
|
packages: list = self.check.is_package_exists(packages)
|
||||||
|
|
||||||
tracking = Tracking(self.flags)
|
tracking = Tracking(self.flags)
|
||||||
tracking.packages(packages)
|
tracking.packages(packages)
|
||||||
|
|
|
@ -12,16 +12,16 @@ class TestPkgInstalled(unittest.TestCase):
|
||||||
self.packages = ['fish', 'ranger', 'pycharm']
|
self.packages = ['fish', 'ranger', 'pycharm']
|
||||||
|
|
||||||
def test_check_exists(self):
|
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):
|
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):
|
def test_check_installed(self):
|
||||||
self.assertListEqual(self.packages, self.check.is_installed(self.packages, self.file_pattern))
|
self.assertListEqual(self.packages, self.check.is_installed(self.packages, self.file_pattern))
|
||||||
|
|
||||||
def test_check_blacklist(self):
|
def test_check_blacklist(self):
|
||||||
self.assertIsNone(self.check.blacklist(self.packages))
|
self.assertIsNone(self.check.is_blacklist(self.packages))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in a new issue