@@ -11,7 +11,7 @@ Lets start with an example `Spec`.
11
11
This Spec has a `repr ` that shows its parameters it was instantiated with:
12
12
13
13
>>> spec
14
- Product(outer=Line(axis='y', start=4.0, stop=5.0, num=6), inner=Line(axis='x', start=1.0, stop=2.0, num=3))
14
+ Product(outer=Line(axis='y', start=4.0, stop=5.0, num=6), inner=Line(axis='x', start=1.0, stop=2.0, num=3), gap=True )
15
15
16
16
17
17
How to Serialize
@@ -20,12 +20,12 @@ How to Serialize
20
20
We can recursively serialize it to a dictionary:
21
21
22
22
>>> spec.serialize()
23
- {'outer': {'axis': 'y', 'start': 4.0, 'stop': 5.0, 'num': 6, 'type': 'Line'}, 'inner': {'axis': 'x', 'start': 1.0, 'stop': 2.0, 'num': 3, 'type': 'Line'}, 'type': 'Product'}
23
+ {'outer': {'axis': 'y', 'start': 4.0, 'stop': 5.0, 'num': 6, 'type': 'Line'}, 'inner': {'axis': 'x', 'start': 1.0, 'stop': 2.0, 'num': 3, 'type': 'Line'}, 'gap': True, ' type': 'Product'}
24
24
25
25
How to Deserialize
26
26
------------------
27
27
28
28
We can turn this back into a spec using `Spec.deserialize `:
29
29
30
30
>>> Spec.deserialize({' outer' : {' axis' : ' y' , ' start' : 4.0 , ' stop' : 5.0 , ' num' : 6 , ' type' : ' Line' }, ' inner' : {' axis' : ' x' , ' start' : 1.0 , ' stop' : 2.0 , ' num' : 3 , ' type' : ' Line' }, ' type' : ' Product' })
31
- Product(outer=Line(axis='y', start=4.0, stop=5.0, num=6), inner=Line(axis='x', start=1.0, stop=2.0, num=3))
31
+ Product(outer=Line(axis='y', start=4.0, stop=5.0, num=6), inner=Line(axis='x', start=1.0, stop=2.0, num=3), gap=True )
0 commit comments