bigraph-schema 0.0.46__tar.gz → 0.0.48__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of bigraph-schema might be problematic. Click here for more details.
- {bigraph-schema-0.0.46/bigraph_schema.egg-info → bigraph-schema-0.0.48}/PKG-INFO +1 -1
- bigraph-schema-0.0.48/bigraph_schema/__init__.py +6 -0
- bigraph-schema-0.0.48/bigraph_schema/edge.py +49 -0
- {bigraph-schema-0.0.46 → bigraph-schema-0.0.48}/bigraph_schema/registry.py +0 -41
- bigraph-schema-0.0.48/bigraph_schema/type_functions.py +2542 -0
- bigraph-schema-0.0.48/bigraph_schema/type_system.py +2069 -0
- bigraph-schema-0.0.48/bigraph_schema/type_system_tests.py +2325 -0
- bigraph-schema-0.0.48/bigraph_schema/utilities.py +222 -0
- {bigraph-schema-0.0.46 → bigraph-schema-0.0.48/bigraph_schema.egg-info}/PKG-INFO +1 -1
- {bigraph-schema-0.0.46 → bigraph-schema-0.0.48}/bigraph_schema.egg-info/SOURCES.txt +4 -2
- {bigraph-schema-0.0.46 → bigraph-schema-0.0.48}/setup.py +1 -1
- bigraph-schema-0.0.46/bigraph_schema/__init__.py +0 -2
- bigraph-schema-0.0.46/bigraph_schema/data.py +0 -1
- bigraph-schema-0.0.46/bigraph_schema/react.py +0 -50
- bigraph-schema-0.0.46/bigraph_schema/type_system.py +0 -7110
- {bigraph-schema-0.0.46 → bigraph-schema-0.0.48}/AUTHORS.md +0 -0
- {bigraph-schema-0.0.46 → bigraph-schema-0.0.48}/LICENSE +0 -0
- {bigraph-schema-0.0.46 → bigraph-schema-0.0.48}/README.md +0 -0
- {bigraph-schema-0.0.46 → bigraph-schema-0.0.48}/bigraph_schema/parse.py +0 -0
- {bigraph-schema-0.0.46 → bigraph-schema-0.0.48}/bigraph_schema/protocols.py +0 -0
- {bigraph-schema-0.0.46 → bigraph-schema-0.0.48}/bigraph_schema/units.py +0 -0
- {bigraph-schema-0.0.46 → bigraph-schema-0.0.48}/bigraph_schema.egg-info/dependency_links.txt +0 -0
- {bigraph-schema-0.0.46 → bigraph-schema-0.0.48}/bigraph_schema.egg-info/requires.txt +0 -0
- {bigraph-schema-0.0.46 → bigraph-schema-0.0.48}/bigraph_schema.egg-info/top_level.txt +0 -0
- {bigraph-schema-0.0.46 → bigraph-schema-0.0.48}/setup.cfg +0 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
from bigraph_schema.registry import (
|
|
2
|
+
deep_merge, validate_merge, default, Registry, hierarchy_depth, is_schema_key, establish_path,
|
|
3
|
+
strip_schema_keys, type_parameter_key, non_schema_keys, set_path, transform_path)
|
|
4
|
+
from bigraph_schema.utilities import get_path, visit_method
|
|
5
|
+
from bigraph_schema.edge import Edge
|
|
6
|
+
from bigraph_schema.type_system import TypeSystem, type_schema_keys
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"""
|
|
2
|
+
====
|
|
3
|
+
Edge
|
|
4
|
+
====
|
|
5
|
+
|
|
6
|
+
Base class for all edges in the bigraph schema.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
class Edge:
|
|
10
|
+
config_schema = {}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def __init__(self, config=None, core=None):
|
|
14
|
+
if core is None:
|
|
15
|
+
raise Exception('must provide a core')
|
|
16
|
+
|
|
17
|
+
self.core = core
|
|
18
|
+
|
|
19
|
+
if config is None:
|
|
20
|
+
config = {}
|
|
21
|
+
|
|
22
|
+
self.config = self.core.fill(
|
|
23
|
+
self.config_schema,
|
|
24
|
+
config)
|
|
25
|
+
|
|
26
|
+
self.initialize(self.config)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def initialize(self):
|
|
30
|
+
pass
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def initial_state(self):
|
|
34
|
+
return {}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def inputs(self):
|
|
38
|
+
return {}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def outputs(self):
|
|
42
|
+
return {}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def interface(self):
|
|
46
|
+
"""Returns the schema for this type"""
|
|
47
|
+
return {
|
|
48
|
+
'inputs': self.inputs(),
|
|
49
|
+
'outputs': self.outputs()}
|
|
@@ -17,31 +17,6 @@ from pprint import pformat as pf
|
|
|
17
17
|
from bigraph_schema.protocols import local_lookup_module, function_module
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
NONE_SYMBOL = '!nil'
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
required_schema_keys = set([
|
|
24
|
-
'_default',
|
|
25
|
-
'_apply',
|
|
26
|
-
'_check',
|
|
27
|
-
'_serialize',
|
|
28
|
-
'_deserialize',
|
|
29
|
-
'_fold',
|
|
30
|
-
])
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
optional_schema_keys = set([
|
|
34
|
-
'_type',
|
|
35
|
-
'_value',
|
|
36
|
-
'_description',
|
|
37
|
-
'_type_parameters',
|
|
38
|
-
'_inherit',
|
|
39
|
-
'_divide',
|
|
40
|
-
])
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
type_schema_keys = required_schema_keys | optional_schema_keys
|
|
44
|
-
|
|
45
20
|
|
|
46
21
|
def deep_merge_copy(dct, merge_dct):
|
|
47
22
|
return deep_merge(copy.deepcopy(dct), merge_dct)
|
|
@@ -371,19 +346,3 @@ class Registry(object):
|
|
|
371
346
|
|
|
372
347
|
def validate(self, item):
|
|
373
348
|
return True
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
def test_remove_omitted():
|
|
377
|
-
result = remove_omitted(
|
|
378
|
-
{'a': {}, 'b': {'c': {}, 'd': {}}},
|
|
379
|
-
{'b': {'c': {}}},
|
|
380
|
-
{'a': {'X': 1111}, 'b': {'c': {'Y': 4444}, 'd': {'Z': 99999}}})
|
|
381
|
-
|
|
382
|
-
assert 'a' not in result
|
|
383
|
-
assert result['b']['c']['Y'] == 4444
|
|
384
|
-
assert 'd' not in result['b']
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
if __name__ == '__main__':
|
|
388
|
-
test_reregister_type()
|
|
389
|
-
test_remove_omitted()
|