-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Value always interpreted as string in YAML data when using key other than Str() for MapPattern #64
Comments
Ouch, that's embarrassing. Thanks for reporting I'll try to roll out a fix
asap.
…On Fri, 28 Jun 2019, 04:35 Douglas, ***@***.***> wrote:
After pulling strictyaml 1.0.2, I can see that the exception is no longer
thrown. However, I'm running into a strange issue when viewing the parsed
YAML data dictionary values. Here's an example:
>>> from strictyaml import *
>>> a = {10.25: 23, 20.33: 76}
>>> schema = MapPattern(Float(), Int())
>>> yaml = as_document(a, schema)
>>> yaml.data
OrderedDict([(10.25, '23'), (20.33, '76')])
Notice that the keys are correctly interpreted as floats, however, the
values are strings instead of the expected ints.
For contrast, here is what happens if I make the keys strings:
>>> from strictyaml import *
>>> a = {'10.25': 23, '20.33': 76}
>>> schema = MapPattern(Str(), Int())
>>> yaml = as_document(a, schema)
>>> yaml.data
OrderedDict([('10.25', 23), ('20.33', 76)])
Now the values are interpreted correctly as ints.
Environment:
- Python 3.7.3
- strictyaml 1.0.2
- ruamel.yaml 0.15.97
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#64?email_source=notifications&email_token=ABOJKNO4LQJHOLMQUHGM7XDP4UCA5A5CNFSM4H37CUK2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4G4EZTKQ>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABOJKNI33R54SRX7IULOX73P4UCA5ANCNFSM4H37CUKQ>
.
|
I'm seeing similar behavior with |
crdoconnor
added a commit
that referenced
this issue
Aug 31, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After pulling strictyaml 1.0.2, I can see that the exception is no longer thrown. However, I'm running into a strange issue when viewing the parsed YAML data dictionary values. Here's an example:
Notice that the keys are correctly interpreted as floats, however, the values are strings instead of the expected ints.
For contrast, here is what happens if I make the keys strings:
Now the values are interpreted correctly as ints.
Environment:
The text was updated successfully, but these errors were encountered: