f_getconfig   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 10
dl 0
loc 15
rs 10
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A getconfig() 0 10 2
1
"""Функция работы с файлом конфигурации."""
2
import yaml
3
4
5
def getconfig() -> dict[str, dict[str, str]]:
6
    """Определяет наличие конфига и загружает его."""
7
    try:
8
        conffile = open('conf/main.yml', 'r')
9
    except IOError:
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: dict[str, dict[str, str]] = yaml.full_load(conffile)
13
    conffile.close()
14
    return config
15