math-spec-mapping 0.2.5__py3-none-any.whl → 0.2.6.1__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- Load/implementations.py +16 -0
- Load/load.py +2 -0
- Load/type.py +32 -1
- Reports/markdown.py +4 -0
- {math_spec_mapping-0.2.5.dist-info → math_spec_mapping-0.2.6.1.dist-info}/METADATA +7 -1
- {math_spec_mapping-0.2.5.dist-info → math_spec_mapping-0.2.6.1.dist-info}/RECORD +9 -10
- {math_spec_mapping-0.2.5.dist-info → math_spec_mapping-0.2.6.1.dist-info}/top_level.txt +0 -2
- __init__.py +0 -29
- schema.py +0 -8
- {math_spec_mapping-0.2.5.dist-info → math_spec_mapping-0.2.6.1.dist-info}/LICENSE +0 -0
- {math_spec_mapping-0.2.5.dist-info → math_spec_mapping-0.2.6.1.dist-info}/WHEEL +0 -0
Load/implementations.py
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
import os
|
2
|
+
|
3
|
+
|
4
|
+
def load_implementations(ms):
|
5
|
+
implementations = {}
|
6
|
+
python_path = "src/Implementations/Python/__init__.py"
|
7
|
+
if os.path.exists(python_path):
|
8
|
+
implementations["python"] = load_python_implementations()
|
9
|
+
|
10
|
+
ms["Implementations"] = implementations
|
11
|
+
|
12
|
+
|
13
|
+
def load_python_implementations():
|
14
|
+
from src.Implementations.Python import implementation
|
15
|
+
|
16
|
+
return implementation
|
Load/load.py
CHANGED
@@ -16,6 +16,7 @@ from .wiring import load_wiring
|
|
16
16
|
from .type import load_types, load_type_keys
|
17
17
|
from .metrics import load_metrics
|
18
18
|
from .displays import load_displays
|
19
|
+
from .implementations import load_implementations
|
19
20
|
|
20
21
|
|
21
22
|
def load_from_json(json: Dict) -> MathSpec:
|
@@ -39,6 +40,7 @@ def load_from_json(json: Dict) -> MathSpec:
|
|
39
40
|
# Do loading one by one to transfer the json
|
40
41
|
|
41
42
|
load_type_keys(ms)
|
43
|
+
load_implementations(ms)
|
42
44
|
load_types(ms, json)
|
43
45
|
load_spaces(ms, json)
|
44
46
|
load_states(ms, json)
|
Load/type.py
CHANGED
@@ -41,6 +41,10 @@ def convert_type(data, ms):
|
|
41
41
|
if type_name in ms["Type Keys"]["typescript"]:
|
42
42
|
data["type"]["typescript"] = ms["Type Keys"]["typescript"][type_name]
|
43
43
|
data["type_name"]["typescript"] = ms["Type Keys"]["typescript"][type_name]
|
44
|
+
if "julia" in ms["Type Keys"]:
|
45
|
+
if type_name in ms["Type Keys"]["julia"]:
|
46
|
+
data["type"]["julia"] = ms["Type Keys"]["julia"][type_name]
|
47
|
+
data["type_name"]["julia"] = ms["Type Keys"]["julia"][type_name]
|
44
48
|
|
45
49
|
# Build the type object
|
46
50
|
return Type(data)
|
@@ -89,13 +93,40 @@ def load_typescript_type_key(path):
|
|
89
93
|
return type_definitions
|
90
94
|
|
91
95
|
|
92
|
-
def
|
96
|
+
def load_julia_type_key(path):
|
97
|
+
with open(path, "r") as file:
|
98
|
+
type_definitions = file.read()
|
99
|
+
type_definitions = type_definitions.split("end")
|
100
|
+
type_definitions = [x.strip() for x in type_definitions]
|
101
|
+
type_definitions = [x for x in type_definitions if len(x) > 0]
|
102
|
+
|
103
|
+
hold = type_definitions[:]
|
104
|
+
type_definitions = {}
|
105
|
+
for x in hold:
|
106
|
+
name = x
|
107
|
+
if x.startswith("abstract type"):
|
108
|
+
name = name[14:]
|
109
|
+
name = name[: name.index("<:")].strip()
|
110
|
+
elif x.startswith("struct"):
|
111
|
+
name = name[7:]
|
112
|
+
name = name[: name.index("\n")].strip()
|
113
|
+
else:
|
114
|
+
assert False
|
115
|
+
|
116
|
+
type_definitions[name] = x
|
117
|
+
return type_definitions
|
118
|
+
|
119
|
+
|
120
|
+
def load_type_keys(ms):
|
93
121
|
type_keys = {}
|
94
122
|
python_path = "src/TypeMappings/types.py"
|
95
123
|
typescript_path = "src/TypeMappings/types.ts"
|
124
|
+
julia_path = "src/TypeMappings/types.jl"
|
96
125
|
if os.path.exists(python_path):
|
97
126
|
type_keys["python"] = load_python_type_key()
|
98
127
|
if os.path.exists(typescript_path):
|
99
128
|
type_keys["typescript"] = load_typescript_type_key(typescript_path)
|
129
|
+
if os.path.exists(julia_path):
|
130
|
+
type_keys["julia"] = load_julia_type_key(julia_path)
|
100
131
|
|
101
132
|
ms["Type Keys"] = type_keys
|
Reports/markdown.py
CHANGED
@@ -99,6 +99,10 @@ def write_types_markdown_report(ms, path, t, add_metadata=True):
|
|
99
99
|
out += "### Typescript Type\n"
|
100
100
|
out += t.type_name["typescript"]
|
101
101
|
out += "\n"
|
102
|
+
if "julia" in t.type:
|
103
|
+
out += "### Julia Type\n"
|
104
|
+
out += t.type_name["julia"]
|
105
|
+
out += "\n"
|
102
106
|
out += "\n"
|
103
107
|
out += "## Notes"
|
104
108
|
out += "\n\n"
|
@@ -1,7 +1,9 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: math_spec_mapping
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.6.1
|
4
4
|
Summary: A library for easy mapping of mathematical specifications.
|
5
|
+
Home-page: https://example.com/math_spec_mapping
|
6
|
+
Author: Sean McOwen
|
5
7
|
Author-email: Sean McOwen <Sean@Block.Science>
|
6
8
|
Classifier: Programming Language :: Python :: 3
|
7
9
|
Classifier: License :: OSI Approved :: MIT License
|
@@ -23,6 +25,10 @@ It uses block diagram wirings and spaces to represent the actions in complex sys
|
|
23
25
|
|
24
26
|
One good example is the [wiring report](https://github.com/SeanMcOwen/Root-Finding-Simulation/blob/main/MSML/reports/Simulation%20Block.md) for the Root Finding Simulation canonical example.
|
25
27
|
|
28
|
+
## Installing the library
|
29
|
+
|
30
|
+
To install the library, simply pip install by running "pip install math_spec_mapping"
|
31
|
+
|
26
32
|
## Why MSML?
|
27
33
|
|
28
34
|
Writing mathematical specifications can be a difficult process, especially when variable names are changed or new mechanisms are introduced. MSML seeks to streamline the process with automations as well as enhance the abilities of static math specs to deliver deeper insights. Because it is automated, one can write specifications at different levels of details or for different purposes.
|
@@ -1,5 +1,3 @@
|
|
1
|
-
__init__.py,sha256=RJMgTt0U7VnF0CtTYKCtx3idtAHhHHn54wBJ9WEZJYE,904
|
2
|
-
schema.py,sha256=6mrRqzEnTTSXjb19xJ63MBp0KjKH0s7i6TfT4MkAY9k,233
|
3
1
|
Classes/ActionTransmissionChannel.py,sha256=zWMo5QsgPh5WGIWXl-xOrZNMXYJXmK6Vejw1dQvi0og,246
|
4
2
|
Classes/Block.py,sha256=hXQO221IP-TqZm_TwFKfURpEEjZm7L1TPZDCYlaOdho,17302
|
5
3
|
Classes/BoundaryAction.py,sha256=AOENCqCEfpjotnHhzUj_F2SOP0SGpkN1tNPr8Mtl6Tc,476
|
@@ -26,7 +24,8 @@ Load/control_actions.py,sha256=VmjezReijEqe9cdPHQubGZTGVPsYbMzWfLu5Dfm9WvY,1563
|
|
26
24
|
Load/displays.py,sha256=ooHWT_OryzEkp7F3LcGywwdLMRJLxuyPK82zJ3gcyN0,414
|
27
25
|
Load/entities.py,sha256=rMD_Pja-zqH1Z14rsO_Ia7dg3BIi5_HoQmqGAoEYofA,1208
|
28
26
|
Load/general.py,sha256=2q6aGKxXhebiHHTZhtACvM4nWIkTben0o5rXuvfv2Vw,4463
|
29
|
-
Load/
|
27
|
+
Load/implementations.py,sha256=SGKZ_YXeNpJUTnw5fajQTXji7S2bNQo8sh-7YcIO6pk,395
|
28
|
+
Load/load.py,sha256=CLprDhJpbwm9RAzKM2Ghwr8eqBu0a-wvGDOCMmc01YE,2484
|
30
29
|
Load/mechanism.py,sha256=aIpMzgQn8f1aywgOHxL5kHQUn1N8K9pmHOVs51bv3Hk,1673
|
31
30
|
Load/metrics.py,sha256=gD68mt0Y5jSgofZUwscV8PFatOMV_LPwYyPrwV9SdtE,3273
|
32
31
|
Load/parameters.py,sha256=aid_vqYub9643s82NDtMAXLRdV9BPQkri5MadA0L0eQ,1334
|
@@ -35,14 +34,14 @@ Load/spaces.py,sha256=7zgGA57Te7T4hfuCCDElffiidWgn1lKm5E14e1yjt8M,1116
|
|
35
34
|
Load/state_update_transmission_channels.py,sha256=FJWp5n4HdtHAfof5BUQ6BnRakljatL2h8dWCapaVSc0,2238
|
36
35
|
Load/stateful_metrics.py,sha256=uGSTc6x6lld5xptgSUMHrO0Vg0QDRIL14C6zTg33S8o,1977
|
37
36
|
Load/states.py,sha256=cwo29SBAtj1FoQLEb8c0wkSCn038lIgM9RjNiZefUaE,1223
|
38
|
-
Load/type.py,sha256=
|
37
|
+
Load/type.py,sha256=R6d5t55TMMCKsOk8xXp_Cu5gvkt2DG4Yzvq6NREIefs,4174
|
39
38
|
Load/wiring.py,sha256=1dR94U5N1W_WI5rL6lYBltH25ZvApB2pIpq9r5Opkug,3083
|
40
39
|
Reports/__init__.py,sha256=W27I6S9Ro1hWeHmnxIokCA06awB__eYey7PvKD4Hc1s,933
|
41
40
|
Reports/boundary_actions.py,sha256=45BPp4QjWdD-3E9ZWwqgj_nI2-YdcI2ZZ19_Qv_K7Qk,1410
|
42
41
|
Reports/control_actions.py,sha256=NksekZKIPFSIkubttFstKFthc5AU9B9PWRLSl9j1wWs,1216
|
43
42
|
Reports/general.py,sha256=WOOn6Wlb8M4fsdN49FlKLwOka6vJPQ9aCUy88TL2ki0,1610
|
44
43
|
Reports/html.py,sha256=rBnwvWeFgCfP7O8nsBL6hWE63Y1Qd24QyGD2Z7CnZ-8,8094
|
45
|
-
Reports/markdown.py,sha256=
|
44
|
+
Reports/markdown.py,sha256=pDGHYMdtZmeXHqvU9FB3BycyB4qflWXq0bf2m-wsXMU,21138
|
46
45
|
Reports/mechanisms.py,sha256=d2Rxt3JBYvqAOAYUynl0buYVoXEHrO8EGq7GK6hK8NA,1322
|
47
46
|
Reports/node_map.py,sha256=FdSMDQG16NX6n9sZcH-T5xwsvgjrV9OqBHc9J_VlNK0,3129
|
48
47
|
Reports/parameters.py,sha256=yizNG4lNGrgrlzYYcHMGfXKDFlPw4PMDYshDqZ3YARs,535
|
@@ -51,8 +50,8 @@ Reports/spaces.py,sha256=-76hR5wQBv4lsG000ypBJ-OprjsNjI-rNRMYdtsYnjQ,579
|
|
51
50
|
Reports/state.py,sha256=RSHDjzSiUj4ZjReWbkBW7k2njs3Ovp-q0rCC7GBfD-A,2203
|
52
51
|
Reports/tables.py,sha256=O0CNuqh3LMECq5uLjBOoxMUk5hUvkUK660FNnwWUxDY,1505
|
53
52
|
Reports/wiring.py,sha256=u9SvKWy6T-WJUEgFI6-zgZanoOaTTs_2YwmEceDLsV8,1618
|
54
|
-
math_spec_mapping-0.2.
|
55
|
-
math_spec_mapping-0.2.
|
56
|
-
math_spec_mapping-0.2.
|
57
|
-
math_spec_mapping-0.2.
|
58
|
-
math_spec_mapping-0.2.
|
53
|
+
math_spec_mapping-0.2.6.1.dist-info/LICENSE,sha256=ObyEzSw8kgCaFbEfpu1zP4TrcAKLA0xhqHMZZfyh7N0,1069
|
54
|
+
math_spec_mapping-0.2.6.1.dist-info/METADATA,sha256=8ZT9E-LTdLFeLSwWW1NNK_FdbHdSXzrF5-El8FY4V-0,6083
|
55
|
+
math_spec_mapping-0.2.6.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
56
|
+
math_spec_mapping-0.2.6.1.dist-info/top_level.txt,sha256=Su_elDptuaN90UL6S2mN2Tb7kpAL6HuAZiLrbNPwBdc,33
|
57
|
+
math_spec_mapping-0.2.6.1.dist-info/RECORD,,
|
__init__.py
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
from .Load import load_from_json
|
2
|
-
from .Reports import (
|
3
|
-
create_action_chains_graph,
|
4
|
-
write_out_boundary_actions,
|
5
|
-
write_out_policies,
|
6
|
-
write_out_mechanisms,
|
7
|
-
load_svg_graphviz,
|
8
|
-
write_basic_report_full,
|
9
|
-
write_action_chain_reports,
|
10
|
-
write_spec_tree,
|
11
|
-
create_parameter_impact_table,
|
12
|
-
write_entity_reports,
|
13
|
-
write_wiring_report,
|
14
|
-
write_overview,
|
15
|
-
write_entity_markdown_report,
|
16
|
-
write_state_markdown_report,
|
17
|
-
write_types_markdown_report,
|
18
|
-
write_boundary_action_markdown_report,
|
19
|
-
write_policy_markdown_report,
|
20
|
-
write_mechanism_markdown_report,
|
21
|
-
write_space_markdown_report,
|
22
|
-
write_control_action_markdown_report,
|
23
|
-
write_wiring_markdown_report,
|
24
|
-
write_parameter_markdown_report,
|
25
|
-
write_stateful_metrics_markdown_report,
|
26
|
-
write_all_markdown_reports,
|
27
|
-
)
|
28
|
-
from .schema import schema
|
29
|
-
from .Convenience import write_top_level_json_description
|
schema.py
DELETED
File without changes
|
File without changes
|