From a48e35876c4eec3cee4ec7f1faa9085cab1a0c46 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sat, 1 Apr 2023 14:31:10 +0300 Subject: [PATCH] Improve speed --- slpkg/repo_info.py | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/slpkg/repo_info.py b/slpkg/repo_info.py index 094caa4c..d61fe034 100644 --- a/slpkg/repo_info.py +++ b/slpkg/repo_info.py @@ -46,6 +46,7 @@ class RepoInfo(Configs): count: int = 0 status: str = 'Disabled' color: str = self.red + if value[0]: enabled += 1 status: str = 'Enabled' @@ -58,25 +59,11 @@ class RepoInfo(Configs): if last is None: last: tuple = ('',) - packages: dict = { - self.repos.sbo_repo_name: SBoQueries('').count_packages(), - self.repos.ponce_repo_name: SBoQueries('').count_packages(), - self.repos.alien_repo_name: BinQueries('', repo).count_packages(), - self.repos.multilib_repo_name: BinQueries('', repo).count_packages(), - self.repos.restricted_repo_name: BinQueries('', repo).count_packages(), - self.repos.gnome_repo_name: BinQueries('', repo).count_packages(), - self.repos.msb_repo_name: BinQueries('', repo).count_packages(), - self.repos.conraid_repo_name: BinQueries('', repo).count_packages(), - self.repos.slackonly_repo_name: BinQueries('', repo).count_packages(), - self.repos.ponce_bin_repo_name: BinQueries('', repo).count_packages(), - self.repos.salixos_repo_name: BinQueries('', repo).count_packages(), - self.repos.salixos_extra_repo_name: BinQueries('', repo).count_packages(), - self.repos.slackel_repo_name: BinQueries('', repo).count_packages(), - self.repos.slint_repo_name: BinQueries('', repo).count_packages() - } - if value[0]: - count: int = packages[repo] + if repo in [self.repos.sbo_repo_name, self.repos.ponce_repo_name]: + count = int(SBoQueries('').count_packages()) + else: + count = int(BinQueries('', repo).count_packages()) total_packages += count