From 3e3cb45ea7d33db40ae107f75c0d69e67fb230f6 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sun, 19 Jun 2022 19:26:30 +0300 Subject: [PATCH] Added some comments --- slpkg/blacklist.py | 1 + slpkg/checks.py | 1 + slpkg/clean_logs.py | 2 +- slpkg/create_data.py | 1 + slpkg/dependencies.py | 2 +- slpkg/downloader.py | 1 + slpkg/remove_packages.py | 8 ++++---- 7 files changed, 10 insertions(+), 6 deletions(-) diff --git a/slpkg/blacklist.py b/slpkg/blacklist.py index d5176c9c..288d55fd 100644 --- a/slpkg/blacklist.py +++ b/slpkg/blacklist.py @@ -13,6 +13,7 @@ class Blacklist: etc_path: str = Configs.etc_path def get(self): + ''' Reads and returns the blacklist. ''' file = f'{self.etc_path}/blacklist.json' if os.path.isfile(file): with open(file, 'r') as black: diff --git a/slpkg/checks.py b/slpkg/checks.py index 8ef14b07..0da8ec66 100644 --- a/slpkg/checks.py +++ b/slpkg/checks.py @@ -11,6 +11,7 @@ from slpkg.blacklist import Blacklist @dataclass class Check: + ''' Some checks before proceed. ''' log_packages: str = Configs.log_packages repo_tag: str = Configs.repo_tag diff --git a/slpkg/clean_logs.py b/slpkg/clean_logs.py index 63f6430e..834fadc9 100644 --- a/slpkg/clean_logs.py +++ b/slpkg/clean_logs.py @@ -11,6 +11,7 @@ from slpkg.models.models import session as Session @dataclass class CleanLogsDependencies: + ''' Cleans the logs from packages. ''' flags: str session: str = Session @@ -19,7 +20,6 @@ class CleanLogsDependencies: LogsDependencies.name, LogsDependencies.requires).all() if dependencies: - view = ViewMessage() view.logs_packages(dependencies) view.question(self.flags) diff --git a/slpkg/create_data.py b/slpkg/create_data.py index 4b885705..5d467a30 100644 --- a/slpkg/create_data.py +++ b/slpkg/create_data.py @@ -11,6 +11,7 @@ from slpkg.models.models import session as Session @dataclass class CreateData: + ''' Reads the SLACKBUILDS.TXT file and inserts them into the database. ''' db_path: str = Configs.db_path sbo_txt: str = Configs.sbo_txt diff --git a/slpkg/dependencies.py b/slpkg/dependencies.py index 147d9161..f6e0d9cf 100644 --- a/slpkg/dependencies.py +++ b/slpkg/dependencies.py @@ -9,7 +9,7 @@ from slpkg.queries import SBoQueries @dataclass class Requires: ''' Creates a list of dependencies with - the right order to install ''' + the right order to install. ''' name: str def resolve(self) -> list: diff --git a/slpkg/downloader.py b/slpkg/downloader.py index 78b683eb..9bb55c0c 100644 --- a/slpkg/downloader.py +++ b/slpkg/downloader.py @@ -9,6 +9,7 @@ from slpkg.configs import Configs @dataclass class Wget: + ''' Wget donwloader. ''' wget_options: str = Configs.wget_options def download(self, path: str, url: str): diff --git a/slpkg/remove_packages.py b/slpkg/remove_packages.py index 80330d54..9c0dc517 100644 --- a/slpkg/remove_packages.py +++ b/slpkg/remove_packages.py @@ -13,14 +13,14 @@ from slpkg.models.models import session as Session @dataclass class RemovePackages: - ''' Remove installed packages. ''' + ''' Removes installed packages. ''' packages: str flags: list session: str = Session removepkg: str = Configs.removepkg def remove(self): - ''' Remove package with dependencies. ''' + ''' Removes package with dependencies. ''' self.installed_packages = [] self.dependencies = [] @@ -44,14 +44,14 @@ class RemovePackages: subprocess.call(command, shell=True) def delete_main_logs(self): - ''' Delete main packages from logs. ''' + ''' Deletes main packages from logs. ''' for pkg in self.packages: self.session.query(LogsDependencies).filter( LogsDependencies.name == pkg).delete() self.session.commit() def delete_deps_logs(self): - ''' Delete depends packages from logs. ''' + ''' Deletes depends packages from logs. ''' for pkg in self.dependencies[0].split(): self.session.query(LogsDependencies).filter( LogsDependencies.name == pkg).delete()