Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. import specular
  2. from apimas.predicates import apimas_schemata
  3.  
  4.  
  5. schemata = [('.schema1', {
  6.     '.schema1': {},
  7.     'mylist': {
  8.         '*': {'.string': {}}
  9.     }
  10. })]
  11.  
  12. domain = specular.Spec()
  13. domain.compile_schemata(apimas_schemata)
  14. domain.compile_schemata(schemata)
  15.  
  16.  
  17. spec = domain.compile_spec({'.schema1': {}})
  18.  
  19. config = {
  20.     '.schema1': {},
  21.     'mylist': ['a', 'b', 'c']
  22. }
  23. spec.config(config)
  24.  
  25. @specular.make_constructor
  26. def ctor(context):
  27.     return {}
  28.  
  29. print spec.construct(constructions={'domain': {'.schema1': ctor}})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement