Passed
Push — dev ( 20c194...b9ffd7 )
by Andreas
01:08
created

f_getconfig.getconfig()   A

Complexity

Conditions 2

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 10
rs 10
c 0
b 0
f 0
cc 2
nop 0
1
import yaml
2
3
def getconfig():
4
    """Определяет наличие конфига и загружает его."""
5
    try:
6
        conffile = open('conf/main.yml', 'r')
7
    except IOError:  # FIXME: Убрать exit() в результате эксепшена
8
        exit(messagebox.showerror('ERROR', _('Config file not found')))
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable messagebox does not seem to be defined.
Loading history...
Comprehensibility Best Practice introduced by
The variable _ does not seem to be defined.
Loading history...
9
10
    config = yaml.full_load(conffile)
11
    conffile.close()
12
    return config
13