O2-DQ User Interface 1.0.0
Loading...
Searching...
No Matches
configSetter Namespace Reference

Functions

def multiConfigurableSet (dict config, str key, str value, list arg, onlySelect)
 
def processDummySet (dict config)
 
def singleConfigurableSet (dict config, str key, str value, str arg)
 

Function Documentation

◆ multiConfigurableSet()

def multiConfigurableSet ( dict  config,
str  key,
str  value,
list  arg,
  onlySelect 
)
multiConfigurableSet method allows to assign values
for multiple configurable value arguments in JSON with/without overriding
depending on interface mode. The onlySelect parameter decides for
interface mode.if the argument contains more than one value, it is saved as list type by default 
and this method converts them to comma separated string, otherwise assigns them as string value directly


Args:
    config (dict): Input as JSON config file
    key (string): Sub key from upper key in provided config JSON config file
    value (string): Value from key in provided JSON config file (sub-level)
    arg (any): Argument from parserargs
    onlySelect (boolean): Input as args.onlySelect for selecting interface mode.
    true for Overrider Mode and false for Additional mode
    
    
Assignment :
    string or comma seperated string: If the argument is of list type, 
    it assign as a comma separated string,
    otherwise it assign directly as a string.

Definition at line 48 of file configSetter.py.

48def multiConfigurableSet(config: dict, key: str, value: str, arg: list, onlySelect):
49 """
50 multiConfigurableSet method allows to assign values
51 for multiple configurable value arguments in JSON with/without overriding
52 depending on interface mode. The onlySelect parameter decides for
53 interface mode.if the argument contains more than one value, it is saved as list type by default
54 and this method converts them to comma separated string, otherwise assigns them as string value directly
55
56
57 Args:
58 config (dict): Input as JSON config file
59 key (string): Sub key from upper key in provided config JSON config file
60 value (string): Value from key in provided JSON config file (sub-level)
61 arg (any): Argument from parserargs
62 onlySelect (boolean): Input as args.onlySelect for selecting interface mode.
63 true for Overrider Mode and false for Additional mode
64
65
66 Assignment :
67 string or comma seperated string: If the argument is of list type,
68 it assign as a comma separated string,
69 otherwise it assign directly as a string.
70
71 """
72
73 if isinstance(arg, list):
74 arg = listToString(arg)
75 if onlySelect == "false":
76 actualConfig = config[key][value]
77 arg = actualConfig + "," + arg
78 config[key][value] = arg
79
80
81# TODO: refactor it it should be work in also loop. Only works for tableReader and dqEfficiency
82# when key have no process Dummy function, this method will crashes.

◆ processDummySet()

def processDummySet ( dict  config)

Definition at line 83 of file configSetter.py.

83def processDummySet(config: dict):
84
85 for k, v in config.items(): # loop over number of keys
86 if isinstance(v, dict): # iterate only possible items in dict keys
87 for v, v2 in v.items():
88 if (not v.endswith("Dummy")) and (v.startswith("process")):
89 if config[k][v] == "true":
90 config[k]["processDummy"] = "false"
91 print(k, "dummy converted false")
92 break
93 else:
94 config[k]["processDummy"] = "true"
95 print(k, "dummy converted true")

◆ singleConfigurableSet()

def singleConfigurableSet ( dict  config,
str  key,
str  value,
str  arg 
)
singleConfigurableSet method allows to assign value
to single configurable value arguments in JSON with overriding.
This method is used for single value arguments
as JSONs will be assigned only by overriding for single value arguments.


Args:
    config (dict): Input as JSON config file
    key (string): Sub key from upper key in provided JSON config file
    value (string): Value from key in provided JSON config file (sub-level)
    arg (any): Argument from parserargs or manual for some situations ("-1" or "true" or "false" etc.)
    
    
Assignment:
    string: Assigned as a direct string

Definition at line 23 of file configSetter.py.

23def singleConfigurableSet(config: dict, key: str, value: str, arg: str):
24 """
25 singleConfigurableSet method allows to assign value
26 to single configurable value arguments in JSON with overriding.
27 This method is used for single value arguments
28 as JSONs will be assigned only by overriding for single value arguments.
29
30
31 Args:
32 config (dict): Input as JSON config file
33 key (string): Sub key from upper key in provided JSON config file
34 value (string): Value from key in provided JSON config file (sub-level)
35 arg (any): Argument from parserargs or manual for some situations ("-1" or "true" or "false" etc.)
36
37
38 Assignment:
39 string: Assigned as a direct string
40
41 """
42
43 config[key][value] = arg
44 #logging.debug(" - [%s] %s : %s", key, value, args.v0Rmax)
45
46
47# For multiple configurables in JSON, always use this method for less verbosity