math-spec-mapping 0.3.11__py3-none-any.whl → 0.3.13__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,8 @@ import os
4
4
  def load_implementations(ms):
5
5
  implementations = {}
6
6
  python_path = "src/Implementations/Python/__init__.py"
7
- if os.path.exists(python_path):
7
+ python_path2 = "../src/Implementations/Python/__init__.py"
8
+ if os.path.exists(python_path) or os.path.exists(python_path2):
8
9
  implementations["python"] = load_python_implementations()
9
10
 
10
11
  ms["Implementations"] = implementations
@@ -134,4 +134,14 @@ def load_type_keys(ms):
134
134
  if os.path.exists(julia_path):
135
135
  type_keys["julia"] = load_julia_type_key(julia_path)
136
136
 
137
+ python_path = "../src/TypeMappings/types.py"
138
+ typescript_path = "../src/TypeMappings/types.ts"
139
+ julia_path = "../src/TypeMappings/types.jl"
140
+ if os.path.exists(python_path):
141
+ type_keys["python"] = load_python_type_key()
142
+ if os.path.exists(typescript_path):
143
+ type_keys["typescript"] = load_typescript_type_key(typescript_path)
144
+ if os.path.exists(julia_path):
145
+ type_keys["julia"] = load_julia_type_key(julia_path)
146
+
137
147
  ms["Type Keys"] = type_keys
@@ -258,11 +258,22 @@ cssclasses:
258
258
  return out
259
259
 
260
260
 
261
- def write_overview(ms: MathSpec, name: str, file_path: str, summary: str = None):
261
+ def write_overview(
262
+ ms: MathSpec,
263
+ name: str,
264
+ file_path: str,
265
+ summary: str = None,
266
+ base_folder: str = None,
267
+ ):
262
268
  out = "<h1>{}</h1>".format(name)
263
269
  if summary:
264
270
  out += "<h2>Summary</h2>"
265
271
  out += "<p>{}</p>".format(summary)
272
+ if base_folder:
273
+ with open(base_folder, "r") as file:
274
+ content = file.read()
275
+ out += content
276
+ out += "\n"
266
277
  out += "<h2>Specification Tree</h2>"
267
278
  out += write_spec_tree(ms, readme=True)
268
279
  with open(file_path, "w") as f:
@@ -15,7 +15,9 @@ def write_out_params(ms: MathSpec, params: List[str]) -> str:
15
15
  return out
16
16
 
17
17
 
18
- def write_parameter_table_markdown(ms, initial_values=None, links=False):
18
+ def write_parameter_table_markdown(
19
+ ms, initial_values=None, links=False, compress_arrays=False
20
+ ):
19
21
  if initial_values:
20
22
  table = """| Name | Description | Parameter Class | Symbol | Domain | Initial Value |
21
23
  | --- | --- | --- | --- | --- | --- |
@@ -43,7 +45,16 @@ def write_parameter_table_markdown(ms, initial_values=None, links=False):
43
45
  table += "{}".format(tv)
44
46
  table += "|"
45
47
  if initial_values:
46
- table += " {} |".format(initial_values[var.name])
48
+ if compress_arrays:
49
+ iv = initial_values[var.name]
50
+ if type(iv) == list:
51
+ if len(iv) > 4:
52
+ iv = "[{}, {}, ... , {}, {}]".format(
53
+ iv[0], iv[1], iv[-2], iv[-1]
54
+ )
55
+ table += " {} |".format(iv)
56
+ else:
57
+ table += " {} |".format(initial_values[var.name])
47
58
 
48
59
  table += "\n"
49
60
 
@@ -33,7 +33,9 @@ def write_state_variable_table(target_state, links=False):
33
33
  return table
34
34
 
35
35
 
36
- def write_state_variable_table_markdown(target_state, initial_values=None, links=False):
36
+ def write_state_variable_table_markdown(
37
+ target_state, initial_values=None, links=False, compress_arrays=False
38
+ ):
37
39
  if initial_values:
38
40
  table = """| Name | Description | Type | Symbol | Domain | Initial Value |
39
41
  | --- | --- | --- | --- | --- | --- |
