You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Configuration entries marked with a @ are treated as calls to function registries and the other entries within that dictionary are treated as function arguments. Is there a way to pass the configuration file itself as a function parameter? For example, let's say I have a registered function defined as:
@registry.visualizer("v1")
def my_visualizer_v1(a, b):
# do stuff
And a configuration file:
[Global]
var1 = 123
var2 = "foo"
[Visualizer]
@visualizer = "v1"
a = ${Global:var1}
b = ${Global:var2}
Is there a way to pass the configuration object itself to my_visualizer_v1 and let it retrieve the values it needs, e.g.
@registry.visualizer("v1")
def my_visualizer_v1(cfg):
a = cfg.Global.var1
b = cfg.Global.var2
# do stuff
My use case is that the parameters defined in the config file are used throughout the library; only a few of them are actually unique to the visualizer function(s). I don't want users to have to remember which of the parameters a certain version of a function needs (for example, another version of the function may require additional or fewer parameters than v1 does) and would rather have the functions themselves extract what they need from the config file.
The text was updated successfully, but these errors were encountered:
Configuration entries marked with a
@
are treated as calls to function registries and the other entries within that dictionary are treated as function arguments. Is there a way to pass the configuration file itself as a function parameter? For example, let's say I have a registered function defined as:And a configuration file:
Is there a way to pass the configuration object itself to
my_visualizer_v1
and let it retrieve the values it needs, e.g.My use case is that the parameters defined in the config file are used throughout the library; only a few of them are actually unique to the visualizer function(s). I don't want users to have to remember which of the parameters a certain version of a function needs (for example, another version of the function may require additional or fewer parameters than
v1
does) and would rather have the functions themselves extract what they need from the config file.The text was updated successfully, but these errors were encountered: