math-spec-mapping 0.3.1__py3-none-any.whl → 0.3.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- math_spec_mapping/Classes/Block.py +2 -0
- math_spec_mapping/Classes/State.py +3 -1
- math_spec_mapping/Convenience/__init__.py +2 -1
- math_spec_mapping/Convenience/documentation.py +1 -1
- math_spec_mapping/Convenience/starter.py +271 -0
- math_spec_mapping/Load/boundary_actions.py +3 -1
- math_spec_mapping/Load/entities.py +5 -1
- math_spec_mapping/Load/parameters.py +3 -1
- math_spec_mapping/Load/states.py +1 -1
- math_spec_mapping/Load/type.py +2 -1
- math_spec_mapping/Reports/markdown.py +13 -9
- math_spec_mapping/__init__.py +1 -0
- math_spec_mapping/schema.schema.json +2 -1
- {math_spec_mapping-0.3.1.dist-info → math_spec_mapping-0.3.3.dist-info}/METADATA +1 -1
- {math_spec_mapping-0.3.1.dist-info → math_spec_mapping-0.3.3.dist-info}/RECORD +18 -18
- {math_spec_mapping-0.3.1.dist-info → math_spec_mapping-0.3.3.dist-info}/LICENSE +0 -0
- {math_spec_mapping-0.3.1.dist-info → math_spec_mapping-0.3.3.dist-info}/WHEEL +0 -0
- {math_spec_mapping-0.3.1.dist-info → math_spec_mapping-0.3.3.dist-info}/top_level.txt +0 -0
| @@ -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( | 
| 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 |  | 
| @@ -1 +1,2 @@ | |
| 1 | 
            -
            from .documentation import write_top_level_json_description
         | 
| 1 | 
            +
            # from .documentation import write_top_level_json_description
         | 
| 2 | 
            +
            from .starter import remove_dummy_repo_components
         | 
| @@ -0,0 +1,271 @@ | |
| 1 | 
            +
            import os
         | 
| 2 | 
            +
             | 
| 3 | 
            +
             | 
| 4 | 
            +
            def remove_dummy_repo_components(path):
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                directory_folders = os.listdir(path)
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                if "StatefulMetrics" in directory_folders:
         | 
| 9 | 
            +
                    path2 = path + "/StatefulMetrics"
         | 
| 10 | 
            +
                    contents = os.listdir(path2)
         | 
| 11 | 
            +
                    if "Dummy.py" in contents:
         | 
| 12 | 
            +
                        os.remove(path2 + "/Dummy.py")
         | 
| 13 | 
            +
                    if "__init__.py" in contents:
         | 
| 14 | 
            +
                        with open(path2 + "/__init__.py", "r") as f:
         | 
| 15 | 
            +
                            contents = f.read()
         | 
| 16 | 
            +
                            contents = contents.replace(
         | 
| 17 | 
            +
                                "from .Dummy import dummy_stateful_metrics\n", ""
         | 
| 18 | 
            +
                            )
         | 
| 19 | 
            +
                            contents = contents.replace(
         | 
| 20 | 
            +
                                "stateful_metrics.extend(dummy_stateful_metrics)\n", ""
         | 
| 21 | 
            +
                            )
         | 
| 22 | 
            +
                            contents = contents.replace(
         | 
| 23 | 
            +
                                "stateful_metrics.extend(dummy_stateful_metrics)", ""
         | 
| 24 | 
            +
                            )
         | 
| 25 | 
            +
                        with open(path2 + "/__init__.py", "w") as f:
         | 
| 26 | 
            +
                            f.write(contents)
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                if "Metrics" in directory_folders:
         | 
| 29 | 
            +
                    path2 = path + "/Metrics"
         | 
| 30 | 
            +
                    contents = os.listdir(path2)
         | 
| 31 | 
            +
                    if "Dummy.py" in contents:
         | 
| 32 | 
            +
                        os.remove(path2 + "/Dummy.py")
         | 
| 33 | 
            +
                    if "__init__.py" in contents:
         | 
| 34 | 
            +
                        with open(path2 + "/__init__.py", "r") as f:
         | 
| 35 | 
            +
                            contents = f.read()
         | 
| 36 | 
            +
                            contents = contents.replace("from .Dummy import metrics_x\n", "")
         | 
| 37 | 
            +
                            contents = contents.replace("metrics.extend(metrics_x)\n", "")
         | 
| 38 | 
            +
                            contents = contents.replace("metrics.extend(metrics_x)", "")
         | 
| 39 | 
            +
                        with open(path2 + "/__init__.py", "w") as f:
         | 
| 40 | 
            +
                            f.write(contents)
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                """if "Displays" in directory_folders:
         | 
| 43 | 
            +
                    path2 = path + "/Displays"
         | 
| 44 | 
            +
                    contents = os.listdir(path2)
         | 
| 45 | 
            +
                    if "Dummy.py" in contents:
         | 
| 46 | 
            +
                        os.remove(path2 + "/Dummy.py")
         | 
| 47 | 
            +
                    if "__init__.py" in contents:
         | 
| 48 | 
            +
                        with open(path2 + "/__init__.py", "r") as f:
         | 
| 49 | 
            +
                            contents = f.read()
         | 
| 50 | 
            +
                            contents = contents.replace("from .Dummy import metrics_x\n", "")
         | 
| 51 | 
            +
                            contents = contents.replace("metrics.extend(metrics_x)\n", "")
         | 
| 52 | 
            +
                            contents = contents.replace("metrics.extend(metrics_x)", "")
         | 
| 53 | 
            +
                        with open(path2 + "/__init__.py", "w") as f:
         | 
| 54 | 
            +
                            f.write(contents)"""
         | 
| 55 | 
            +
             | 
| 56 | 
            +
                if "Wiring" in directory_folders:
         | 
| 57 | 
            +
                    path2 = path + "/Wiring"
         | 
| 58 | 
            +
                    contents = os.listdir(path2)
         | 
| 59 | 
            +
                    if "Dummy.py" in contents:
         | 
| 60 | 
            +
                        os.remove(path2 + "/Dummy.py")
         | 
| 61 | 
            +
                    if "__init__.py" in contents:
         | 
| 62 | 
            +
                        with open(path2 + "/__init__.py", "r") as f:
         | 
| 63 | 
            +
                            contents = f.read()
         | 
| 64 | 
            +
                            contents = contents.replace("from .Dummy import dummy_wiring\n", "")
         | 
| 65 | 
            +
                            contents = contents.replace("wiring.extend(dummy_wiring)\n", "")
         | 
| 66 | 
            +
                            contents = contents.replace("wiring.extend(dummy_wiring)", "")
         | 
| 67 | 
            +
                        with open(path2 + "/__init__.py", "w") as f:
         | 
| 68 | 
            +
                            f.write(contents)
         | 
| 69 | 
            +
             | 
| 70 | 
            +
                if "Mechanisms" in directory_folders:
         | 
| 71 | 
            +
                    path2 = path + "/Mechanisms"
         | 
| 72 | 
            +
                    contents = os.listdir(path2)
         | 
| 73 | 
            +
                    if "Dummy.py" in contents:
         | 
| 74 | 
            +
                        os.remove(path2 + "/Dummy.py")
         | 
| 75 | 
            +
                    if "__init__.py" in contents:
         | 
| 76 | 
            +
                        with open(path2 + "/__init__.py", "r") as f:
         | 
| 77 | 
            +
                            contents = f.read()
         | 
| 78 | 
            +
                            contents = contents.replace("from .Dummy import dummy_mechanisms\n", "")
         | 
| 79 | 
            +
                            contents = contents.replace("mechanism.extend(dummy_mechanisms)\n", "")
         | 
| 80 | 
            +
                            contents = contents.replace("mechanism.extend(dummy_mechanisms)", "")
         | 
| 81 | 
            +
                        with open(path2 + "/__init__.py", "w") as f:
         | 
| 82 | 
            +
                            f.write(contents)
         | 
| 83 | 
            +
             | 
| 84 | 
            +
                if "Policies" in directory_folders:
         | 
| 85 | 
            +
                    path2 = path + "/Policies"
         | 
| 86 | 
            +
                    contents = os.listdir(path2)
         | 
| 87 | 
            +
                    if "Dummy.py" in contents:
         | 
| 88 | 
            +
                        os.remove(path2 + "/Dummy.py")
         | 
| 89 | 
            +
                    if "__init__.py" in contents:
         | 
| 90 | 
            +
                        with open(path2 + "/__init__.py", "r") as f:
         | 
| 91 | 
            +
                            contents = f.read()
         | 
| 92 | 
            +
                            contents = contents.replace("from .Dummy import dummy_policies\n", "")
         | 
| 93 | 
            +
                            contents = contents.replace("policies.extend(dummy_policies)\n", "")
         | 
| 94 | 
            +
                            contents = contents.replace("policies.extend(dummy_policies)", "")
         | 
| 95 | 
            +
                        with open(path2 + "/__init__.py", "w") as f:
         | 
| 96 | 
            +
                            f.write(contents)
         | 
| 97 | 
            +
             | 
| 98 | 
            +
                if "BoundaryActions" in directory_folders:
         | 
| 99 | 
            +
                    path2 = path + "/BoundaryActions"
         | 
| 100 | 
            +
                    contents = os.listdir(path2)
         | 
| 101 | 
            +
                    if "Dummy.py" in contents:
         | 
| 102 | 
            +
                        os.remove(path2 + "/Dummy.py")
         | 
| 103 | 
            +
                    if "__init__.py" in contents:
         | 
| 104 | 
            +
                        with open(path2 + "/__init__.py", "r") as f:
         | 
| 105 | 
            +
                            contents = f.read()
         | 
| 106 | 
            +
                            contents = contents.replace(
         | 
| 107 | 
            +
                                "from .Dummy import dummy_boundary_action\n", ""
         | 
| 108 | 
            +
                            )
         | 
| 109 | 
            +
                            contents = contents.replace("dummy_boundary_action,\n", "")
         | 
| 110 | 
            +
                            contents = contents.replace("dummy_boundary_action,", "")
         | 
| 111 | 
            +
                            contents = contents.replace("dummy_boundary_action", "")
         | 
| 112 | 
            +
                        with open(path2 + "/__init__.py", "w") as f:
         | 
| 113 | 
            +
                            f.write(contents)
         | 
| 114 | 
            +
             | 
| 115 | 
            +
                if "ControlActions" in directory_folders:
         | 
| 116 | 
            +
                    path2 = path + "/ControlActions"
         | 
| 117 | 
            +
                    contents = os.listdir(path2)
         | 
| 118 | 
            +
                    if "Dummy.py" in contents:
         | 
| 119 | 
            +
                        os.remove(path2 + "/Dummy.py")
         | 
| 120 | 
            +
                    if "__init__.py" in contents:
         | 
| 121 | 
            +
                        with open(path2 + "/__init__.py", "r") as f:
         | 
| 122 | 
            +
                            contents = f.read()
         | 
| 123 | 
            +
                            contents = contents.replace(
         | 
| 124 | 
            +
                                "from .Dummy import dummy_control_action\n", ""
         | 
| 125 | 
            +
                            )
         | 
| 126 | 
            +
                            contents = contents.replace("dummy_control_action,\n", "")
         | 
| 127 | 
            +
                            contents = contents.replace("dummy_control_action,", "")
         | 
| 128 | 
            +
                            contents = contents.replace("dummy_control_action", "")
         | 
| 129 | 
            +
                        with open(path2 + "/__init__.py", "w") as f:
         | 
| 130 | 
            +
                            f.write(contents)
         | 
| 131 | 
            +
                if "Entities" in directory_folders:
         | 
| 132 | 
            +
                    path2 = path + "/Entities"
         | 
| 133 | 
            +
                    contents = os.listdir(path2)
         | 
| 134 | 
            +
                    if "Dummy.py" in contents:
         | 
| 135 | 
            +
                        os.remove(path2 + "/Dummy.py")
         | 
| 136 | 
            +
                    if "__init__.py" in contents:
         | 
| 137 | 
            +
                        with open(path2 + "/__init__.py", "r") as f:
         | 
| 138 | 
            +
                            contents = f.read()
         | 
| 139 | 
            +
                            contents = contents.replace("from .Dummy import dummy_entity\n", "")
         | 
| 140 | 
            +
                            contents = contents.replace("dummy_entity, ", "")
         | 
| 141 | 
            +
                            contents = contents.replace("dummy_entity,", "")
         | 
| 142 | 
            +
                            contents = contents.replace("dummy_entity", "")
         | 
| 143 | 
            +
                        with open(path2 + "/__init__.py", "w") as f:
         | 
| 144 | 
            +
                            f.write(contents)
         | 
| 145 | 
            +
                if "State" in directory_folders:
         | 
| 146 | 
            +
                    path2 = path + "/State"
         | 
| 147 | 
            +
                    contents = os.listdir(path2)
         | 
| 148 | 
            +
                    if "Dummy.py" in contents:
         | 
| 149 | 
            +
                        os.remove(path2 + "/Dummy.py")
         | 
| 150 | 
            +
                    if "__init__.py" in contents:
         | 
| 151 | 
            +
                        with open(path2 + "/__init__.py", "r") as f:
         | 
| 152 | 
            +
                            contents = f.read()
         | 
| 153 | 
            +
                            contents = contents.replace("from .Dummy import dummy_state\n", "")
         | 
| 154 | 
            +
                            contents = contents.replace("dummy_state, ", "")
         | 
| 155 | 
            +
                            contents = contents.replace("dummy_state,", "")
         | 
| 156 | 
            +
                            contents = contents.replace("dummy_state", "")
         | 
| 157 | 
            +
                        with open(path2 + "/__init__.py", "w") as f:
         | 
| 158 | 
            +
                            f.write(contents)
         | 
| 159 | 
            +
             | 
| 160 | 
            +
                if "Parameters" in directory_folders:
         | 
| 161 | 
            +
                    path2 = path + "/Parameters"
         | 
| 162 | 
            +
                    contents = os.listdir(path2)
         | 
| 163 | 
            +
                    if "Dummy.py" in contents:
         | 
| 164 | 
            +
                        os.remove(path2 + "/Dummy.py")
         | 
| 165 | 
            +
                    if "__init__.py" in contents:
         | 
| 166 | 
            +
                        with open(path2 + "/__init__.py", "r") as f:
         | 
| 167 | 
            +
                            contents = f.read()
         | 
| 168 | 
            +
                            contents = contents.replace(
         | 
| 169 | 
            +
                                "from .Dummy import dummy_parameter_sets", ""
         | 
| 170 | 
            +
                            )
         | 
| 171 | 
            +
                            contents = contents.replace(
         | 
| 172 | 
            +
                                "parameters.extend(dummy_parameter_sets)", ""
         | 
| 173 | 
            +
                            )
         | 
| 174 | 
            +
             | 
| 175 | 
            +
                        with open(path2 + "/__init__.py", "w") as f:
         | 
| 176 | 
            +
                            f.write(contents)
         | 
| 177 | 
            +
             | 
| 178 | 
            +
                if "Spaces" in directory_folders:
         | 
| 179 | 
            +
                    path2 = path + "/Spaces"
         | 
| 180 | 
            +
                    contents = os.listdir(path2)
         | 
| 181 | 
            +
                    if "Dummy.py" in contents:
         | 
| 182 | 
            +
                        os.remove(path2 + "/Dummy.py")
         | 
| 183 | 
            +
                    if "__init__.py" in contents:
         | 
| 184 | 
            +
                        with open(path2 + "/__init__.py", "r") as f:
         | 
| 185 | 
            +
                            contents = f.read()
         | 
| 186 | 
            +
                            contents = contents.replace("from .Dummy import dummy_spaces\n", "")
         | 
| 187 | 
            +
                            contents = contents.replace("spaces.extend(dummy_spaces)", "")
         | 
| 188 | 
            +
             | 
| 189 | 
            +
                        with open(path2 + "/__init__.py", "w") as f:
         | 
| 190 | 
            +
                            f.write(contents)
         | 
| 191 | 
            +
             | 
| 192 | 
            +
                if "Types" in directory_folders:
         | 
| 193 | 
            +
                    path2 = path + "/Types"
         | 
| 194 | 
            +
                    contents = os.listdir(path2)
         | 
| 195 | 
            +
                    if "Dummy.py" in contents:
         | 
| 196 | 
            +
                        os.remove(path2 + "/Dummy.py")
         | 
| 197 | 
            +
                    if "__init__.py" in contents:
         | 
| 198 | 
            +
                        with open(path2 + "/__init__.py", "r") as f:
         | 
| 199 | 
            +
                            contents = f.read()
         | 
| 200 | 
            +
                            contents = contents.replace(
         | 
| 201 | 
            +
                                "from .Dummy import DummyCompoundType, DummyType1, DummyType2\n", ""
         | 
| 202 | 
            +
                            )
         | 
| 203 | 
            +
                            contents = contents.replace(
         | 
| 204 | 
            +
                                """    DummyType1,
         | 
| 205 | 
            +
                DummyType2,
         | 
| 206 | 
            +
                DummyCompoundType,""",
         | 
| 207 | 
            +
                                "",
         | 
| 208 | 
            +
                            )
         | 
| 209 | 
            +
                            contents = contents.replace(
         | 
| 210 | 
            +
                                """    DummyType1,
         | 
| 211 | 
            +
                DummyType2,
         | 
| 212 | 
            +
                DummyCompoundType""",
         | 
| 213 | 
            +
                                "",
         | 
| 214 | 
            +
                            )
         | 
| 215 | 
            +
             | 
| 216 | 
            +
                        with open(path2 + "/__init__.py", "w") as f:
         | 
| 217 | 
            +
                            f.write(contents)
         | 
| 218 | 
            +
             | 
| 219 | 
            +
                if "TypeMappings" in directory_folders:
         | 
| 220 | 
            +
                    path2 = path + "/TypeMappings"
         | 
| 221 | 
            +
                    contents = os.listdir(path2)
         | 
| 222 | 
            +
             | 
| 223 | 
            +
                    if "types.py" in contents:
         | 
| 224 | 
            +
                        with open(path2 + "/types.py", "r") as f:
         | 
| 225 | 
            +
                            contents = f.read()
         | 
| 226 | 
            +
                            contents = contents.replace(
         | 
| 227 | 
            +
                                """    "DummyType1": str,
         | 
| 228 | 
            +
                "DummyType2": int,
         | 
| 229 | 
            +
                "DummyCompoundType": {"A": "Dummy Type 1", "B": "Dummy Type 2"},""",
         | 
| 230 | 
            +
                                "",
         | 
| 231 | 
            +
                            )
         | 
| 232 | 
            +
             | 
| 233 | 
            +
                        with open(path2 + "/types.py", "w") as f:
         | 
| 234 | 
            +
                            f.write(contents)
         | 
| 235 | 
            +
             | 
| 236 | 
            +
                if "TypeMappings" in directory_folders:
         | 
| 237 | 
            +
                    path2 = path + "/TypeMappings"
         | 
| 238 | 
            +
                    contents = os.listdir(path2)
         | 
| 239 | 
            +
             | 
| 240 | 
            +
                    if "types.py" in contents:
         | 
| 241 | 
            +
                        with open(path2 + "/types.jl", "r") as f:
         | 
| 242 | 
            +
                            contents = f.read()
         | 
| 243 | 
            +
                            contents = contents.replace(
         | 
| 244 | 
            +
                                """const DummyType1 = String
         | 
| 245 | 
            +
            const DummyType2 = Integer
         | 
| 246 | 
            +
            struct DummyCompoundType
         | 
| 247 | 
            +
                A::DummyType1
         | 
| 248 | 
            +
                B::DummyType2
         | 
| 249 | 
            +
            end""",
         | 
| 250 | 
            +
                                "",
         | 
| 251 | 
            +
                            )
         | 
| 252 | 
            +
             | 
| 253 | 
            +
                        with open(path2 + "/types.jl", "w") as f:
         | 
| 254 | 
            +
                            f.write(contents)
         | 
| 255 | 
            +
             | 
| 256 | 
            +
                if "TypeMappings" in directory_folders:
         | 
| 257 | 
            +
                    path2 = path + "/TypeMappings"
         | 
| 258 | 
            +
                    contents = os.listdir(path2)
         | 
| 259 | 
            +
             | 
| 260 | 
            +
                    if "types.py" in contents:
         | 
| 261 | 
            +
                        with open(path2 + "/types.ts", "r") as f:
         | 
| 262 | 
            +
                            contents = f.read()
         | 
| 263 | 
            +
                            contents = contents.replace(
         | 
| 264 | 
            +
                                """type DummyType1 = string
         | 
| 265 | 
            +
            type DummyType2 = number
         | 
| 266 | 
            +
            type DummyCompoundType = {"A": DummyType1, "B": DummyType2}""",
         | 
| 267 | 
            +
                                "",
         | 
| 268 | 
            +
                            )
         | 
| 269 | 
            +
             | 
| 270 | 
            +
                        with open(path2 + "/types.ts", "w") as f:
         | 
| 271 | 
            +
                            f.write(contents)
         | 
| @@ -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( | 
| 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  | 
| 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
         | 
| @@ -18,7 +18,9 @@ def convert_parameter_set(ms, data: Dict) -> ParameterSet: | |
| 18 18 | 
             
                    if "metadata" not in param:
         | 
| 19 19 | 
             
                        param["metadata"] = {}
         | 
| 20 20 | 
             
                    check_json_keys(param, "Parameter")
         | 
| 21 | 
            -
                    assert param["variable_type"] in ms["Types"], "Type not in ms"
         | 
| 21 | 
            +
                    assert param["variable_type"] in ms["Types"], "Type of {} not in ms".format(
         | 
| 22 | 
            +
                        param["variable_type"]
         | 
| 23 | 
            +
                    )
         | 
| 22 24 | 
             
                    param["variable_type"] = ms["Types"][param["variable_type"]]
         | 
| 23 25 | 
             
                    new_parameters.append(Parameter(param))
         | 
| 24 26 | 
             
                data["parameters"] = new_parameters
         | 
    
        math_spec_mapping/Load/states.py
    CHANGED
    
    | @@ -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"] = {}
         | 
    
        math_spec_mapping/Load/type.py
    CHANGED
    
    | @@ -71,7 +71,8 @@ def load_typescript_type_key(path): | |
| 71 71 | 
             
                type_definitions = [x for x in type_definitions if len(x) > 0]
         | 
| 72 72 | 
             
                hold = type_definitions[:]
         | 
| 73 73 | 
             
                type_definitions = []
         | 
| 74 | 
            -
                 | 
| 74 | 
            +
                if len(hold) > 0:
         | 
| 75 | 
            +
                    type_definitions.append(hold.pop(0))
         | 
| 75 76 | 
             
                while len(hold) > 0:
         | 
| 76 77 | 
             
                    curr = hold.pop(0)
         | 
| 77 78 | 
             
                    if "type" in curr or "interface" in curr:
         | 
| @@ -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( | 
| 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:
         | 
| @@ -585,7 +587,7 @@ def write_metrics_markdown_report(ms, path, metric, add_metadata=True): | |
| 585 587 |  | 
| 586 588 | 
             
                out += "## Variables Used\n"
         | 
| 587 589 | 
             
                for i, x in enumerate(metric.variables_used):
         | 
| 588 | 
            -
                    out += "{}. {}.{}".format(i + 1, x[0], x[1])
         | 
| 590 | 
            +
                    out += "{}. [[{}]].[[{}-{}|{}]]".format(i + 1, x[0], x[0], x[1], x[1])
         | 
| 589 591 | 
             
                    var = ms.state[x[0]].variable_map[x[1]]
         | 
| 590 592 | 
             
                    if var.symbol:
         | 
| 591 593 | 
             
                        out += " , symbol: {}".format(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"
         | 
    
        math_spec_mapping/__init__.py
    CHANGED
    
    
| @@ -1,8 +1,8 @@ | |
| 1 | 
            -
            math_spec_mapping/__init__.py,sha256= | 
| 1 | 
            +
            math_spec_mapping/__init__.py,sha256=CzT9KycdX5nuiUzDFmLXVeAIr8v8UKGbXsEQF8vjl1c,961
         | 
| 2 2 | 
             
            math_spec_mapping/schema.py,sha256=6mrRqzEnTTSXjb19xJ63MBp0KjKH0s7i6TfT4MkAY9k,233
         | 
| 3 | 
            -
            math_spec_mapping/schema.schema.json,sha256= | 
| 3 | 
            +
            math_spec_mapping/schema.schema.json,sha256=5_DiubQzPo8koyx5PKFh_zIINyjtrhGWG_7N73s9b1Q,29400
         | 
| 4 4 | 
             
            math_spec_mapping/Classes/ActionTransmissionChannel.py,sha256=zWMo5QsgPh5WGIWXl-xOrZNMXYJXmK6Vejw1dQvi0og,246
         | 
| 5 | 
            -
            math_spec_mapping/Classes/Block.py,sha256= | 
| 5 | 
            +
            math_spec_mapping/Classes/Block.py,sha256=OsWM1ZAi6ZvavDhMFJi_H7w8ZF9LqJIKR3ZLTXnts9w,17437
         | 
| 6 6 | 
             
            math_spec_mapping/Classes/BoundaryAction.py,sha256=AOENCqCEfpjotnHhzUj_F2SOP0SGpkN1tNPr8Mtl6Tc,476
         | 
| 7 7 | 
             
            math_spec_mapping/Classes/ControlAction.py,sha256=ysqpgANwdizVdwqtgZmnxXMpCqrzmVEF_6YT0M3l4Ho,526
         | 
| 8 8 | 
             
            math_spec_mapping/Classes/Entity.py,sha256=fA0-b128_OHHxfCg4pzqyQV083EYev1HlVpy86S5igg,1226
         | 
| @@ -12,39 +12,39 @@ math_spec_mapping/Classes/Metric.py,sha256=AhPgYppOP6q49xvR8S9STxQsXUKJlTWx7wI1L | |
| 12 12 | 
             
            math_spec_mapping/Classes/Parameter.py,sha256=ZuJ_w0sChvRElJ4sOnXZ2EV4Ell2xXFulKLjVOpgz2E,1237
         | 
| 13 13 | 
             
            math_spec_mapping/Classes/Policy.py,sha256=fzV85tB3QScjiYGfhw_dyQt9L1BYYfTyTIQQcxeT8ac,530
         | 
| 14 14 | 
             
            math_spec_mapping/Classes/Space.py,sha256=QsahxoUfRsDWQLBL683KnGx72MAmRxv7CDE7TMgCG-E,472
         | 
| 15 | 
            -
            math_spec_mapping/Classes/State.py,sha256= | 
| 15 | 
            +
            math_spec_mapping/Classes/State.py,sha256=U40DoF2qlx_k9gvqQiP1S3C9ZLk3cW_-jmJn71TiCxg,1599
         | 
| 16 16 | 
             
            math_spec_mapping/Classes/StateUpdateTransmissionChannel.py,sha256=3hBLvD1lE64PkwqksBXAfFWv7foOZzGQLAFQWy42tOA,257
         | 
| 17 17 | 
             
            math_spec_mapping/Classes/StatefulMetric.py,sha256=UCis1BJ7fsajHHxFF05ZiyDean2D4s4a95uYYW1Mjq4,749
         | 
| 18 18 | 
             
            math_spec_mapping/Classes/Type.py,sha256=2KFY8d3cv1PzJJ7SSMHJf1zcfQ3ZbqxotK2KgTaLZdM,289
         | 
| 19 19 | 
             
            math_spec_mapping/Classes/__init__.py,sha256=0zxgOqns_9JybD74HKMVh6aw8ij8WVbfQ4Q_1uWzof0,761
         | 
| 20 | 
            -
            math_spec_mapping/Convenience/__init__.py,sha256 | 
| 21 | 
            -
            math_spec_mapping/Convenience/documentation.py,sha256= | 
| 22 | 
            -
            math_spec_mapping/Convenience/starter.py,sha256= | 
| 20 | 
            +
            math_spec_mapping/Convenience/__init__.py,sha256=z2W-E5Wg1CNEkDI5UqH3qIVBqp-3A1e63f3u9fA-N7w,112
         | 
| 21 | 
            +
            math_spec_mapping/Convenience/documentation.py,sha256=1ziWVJznbCUxeAAt03nAdEYtMlXNo5TeedHfgs0vSBU,1625
         | 
| 22 | 
            +
            math_spec_mapping/Convenience/starter.py,sha256=Pv0b5pHnv5Bxk3PkY8O9Nv62z2C_gxj5xcf8G9r4Pkw,11010
         | 
| 23 23 | 
             
            math_spec_mapping/Load/__init__.py,sha256=_ga5nHi7U5rY5lCF36_XI9Qmybq4P8R4m5I5mmjLBk8,33
         | 
| 24 24 | 
             
            math_spec_mapping/Load/action_transmission_channel.py,sha256=9Wer7g2s5SSOcUYuZ0PqSKUVVnW3EvGQJZNXJTwW__0,2561
         | 
| 25 | 
            -
            math_spec_mapping/Load/boundary_actions.py,sha256= | 
| 25 | 
            +
            math_spec_mapping/Load/boundary_actions.py,sha256=mKX4hUHlX4xoJzm-6W3W3AjWRC9RNiEWb0al7lN0DBs,2142
         | 
| 26 26 | 
             
            math_spec_mapping/Load/control_actions.py,sha256=4E57s730W4tX5SaKXKaAvet37r8Bwt-g8Kk6EanF4TU,2042
         | 
| 27 27 | 
             
            math_spec_mapping/Load/displays.py,sha256=ooHWT_OryzEkp7F3LcGywwdLMRJLxuyPK82zJ3gcyN0,414
         | 
| 28 | 
            -
            math_spec_mapping/Load/entities.py,sha256= | 
| 28 | 
            +
            math_spec_mapping/Load/entities.py,sha256=Ds7VQY_govWEn1vSHYVrLa8IadSNyOQzaCK18JPYPKk,1289
         | 
| 29 29 | 
             
            math_spec_mapping/Load/general.py,sha256=2q6aGKxXhebiHHTZhtACvM4nWIkTben0o5rXuvfv2Vw,4463
         | 
| 30 30 | 
             
            math_spec_mapping/Load/implementations.py,sha256=SGKZ_YXeNpJUTnw5fajQTXji7S2bNQo8sh-7YcIO6pk,395
         | 
| 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=EyCFEgHpyffBPKaqISdIeTyqUtPtu2xoS0gZjh-6i3U,3434
         | 
| 34 | 
            -
            math_spec_mapping/Load/parameters.py,sha256= | 
| 34 | 
            +
            math_spec_mapping/Load/parameters.py,sha256=W4utm7to3s2fo4z3XgLH0TM1agaIad1qfM2I-lLMua4,1393
         | 
| 35 35 | 
             
            math_spec_mapping/Load/policy.py,sha256=HvlhGHGJTweVs7DOI2HSL_2_diECr8ukDUmzoFLQELo,2444
         | 
| 36 36 | 
             
            math_spec_mapping/Load/spaces.py,sha256=7zgGA57Te7T4hfuCCDElffiidWgn1lKm5E14e1yjt8M,1116
         | 
| 37 37 | 
             
            math_spec_mapping/Load/state_update_transmission_channels.py,sha256=FJWp5n4HdtHAfof5BUQ6BnRakljatL2h8dWCapaVSc0,2238
         | 
| 38 38 | 
             
            math_spec_mapping/Load/stateful_metrics.py,sha256=uGSTc6x6lld5xptgSUMHrO0Vg0QDRIL14C6zTg33S8o,1977
         | 
| 39 | 
            -
            math_spec_mapping/Load/states.py,sha256= | 
| 40 | 
            -
            math_spec_mapping/Load/type.py,sha256= | 
| 39 | 
            +
            math_spec_mapping/Load/states.py,sha256=WTLvonzrUQWDVnkF9OPzHeyImrxoMPmonEl5O9O6Pxg,1313
         | 
| 40 | 
            +
            math_spec_mapping/Load/type.py,sha256=z6cBdBNjWed7cRyA0Bj7Jd5PmtemVVh07n3mWFj_5U4,4356
         | 
| 41 41 | 
             
            math_spec_mapping/Load/wiring.py,sha256=1dR94U5N1W_WI5rL6lYBltH25ZvApB2pIpq9r5Opkug,3083
         | 
| 42 42 | 
             
            math_spec_mapping/Reports/__init__.py,sha256=W27I6S9Ro1hWeHmnxIokCA06awB__eYey7PvKD4Hc1s,933
         | 
| 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 46 | 
             
            math_spec_mapping/Reports/html.py,sha256=tqydmwFWz_1Bg_J_avG4t9LtE-DUGbOKAPNuwg6lgRI,9007
         | 
| 47 | 
            -
            math_spec_mapping/Reports/markdown.py,sha256= | 
| 47 | 
            +
            math_spec_mapping/Reports/markdown.py,sha256=K1amcJrAs4dNv9mN8NeC8U97RtWGJrRmJfEkZlAn_jA,22881
         | 
| 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 50 | 
             
            math_spec_mapping/Reports/parameters.py,sha256=yizNG4lNGrgrlzYYcHMGfXKDFlPw4PMDYshDqZ3YARs,535
         | 
| @@ -53,8 +53,8 @@ math_spec_mapping/Reports/spaces.py,sha256=-76hR5wQBv4lsG000ypBJ-OprjsNjI-rNRMYd | |
| 53 53 | 
             
            math_spec_mapping/Reports/state.py,sha256=RkqfSonar74KVC8PpA9GgI2xaHX6BrkNdAuWMZlYQfI,2321
         | 
| 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. | 
| 57 | 
            -
            math_spec_mapping-0.3. | 
| 58 | 
            -
            math_spec_mapping-0.3. | 
| 59 | 
            -
            math_spec_mapping-0.3. | 
| 60 | 
            -
            math_spec_mapping-0.3. | 
| 56 | 
            +
            math_spec_mapping-0.3.3.dist-info/LICENSE,sha256=ObyEzSw8kgCaFbEfpu1zP4TrcAKLA0xhqHMZZfyh7N0,1069
         | 
| 57 | 
            +
            math_spec_mapping-0.3.3.dist-info/METADATA,sha256=M8t5087vsXIk7Xw-SROeZa8xWRuuMs2lkaqswl0_srU,6012
         | 
| 58 | 
            +
            math_spec_mapping-0.3.3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
         | 
| 59 | 
            +
            math_spec_mapping-0.3.3.dist-info/top_level.txt,sha256=AImhn9wgazkdV0a9vfiphtQR8uGe2nq-ZIOp-6yUk9o,18
         | 
| 60 | 
            +
            math_spec_mapping-0.3.3.dist-info/RECORD,,
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         |