Update for lang-graph rewrite (maltoolbox 0.2)#89
Conversation
643decd to
d34c367
Compare
|
Did I do double work again (#94).. But some notes:
I could make a PR into your PR, keeping the parts I like in your solution but adding the required changes that are only in mine, so it is all in one place? |
|
Where can i find your solution? |
|
Where can I learn to read? |
Well, I might also take that course so I read the name of your PR next time before I make my own:) |
I agree.
Actually is this still needed? I don't think
Can you pull that part here? You can do
Can you pull these changes here?
Yes, makes sense. I think you can push directly here. |
I think it is still prepends 'Association_' in the lang classes factory. But that will soon be forgotten. I will try to put the valid changes from my PR into this PR. |
|
Let me know what you think |
| self._index_to_id = [n.id for n in self.attack_graph.nodes] | ||
| self._index_to_full_name = [n.full_name | ||
| for n in self.attack_graph.nodes] | ||
| self._index_to_asset_type = [n.name for n in self.lang_graph.assets] | ||
| self._index_to_step_name = [n.asset.name + ":" + n.name | ||
| for n in self.lang_graph.attack_steps] | ||
| self._index_to_model_asset_id = [int(asset.id) for asset in \ | ||
| self.attack_graph.model.assets] | ||
| self._index_to_model_assoc_type = [assoc.name + '_' + \ | ||
| assoc.left_field.asset.name + '_' + \ | ||
| assoc.right_field.asset.name \ | ||
| for assoc in self.lang_graph.associations] | ||
| self._index_to_full_name = ( | ||
| [n.full_name for n in self.attack_graph.nodes] | ||
| ) | ||
| self._index_to_asset_type = ( | ||
| [n.name for n in self.lang_graph.assets.values()] | ||
| ) | ||
|
|
||
| unique_step_type_names = { | ||
| n.full_name | ||
| for asset in self.lang_graph.assets.values() | ||
| for n in asset.attack_steps.values() | ||
| } | ||
| self._index_to_step_name = list(unique_step_type_names) | ||
|
|
||
| self._index_to_model_asset_id = ( | ||
| [int(asset.id) for asset in self.attack_graph.model.assets] | ||
| ) | ||
|
|
||
| unique_assoc_type_names = { | ||
| assoc.full_name | ||
| for asset in self.lang_graph.assets.values() | ||
| for assoc in asset.associations.values() | ||
| } | ||
| self._index_to_model_assoc_type = list(unique_assoc_type_names) | ||
|
|
||
| # Lookup dicts attribute to index | ||
| self._id_to_index = { |
There was a problem hiding this comment.
Most of these will be possible to drop once mal-lang/mal-toolbox#105 is merged.
12e8b77 to
8601ab3
Compare
Fixes to make the simulator work with the lang-graph rewrite of mal-toolbox.