Refactor query names

This commit is contained in:
Dimitris Zlatanidis 2022-12-24 18:04:09 +02:00
parent 727b90fcea
commit 86ab4deecd
6 changed files with 8 additions and 8 deletions

View file

@ -74,6 +74,6 @@ class Check:
def database(self):
""" Checking for empty table """
db = f'{self.configs.db_path}/{self.configs.database}'
if not SBoQueries('').names() or not os.path.isfile(db):
if not SBoQueries('').sbos() or not os.path.isfile(db):
raise SystemExit('\nYou need to update the package lists first.\n'
'Please run slpkg update.\n')

View file

@ -30,7 +30,7 @@ class Dependees:
dependees = {}
for package in self.packages:
found = [] # Reset list every package
sbos = SBoQueries('').names()
sbos = SBoQueries('').sbos()
for sbo in sbos:
requires = SBoQueries(sbo).requires()

View file

@ -20,10 +20,10 @@ class SBoQueries:
if self.name in self.black.get():
self.name = ''
def names(self) -> list:
def sbos(self) -> list:
""" Returns all the slackbuilds. """
names = self.session.query(SBoTable.name).all()
return [name[0] for name in names]
sbos = self.session.query(SBoTable.name).all()
return [sbo[0] for sbo in sbos]
def slackbuild(self) -> str:
""" Returns a slackbuild. """

View file

@ -19,7 +19,7 @@ class SearchPackage:
endc = color['endc']
matching = 0
names = SBoQueries('').names()
names = SBoQueries('').sbos()
print(f'The list below shows the repo '
f'packages that contains \'{", ".join([p for p in packages])}\' files:\n')

View file

@ -19,7 +19,7 @@ class Upgrade:
def packages(self):
""" Compares version of packages and returns the maximum. """
repo_packages = SBoQueries('').names()
repo_packages = SBoQueries('').sbos()
black = Blacklist().get()
for pkg in os.listdir(self.configs.log_packages):

View file

@ -35,7 +35,7 @@ class TestSBoQueries(unittest.TestCase):
self.query.description())
def test_names(self):
self.assertIn('slpkg', self.query.names())
self.assertIn('slpkg', self.query.sbos())
if __name__ == '__main__':