math-spec-mapping 0.2.4__tar.gz → 0.2.5__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {math_spec_mapping-0.2.4/src/math_spec_mapping.egg-info → math_spec_mapping-0.2.5}/PKG-INFO +1 -1
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/pyproject.toml +1 -1
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Classes/Block.py +12 -0
- math_spec_mapping-0.2.5/src/Convenience/__init__.py +1 -0
- math_spec_mapping-0.2.5/src/Convenience/documentation.py +49 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Load/stateful_metrics.py +4 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Load/type.py +1 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Reports/html.py +11 -4
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Reports/markdown.py +48 -4
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/__init__.py +1 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5/src/math_spec_mapping.egg-info}/PKG-INFO +1 -1
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/math_spec_mapping.egg-info/SOURCES.txt +1 -0
- math_spec_mapping-0.2.4/src/Convenience/__init__.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/LICENSE +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/README.md +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/setup.cfg +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Classes/ActionTransmissionChannel.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Classes/BoundaryAction.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Classes/ControlAction.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Classes/Entity.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Classes/MathSpec.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Classes/Mechanism.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Classes/Metric.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Classes/Parameter.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Classes/Policy.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Classes/Space.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Classes/State.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Classes/StateUpdateTransmissionChannel.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Classes/StatefulMetric.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Classes/Type.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Classes/__init__.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Convenience/starter.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Load/__init__.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Load/action_transmission_channel.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Load/boundary_actions.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Load/control_actions.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Load/displays.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Load/entities.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Load/general.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Load/load.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Load/mechanism.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Load/metrics.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Load/parameters.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Load/policy.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Load/spaces.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Load/state_update_transmission_channels.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Load/states.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Load/wiring.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Reports/__init__.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Reports/boundary_actions.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Reports/control_actions.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Reports/general.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Reports/mechanisms.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Reports/node_map.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Reports/parameters.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Reports/policies.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Reports/spaces.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Reports/state.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Reports/tables.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Reports/wiring.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/math_spec_mapping.egg-info/dependency_links.txt +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/math_spec_mapping.egg-info/requires.txt +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/math_spec_mapping.egg-info/top_level.txt +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/schema.py +0 -0
@@ -141,6 +141,18 @@ class Block:
|
|
141
141
|
self.all_updates.extend(x.all_updates)
|
142
142
|
self.all_updates = list(set(self.all_updates))
|
143
143
|
|
144
|
+
def components_full(self):
|
145
|
+
q = [self]
|
146
|
+
out = []
|
147
|
+
while len(q) > 0:
|
148
|
+
cur = q.pop()
|
149
|
+
if hasattr(cur, "components"):
|
150
|
+
q.extend(cur.components)
|
151
|
+
else:
|
152
|
+
out.append(cur)
|
153
|
+
out = list(set(out))
|
154
|
+
return out
|
155
|
+
|
144
156
|
|
145
157
|
class ParallelBlock(Block):
|
146
158
|
def __init__(self, data: Dict):
|
@@ -0,0 +1 @@
|
|
1
|
+
from .documentation import write_top_level_json_description
|
@@ -0,0 +1,49 @@
|
|
1
|
+
from src import schema
|
2
|
+
|
3
|
+
|
4
|
+
def write_json_description(schema, key, name):
|
5
|
+
out = "- **{}**: ".format(name)
|
6
|
+
|
7
|
+
out += schema["definitions"][key]["description"]
|
8
|
+
out += "\n"
|
9
|
+
return out
|
10
|
+
|
11
|
+
|
12
|
+
def write_top_level_json_description(indent_level):
|
13
|
+
|
14
|
+
out = "#{} MSML Components".format("#" * indent_level)
|
15
|
+
out += "\n\n"
|
16
|
+
out += "MSML extends GDS with multiple types of blocks and other enhancements. Below are the definitions of top level components."
|
17
|
+
out += "\n\n"
|
18
|
+
|
19
|
+
out += "##{} Types & Spaces".format("#" * indent_level)
|
20
|
+
out += "\n\n"
|
21
|
+
|
22
|
+
out += write_json_description(schema, "Type", "Type")
|
23
|
+
out += write_json_description(schema, "Space", "Space")
|
24
|
+
|
25
|
+
out += "\n"
|
26
|
+
|
27
|
+
out += "##{} Entities, States, Parameters & Metrics".format("#" * indent_level)
|
28
|
+
out += "\n\n"
|
29
|
+
|
30
|
+
out += write_json_description(schema, "Entity", "Entity")
|
31
|
+
out += write_json_description(schema, "State", "State")
|
32
|
+
out += write_json_description(schema, "StatefulMetric", "Stateful Metric")
|
33
|
+
out += write_json_description(schema, "Parameter", "Parameter")
|
34
|
+
out += write_json_description(schema, "Metric", "Metric")
|
35
|
+
|
36
|
+
out += "\n"
|
37
|
+
|
38
|
+
out += "##{} Blocks & Wiring".format("#" * indent_level)
|
39
|
+
out += "\n\n"
|
40
|
+
|
41
|
+
out += write_json_description(schema, "BoundaryAction", "Boundary Action")
|
42
|
+
out += write_json_description(schema, "ControlAction", "Control Action")
|
43
|
+
out += write_json_description(schema, "Policy", "Policy")
|
44
|
+
out += write_json_description(schema, "Mechanism", "Mechanism")
|
45
|
+
out += write_json_description(schema, "Wiring", "Wiring")
|
46
|
+
|
47
|
+
out += "\n"
|
48
|
+
|
49
|
+
return out
|
@@ -55,5 +55,9 @@ def load_stateful_metrics(ms: Dict, json: Dict) -> None:
|
|
55
55
|
"""
|
56
56
|
|
57
57
|
ms["Stateful Metrics"] = {}
|
58
|
+
check = []
|
58
59
|
for sm in json["Stateful Metrics"]:
|
59
60
|
ms["Stateful Metrics"][sm["name"]] = convert_stateful_metric(ms, sm)
|
61
|
+
for x in ms["Stateful Metrics"][sm["name"]].metrics:
|
62
|
+
assert x.name not in check, "{} stateful metric name is repeated"
|
63
|
+
check.append(x)
|
@@ -37,6 +37,7 @@ def convert_type(data, ms):
|
|
37
37
|
data["type_name"]["python"] = data["type"]["python"].__repr__()
|
38
38
|
else:
|
39
39
|
data["type_name"]["python"] = data["type"]["python"].__name__
|
40
|
+
if "typescript" in ms["Type Keys"]:
|
40
41
|
if type_name in ms["Type Keys"]["typescript"]:
|
41
42
|
data["type"]["typescript"] = ms["Type Keys"]["typescript"][type_name]
|
42
43
|
data["type_name"]["typescript"] = ms["Type Keys"]["typescript"][type_name]
|
@@ -147,11 +147,18 @@ def write_spec_tree(
|
|
147
147
|
out += symbol1 + "**Stateful Metrics**\n"
|
148
148
|
for name in ms.stateful_metrics.keys():
|
149
149
|
if linking:
|
150
|
-
out += symbol2 + "
|
150
|
+
out += symbol2 + "{}".format(name) + "\n"
|
151
151
|
else:
|
152
152
|
out += symbol2 + name + "\n"
|
153
153
|
for var in ms.stateful_metrics[name].metrics:
|
154
|
-
out += symbol3 + var.name + "\n"
|
154
|
+
out += symbol3 + "[[{}]]".format(var.name) + "\n"
|
155
|
+
|
156
|
+
out += symbol1 + "**Types**\n"
|
157
|
+
for name in ms.types.keys():
|
158
|
+
if linking:
|
159
|
+
out += symbol2 + "[[{}]]".format(name) + "\n"
|
160
|
+
else:
|
161
|
+
out += symbol2 + name + "\n"
|
155
162
|
|
156
163
|
out += symbol1 + "**Spaces**\n"
|
157
164
|
for name in ms.spaces.keys():
|
@@ -162,11 +169,11 @@ def write_spec_tree(
|
|
162
169
|
out += symbol1 + "**Parameters**\n"
|
163
170
|
for name in ms.parameters.data.keys():
|
164
171
|
if linking:
|
165
|
-
out += symbol2 + "
|
172
|
+
out += symbol2 + "{}".format(name) + "\n"
|
166
173
|
else:
|
167
174
|
out += symbol2 + name + "\n"
|
168
175
|
for param in [x.name for x in ms.parameters.data[name].parameters]:
|
169
|
-
out += symbol3 + param + "\n"
|
176
|
+
out += symbol3 + "[[{}]]".format(param) + "\n"
|
170
177
|
|
171
178
|
out += symbol1 + "**Boundary Actions**\n"
|
172
179
|
for name in ms.boundary_actions.keys():
|
@@ -135,6 +135,12 @@ def write_boundary_action_markdown_report(ms, path, boundary_action, add_metadat
|
|
135
135
|
out += "\n"
|
136
136
|
out += "\n"
|
137
137
|
|
138
|
+
out += "## Followed By\n"
|
139
|
+
for i, x in enumerate([x[0] for x in boundary_action.calls]):
|
140
|
+
out += "{}. [[{}]]".format(i + 1, x.label)
|
141
|
+
out += "\n"
|
142
|
+
out += "\n"
|
143
|
+
|
138
144
|
out += "## Constraints"
|
139
145
|
for i, x in enumerate(boundary_action.constraints):
|
140
146
|
out += "{}. {}".format(i + 1, x)
|
@@ -342,6 +348,12 @@ def write_control_action_markdown_report(ms, path, control_action, add_metadata=
|
|
342
348
|
out += control_action.description
|
343
349
|
out += "\n"
|
344
350
|
|
351
|
+
out += "## Followed By\n"
|
352
|
+
for i, x in enumerate([x[0] for x in control_action.calls]):
|
353
|
+
out += "{}. [[{}]]".format(i + 1, x.label)
|
354
|
+
out += "\n"
|
355
|
+
out += "\n"
|
356
|
+
|
345
357
|
out += "## Constraints"
|
346
358
|
for i, x in enumerate(control_action.constraints):
|
347
359
|
out += "{}. {}".format(i + 1, x)
|
@@ -406,7 +418,14 @@ def write_wiring_markdown_report(ms, path, wiring, add_metadata=True):
|
|
406
418
|
|
407
419
|
out += "\n"
|
408
420
|
|
409
|
-
out += "##
|
421
|
+
out += "## All Blocks\n"
|
422
|
+
for i, x in enumerate(wiring.components_full()):
|
423
|
+
out += "{}. [[{}]]".format(i + 1, x.name)
|
424
|
+
out += "\n"
|
425
|
+
|
426
|
+
out += "\n"
|
427
|
+
|
428
|
+
out += "## Constraints\n"
|
410
429
|
for i, x in enumerate(wiring.constraints):
|
411
430
|
out += "{}. {}".format(i + 1, x)
|
412
431
|
out += "\n"
|
@@ -510,7 +529,7 @@ def write_stateful_metrics_markdown_report(ms, path, metric, add_metadata=True):
|
|
510
529
|
|
511
530
|
out += "## Variables Used\n"
|
512
531
|
for i, x in enumerate(metric.variables_used):
|
513
|
-
out += "{}. {}.{}".format(i + 1, x[0], x[1])
|
532
|
+
out += "{}. [[{}]].{}".format(i + 1, x[0], x[1])
|
514
533
|
out += "\n"
|
515
534
|
out += "\n"
|
516
535
|
|
@@ -544,12 +563,18 @@ def write_metrics_markdown_report(ms, path, metric, add_metadata=True):
|
|
544
563
|
out += "## Parameters Used\n"
|
545
564
|
for i, x in enumerate(metric.parameters_used):
|
546
565
|
out += "{}. [[{}]]".format(i + 1, x)
|
566
|
+
var = ms.parameters.parameter_map[x]
|
567
|
+
if var.symbol:
|
568
|
+
out += " , symbol: {}".format(var.symbol)
|
547
569
|
out += "\n"
|
548
570
|
out += "\n"
|
549
571
|
|
550
572
|
out += "## Variables Used\n"
|
551
573
|
for i, x in enumerate(metric.variables_used):
|
552
574
|
out += "{}. {}.{}".format(i + 1, x[0], x[1])
|
575
|
+
var = ms.state[x[0]].variable_map[x[1]]
|
576
|
+
if var.symbol:
|
577
|
+
out += " , symbol: {}".format(var.symbol)
|
553
578
|
out += "\n"
|
554
579
|
out += "\n"
|
555
580
|
|
@@ -603,7 +628,7 @@ def write_wiring_display_markdown_report(ms, path, wiring, add_metadata=True):
|
|
603
628
|
out += "\n"
|
604
629
|
|
605
630
|
out += "## Unique Components Used\n"
|
606
|
-
components = [set(x.
|
631
|
+
components = [set(x.components_full()) for x in wirings]
|
607
632
|
components = set().union(*components)
|
608
633
|
for i, x in enumerate(components):
|
609
634
|
out += "{}. [[{}]]".format(i + 1, x.name)
|
@@ -638,7 +663,26 @@ def write_wiring_display_markdown_report(ms, path, wiring, add_metadata=True):
|
|
638
663
|
f.write(out)
|
639
664
|
|
640
665
|
|
641
|
-
def write_all_markdown_reports(ms, path):
|
666
|
+
def write_all_markdown_reports(ms, path, clear_folders=False):
|
667
|
+
if clear_folders:
|
668
|
+
for x in [
|
669
|
+
"Metrics",
|
670
|
+
"Mechanisms",
|
671
|
+
"Types",
|
672
|
+
"Control Actions",
|
673
|
+
"Spaces",
|
674
|
+
".obsidian",
|
675
|
+
"Boundary Actions",
|
676
|
+
"Policies",
|
677
|
+
"Wiring",
|
678
|
+
"States",
|
679
|
+
"Parameters",
|
680
|
+
"Entities",
|
681
|
+
"Stateful Metrics",
|
682
|
+
]:
|
683
|
+
if os.path.exists("{}/{}".format(path, x)):
|
684
|
+
for y in os.listdir("{}/{}".format(path, x)):
|
685
|
+
os.remove("{}/{}/{}".format(path, x, y))
|
642
686
|
|
643
687
|
# Write entities
|
644
688
|
entities = list(ms.entities.keys())
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Classes/ActionTransmissionChannel.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Classes/StateUpdateTransmissionChannel.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/Load/state_update_transmission_channels.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/math_spec_mapping.egg-info/requires.txt
RENAMED
File without changes
|
{math_spec_mapping-0.2.4 → math_spec_mapping-0.2.5}/src/math_spec_mapping.egg-info/top_level.txt
RENAMED
File without changes
|
File without changes
|