math-spec-mapping 0.3.2__tar.gz → 0.3.3__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. {math_spec_mapping-0.3.2/src/math_spec_mapping.egg-info → math_spec_mapping-0.3.3}/PKG-INFO +1 -1
  2. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/pyproject.toml +1 -1
  3. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Classes/Block.py +2 -0
  4. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Classes/State.py +3 -1
  5. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Load/boundary_actions.py +3 -1
  6. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Load/entities.py +5 -1
  7. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Load/states.py +1 -1
  8. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Reports/markdown.py +12 -8
  9. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3/src/math_spec_mapping.egg-info}/PKG-INFO +1 -1
  10. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/LICENSE +0 -0
  11. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/README.md +0 -0
  12. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/setup.cfg +0 -0
  13. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Classes/ActionTransmissionChannel.py +0 -0
  14. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Classes/BoundaryAction.py +0 -0
  15. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Classes/ControlAction.py +0 -0
  16. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Classes/Entity.py +0 -0
  17. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Classes/MathSpec.py +0 -0
  18. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Classes/Mechanism.py +0 -0
  19. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Classes/Metric.py +0 -0
  20. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Classes/Parameter.py +0 -0
  21. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Classes/Policy.py +0 -0
  22. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Classes/Space.py +0 -0
  23. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Classes/StateUpdateTransmissionChannel.py +0 -0
  24. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Classes/StatefulMetric.py +0 -0
  25. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Classes/Type.py +0 -0
  26. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Classes/__init__.py +0 -0
  27. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Convenience/__init__.py +0 -0
  28. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Convenience/documentation.py +0 -0
  29. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Convenience/starter.py +0 -0
  30. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Load/__init__.py +0 -0
  31. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Load/action_transmission_channel.py +0 -0
  32. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Load/control_actions.py +0 -0
  33. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Load/displays.py +0 -0
  34. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Load/general.py +0 -0
  35. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Load/implementations.py +0 -0
  36. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Load/load.py +0 -0
  37. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Load/mechanism.py +0 -0
  38. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Load/metrics.py +0 -0
  39. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Load/parameters.py +0 -0
  40. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Load/policy.py +0 -0
  41. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Load/spaces.py +0 -0
  42. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Load/state_update_transmission_channels.py +0 -0
  43. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Load/stateful_metrics.py +0 -0
  44. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Load/type.py +0 -0
  45. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Load/wiring.py +0 -0
  46. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Reports/__init__.py +0 -0
  47. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Reports/boundary_actions.py +0 -0
  48. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Reports/control_actions.py +0 -0
  49. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Reports/general.py +0 -0
  50. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Reports/html.py +0 -0
  51. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Reports/mechanisms.py +0 -0
  52. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Reports/node_map.py +0 -0
  53. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Reports/parameters.py +0 -0
  54. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Reports/policies.py +0 -0
  55. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Reports/spaces.py +0 -0
  56. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Reports/state.py +0 -0
  57. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Reports/tables.py +0 -0
  58. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/Reports/wiring.py +0 -0
  59. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/__init__.py +0 -0
  60. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/schema.py +0 -0
  61. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping/schema.schema.json +0 -0
  62. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping.egg-info/SOURCES.txt +0 -0
  63. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping.egg-info/dependency_links.txt +0 -0
  64. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping.egg-info/requires.txt +0 -0
  65. {math_spec_mapping-0.3.2 → math_spec_mapping-0.3.3}/src/math_spec_mapping.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: math-spec-mapping
3
- Version: 0.3.2
3
+ Version: 0.3.3
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
@@ -3,7 +3,7 @@ requires = ["setuptools>=61.0"]
3
3
  build-backend = "setuptools.build_meta"
4
4
  [project]
5
5
  name = "math-spec-mapping"
6
- version = "0.3.2"
6
+ version = "0.3.3"
7
7
  authors = [
8
8
  { name="Sean McOwen", email="Sean@Block.Science" },
9
9
  ]
@@ -83,6 +83,7 @@ class Block:
83
83
  updates = self.all_updates
84
84
  else:
85
85
  return "\n", {}
86
+ updates = sorted(updates, key=lambda x: x[0].name + "-" + x[1].name)
86
87
 
87
88
  out = "\n"
88
89
  out += 'subgraph SVS["State Variables"]\n'
@@ -90,6 +91,7 @@ class Block:
90
91
  # Render the entities
91
92
  entity_mapping = {}
92
93
  entities = set([x[0] for x in updates])
94
+ entities = sorted(entities, key=lambda x: x.name)
93
95
  for i, x in enumerate(entities):
94
96
  entity_mapping[x.name] = "EE{}".format(i)
95
97
  out += '{}[("{}")]'.format(entity_mapping[x.name], x.name)
@@ -31,7 +31,9 @@ class State:
31
31
  # Check variable name not repeated
32
32
  assert (
33
33
  var.name not in self.variable_map
34
- ), "Variable name {} is already present in variables!".format(key)
34
+ ), "Variable name {} is already present in variables for the state of {}!".format(
35
+ key, self.name
36
+ )
35
37
 
36
38
  self.variable_map[key] = var
37
39
 
@@ -42,7 +42,9 @@ def convert_boundary_action(data: Dict, ms: Dict) -> BoundaryAction:
42
42
  for name in data["called_by"]:
43
43
  assert (
44
44
  name in ms["Entities"]
45
- ), "{} entity not in entities dictionary".format(name)
45
+ ), "{} entity not in entities dictionary which is referenced in called_by for {}".format(
46
+ name, data["name"]
47
+ )
46
48
  data["called_by"] = [ms["Entities"][x] for x in data["called_by"]]
47
49
 
48
50
  data["codomain"] = tuple(ms["Spaces"][x] for x in data["codomain"])
