| DayF core 1.2.1.2 DayF (Decision at your Fingertips) is an AutoML freeware development framework that let developers works with Machine Learning models without any idea of AI, simply taking a csv dataset and the objective column

loadconfig.py
1
3
4 '''
5 Copyright (C) e2its - All Rights Reserved
6 * Unauthorized copying of this file, via any medium is strictly prohibited
7 * Proprietary and confidential
8 *
9 * This file is part of gDayF project.
10 *
11 * Written by Jose L. Sanchez <e2its.es@gmail.com>, 2016-2019
12 '''
13
14 from collections import OrderedDict
15 import json
16 from os import path, makedirs
17 from shutil import copyfile
18
19
20
22 class LoadConfig(object):
23 _config = None
24 _configfile = None
25
26
27 def __init__(self, user_id='PoC_gDayF'):
28 # @var _config protected member variable to store config parameters
29 self._config = None
30 configpath = path.join(path.dirname(__file__), '../../../.config')
31 configfile = path.join(configpath, 'config.json')
32 user_configpath = path.join(configpath, user_id)
33 user_configfile = path.join(user_configpath, 'config.json')
34 if not path.exists(user_configfile):
35 try:
36 makedirs(user_configpath, mode=0o755, exist_ok=True)
37 copyfile(configfile, user_configfile)
38 except IOError:
39 raise IOError
40
41 # @var _configfile protected member variable to store configfile path
42 self._configfile = user_configfile
43 if path.exists(self._configfile):
44 with open(self._configfile, 'rt') as f:
45 try:
46 self._config = json.load(f, object_hook=OrderedDict, encoding='utf8')
47 except IOError:
48 raise IOError
49 else:
50 raise IOError
51
52
55 def get_config(self):
56 return self._config
57
58
61 def get_configfile(self):
62 return self._configfile
63
64
65
66
68 class LoadLabels(object):
69 _config = None
70 _configfile = None
71
72
73 def __init__(self, lang='en'):
74 # @var _config protected member variable to store config parameters
75 self._config = None
76 configpath = path.join(path.dirname(__file__), '../../../.config')
77 configfile = path.join(configpath, 'labels.json')
78
79 # @var _configfile protected member variable to store configfile path
80 self._configfile = configfile
81 if path.exists(self._configfile):
82 with open(configfile, 'rt') as f:
83 try:
84 self._config = json.load(f, object_hook=OrderedDict, encoding='utf8')[lang]
85 except IOError:
86 raise IOError
87 else:
88 raise IOError
89
90
93 def get_config(self):
94 return self._config
95
96
99 def get_configfile(self):
100 return self._configfile
101
gdayf.conf.loadconfig.LoadLabels._config
_config
Definition: loadconfig.py:69
gdayf.conf.loadconfig.LoadConfig
Class Getting the config file place on default location and load all parameters on an internal variab...
Definition: loadconfig.py:22
gdayf.conf.loadconfig.LoadConfig._configfile
_configfile
Definition: loadconfig.py:24
gdayf.conf.loadconfig.LoadLabels.__init__
def __init__(self, lang='en')
Constructor.
Definition: loadconfig.py:73
gdayf.conf.loadconfig.LoadLabels
Class Getting the config file place on default location and load all labels named self...
Definition: loadconfig.py:68
gdayf.conf.loadconfig.LoadLabels.get_config
def get_config(self)
Returns OrderedDict with all system labels.
Definition: loadconfig.py:93
gdayf.conf.loadconfig.LoadLabels.get_configfile
def get_configfile(self)
Returns labelsfile path.
Definition: loadconfig.py:99
gdayf.conf.loadconfig.LoadConfig.get_config
def get_config(self)
Returns OrderedDict with all system configuration.
Definition: loadconfig.py:55
gdayf.conf.loadconfig.LoadConfig._config
_config
Definition: loadconfig.py:23
gdayf.conf.loadconfig.LoadLabels._configfile
_configfile
Definition: loadconfig.py:70
gdayf.conf.loadconfig.LoadConfig.__init__
def __init__(self, user_id='PoC_gDayF')
Constructor.
Definition: loadconfig.py:27
gdayf.conf.loadconfig.LoadConfig.get_configfile
def get_configfile(self)
Returns configfile path.
Definition: loadconfig.py:61