Removed dataclasses

Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
Dimitris Zlatanidis 2022-12-02 22:06:18 +02:00
parent 6baea770f8
commit e6a8db4e12
8 changed files with 37 additions and 42 deletions

View file

@ -4,15 +4,14 @@
import os
import tomli
from dataclasses import dataclass
from slpkg.configs import Configs
@dataclass
class Blacklist:
''' Reads and returns the blacklist. '''
etc_path: str = Configs.etc_path
def __init__(self):
self.etc_path: str = Configs.etc_path
def get(self):
file = f'{self.etc_path}/blacklist.toml'

View file

@ -4,16 +4,16 @@
import os
import urllib3
from dataclasses import dataclass
from slpkg.configs import Configs
@dataclass
class CheckUpdates:
sbo_repo_url: str = Configs.sbo_repo_url
sbo_repo_path: str = Configs.sbo_repo_path
chglog_txt: str = Configs.chglog_txt
def __init__(self):
self.sbo_repo_url: str = Configs.sbo_repo_url
self.sbo_repo_path: str = Configs.sbo_repo_path
self.chglog_txt: str = Configs.chglog_txt
def updates(self):

View file

@ -2,21 +2,21 @@
# -*- coding: utf-8 -*-
import os
from dataclasses import dataclass
from slpkg.configs import Configs
from slpkg.queries import SBoQueries
from slpkg.blacklist import Blacklist
@dataclass
class Check:
''' Some checks before proceed. '''
log_packages: str = Configs.log_packages
sbo_repo_tag: str = Configs.sbo_repo_tag
db_path: str = Configs.db_path
database_name: str = Configs.database
etc_path: str = Configs.etc_path
def __init__(self):
self.log_packages: str = Configs.log_packages
self.sbo_repo_tag: str = Configs.sbo_repo_tag
self.db_path: str = Configs.db_path
self.database_name: str = Configs.database
self.etc_path: str = Configs.etc_path
def exists(self, slackbuilds: list):
''' Checking if the slackbuild exists in the repository. '''

View file

@ -3,15 +3,15 @@
import hashlib
from dataclasses import dataclass
from slpkg.views.views import ViewMessage
@dataclass
class Md5sum:
''' Checksum the sources. '''
flags: str
def __init__(self, flags):
self.flags: str = flags
def check(self, path: str, source: str, checksum: str, name: str):
filename = f'{path}/{source.split("/")[-1]}'

View file

@ -2,18 +2,17 @@
# -*- coding: utf-8 -*-
from dataclasses import dataclass
from slpkg.views.views import ViewMessage
from slpkg.models.models import LogsDependencies
from slpkg.models.models import session as Session
@dataclass
class CleanLogsDependencies:
''' Cleans the logs from packages. '''
flags: str
session: str = Session
def __init__(self, flags):
self.flags: str = flags
self.session: str = Session
def clean(self):
dependencies = self.session.query(

View file

@ -2,21 +2,19 @@
# -*- coding: utf-8 -*-
from dataclasses import dataclass
from slpkg.configs import Configs
from slpkg.models.models import SBoTable
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
sbo_repo_path: str = Configs.sbo_repo_path
session: str = Session
def __init__(self):
self.db_path: str = Configs.db_path
self.sbo_txt: str = Configs.sbo_txt
self.sbo_repo_path: str = Configs.sbo_repo_path
self.session: str = Session
def insert_sbo_table(self):
sbo_tags = [

View file

@ -2,16 +2,15 @@
# -*- coding: utf-8 -*-
from dataclasses import dataclass
from slpkg.queries import SBoQueries
@dataclass
class Requires:
''' Creates a list of dependencies with
the right order to install. '''
name: str
def __init__(self, name):
self.name: str = name
def resolve(self) -> list:
requires = SBoQueries(self.name).requires()

View file

@ -2,8 +2,6 @@
# -*- coding: utf-8 -*-
from dataclasses import dataclass
from slpkg.downloader import Wget
from slpkg.configs import Configs
from slpkg.queries import SBoQueries
@ -11,13 +9,15 @@ from slpkg.views.views import ViewMessage
from slpkg.models.models import session as Session
@dataclass
class Download:
flags: list
session: str = Session
download_only = Configs.download_only
sbo_repo_url: str = Configs.sbo_repo_url
sbo_tar_suffix: str = Configs.sbo_tar_suffix
''' Download the slackbuilds with the sources only. '''
def __init__(self):
self.flags: list
self.session: str = Session
self.download_only = Configs.download_only
self.sbo_repo_url: str = Configs.sbo_repo_url
self.sbo_tar_suffix: str = Configs.sbo_tar_suffix
def packages(self, slackbuilds: list):