Moved getConfig to utils.

This commit is contained in:
2021-07-03 18:41:28 +02:00
parent 9bfa913912
commit 88d91af382

View File

@@ -6,12 +6,15 @@
# @Last Modified time: 2017-12-22 12:07:18 # @Last Modified time: 2017-12-22 12:07:18
import re import re
import os
import logging import logging
import colored import colored
import configparser
from datetime import datetime from datetime import datetime
from colored import stylize from colored import stylize
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
SYMBOLS = { SYMBOLS = {
'customary' : ('B', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'), 'customary' : ('B', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'),
'customary_ext' : ('byte', 'kilo', 'mega', 'giga', 'tera', 'peta', 'exa', 'customary_ext' : ('byte', 'kilo', 'mega', 'giga', 'tera', 'peta', 'exa',
@@ -23,6 +26,19 @@ SYMBOLS = {
__all__ = ('ColorizeFilter', ) __all__ = ('ColorizeFilter', )
def getConfig():
"""
Read path and get configuartion file with site settings
:return: config settings read from 'config.ini'
:rtype: configparser.ConfigParser
"""
config = configparser.ConfigParser()
config_dir = os.path.join(BASE_DIR, 'config.ini')
config.read(config_dir)
return config
class ColorizeFilter(logging.Filter): class ColorizeFilter(logging.Filter):
""" """
Class for setting specific colors to levels of severity for log output Class for setting specific colors to levels of severity for log output