Refactor for load configs

This commit is contained in:
Dimitris Zlatanidis 2023-03-09 12:22:35 +02:00
parent 262b23f6be
commit ab9ff1137d
2 changed files with 6 additions and 6 deletions

View file

@ -8,7 +8,7 @@ from pathlib import Path
from dataclasses import dataclass
class LoadConfigs:
class Load:
def __init__(self):
bold = '\033[1m'
@ -17,7 +17,7 @@ class LoadConfigs:
self.endc: str = '\x1b[0m'
self.bred: str = f'{bold}{red}'
def file(self, path: str, file: str) -> dict: # type: ignore
def config_file(self, path: str, file: str) -> dict: # type: ignore
try:
""" Load the configs from the file. """
config_path_file = Path(path, f'{file}.toml')
@ -120,8 +120,8 @@ class Configs:
file_pattern_conf: str = ""
# Load configurations from the file.
load = LoadConfigs()
configs = load.file(etc_path, prog_name)
load = Load()
configs = load.config_file(etc_path, prog_name)
if configs:
try:

View file

@ -5,7 +5,7 @@ import os
from pathlib import Path
from slpkg.configs import Configs
from slpkg.configs import LoadConfigs
from slpkg.configs import Load
from slpkg.dialog_box import DialogBox
@ -13,7 +13,7 @@ class FormConfigs(Configs):
def __init__(self):
super(Configs).__init__()
self.load_configs = LoadConfigs()
self.load_configs = Load()
self.dialogbox = DialogBox()
self.color = self.colour()