Quoting strings of digits
Thomas Conway <[email protected]> Mon, 20 Nov 2017 12:10:14 +1100
| Newsgroups | gmane.text.yaml.general |
|---|---|
| Message-ID | <CAC8Emi6Rgq+j10urjEL5q33dNp3+p+xHzPuOXYEFL3sUgi8KUg@mail.gmail.com> |
Hi Yamlies,
I have a bit of a problem where some of our tools use Java, and some Python
(2). The output of the python is consumed by the Java, and inconsistencies
are leading to some problems. My question is which if any behaviours are
incorrect with respect to the specification?
I've cut down the problem to the following.
Consider the following python code (using pyyaml):
import sys
import yaml
w = {'userName': 'scientist ', 'userEmail': '[email protected]',
'sampleName': '08063075', 'fastqDir':
'/foo/bar/baz/171108_M00139_0253_000000000-BHFD5/ProjectFolders/Project_Qux-Wombat-/Sample_08063075',
'analysis': 'Somatic_Run375_MY_DY_08112017', 'laneNo': 1, 'panel':
'Somatic_Panel_Manifest_v4_23_10_2015'}
yaml.dump(w, sys.stdout, default_flow_style=False)
which produces the output:
analysis: Somatic_Run375_MY_DY_08112017
fastqDir:
/foo/bar/baz/171108_M00139_0253_000000000-BHFD5/ProjectFolders/Project_Qux-Wombat-/Sample_08063075
laneNo: 1
panel: Somatic_Panel_Manifest_v4_23_10_2015
sampleName: 08063075
userEmail: [email protected]
userName: 'scientist '
Note in particular that the string value for the key 'sampleName' is a
sequence of digits with a leading zero, and is not quoted.
When we read it in to our java system (using snakeyaml), the unquoted
sequence of digits is turned into an integer, which means that subsequent
steps drop the leading zero.
I've tried reading the specification, but I can't see that it defines the
conversion.
Is the serialisation valid?
Is the conversion of the string of digits to an integer valid?
Thanks for any precision you can add to my understanding,
Tom.
--
Dr Thomas Conway
[email protected]
My friends, love is better than anger. Hope is better than fear. Optimism
is better than despair. So let us be loving, hopeful and optimistic. And
we'll change the world. - Jack Layton
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Yaml-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/yaml-core