Added some comments

This commit is contained in:
Dimitris Zlatanidis 2022-06-19 19:26:30 +03:00
parent e0d11fe3dc
commit 3e3cb45ea7
7 changed files with 10 additions and 6 deletions

View file

@ -13,6 +13,7 @@ class Blacklist:
etc_path: str = Configs.etc_path etc_path: str = Configs.etc_path
def get(self): def get(self):
''' Reads and returns the blacklist. '''
file = f'{self.etc_path}/blacklist.json' file = f'{self.etc_path}/blacklist.json'
if os.path.isfile(file): if os.path.isfile(file):
with open(file, 'r') as black: with open(file, 'r') as black:

View file

@ -11,6 +11,7 @@ from slpkg.blacklist import Blacklist
@dataclass @dataclass
class Check: class Check:
''' Some checks before proceed. '''
log_packages: str = Configs.log_packages log_packages: str = Configs.log_packages
repo_tag: str = Configs.repo_tag repo_tag: str = Configs.repo_tag

View file

@ -11,6 +11,7 @@ from slpkg.models.models import session as Session
@dataclass @dataclass
class CleanLogsDependencies: class CleanLogsDependencies:
''' Cleans the logs from packages. '''
flags: str flags: str
session: str = Session session: str = Session
@ -19,7 +20,6 @@ class CleanLogsDependencies:
LogsDependencies.name, LogsDependencies.requires).all() LogsDependencies.name, LogsDependencies.requires).all()
if dependencies: if dependencies:
view = ViewMessage() view = ViewMessage()
view.logs_packages(dependencies) view.logs_packages(dependencies)
view.question(self.flags) view.question(self.flags)

View file

@ -11,6 +11,7 @@ from slpkg.models.models import session as Session
@dataclass @dataclass
class CreateData: class CreateData:
''' Reads the SLACKBUILDS.TXT file and inserts them into the database. '''
db_path: str = Configs.db_path db_path: str = Configs.db_path
sbo_txt: str = Configs.sbo_txt sbo_txt: str = Configs.sbo_txt

View file

@ -9,7 +9,7 @@ from slpkg.queries import SBoQueries
@dataclass @dataclass
class Requires: class Requires:
''' Creates a list of dependencies with ''' Creates a list of dependencies with
the right order to install ''' the right order to install. '''
name: str name: str
def resolve(self) -> list: def resolve(self) -> list:

View file

@ -9,6 +9,7 @@ from slpkg.configs import Configs
@dataclass @dataclass
class Wget: class Wget:
''' Wget donwloader. '''
wget_options: str = Configs.wget_options wget_options: str = Configs.wget_options
def download(self, path: str, url: str): def download(self, path: str, url: str):

View file

@ -13,14 +13,14 @@ from slpkg.models.models import session as Session
@dataclass @dataclass
class RemovePackages: class RemovePackages:
''' Remove installed packages. ''' ''' Removes installed packages. '''
packages: str packages: str
flags: list flags: list
session: str = Session session: str = Session
removepkg: str = Configs.removepkg removepkg: str = Configs.removepkg
def remove(self): def remove(self):
''' Remove package with dependencies. ''' ''' Removes package with dependencies. '''
self.installed_packages = [] self.installed_packages = []
self.dependencies = [] self.dependencies = []
@ -44,14 +44,14 @@ class RemovePackages:
subprocess.call(command, shell=True) subprocess.call(command, shell=True)
def delete_main_logs(self): def delete_main_logs(self):
''' Delete main packages from logs. ''' ''' Deletes main packages from logs. '''
for pkg in self.packages: for pkg in self.packages:
self.session.query(LogsDependencies).filter( self.session.query(LogsDependencies).filter(
LogsDependencies.name == pkg).delete() LogsDependencies.name == pkg).delete()
self.session.commit() self.session.commit()
def delete_deps_logs(self): def delete_deps_logs(self):
''' Delete depends packages from logs. ''' ''' Deletes depends packages from logs. '''
for pkg in self.dependencies[0].split(): for pkg in self.dependencies[0].split():
self.session.query(LogsDependencies).filter( self.session.query(LogsDependencies).filter(
LogsDependencies.name == pkg).delete() LogsDependencies.name == pkg).delete()