@@ -25,7 +25,11 @@ def convert_entity(data: Dict, ms: Dict) -> Entity:
25
25
  # Assert that the state is in the math spec and assign it here
26
26
  if data["state"]:
27
27
  name = data["state"]
28
- assert name in ms["State"], "{} state not in states dictionary".format(name)
28
+ assert (
29
+ name in ms["State"]
30
+ ), "{} state not in states dictionary for the entity of {}".format(
31
+ name, data["name"]
32
+ )
29
33
  data["state"] = ms["State"][name]
30
34
 
31
35
  # Build the state object
@@ -25,7 +25,7 @@ def convert_state(ms, data: Dict) -> State:
25
25
  new_variables = []
26
26
  for var in data["variables"]:
27
27
  check_json_keys(var, "State Variable")
28
- assert var["type"] in ms["Types"], "Type not in ms"
28
+ assert var["type"] in ms["Types"], "Type {} not in ms".format(var["name"])
29
29
  var["type"] = ms["Types"][var["type"]]
30
30
  if "metadata" not in var:
31
31
  var["metadata"] = {}
@@ -225,7 +225,7 @@ def write_policy_markdown_report(ms, path, policy, add_metadata=True):
225
225
  out += "\n"
226
226
 
227
227
  out += "## Parameters Used\n"
228
- for i, x in enumerate(policy.parameters_used):
228
+ for i, x in enumerate(sorted(policy.parameters_used, key=lambda x: x)):
229
229
  out += "{}. [[{}]]".format(i + 1, x)
230
230
  out += "\n"
231
231
 
@@ -427,7 +427,7 @@ def write_wiring_markdown_report(ms, path, wiring, add_metadata=True):
427
427
  out += "\n"
428
428
 
429
429
  out += "## All Blocks\n"
430
- for i, x in enumerate(wiring.components_full()):
430
+ for i, x in enumerate(sorted(wiring.components_full(), key=lambda x: x.name)):
431
431
  out += "{}. [[{}]]".format(i + 1, x.name)
432
432
  out += "\n"
433
433
 
@@ -452,13 +452,13 @@ def write_wiring_markdown_report(ms, path, wiring, add_metadata=True):
452
452
  out += "\n"
453
453
 
454
454
  out += "## All Spaces Used\n"
455
- for i, x in enumerate(wiring.all_spaces_used):
455
+ for i, x in enumerate(sorted(wiring.all_spaces_used, key=lambda x: x.name)):
456
456
  out += "{}. [[{}]]".format(i + 1, x.name)
457
457
  out += "\n"
458
458
  out += "\n"
459
459
 
460
460
  out += "## Parameters Used\n"
461
- for i, x in enumerate(wiring.parameters_used):
461
+ for i, x in enumerate(sorted(wiring.parameters_used, key=lambda x: x)):
462
462
  out += "{}. [[{}]]".format(i + 1, x)
463
463
  out += "\n"
464
464
  out += "\n"
@@ -477,7 +477,9 @@ def write_wiring_markdown_report(ms, path, wiring, add_metadata=True):
477
477
 
478
478
  out += "## All State Updates\n"
479
479
 
480
- for i, x in enumerate(wiring.all_updates):
480
+ for i, x in enumerate(
481
+ sorted(wiring.all_updates, key=lambda x: x[0].name + "-" + x[1].name)
482
+ ):
481
483
  out += "{}. [[{}]].[[{}|{}]]".format(
482
484
  i + 1,
483
485
  x[0].name,
@@ -536,7 +538,7 @@ def write_stateful_metrics_markdown_report(ms, path, metric, add_metadata=True):
536
538
  out += "Domain: {}\n\n".format(metric.domain)
537
539
 
538
540
  out += "## Parameters Used\n"
539
- for i, x in enumerate(metric.parameters_used):
541
+ for i, x in enumerate(sorted(metric.parameters_used, key=lambda x: x.name)):
540
542
  out += "{}. [[{}]]".format(i + 1, x)
541
543
  out += "\n"
542
544
  out += "\n"
@@ -575,7 +577,7 @@ def write_metrics_markdown_report(ms, path, metric, add_metadata=True):
575
577
  out += "\n\n"
576
578
 
577
579
  out += "## Parameters Used\n"
578
- for i, x in enumerate(metric.parameters_used):
580
+ for i, x in enumerate(sorted(metric.parameters_used, key=lambda x: x.name)):
579
581
  out += "{}. [[{}]]".format(i + 1, x)
580
582
  var = ms.parameters.parameter_map[x]
581
583
  if var.symbol:
@@ -683,6 +685,7 @@ def write_wiring_display_markdown_report(ms, path, wiring, add_metadata=True):
683
685
  out += "## Unique Components Used\n"
684
686
  components = [set(x.components_full()) for x in wirings]
685
687
  components = set().union(*components)
688
+ components = sorted(components, key=lambda x: x.name)
686
689
  for i, x in enumerate(components):
687
690
  out += "{}. [[{}]]".format(i + 1, x.name)
688
691
  out += "\n"
@@ -706,8 +709,9 @@ def write_wiring_display_markdown_report(ms, path, wiring, add_metadata=True):
706
709
 
707
710
  parameters = [set(x.parameters_used) for x in wirings]
708
711
  parameters = set().union(*parameters)
712
+ parameters = sorted(parameters, key=lambda x: x)
709
713
  out += "## Unique Parameters Used\n"
710
- for i, x in enumerate(parameters):
714
+ for i, x in enumerate(sorted(parameters, key=lambda x: x.name)):
711
715
  out += "{}. [[{}]]".format(i + 1, x)
712
716
  out += "\n"
713
717
  out += "\n"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: math-spec-mapping
3
- Version: 0.3.2
3
+ Version: 0.3.3
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