-
-
Notifications
You must be signed in to change notification settings - Fork 5
Keywords
Julian Berman edited this page Dec 31, 2013
·
7 revisions
Keywords are what I'll call the new keys, barring a better term (they're the analog of validators in JSON Schema, but for our purposes they don't do any validation).
Here are some ideas for potential keywords:
Names a property in the return value.
seep.deserialize(
{"info" : {"id" : "abc123"}},
{"properties" : {"info" : {"annotate" : "Car", {"properties" : {"id" : {"annotate" : "license"}}}},
)
{"Car" : {"license" : "abc123"}}
Coerces a property's value into a different (Python) type upon deserialization.
seep.deserialize(
{"today" : "01/01/2013"},
{"properties" : {"today" : {"coerce" : "ddmmyyyy"}}},
coercions={"ddmmyyyy" : lambda date : datetime.strptime(date, "%d/%m/%y").date},
)
{"today" : datetime.datetime(2013, 01, 01)}
Pulls up a value from a container.
seep.deserialize(
{"now" : 123},
{"properties" : {"now" : {"extract" : True}}},
)
123