@@ -62,18 +64,32 @@ def write_state_variable_table_markdown(target_state, initial_values=None, links
62
64
  table += "{}".format(tv)
63
65
  table += "|"
64
66
  if initial_values:
65
- table += " {} |".format(initial_values[var.name])
67
+ if compress_arrays:
68
+ iv = initial_values[var.name]
69
+ if type(iv) == list:
70
+ if len(iv) > 4:
71
+ iv = "[{}, {}, ... , {}, {}]".format(
72
+ iv[0], iv[1], iv[-2], iv[-1]
73
+ )
74
+ table += " {} |".format(iv)
75
+ else:
76
+ table += " {} |".format(initial_values[var.name])
66
77
 
67
78
  table += "\n"
68
79
 
69
80
  return table
70
81
 
71
82
 
72
- def write_initial_state_variables_tables(ms, initial_values, links=False):
83
+ def write_initial_state_variables_tables(
84
+ ms, initial_values, links=False, compress_arrays=False
85
+ ):
73
86
  out = "### Global State"
74
87
  out += "\n\n"
75
88
  out += write_state_variable_table_markdown(
76
- ms.state["Global State"], initial_values=initial_values, links=links
89
+ ms.state["Global State"],
90
+ initial_values=initial_values,
91
+ links=links,
92
+ compress_arrays=compress_arrays,
77
93
  )
78
94
  out += "\n"
79
95
  for x in ms.state:
@@ -82,7 +98,9 @@ def write_initial_state_variables_tables(ms, initial_values, links=False):
82
98
 
83
99
  out += "### {}".format(x)
84
100
  out += "\n\n"
85
- out += write_state_variable_table_markdown(ms.state[x], links=links)
101
+ out += write_state_variable_table_markdown(
102
+ ms.state[x], links=links, compress_arrays=compress_arrays
103
+ )
86
104
  out += "\n"
87
105
 
88
106
  return out
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: math-spec-mapping
3
- Version: 0.3.11
3
+ Version: 0.3.13
4
4
  Summary: A library for easy mapping of mathematical specifications.
5
5
  Author-email: Sean McOwen <Sean@Block.Science>
6
6
  Classifier: Programming Language :: Python :: 3
@@ -27,7 +27,7 @@ math_spec_mapping/Load/control_actions.py,sha256=W7kKLcA0UQ40m1ZExmvu0ujdxvJ8wH-
27
27
  math_spec_mapping/Load/displays.py,sha256=uQvs0Jhp8-9SXGex8SG3ibxHJu7ahAV3xLeBFbT8QEE,480
28
28
  math_spec_mapping/Load/entities.py,sha256=Ds7VQY_govWEn1vSHYVrLa8IadSNyOQzaCK18JPYPKk,1289
29
29
  math_spec_mapping/Load/general.py,sha256=2q6aGKxXhebiHHTZhtACvM4nWIkTben0o5rXuvfv2Vw,4463
30
- math_spec_mapping/Load/implementations.py,sha256=SGKZ_YXeNpJUTnw5fajQTXji7S2bNQo8sh-7YcIO6pk,395
30
+ math_spec_mapping/Load/implementations.py,sha256=a8YvumnyQvrnCo-o52Rv4yU8D7nmkMrV1iIA15fr6Bw,490
31
31
  math_spec_mapping/Load/load.py,sha256=CLprDhJpbwm9RAzKM2Ghwr8eqBu0a-wvGDOCMmc01YE,2484
32
32
  math_spec_mapping/Load/mechanism.py,sha256=JBy-QpB4W0Z2OcNiakONjD4_RtEgxlFKtLXfDqfhR-0,2037
33
33
  math_spec_mapping/Load/metrics.py,sha256=0XL-E7PUZg5PX_ZensoDpT2Z2xq893JncBEYbPzxeGo,3866
@@ -37,24 +37,24 @@ math_spec_mapping/Load/spaces.py,sha256=5nJto38BVMED5KuMXOqavYj8gcSTKiNSTdMOOp5T
37
37
  math_spec_mapping/Load/state_update_transmission_channels.py,sha256=FJWp5n4HdtHAfof5BUQ6BnRakljatL2h8dWCapaVSc0,2238
38
38
  math_spec_mapping/Load/stateful_metrics.py,sha256=3Lq1ZGMaDd5OcGeqR2p5c_znkYw7ETTNPFjUVdZAHKk,2384
39
39
  math_spec_mapping/Load/states.py,sha256=3YurI7eTNkN6nrXRFVrc58wH0VfM22XOuWE07HVpR7Y,1365
40
- math_spec_mapping/Load/type.py,sha256=z6cBdBNjWed7cRyA0Bj7Jd5PmtemVVh07n3mWFj_5U4,4356
40
+ math_spec_mapping/Load/type.py,sha256=FbViE3wV1o1JTx7mUYyUpAvgIxDKDQYc6Iw50FrZ4nY,4808
41
41
  math_spec_mapping/Load/wiring.py,sha256=1dR94U5N1W_WI5rL6lYBltH25ZvApB2pIpq9r5Opkug,3083
42
42
  math_spec_mapping/Reports/__init__.py,sha256=P3IuE1wiM1EO_yCSD73D4O0O6j7aVWmiwpKJM58ISEs,1121
43
43
  math_spec_mapping/Reports/boundary_actions.py,sha256=45BPp4QjWdD-3E9ZWwqgj_nI2-YdcI2ZZ19_Qv_K7Qk,1410
44
44
  math_spec_mapping/Reports/control_actions.py,sha256=NksekZKIPFSIkubttFstKFthc5AU9B9PWRLSl9j1wWs,1216
45
45
  math_spec_mapping/Reports/general.py,sha256=WOOn6Wlb8M4fsdN49FlKLwOka6vJPQ9aCUy88TL2ki0,1610
46
- math_spec_mapping/Reports/html.py,sha256=zRo67S81pIRK_sttuFy8Y06qllen_K0lNS1qeHQo5ik,9521
46
+ math_spec_mapping/Reports/html.py,sha256=RpyQQON8pDnMmfcyxOsm8UAD5Ad8VKnnW-OyOarTmzA,9711
47
47
  math_spec_mapping/Reports/markdown.py,sha256=SdhgOMpMBnGKWDG0cimk-LI_UqjQDPy87IxTb-PrBQ0,22866
48
48
  math_spec_mapping/Reports/mechanisms.py,sha256=d2Rxt3JBYvqAOAYUynl0buYVoXEHrO8EGq7GK6hK8NA,1322
49
49
  math_spec_mapping/Reports/node_map.py,sha256=FdSMDQG16NX6n9sZcH-T5xwsvgjrV9OqBHc9J_VlNK0,3129
50
- math_spec_mapping/Reports/parameters.py,sha256=T73OKY3dWufeYEb6jSxGQH6GH4PSZLMmZcaV1m8qUn0,1553
50
+ math_spec_mapping/Reports/parameters.py,sha256=-ucL71lolqU0xvV7yb0sXl4pFMRl5tXNWdoBfUjLOaQ,1944
51
51
  math_spec_mapping/Reports/policies.py,sha256=EuBzBsTM6QSS_GHFcAyhGgWvDDZwRuKe7Eos9nX13ho,1814
52
52
  math_spec_mapping/Reports/spaces.py,sha256=-76hR5wQBv4lsG000ypBJ-OprjsNjI-rNRMYdtsYnjQ,579
53
- math_spec_mapping/Reports/state.py,sha256=EPiHz3cDCEPHnVjuFruVKaGJ2SclUfGUFvvOukiHPNg,3110
53
+ math_spec_mapping/Reports/state.py,sha256=QYeCvX5cHeZBrbvMeDsTqJcUDTuDFJSLvPbasjLspk8,3643
54
54
  math_spec_mapping/Reports/tables.py,sha256=O0CNuqh3LMECq5uLjBOoxMUk5hUvkUK660FNnwWUxDY,1505
55
55
  math_spec_mapping/Reports/wiring.py,sha256=u9SvKWy6T-WJUEgFI6-zgZanoOaTTs_2YwmEceDLsV8,1618
56
- math_spec_mapping-0.3.11.dist-info/LICENSE,sha256=ObyEzSw8kgCaFbEfpu1zP4TrcAKLA0xhqHMZZfyh7N0,1069
57
- math_spec_mapping-0.3.11.dist-info/METADATA,sha256=5mt9yY0Os1Ve_d-ilf7LL-lmiZ_K3vyo39JjKtKDdbM,6501
58
- math_spec_mapping-0.3.11.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
59
- math_spec_mapping-0.3.11.dist-info/top_level.txt,sha256=AImhn9wgazkdV0a9vfiphtQR8uGe2nq-ZIOp-6yUk9o,18
60
- math_spec_mapping-0.3.11.dist-info/RECORD,,
56
+ math_spec_mapping-0.3.13.dist-info/LICENSE,sha256=ObyEzSw8kgCaFbEfpu1zP4TrcAKLA0xhqHMZZfyh7N0,1069
57
+ math_spec_mapping-0.3.13.dist-info/METADATA,sha256=v-EO7cVDpF_0OaPmLUYvJtynV3CEpMgpnUrhWUCuCvs,6501
58
+ math_spec_mapping-0.3.13.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
59
+ math_spec_mapping-0.3.13.dist-info/top_level.txt,sha256=AImhn9wgazkdV0a9vfiphtQR8uGe2nq-ZIOp-6yUk9o,18
60
+ math_spec_mapping-0.3.13.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.0.0)
2
+ Generator: setuptools (75.2.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5