Added doc for ChartConfig
This commit is contained in:
@ -1,11 +1,32 @@
|
|||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
class ChartConfig:
|
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):
|
def __init__(self, path):
|
||||||
|
"""
|
||||||
|
Parameters :
|
||||||
|
path (str) : the path to the configuration file
|
||||||
|
"""
|
||||||
cfgp = ConfigParser(interpolation=None)
|
cfgp = ConfigParser(interpolation=None)
|
||||||
cfgp.read(path)
|
cfgp.read(path)
|
||||||
self.chart_config = cfgp["chart"]
|
self.chart_config = cfgp["chart"]
|
||||||
|
|
||||||
def get_variable_parameter_config(self, key):
|
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 (<variable>[.<param>])
|
||||||
|
|
||||||
|
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 = {}
|
config = {}
|
||||||
positionnal = ["cat", "color", "unit"]
|
positionnal = ["cat", "color", "unit"]
|
||||||
if key in self.chart_config.keys():
|
if key in self.chart_config.keys():
|
||||||
|
Reference in New Issue
Block a user