summaryrefslogtreecommitdiff
path: root/grc/core/schema_checker/block.py
diff options
context:
space:
mode:
authorSebastian Koslowski <sebastian.koslowski@gmail.com>2016-05-03 17:13:08 +0200
committerJohnathan Corgan <johnathan@corganlabs.com>2017-06-29 09:16:49 -0700
commit7f7fa2f91467fdb2b11312be8562e7b51fdeb199 (patch)
tree24268bac15b9920d2a15ddbb45eaf3b9b03718a1 /grc/core/schema_checker/block.py
parent44cae388881821942e691a4d69a923bbd8d347db (diff)
grc: added yaml/mako support
Includes basic converter from XML/Cheetah to YAML/Mako based block format.
Diffstat (limited to 'grc/core/schema_checker/block.py')
-rw-r--r--grc/core/schema_checker/block.py57
1 files changed, 57 insertions, 0 deletions
diff --git a/grc/core/schema_checker/block.py b/grc/core/schema_checker/block.py
new file mode 100644
index 0000000000..db8830fddf
--- /dev/null
+++ b/grc/core/schema_checker/block.py
@@ -0,0 +1,57 @@
+from .utils import Spec, expand, str_
+
+PARAM_SCHEME = expand(
+ base_key=str_, # todo: rename/remove
+
+ id=str_,
+ label=str_,
+ category=str_,
+
+ dtype=str_,
+ default=object,
+
+ options=list,
+ option_labels=list,
+ option_attributes=Spec(types=dict, required=False, item_scheme=(str_, list)),
+
+ hide=str_,
+)
+PORT_SCHEME = expand(
+ label=str_,
+ domain=str_,
+
+ id=str_,
+ dtype=str_,
+ vlen=(int, str_),
+
+ multiplicity=(int, str_),
+ optional=(bool, int, str_),
+ hide=(bool, str_),
+)
+TEMPLATES_SCHEME = expand(
+ imports=str_,
+ var_make=str_,
+ make=str_,
+ callbacks=list,
+)
+BLOCK_SCHEME = expand(
+ id=Spec(types=str_, required=True, item_scheme=None),
+ label=str_,
+ category=(list, str_),
+ flags=(list, str_),
+
+ parameters=Spec(types=list, required=False, item_scheme=PARAM_SCHEME),
+ inputs=Spec(types=list, required=False, item_scheme=PORT_SCHEME),
+ outputs=Spec(types=list, required=False, item_scheme=PORT_SCHEME),
+
+ checks=(list, str_),
+ value=str_,
+
+ templates=Spec(types=dict, required=False, item_scheme=TEMPLATES_SCHEME),
+
+ documentation=str_,
+
+ file_format=Spec(types=int, required=True, item_scheme=None),
+
+ block_wrapper_path=str_, # todo: rename/remove
+)