mirror of
https://github.com/Redume/Kekkai.git
synced 2025-02-23 20:51:25 +03:00
refactor(chart): The function with data retrieval from the config has been moved to a separate file and function
This commit is contained in:
parent
a3b94f18ef
commit
c5d3d9fe9b
1 changed files with 21 additions and 0 deletions
21
chart/utils/load_config.py
Normal file
21
chart/utils/load_config.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
"""
|
||||
This module provides a function for loading a YAML configuration file.
|
||||
The function reads the file content and returns it as a Python dictionary.
|
||||
"""
|
||||
import yaml
|
||||
|
||||
def load_config(file_path: str) -> dict:
|
||||
"""
|
||||
Loads a YAML configuration file and returns its contents as a dictionary.
|
||||
|
||||
This function opens the specified YAML file, parses its content, and
|
||||
returns it in dictionary format, making it accessible for use in
|
||||
the application.
|
||||
|
||||
:param file_path: The path to the YAML configuration file to be loaded.
|
||||
:return: A dictionary containing the parsed content of the YAML file.
|
||||
"""
|
||||
with open(file_path, 'r', encoding='utf-8') as file:
|
||||
return yaml.safe_load(file)
|
||||
|
||||
config = load_config('config.yaml')
|
Loading…
Add table
Reference in a new issue