From 0e55075031037bd3ac0418150cf3cb21dd54ace0 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sun, 7 May 2023 17:01:36 +0300 Subject: [PATCH] Updated for methods --- slpkg/search.py | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/slpkg/search.py b/slpkg/search.py index 48bbd916..eb125e28 100644 --- a/slpkg/search.py +++ b/slpkg/search.py @@ -30,22 +30,31 @@ class SearchPackage(Configs): f'packages that contains \'{", ".join([p for p in self.packages])}\':\n') if self.repository == '*': - self.search_to_enabled_repositories() + self.search_to_all_repositories() else: - self.search_for_packages() + self.search_to_the_repository() self.summary_of_searching() - def search_to_enabled_repositories(self): + def search_to_all_repositories(self): for repo, value in self.repos.repositories.items(): if value[0]: # Check if the repository is enabled if self.utils.is_binary_repo(repo): - self.search_into_binary_repositories(repo) + data: dict = BinQueries(repo).repository_data() + self.search_for_the_packages(data, repo) else: - self.search_into_slackbuild_repositories(repo) + data: dict = SBoQueries(repo).repository_data() + self.search_for_the_packages(data, repo) - def search_into_binary_repositories(self, repo): - data: dict = BinQueries(repo).repository_data() + def search_to_the_repository(self): + if self.is_binary: + data: dict = BinQueries(self.repository).repository_data() + self.search_for_the_packages(data, self.repository) + else: + data: dict = SBoQueries(self.repository).repository_data() + self.search_for_the_packages(data, self.repository) + + def search_for_the_packages(self, data, repo): for package in self.packages: for name, data_pkg in data.items(): @@ -53,21 +62,6 @@ class SearchPackage(Configs): self.matching += 1 self.data_dict[self.matching] = (repo, name, data_pkg[0]) - def search_into_slackbuild_repositories(self, repo): - data: dict = SBoQueries(repo).repository_data() - for package in self.packages: - for name, data_pkg in data.items(): - - if package in name or package == '*': - self.matching += 1 - self.data_dict[self.matching] = (repo, name, data_pkg[2]) - - def search_for_packages(self): - if self.is_binary: - self.search_into_binary_repositories(self.repository) - else: - self.search_into_slackbuild_repositories(self.repository) - def summary_of_searching(self): if self.matching: for pkg, item in self.data_dict.items():