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
You are right. I'm actually wondering which way would be right. Would you rather like to see defaults parsed or not? Also, it looks like we might have a migration problem or need to consider doing something like: if it's already of the expected type - don't convert it, but specifically non-type conversions would be hard to do ...
So, looking at this in detail we have an issue where we want a conversion function (not just a type factory) that helps crossing the IO boundary between config/secret files and regular Python data structures.
The conversion really should only be happening when handling strings from the config file. Data in Python should be using the proper types already.
I would really appreciate if we reduce the conversion to the explicit cases where we have a config string. To help with documentation it is worthwhile to allow specifying defaults as config strings but making this explicit:
no implicit conversions any longer
check docs and places where we mention the attributes (at least the Component class)
add a from_config_string method to the Attribute class
review the locations where we have config strings and explicitly check for attributes that support from_config_string
add default_config argument to the Attribute class in addition to default (but XOR their usage) that will be run through the conversion
sallner
changed the title
Unclear documentation of Attribute.
Refactor Attribute conversion from configuration file and improve documentation.
Jul 9, 2021
Working with attributes for configuration I stumbled over this line
batou/src/batou/component.py
Line 1037 in 0d1fca7
Reading the
__get__
method afterwards looks as if the default is actually converted by passing it to__set__
batou/src/batou/component.py
Line 1072 in 0d1fca7
Also, multiple places of use show a behaviour which indicate a conversion of the default, e.g.
batou/src/batou/lib/supervisor.py
Line 186 in 0d1fca7
If you could clarify the situation, I would also create a PR for the docstring chance.
The text was updated successfully, but these errors were encountered: