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
I want to use confuse for configuring applications that use TensorFlow/Keras for deep learning. Part of that is reading various numerical values from the config file. For most types, this is painless, but I encountered the following issue.
According to that regex, it seems like the + or - is required. So maybe this works?
>>> type(yaml.safe_load("1e+4"))
<class'str'>
Sadly, no. A little googling leads to yaml/pyyaml#173 indicating that this is a bug. PyYAML needs a dot in the base part:
>>> type(yaml.safe_load("1.0e+4"))
<class'float'>
That works! So as a workaround, I suggest using that literal format. According to the aforelinked issue thread, however, ruamel.yaml fixes this bug. So Confuse could "fix" it to by doing #52, for which I would be eternally grateful for a pull request! 😇
Thanks for the reply! I never considered that it needed to be that explicit, but in any case this is much less of a hassle than to write out the numbers as a decimal, so I will accept it as closed for now 👍 If I get the chance later, I will look into the fix that ruamel.yaml uses and see if I can implement something similar in confuse :)
I want to use
confuse
for configuring applications that use TensorFlow/Keras for deep learning. Part of that is reading various numerical values from the config file. For most types, this is painless, but I encountered the following issue.Consider a config.yaml that looks like this:
In python, the following will happen:
The expected behavior is of course that this assertion does not fail.
OS and info:
Ubuntu 16.04
Python 3.8.2
confuse 1.1.0
The text was updated successfully, but these errors were encountered: