From a52cb3550fbd1acfda93de70ca4a6b41a81f61f4 Mon Sep 17 00:00:00 2001 From: l_samenv Date: Mon, 9 Sep 2024 15:43:40 +0200 Subject: [PATCH] Added doc for ChartConfig --- chart_config.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/chart_config.py b/chart_config.py index c6487a4..a71568a 100644 --- a/chart_config.py +++ b/chart_config.py @@ -1,11 +1,32 @@ from configparser import ConfigParser class ChartConfig: + """ + Class that holds the chart section of a configuration file (for an instrument). + + Attributes : + chart_config (Section) : the Section corresponding to the "chart" section in the given configuration file + """ def __init__(self, path): + """ + Parameters : + path (str) : the path to the configuration file + """ cfgp = ConfigParser(interpolation=None) cfgp.read(path) self.chart_config = cfgp["chart"] def get_variable_parameter_config(self, key): + """ + Gets the configuration of the given key in the configuration file (chart section). + + Parameters : + key (str) : the key to look for in the chart section ([.]) + + Returns : + {"cat":(str), "color":(str), "unit":(str)} | None : a dictionnary representing the different options for the given key in the chart section. + The different options are in this dict if they are found in the chart section for the given key. Returns None if the key is not in the chart section, + or if there is a syntax problem for the given key. + """ config = {} positionnal = ["cat", "color", "unit"] if key in self.chart_config.keys():