math-spec-mapping 0.3.18__py3-none-any.whl → 0.3.19__py3-none-any.whl
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.
- math_spec_mapping/Classes/Block.py +3 -0
- math_spec_mapping/Classes/MathSpec.py +43 -3
- math_spec_mapping/Load/action_transmission_channel.py +8 -2
- math_spec_mapping/Load/boundary_actions.py +3 -1
- math_spec_mapping/Load/control_actions.py +3 -1
- math_spec_mapping/Load/general.py +9 -0
- math_spec_mapping/Load/mechanism.py +3 -1
- math_spec_mapping/Load/policy.py +2 -1
- math_spec_mapping/Load/stateful_metrics.py +6 -0
- math_spec_mapping/Reports/html.py +13 -0
- math_spec_mapping/Reports/markdown.py +8 -2
- {math_spec_mapping-0.3.18.dist-info → math_spec_mapping-0.3.19.dist-info}/METADATA +1 -1
- {math_spec_mapping-0.3.18.dist-info → math_spec_mapping-0.3.19.dist-info}/RECORD +16 -16
- {math_spec_mapping-0.3.18.dist-info → math_spec_mapping-0.3.19.dist-info}/LICENSE +0 -0
- {math_spec_mapping-0.3.18.dist-info → math_spec_mapping-0.3.19.dist-info}/WHEEL +0 -0
- {math_spec_mapping-0.3.18.dist-info → math_spec_mapping-0.3.19.dist-info}/top_level.txt +0 -0
@@ -439,7 +439,14 @@ class MathSpec:
|
|
439
439
|
|
440
440
|
self._used_spaces = list(set().union(*self._used_spaces))
|
441
441
|
us_names = [y.name for y in self._used_spaces]
|
442
|
-
self._unused_spaces = [
|
442
|
+
self._unused_spaces = [
|
443
|
+
self.spaces[x]
|
444
|
+
for x in self.spaces
|
445
|
+
if x not in us_names and x not in ["Terminating Space", "Empty Space"]
|
446
|
+
]
|
447
|
+
|
448
|
+
if len(self._unused_spaces) > 0:
|
449
|
+
print("The following spaces are not used: {}".format(self._unused_spaces))
|
443
450
|
|
444
451
|
def _add_spec_tree(self, tree):
|
445
452
|
self.tree = tree
|
@@ -535,8 +542,17 @@ class MathSpec:
|
|
535
542
|
component
|
536
543
|
]
|
537
544
|
elif folder == "Displays":
|
538
|
-
|
539
|
-
|
545
|
+
|
546
|
+
for component in self.displays["Wiring"]:
|
547
|
+
if component["name"] not in tree:
|
548
|
+
print(
|
549
|
+
"Can't find component code source in {} for {}".format(
|
550
|
+
folder, component["name"]
|
551
|
+
)
|
552
|
+
)
|
553
|
+
component["Source Code Location"] = None
|
554
|
+
else:
|
555
|
+
component["Source Code Location"] = tree[component["name"]]
|
540
556
|
elif folder == "Spaces":
|
541
557
|
for component in self.spaces:
|
542
558
|
if component in ["Terminating Space", "Empty Space"]:
|
@@ -1010,6 +1026,14 @@ class MathSpecImplementation:
|
|
1010
1026
|
)
|
1011
1027
|
else:
|
1012
1028
|
control_actions[ca.name] = opt.implementations["python"]
|
1029
|
+
|
1030
|
+
for opt_i in [x for x in ca.control_action_options if x != opt]:
|
1031
|
+
if "python" not in opt_i.implementations:
|
1032
|
+
print(
|
1033
|
+
"No python implementation for {} / {}. To fix this, go to Implementations/Python/ControlActions and add {}".format(
|
1034
|
+
ca.name, opt_i.name, opt_i.name
|
1035
|
+
)
|
1036
|
+
)
|
1013
1037
|
return control_actions
|
1014
1038
|
|
1015
1039
|
def load_boundary_actions(self):
|
@@ -1041,6 +1065,14 @@ class MathSpecImplementation:
|
|
1041
1065
|
)
|
1042
1066
|
else:
|
1043
1067
|
boundary_actions[ba.name] = opt.implementations["python"]
|
1068
|
+
|
1069
|
+
for opt_i in [x for x in ba.boundary_action_options if x != opt]:
|
1070
|
+
if "python" not in opt_i.implementations:
|
1071
|
+
print(
|
1072
|
+
"No python implementation for {} / {}. To fix this, go to Implementations/Python/BoundaryActions and add {}".format(
|
1073
|
+
ba.name, opt_i.name, opt_i.name
|
1074
|
+
)
|
1075
|
+
)
|
1044
1076
|
return boundary_actions
|
1045
1077
|
|
1046
1078
|
def load_mechanisms(self):
|
@@ -1137,6 +1169,14 @@ class MathSpecImplementation:
|
|
1137
1169
|
)
|
1138
1170
|
else:
|
1139
1171
|
policies[p.name] = opt.implementations["python"]
|
1172
|
+
for opt_i in [x for x in p.policy_options if x != opt]:
|
1173
|
+
if "python" not in opt_i.implementations:
|
1174
|
+
print(
|
1175
|
+
"No python implementation for {} / {}. To fix this, go to Implementations/Python/Policies and add {}".format(
|
1176
|
+
p.name, opt_i.name, opt_i.name
|
1177
|
+
)
|
1178
|
+
)
|
1179
|
+
|
1140
1180
|
return policies
|
1141
1181
|
|
1142
1182
|
def load_stateful_metrics(self):
|
@@ -50,8 +50,14 @@ def convert_action_transmission_channel(
|
|
50
50
|
data["target"] = ms["Mechanisms"][target]
|
51
51
|
|
52
52
|
# Add in called by and called here with origin and target
|
53
|
-
|
54
|
-
|
53
|
+
if (data["target"], data["optional"], data["space"]) not in data["origin"].calls:
|
54
|
+
data["origin"].calls.append((data["target"], data["optional"], data["space"]))
|
55
|
+
if (data["origin"], data["optional"], data["space"]) not in data[
|
56
|
+
"target"
|
57
|
+
].called_by:
|
58
|
+
data["target"].called_by.append(
|
59
|
+
(data["origin"], data["optional"], data["space"])
|
60
|
+
)
|
55
61
|
|
56
62
|
# Build the action transmission channel object
|
57
63
|
return ActionTransmissionChannel(data)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from typing import Dict
|
2
2
|
from ..Classes import BoundaryAction, BoundaryActionOption
|
3
|
-
from .general import check_json_keys
|
3
|
+
from .general import check_json_keys, check_domain_codomain_spaces
|
4
4
|
|
5
5
|
|
6
6
|
def convert_boundary_action(data: Dict, ms: Dict) -> BoundaryAction:
|
@@ -24,6 +24,8 @@ def convert_boundary_action(data: Dict, ms: Dict) -> BoundaryAction:
|
|
24
24
|
data["name"]
|
25
25
|
)
|
26
26
|
|
27
|
+
check_domain_codomain_spaces(data, ms)
|
28
|
+
|
27
29
|
if len(data["codomain"]) == 0:
|
28
30
|
data["codomain"] = ("Empty Space",)
|
29
31
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from typing import Dict
|
2
2
|
from ..Classes import ControlAction, ControlActionOption
|
3
|
-
from .general import check_json_keys
|
3
|
+
from .general import check_json_keys, check_domain_codomain_spaces
|
4
4
|
|
5
5
|
|
6
6
|
def convert_control_action(data: Dict, ms: Dict) -> ControlAction:
|
@@ -25,6 +25,8 @@ def convert_control_action(data: Dict, ms: Dict) -> ControlAction:
|
|
25
25
|
data["name"]
|
26
26
|
)
|
27
27
|
|
28
|
+
check_domain_codomain_spaces(data, ms)
|
29
|
+
|
28
30
|
if len(data["codomain"]) == 0:
|
29
31
|
data["codomain"] = ("Empty Space",)
|
30
32
|
|
@@ -159,3 +159,12 @@ def check_json_keys(json: Dict, check_set_key: str) -> None:
|
|
159
159
|
|
160
160
|
def validate_json_schema(json):
|
161
161
|
validate(json, schema)
|
162
|
+
|
163
|
+
|
164
|
+
def check_domain_codomain_spaces(json: Dict, ms) -> None:
|
165
|
+
if "domain" in json:
|
166
|
+
for key in json["domain"]:
|
167
|
+
assert key in ms["Spaces"], "{} not in spaces".format(key)
|
168
|
+
if "codomain" in json:
|
169
|
+
for key in json["codomain"]:
|
170
|
+
assert key in ms["Spaces"], "{} not in spaces".format(key)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from typing import Dict
|
2
2
|
from ..Classes import Mechanism
|
3
|
-
from .general import check_json_keys
|
3
|
+
from .general import check_json_keys, check_domain_codomain_spaces
|
4
4
|
|
5
5
|
|
6
6
|
def convert_mechanism(data: Dict, ms: Dict) -> Mechanism:
|
@@ -26,6 +26,8 @@ def convert_mechanism(data: Dict, ms: Dict) -> Mechanism:
|
|
26
26
|
if len(data["domain"]) == 0:
|
27
27
|
data["domain"] = ("Empty Space",)
|
28
28
|
|
29
|
+
check_domain_codomain_spaces(data, ms)
|
30
|
+
|
29
31
|
# Copy
|
30
32
|
data = data.copy()
|
31
33
|
|
math_spec_mapping/Load/policy.py
CHANGED
@@ -2,7 +2,7 @@ from typing import Dict
|
|
2
2
|
from ..Classes import Policy, PolicyOption
|
3
3
|
|
4
4
|
|
5
|
-
from .general import check_json_keys
|
5
|
+
from .general import check_json_keys, check_domain_codomain_spaces
|
6
6
|
|
7
7
|
|
8
8
|
def convert_policy_options(data: Dict, ms) -> PolicyOption:
|
@@ -58,6 +58,7 @@ def convert_policy(data: Dict, ms: Dict) -> Policy:
|
|
58
58
|
assert type(data["domain"]) == tuple, "{} domain is not a tuple".format(
|
59
59
|
data["name"]
|
60
60
|
)
|
61
|
+
check_domain_codomain_spaces(data, ms)
|
61
62
|
|
62
63
|
if len(data["codomain"]) == 0:
|
63
64
|
data["codomain"] = ("Empty Space",)
|
@@ -40,6 +40,12 @@ def convert_stateful_metric(ms, data: Dict) -> StatefulMetricSet:
|
|
40
40
|
x[1]
|
41
41
|
)
|
42
42
|
|
43
|
+
assert (
|
44
|
+
var["type"] in ms["Types"]
|
45
|
+
), "{} type referenced by {} is not present in math spec".format(
|
46
|
+
var["type"], var["name"]
|
47
|
+
)
|
48
|
+
|
43
49
|
var["implementations"] = {}
|
44
50
|
if "python" in ms["Implementations"]:
|
45
51
|
if "stateful_metrics" in ms["Implementations"]["python"]:
|
@@ -169,6 +169,13 @@ cssclasses:
|
|
169
169
|
else:
|
170
170
|
out += symbol3 + "{}".format(var.name) + "\n"
|
171
171
|
|
172
|
+
out += symbol1 + "**Metrics**\n"
|
173
|
+
for name in ms.metrics.keys():
|
174
|
+
if linking:
|
175
|
+
out += symbol2 + "[[{}]]".format(name) + "\n"
|
176
|
+
else:
|
177
|
+
out += symbol2 + "{}".format(name) + "\n"
|
178
|
+
|
172
179
|
out += symbol1 + "**Types**\n"
|
173
180
|
for name in ms.types.keys():
|
174
181
|
if linking:
|
@@ -221,6 +228,12 @@ cssclasses:
|
|
221
228
|
out += symbol2 + "[[{}]]".format(name) + "\n"
|
222
229
|
else:
|
223
230
|
out += symbol2 + name + "\n"
|
231
|
+
out += symbol1 + "**Wirings**\n"
|
232
|
+
for name in ms.wiring.keys():
|
233
|
+
if linking:
|
234
|
+
out += symbol2 + "[[{}]]".format(name) + "\n"
|
235
|
+
else:
|
236
|
+
out += symbol2 + name + "\n"
|
224
237
|
|
225
238
|
if add_tabbing:
|
226
239
|
out = out.split("\n")
|
@@ -67,7 +67,10 @@ def write_entity_markdown_report(ms, path, entity, add_metadata=True):
|
|
67
67
|
|
68
68
|
|
69
69
|
def write_source_code_block(component, text, path):
|
70
|
-
|
70
|
+
if hasattr(component, "source_code_location"):
|
71
|
+
file_path = component.source_code_location
|
72
|
+
else:
|
73
|
+
file_path = component["Source Code Location"]
|
71
74
|
if file_path:
|
72
75
|
file_path = os.path.relpath(file_path, path)
|
73
76
|
text += "## Spec Source Code Location\n\n"
|
@@ -939,7 +942,10 @@ def write_wiring_display_markdown_report(ms, path, wiring, add_metadata=True):
|
|
939
942
|
out += "\n"
|
940
943
|
out += "\n"
|
941
944
|
|
942
|
-
|
945
|
+
path = "{}/Displays/Wiring/{}.md".format(path, wiring["name"])
|
946
|
+
out = write_source_code_block(wiring, out, path)
|
947
|
+
|
948
|
+
with open(path, "w") as f:
|
943
949
|
f.write(out)
|
944
950
|
|
945
951
|
|
@@ -2,11 +2,11 @@ math_spec_mapping/__init__.py,sha256=7fGuxoSDYl61z0PZ_PzS6x5P8l174gOzobI9u0aoLVw
|
|
2
2
|
math_spec_mapping/schema.py,sha256=6mrRqzEnTTSXjb19xJ63MBp0KjKH0s7i6TfT4MkAY9k,233
|
3
3
|
math_spec_mapping/schema.schema.json,sha256=hJP2TcV5WPFPmx4u_A5U1xtnpkE1LeYaTeYOXadTot0,30916
|
4
4
|
math_spec_mapping/Classes/ActionTransmissionChannel.py,sha256=zWMo5QsgPh5WGIWXl-xOrZNMXYJXmK6Vejw1dQvi0og,246
|
5
|
-
math_spec_mapping/Classes/Block.py,sha256=
|
5
|
+
math_spec_mapping/Classes/Block.py,sha256=KHdGILGW7G29nXXsrjeRkKsilqEqYl31ZV1u9gm4xio,20147
|
6
6
|
math_spec_mapping/Classes/BoundaryAction.py,sha256=_rFvEZ4LNxmlM59js4SuQ9n5CgVmITw4YWKs0-q0r-4,560
|
7
7
|
math_spec_mapping/Classes/ControlAction.py,sha256=4AzMSA8fbnUf-fGlvMJXHJFbz32G1h1QVWf2yzrXrLA,493
|
8
8
|
math_spec_mapping/Classes/Entity.py,sha256=fA0-b128_OHHxfCg4pzqyQV083EYev1HlVpy86S5igg,1226
|
9
|
-
math_spec_mapping/Classes/MathSpec.py,sha256=
|
9
|
+
math_spec_mapping/Classes/MathSpec.py,sha256=4tD5c0qkQM2d99f0i1YYzmq20NNnQtqVmsa9P18qoR8,53181
|
10
10
|
math_spec_mapping/Classes/Mechanism.py,sha256=2sLm3wYBIeTQaMBcsJ9btqIWsbS895Ra8NY6Y9_G_Dg,379
|
11
11
|
math_spec_mapping/Classes/Metric.py,sha256=iQhH4g8Z60QlM22nPX9ytGmidOsZSiSs0KjqwmsScwU,636
|
12
12
|
math_spec_mapping/Classes/Parameter.py,sha256=ZuJ_w0sChvRElJ4sOnXZ2EV4Ell2xXFulKLjVOpgz2E,1237
|
@@ -22,22 +22,22 @@ math_spec_mapping/Convenience/documentation.py,sha256=1ziWVJznbCUxeAAt03nAdEYtMl
|
|
22
22
|
math_spec_mapping/Convenience/github.py,sha256=Wddr1FCxcIxaFeiKyvx3mvVDbzjcgTxs4rU8ulc4qXk,3539
|
23
23
|
math_spec_mapping/Convenience/starter.py,sha256=dD1R9wcVFZV-BCTflxNkR6Ay6NF1TlVBdIaWmbJwMGE,17379
|
24
24
|
math_spec_mapping/Load/__init__.py,sha256=QfHMLatZAKqj4up-LkDL_r42tO7Mo_-qdqPQYLYY5l0,49
|
25
|
-
math_spec_mapping/Load/action_transmission_channel.py,sha256=
|
26
|
-
math_spec_mapping/Load/boundary_actions.py,sha256=
|
27
|
-
math_spec_mapping/Load/control_actions.py,sha256=
|
25
|
+
math_spec_mapping/Load/action_transmission_channel.py,sha256=oTYCi7as4LWKZLxfRckuWpfLsAPZXjp-VBYmyLBN3yk,2781
|
26
|
+
math_spec_mapping/Load/boundary_actions.py,sha256=sR1JWzWD-9jegIQ8Api_NNUp11RgYM-6sAi1Pq-vkss,3007
|
27
|
+
math_spec_mapping/Load/control_actions.py,sha256=gL4HVn81e1UwBjUKEVtNEJop7E8KQGuq4F43oMaoyvA,2445
|
28
28
|
math_spec_mapping/Load/displays.py,sha256=uQvs0Jhp8-9SXGex8SG3ibxHJu7ahAV3xLeBFbT8QEE,480
|
29
29
|
math_spec_mapping/Load/entities.py,sha256=Ds7VQY_govWEn1vSHYVrLa8IadSNyOQzaCK18JPYPKk,1289
|
30
|
-
math_spec_mapping/Load/general.py,sha256=
|
30
|
+
math_spec_mapping/Load/general.py,sha256=Wjg0ESB80j9UwvoRB_-J8SBKq3KqCFZAKsuKNJFqkE4,4789
|
31
31
|
math_spec_mapping/Load/implementations.py,sha256=a8YvumnyQvrnCo-o52Rv4yU8D7nmkMrV1iIA15fr6Bw,490
|
32
32
|
math_spec_mapping/Load/load.py,sha256=Cm1IP_jIzWNGFVPcb1OOfQQYSNgyIfUdT--v1D1dkKE,2797
|
33
|
-
math_spec_mapping/Load/mechanism.py,sha256=
|
33
|
+
math_spec_mapping/Load/mechanism.py,sha256=6tgISsxc-SXCYS5yxuIqnl0nX__t1k0uj9z0O0E1uC4,2367
|
34
34
|
math_spec_mapping/Load/metrics.py,sha256=CcVM0_aN-aPnH5_AyEKzFCJGPbgMb0brw5nECsdNVeU,3936
|
35
35
|
math_spec_mapping/Load/parameters.py,sha256=W4utm7to3s2fo4z3XgLH0TM1agaIad1qfM2I-lLMua4,1393
|
36
|
-
math_spec_mapping/Load/policy.py,sha256=
|
36
|
+
math_spec_mapping/Load/policy.py,sha256=61F7sobAwaXrT1g_pXqBmQS0O-jekdQ1nB9C658LJyg,2770
|
37
37
|
math_spec_mapping/Load/spaces.py,sha256=5nJto38BVMED5KuMXOqavYj8gcSTKiNSTdMOOp5ThTA,1186
|
38
38
|
math_spec_mapping/Load/spec_tree.py,sha256=4If9twlH30tDFxmZSRkwrRnfLlG_dTWOHbzvVrn42Bg,2481
|
39
39
|
math_spec_mapping/Load/state_update_transmission_channels.py,sha256=FJWp5n4HdtHAfof5BUQ6BnRakljatL2h8dWCapaVSc0,2238
|
40
|
-
math_spec_mapping/Load/stateful_metrics.py,sha256=
|
40
|
+
math_spec_mapping/Load/stateful_metrics.py,sha256=l-tjCnBnURlGxbJG1xtvmfWJ2egI9kMTkcoZUrmvtBY,2562
|
41
41
|
math_spec_mapping/Load/states.py,sha256=3YurI7eTNkN6nrXRFVrc58wH0VfM22XOuWE07HVpR7Y,1365
|
42
42
|
math_spec_mapping/Load/type.py,sha256=FbViE3wV1o1JTx7mUYyUpAvgIxDKDQYc6Iw50FrZ4nY,4808
|
43
43
|
math_spec_mapping/Load/wiring.py,sha256=l1FhHNFRMKorn1oiRhsuMDsExcXnUmTjqQt5ElE-Bbk,3258
|
@@ -45,8 +45,8 @@ math_spec_mapping/Reports/__init__.py,sha256=P3IuE1wiM1EO_yCSD73D4O0O6j7aVWmiwpK
|
|
45
45
|
math_spec_mapping/Reports/boundary_actions.py,sha256=45BPp4QjWdD-3E9ZWwqgj_nI2-YdcI2ZZ19_Qv_K7Qk,1410
|
46
46
|
math_spec_mapping/Reports/control_actions.py,sha256=NksekZKIPFSIkubttFstKFthc5AU9B9PWRLSl9j1wWs,1216
|
47
47
|
math_spec_mapping/Reports/general.py,sha256=WOOn6Wlb8M4fsdN49FlKLwOka6vJPQ9aCUy88TL2ki0,1610
|
48
|
-
math_spec_mapping/Reports/html.py,sha256=
|
49
|
-
math_spec_mapping/Reports/markdown.py,sha256=
|
48
|
+
math_spec_mapping/Reports/html.py,sha256=MCVp_D1LuRoZrHtwzFOJGQviztGeahqsWf3Zue1Yz64,10134
|
49
|
+
math_spec_mapping/Reports/markdown.py,sha256=hrUzpaB7v8odPRH9ZiQCJTcCity8SB8x-NrAs-1IQA8,30303
|
50
50
|
math_spec_mapping/Reports/mechanisms.py,sha256=d2Rxt3JBYvqAOAYUynl0buYVoXEHrO8EGq7GK6hK8NA,1322
|
51
51
|
math_spec_mapping/Reports/node_map.py,sha256=FdSMDQG16NX6n9sZcH-T5xwsvgjrV9OqBHc9J_VlNK0,3129
|
52
52
|
math_spec_mapping/Reports/parameters.py,sha256=-ucL71lolqU0xvV7yb0sXl4pFMRl5tXNWdoBfUjLOaQ,1944
|
@@ -55,8 +55,8 @@ math_spec_mapping/Reports/spaces.py,sha256=-76hR5wQBv4lsG000ypBJ-OprjsNjI-rNRMYd
|
|
55
55
|
math_spec_mapping/Reports/state.py,sha256=QYeCvX5cHeZBrbvMeDsTqJcUDTuDFJSLvPbasjLspk8,3643
|
56
56
|
math_spec_mapping/Reports/tables.py,sha256=O0CNuqh3LMECq5uLjBOoxMUk5hUvkUK660FNnwWUxDY,1505
|
57
57
|
math_spec_mapping/Reports/wiring.py,sha256=u9SvKWy6T-WJUEgFI6-zgZanoOaTTs_2YwmEceDLsV8,1618
|
58
|
-
math_spec_mapping-0.3.
|
59
|
-
math_spec_mapping-0.3.
|
60
|
-
math_spec_mapping-0.3.
|
61
|
-
math_spec_mapping-0.3.
|
62
|
-
math_spec_mapping-0.3.
|
58
|
+
math_spec_mapping-0.3.19.dist-info/LICENSE,sha256=ObyEzSw8kgCaFbEfpu1zP4TrcAKLA0xhqHMZZfyh7N0,1069
|
59
|
+
math_spec_mapping-0.3.19.dist-info/METADATA,sha256=H5WfPm1pg2PybAhdQL8qx27FPNlvmg-f9iTGTpGJ6oE,6498
|
60
|
+
math_spec_mapping-0.3.19.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
61
|
+
math_spec_mapping-0.3.19.dist-info/top_level.txt,sha256=AImhn9wgazkdV0a9vfiphtQR8uGe2nq-ZIOp-6yUk9o,18
|
62
|
+
math_spec_mapping-0.3.19.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|