math-spec-mapping 0.3.10__tar.gz → 0.3.11__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {math_spec_mapping-0.3.10/src/math_spec_mapping.egg-info → math_spec_mapping-0.3.11}/PKG-INFO +1 -1
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/pyproject.toml +1 -1
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Classes/MathSpec.py +41 -2
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11/src/math_spec_mapping.egg-info}/PKG-INFO +1 -1
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/LICENSE +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/README.md +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/setup.cfg +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Classes/ActionTransmissionChannel.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Classes/Block.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Classes/BoundaryAction.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Classes/ControlAction.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Classes/Entity.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Classes/Mechanism.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Classes/Metric.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Classes/Parameter.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Classes/Policy.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Classes/Space.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Classes/State.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Classes/StateUpdateTransmissionChannel.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Classes/StatefulMetric.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Classes/Type.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Classes/__init__.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Convenience/__init__.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Convenience/documentation.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Convenience/starter.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Load/__init__.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Load/action_transmission_channel.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Load/boundary_actions.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Load/control_actions.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Load/displays.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Load/entities.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Load/general.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Load/implementations.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Load/load.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Load/mechanism.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Load/metrics.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Load/parameters.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Load/policy.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Load/spaces.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Load/state_update_transmission_channels.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Load/stateful_metrics.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Load/states.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Load/type.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Load/wiring.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Reports/__init__.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Reports/boundary_actions.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Reports/control_actions.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Reports/general.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Reports/html.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Reports/markdown.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Reports/mechanisms.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Reports/node_map.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Reports/parameters.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Reports/policies.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Reports/spaces.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Reports/state.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Reports/tables.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Reports/wiring.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/__init__.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/schema.py +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/schema.schema.json +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping.egg-info/SOURCES.txt +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping.egg-info/dependency_links.txt +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping.egg-info/requires.txt +0 -0
- {math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping.egg-info/top_level.txt +0 -0
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Classes/MathSpec.py
RENAMED
@@ -8,6 +8,7 @@ import os
|
|
8
8
|
from copy import deepcopy
|
9
9
|
import shutil
|
10
10
|
import pandas as pd
|
11
|
+
from inspect import signature, getsource
|
11
12
|
|
12
13
|
|
13
14
|
class MathSpec:
|
@@ -47,6 +48,7 @@ class MathSpec:
|
|
47
48
|
self._build_functional_parameters()
|
48
49
|
self._build_parameter_types()
|
49
50
|
self._crawl_spaces()
|
51
|
+
self._set_source_code()
|
50
52
|
|
51
53
|
def _check_dictionary_names(self):
|
52
54
|
for key in self.boundary_actions:
|
@@ -765,6 +767,15 @@ using .Spaces: generate_space_type
|
|
765
767
|
def build_implementation(self, params):
|
766
768
|
return MathSpecImplementation(self, params)
|
767
769
|
|
770
|
+
def _set_source_code(self):
|
771
|
+
if "python" not in self.implementations:
|
772
|
+
self.source_code = None
|
773
|
+
return
|
774
|
+
self.source_code = deepcopy(self.implementations["python"])
|
775
|
+
for x in self.source_code:
|
776
|
+
for y in self.source_code[x]:
|
777
|
+
self.source_code[x][y] = getsource(self.source_code[x][y])
|
778
|
+
|
768
779
|
|
769
780
|
class MathSpecImplementation:
|
770
781
|
def __init__(self, ms: MathSpec, params):
|
@@ -778,6 +789,7 @@ class MathSpecImplementation:
|
|
778
789
|
self.metrics = self.load_metrics()
|
779
790
|
self.load_wiring()
|
780
791
|
self.load_components()
|
792
|
+
self.load_source_files()
|
781
793
|
|
782
794
|
def load_control_actions(self):
|
783
795
|
control_actions = {}
|
@@ -1046,13 +1058,27 @@ class MathSpecImplementation:
|
|
1046
1058
|
state["Metrics"] = self.metrics
|
1047
1059
|
if state_preperation_functions:
|
1048
1060
|
for f in state_preperation_functions:
|
1049
|
-
|
1061
|
+
if len(signature(f).parameters) == 1:
|
1062
|
+
state = f(state)
|
1063
|
+
elif len(signature(f).parameters) == 2:
|
1064
|
+
state = f(state, params)
|
1065
|
+
else:
|
1066
|
+
assert (
|
1067
|
+
False
|
1068
|
+
), "Incorrect number of parameters for the state preperation function"
|
1050
1069
|
assert (
|
1051
1070
|
state is not None
|
1052
1071
|
), "A state must be returned from the state preperation functions"
|
1053
1072
|
if parameter_preperation_functions:
|
1054
1073
|
for f in parameter_preperation_functions:
|
1055
|
-
|
1074
|
+
if len(signature(f).parameters) == 1:
|
1075
|
+
params = f(params)
|
1076
|
+
elif len(signature(f).parameters) == 2:
|
1077
|
+
params = f(params, state)
|
1078
|
+
else:
|
1079
|
+
assert (
|
1080
|
+
False
|
1081
|
+
), "Incorrect number of parameters for the state preperation function"
|
1056
1082
|
assert (
|
1057
1083
|
params is not None
|
1058
1084
|
), "A parameter set must be returned from the parameter preperation functions"
|
@@ -1070,3 +1096,16 @@ class MathSpecImplementation:
|
|
1070
1096
|
for block in blocks:
|
1071
1097
|
self.components[block](state, params, [])
|
1072
1098
|
return state
|
1099
|
+
|
1100
|
+
def load_source_files(self):
|
1101
|
+
self.source_files = {}
|
1102
|
+
for key in self.components:
|
1103
|
+
self.source_files[key] = getsource(self.components[key])
|
1104
|
+
|
1105
|
+
def print_source_code_files(self, keys=None):
|
1106
|
+
if not keys:
|
1107
|
+
keys = list(self.source_files.keys())
|
1108
|
+
for key in keys:
|
1109
|
+
print("-" * 20 + key + "-" * 20)
|
1110
|
+
print(self.source_files[key])
|
1111
|
+
print("\n\n\n")
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Classes/Block.py
RENAMED
File without changes
|
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Classes/ControlAction.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Classes/Entity.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Classes/Mechanism.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Classes/Metric.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Classes/Parameter.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Classes/Policy.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Classes/Space.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Classes/State.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Classes/__init__.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Convenience/__init__.py
RENAMED
File without changes
|
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Convenience/starter.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Load/__init__.py
RENAMED
File without changes
|
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Load/boundary_actions.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Load/control_actions.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Load/displays.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Load/entities.py
RENAMED
File without changes
|
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Load/implementations.py
RENAMED
File without changes
|
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Load/mechanism.py
RENAMED
File without changes
|
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Load/parameters.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Load/stateful_metrics.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Reports/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Reports/general.py
RENAMED
File without changes
|
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Reports/markdown.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Reports/mechanisms.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Reports/node_map.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Reports/parameters.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Reports/policies.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Reports/spaces.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Reports/state.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Reports/tables.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/Reports/wiring.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping/schema.schema.json
RENAMED
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping.egg-info/SOURCES.txt
RENAMED
File without changes
|
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping.egg-info/requires.txt
RENAMED
File without changes
|
{math_spec_mapping-0.3.10 → math_spec_mapping-0.3.11}/src/math_spec_mapping.egg-info/top_level.txt
RENAMED
File without changes
|