Completed
Push — master ( 91d748...e1a893 )
by Andreas
19s queued 12s
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
"""Функция работы с файлом конфигурации."""
2
import yaml
3
4
5
def getconfig():
6
    """Определяет наличие конфига и загружает его."""
7
    try:
8
        conffile = open('conf/main.yml', 'r')
9
    except IOError:  # FIXME: Убрать exit() в результате эксепшена
10
        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...
11
12
    config = yaml.full_load(conffile)
13
    conffile.close()
14
    return config
15