From b211d27222d3d78eb3d1f104831166f2a73366b9 Mon Sep 17 00:00:00 2001 From: Eran Date: Mon, 25 Mar 2024 13:12:04 -0400 Subject: [PATCH] reproducing recursion bug from within diagrams.py in test_nested_composite --- bigraph_viz/diagram.py | 62 +++++++++++++++++++++++++- notebooks/BMCA.ipynb | 2 +- notebooks/format.ipynb | 99 +++++++++++++++++++++++++----------------- 3 files changed, 120 insertions(+), 43 deletions(-) diff --git a/bigraph_viz/diagram.py b/bigraph_viz/diagram.py index 22d039a..e77e20f 100644 --- a/bigraph_viz/diagram.py +++ b/bigraph_viz/diagram.py @@ -716,6 +716,65 @@ def test_plot_disconnected(): filename='multiple_disconnected') +def test_nested_composite(): + core = generate_types() + + nested_composite_spec = { + 'store1': { + 'store1.1': { + '_value': 1.1, + '_type': 'float', + }, + 'store1.2': { + '_value': 2, + '_type': 'integer', + }, + 'store1.3': { + '_value': 1.1, + '_type': 'float', + }, + 'process1': { + '_type': 'process', + '_inputs': { + 'port1': 'float', + 'port2': 'integer', + }, + '_outputs': {}, + 'inputs': { + 'port1': ['store1.1'], + 'port2': ['store1.2'], + }, + 'outputs': {}, + }, + 'process2': { + '_type': 'process', + '_outputs': { + 'port1': 'float', + 'port2': 'integer', + }, + 'outputs': { + 'port1': ['store1.1'], + 'port2': ['store1.2'], + } + }, + }, + 'process3': { + '_type': 'process', + '_outputs': { + 'port1': 'any' + }, + 'outputs': { + 'port1': ['store1'], + } + } + } + plot_bigraph( + nested_composite_spec, + core=core, + out_dir='out', + filename='nest_composite') + + if __name__ == '__main__': # test_diagram_plot() # test_bio_schema() @@ -724,4 +783,5 @@ def test_plot_disconnected(): # test_nested_processes() # test_multi_input_output() # test_cell_hierarchy() - test_plot_disconnected() + # test_plot_disconnected() + test_nested_composite() diff --git a/notebooks/BMCA.ipynb b/notebooks/BMCA.ipynb index 7e0e791..434b52d 100644 --- a/notebooks/BMCA.ipynb +++ b/notebooks/BMCA.ipynb @@ -680,7 +680,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 11, "id": "1af3b2fe", "metadata": {}, "outputs": [ diff --git a/notebooks/format.ipynb b/notebooks/format.ipynb index d5f09e1..693fc45 100644 --- a/notebooks/format.ipynb +++ b/notebooks/format.ipynb @@ -9,8 +9,9 @@ }, "outputs": [], "source": [ - "from bigraph_viz import plot_bigraph\n", + "from bigraph_viz import plot_bigraph, replace_regex_recursive, generate_types\n", "\n", + "core = generate_types()\n", "plot_settings = {}" ] }, @@ -26,7 +27,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "-e git+https://github.com/vivarium-collective/bigraph-viz.git@846f9a2bfd4f601146f9143a7f5bf2c80e559393#egg=bigraph_viz\n" + "-e git+https://github.com/vivarium-collective/bigraph-viz.git@cc41bb038afd6aaacd6f805e22db00196640d441#egg=bigraph_viz\n" ] } ], @@ -49,7 +50,7 @@ "text": [ "Help on function plot_bigraph in module bigraph_viz.diagram:\n", "\n", - "plot_bigraph(state, schema=None, core=None, out_dir=None, filename=None, file_format='png', size='16,10', node_label_size='12pt', show_values=False, show_types=False, port_labels=True, port_label_size='10pt', rankdir='TB', print_source=False, dpi='70', label_margin='0.05', node_border_colors=None, node_fill_colors=None, node_groups=False, remove_nodes=None, invisible_edges=False, remove_process_place_edges=False, show_process_schema_keys=['interval'])\n", + "plot_bigraph(state, schema=None, core=None, out_dir=None, filename=None, file_format='png', size='16,10', node_label_size='12pt', show_values=False, show_types=False, port_labels=True, port_label_size='10pt', rankdir='TB', print_source=False, dpi='70', label_margin='0.05', node_border_colors=None, node_fill_colors=None, node_groups=False, remove_nodes=None, invisible_edges=False, remove_process_place_edges=False, show_process_schema_keys=[])\n", "\n" ] } @@ -70,29 +71,45 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 4, "id": "5f0f7e7e-4216-40ac-a39f-3c6f7599b526", "metadata": { "tags": [] }, "outputs": [ { - "ename": "Exception", - "evalue": "schema not found for type: 2", + "ename": "RecursionError", + "evalue": "maximum recursion depth exceeded in comparison", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mException\u001b[0m Traceback (most recent call last)", - "Cell \u001b[0;32mIn[6], line 42\u001b[0m\n\u001b[1;32m 1\u001b[0m nested_composite_spec \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 2\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mstore1\u001b[39m\u001b[38;5;124m'\u001b[39m: {\n\u001b[1;32m 3\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mstore1.1\u001b[39m\u001b[38;5;124m'\u001b[39m: {\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 40\u001b[0m }\n\u001b[1;32m 41\u001b[0m }\n\u001b[0;32m---> 42\u001b[0m \u001b[43mplot_bigraph\u001b[49m\u001b[43m(\u001b[49m\u001b[43mnested_composite_spec\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/code/bigraph-viz/bigraph_viz/diagram.py:430\u001b[0m, in \u001b[0;36mplot_bigraph\u001b[0;34m(state, schema, core, out_dir, filename, file_format, size, node_label_size, show_values, show_types, port_labels, port_label_size, rankdir, print_source, dpi, label_margin, node_border_colors, node_fill_colors, node_groups, remove_nodes, invisible_edges, remove_process_place_edges, show_process_schema_keys)\u001b[0m\n\u001b[1;32m 427\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m core\u001b[38;5;241m.\u001b[39mexists(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mprocess\u001b[39m\u001b[38;5;124m'\u001b[39m):\n\u001b[1;32m 428\u001b[0m core\u001b[38;5;241m.\u001b[39mregister(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mprocess\u001b[39m\u001b[38;5;124m'\u001b[39m, process_type)\n\u001b[0;32m--> 430\u001b[0m schema, state \u001b[38;5;241m=\u001b[39m \u001b[43mcore\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcomplete\u001b[49m\u001b[43m(\u001b[49m\u001b[43mschema\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 432\u001b[0m \u001b[38;5;66;03m# parse out the network\u001b[39;00m\n\u001b[1;32m 433\u001b[0m graph_dict \u001b[38;5;241m=\u001b[39m get_graph_dict(\n\u001b[1;32m 434\u001b[0m schema\u001b[38;5;241m=\u001b[39mschema,\n\u001b[1;32m 435\u001b[0m state\u001b[38;5;241m=\u001b[39mstate,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 438\u001b[0m show_process_schema_keys\u001b[38;5;241m=\u001b[39mshow_process_schema_keys,\n\u001b[1;32m 439\u001b[0m )\n", - "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:1334\u001b[0m, in \u001b[0;36mTypeSystem.complete\u001b[0;34m(self, initial_schema, initial_state)\u001b[0m\n\u001b[1;32m 1328\u001b[0m state \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhydrate(\n\u001b[1;32m 1329\u001b[0m full_schema,\n\u001b[1;32m 1330\u001b[0m initial_state)\n\u001b[1;32m 1332\u001b[0m \u001b[38;5;66;03m# fill in the parts of the composition schema\u001b[39;00m\n\u001b[1;32m 1333\u001b[0m \u001b[38;5;66;03m# determined by the state\u001b[39;00m\n\u001b[0;32m-> 1334\u001b[0m schema, state \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minfer_schema\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1335\u001b[0m \u001b[43m \u001b[49m\u001b[43mfull_schema\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1336\u001b[0m \u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1338\u001b[0m final_state \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mfill(schema, state)\n\u001b[1;32m 1340\u001b[0m \u001b[38;5;66;03m# TODO: add flag to types.access(copy=True)\u001b[39;00m\n", - "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:1260\u001b[0m, in \u001b[0;36mTypeSystem.infer_schema\u001b[0;34m(self, schema, state, top_state, path)\u001b[0m\n\u001b[1;32m 1257\u001b[0m inner_path \u001b[38;5;241m=\u001b[39m path \u001b[38;5;241m+\u001b[39m (key,)\n\u001b[1;32m 1258\u001b[0m \u001b[38;5;66;03m# if get_path(schema, inner_path) is None or get_path(state, inner_path) is None:\u001b[39;00m\n\u001b[0;32m-> 1260\u001b[0m schema, top_state \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minfer_schema\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1261\u001b[0m \u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1262\u001b[0m \u001b[43m \u001b[49m\u001b[43mvalue\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1263\u001b[0m \u001b[43m \u001b[49m\u001b[43mtop_state\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtop_state\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1264\u001b[0m \u001b[43m \u001b[49m\u001b[43mpath\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43minner_path\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1266\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(state, \u001b[38;5;28mstr\u001b[39m):\n\u001b[1;32m 1267\u001b[0m \u001b[38;5;28;01mpass\u001b[39;00m\n", - "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:1260\u001b[0m, in \u001b[0;36mTypeSystem.infer_schema\u001b[0;34m(self, schema, state, top_state, path)\u001b[0m\n\u001b[1;32m 1257\u001b[0m inner_path \u001b[38;5;241m=\u001b[39m path \u001b[38;5;241m+\u001b[39m (key,)\n\u001b[1;32m 1258\u001b[0m \u001b[38;5;66;03m# if get_path(schema, inner_path) is None or get_path(state, inner_path) is None:\u001b[39;00m\n\u001b[0;32m-> 1260\u001b[0m schema, top_state \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minfer_schema\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1261\u001b[0m \u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1262\u001b[0m \u001b[43m \u001b[49m\u001b[43mvalue\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1263\u001b[0m \u001b[43m \u001b[49m\u001b[43mtop_state\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtop_state\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1264\u001b[0m \u001b[43m \u001b[49m\u001b[43mpath\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43minner_path\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1266\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(state, \u001b[38;5;28mstr\u001b[39m):\n\u001b[1;32m 1267\u001b[0m \u001b[38;5;28;01mpass\u001b[39;00m\n", - "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:1218\u001b[0m, in \u001b[0;36mTypeSystem.infer_schema\u001b[0;34m(self, schema, state, top_state, path)\u001b[0m\n\u001b[1;32m 1211\u001b[0m state_type \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 1212\u001b[0m key: value\n\u001b[1;32m 1213\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m key, value \u001b[38;5;129;01min\u001b[39;00m state\u001b[38;5;241m.\u001b[39mitems()\n\u001b[1;32m 1214\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m key\u001b[38;5;241m.\u001b[39mstartswith(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m_\u001b[39m\u001b[38;5;124m'\u001b[39m)}\n\u001b[1;32m 1215\u001b[0m state_schema \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39maccess(\n\u001b[1;32m 1216\u001b[0m state_type)\n\u001b[0;32m-> 1218\u001b[0m hydrated_state \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdeserialize\u001b[49m\u001b[43m(\u001b[49m\u001b[43mstate_schema\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1219\u001b[0m top_state \u001b[38;5;241m=\u001b[39m set_path(\n\u001b[1;32m 1220\u001b[0m top_state,\n\u001b[1;32m 1221\u001b[0m path,\n\u001b[1;32m 1222\u001b[0m hydrated_state)\n\u001b[1;32m 1224\u001b[0m update \u001b[38;5;241m=\u001b[39m state_type\n", - "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:684\u001b[0m, in \u001b[0;36mTypeSystem.deserialize\u001b[0;34m(self, schema, encoded)\u001b[0m\n\u001b[1;32m 682\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m key, branch \u001b[38;5;129;01min\u001b[39;00m encoded\u001b[38;5;241m.\u001b[39mitems():\n\u001b[1;32m 683\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m key \u001b[38;5;129;01min\u001b[39;00m schema:\n\u001b[0;32m--> 684\u001b[0m result[key] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdeserialize\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 685\u001b[0m \u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[43m[\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 686\u001b[0m \u001b[43m \u001b[49m\u001b[43mbranch\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 687\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m result\n\u001b[1;32m 689\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n", - "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:658\u001b[0m, in \u001b[0;36mTypeSystem.deserialize\u001b[0;34m(self, schema, encoded)\u001b[0m\n\u001b[1;32m 657\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mdeserialize\u001b[39m(\u001b[38;5;28mself\u001b[39m, schema, encoded):\n\u001b[0;32m--> 658\u001b[0m found \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mretrieve\u001b[49m\u001b[43m(\u001b[49m\u001b[43mschema\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 660\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m_deserialize\u001b[39m\u001b[38;5;124m'\u001b[39m \u001b[38;5;129;01min\u001b[39;00m found:\n\u001b[1;32m 661\u001b[0m deserialize \u001b[38;5;241m=\u001b[39m found[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m_deserialize\u001b[39m\u001b[38;5;124m'\u001b[39m]\n", - "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:97\u001b[0m, in \u001b[0;36mTypeSystem.retrieve\u001b[0;34m(self, schema)\u001b[0m\n\u001b[1;32m 95\u001b[0m found \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39maccess(schema)\n\u001b[1;32m 96\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m found \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m---> 97\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mschema not found for type: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mschema\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 98\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m found\n", - "\u001b[0;31mException\u001b[0m: schema not found for type: 2" + "\u001b[0;31mRecursionError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[4], line 50\u001b[0m\n\u001b[1;32m 1\u001b[0m nested_composite_spec \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 2\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mstore1\u001b[39m\u001b[38;5;124m'\u001b[39m: {\n\u001b[1;32m 3\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mstore1.1\u001b[39m\u001b[38;5;124m'\u001b[39m: {\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 48\u001b[0m }\n\u001b[1;32m 49\u001b[0m }\n\u001b[0;32m---> 50\u001b[0m \u001b[43mplot_bigraph\u001b[49m\u001b[43m(\u001b[49m\u001b[43mnested_composite_spec\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcore\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcore\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/code/bigraph-viz/bigraph_viz/diagram.py:436\u001b[0m, in \u001b[0;36mplot_bigraph\u001b[0;34m(state, schema, core, out_dir, filename, file_format, size, node_label_size, show_values, show_types, port_labels, port_label_size, rankdir, print_source, dpi, label_margin, node_border_colors, node_fill_colors, node_groups, remove_nodes, invisible_edges, remove_process_place_edges, show_process_schema_keys)\u001b[0m\n\u001b[1;32m 433\u001b[0m schema, state \u001b[38;5;241m=\u001b[39m core\u001b[38;5;241m.\u001b[39mcomplete(schema, state)\n\u001b[1;32m 435\u001b[0m \u001b[38;5;66;03m# parse out the network\u001b[39;00m\n\u001b[0;32m--> 436\u001b[0m graph_dict \u001b[38;5;241m=\u001b[39m \u001b[43mget_graph_dict\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 437\u001b[0m \u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mschema\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 438\u001b[0m \u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstate\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 439\u001b[0m \u001b[43m \u001b[49m\u001b[43mcore\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcore\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 440\u001b[0m \u001b[43m \u001b[49m\u001b[43mremove_nodes\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mremove_nodes\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 441\u001b[0m \u001b[43m \u001b[49m\u001b[43mshow_process_schema_keys\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mshow_process_schema_keys\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 442\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 444\u001b[0m \u001b[38;5;66;03m# make a figure\u001b[39;00m\n\u001b[1;32m 445\u001b[0m graph \u001b[38;5;241m=\u001b[39m get_graphviz_fig(graph_dict, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mremaining_kwargs)\n", + "File \u001b[0;32m~/code/bigraph-viz/bigraph_viz/diagram.py:207\u001b[0m, in \u001b[0;36mget_graph_dict\u001b[0;34m(schema, state, core, graph_dict, path, retain_type_keys, retain_process_keys, remove_nodes, show_process_schema_keys)\u001b[0m\n\u001b[1;32m 204\u001b[0m removed_process_schema_keys \u001b[38;5;241m=\u001b[39m [subpath \u001b[38;5;241m+\u001b[39m (schema_key,) \u001b[38;5;28;01mfor\u001b[39;00m schema_key \u001b[38;5;129;01min\u001b[39;00m removed_process_keys]\n\u001b[1;32m 205\u001b[0m remove_nodes\u001b[38;5;241m.\u001b[39mextend(removed_process_schema_keys)\n\u001b[0;32m--> 207\u001b[0m graph_dict \u001b[38;5;241m=\u001b[39m \u001b[43mget_graph_dict\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 208\u001b[0m \u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mschema\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 209\u001b[0m \u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvalue\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 210\u001b[0m \u001b[43m \u001b[49m\u001b[43mcore\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcore\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 211\u001b[0m \u001b[43m \u001b[49m\u001b[43mgraph_dict\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mgraph_dict\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 212\u001b[0m \u001b[43m \u001b[49m\u001b[43mpath\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43msubpath\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 213\u001b[0m \u001b[43m \u001b[49m\u001b[43mremove_nodes\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mremove_nodes\u001b[49m\n\u001b[1;32m 214\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 216\u001b[0m \u001b[38;5;66;03m# get the place edge\u001b[39;00m\n\u001b[1;32m 217\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m node \u001b[38;5;129;01min\u001b[39;00m value\u001b[38;5;241m.\u001b[39mkeys():\n", + "File \u001b[0;32m~/code/bigraph-viz/bigraph_viz/diagram.py:207\u001b[0m, in \u001b[0;36mget_graph_dict\u001b[0;34m(schema, state, core, graph_dict, path, retain_type_keys, retain_process_keys, remove_nodes, show_process_schema_keys)\u001b[0m\n\u001b[1;32m 204\u001b[0m removed_process_schema_keys \u001b[38;5;241m=\u001b[39m [subpath \u001b[38;5;241m+\u001b[39m (schema_key,) \u001b[38;5;28;01mfor\u001b[39;00m schema_key \u001b[38;5;129;01min\u001b[39;00m removed_process_keys]\n\u001b[1;32m 205\u001b[0m remove_nodes\u001b[38;5;241m.\u001b[39mextend(removed_process_schema_keys)\n\u001b[0;32m--> 207\u001b[0m graph_dict \u001b[38;5;241m=\u001b[39m \u001b[43mget_graph_dict\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 208\u001b[0m \u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mschema\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 209\u001b[0m \u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvalue\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 210\u001b[0m \u001b[43m \u001b[49m\u001b[43mcore\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcore\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 211\u001b[0m \u001b[43m \u001b[49m\u001b[43mgraph_dict\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mgraph_dict\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 212\u001b[0m \u001b[43m \u001b[49m\u001b[43mpath\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43msubpath\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 213\u001b[0m \u001b[43m \u001b[49m\u001b[43mremove_nodes\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mremove_nodes\u001b[49m\n\u001b[1;32m 214\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 216\u001b[0m \u001b[38;5;66;03m# get the place edge\u001b[39;00m\n\u001b[1;32m 217\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m node \u001b[38;5;129;01min\u001b[39;00m value\u001b[38;5;241m.\u001b[39mkeys():\n", + " \u001b[0;31m[... skipping similar frames: get_graph_dict at line 207 (2950 times)]\u001b[0m\n", + "File \u001b[0;32m~/code/bigraph-viz/bigraph_viz/diagram.py:207\u001b[0m, in \u001b[0;36mget_graph_dict\u001b[0;34m(schema, state, core, graph_dict, path, retain_type_keys, retain_process_keys, remove_nodes, show_process_schema_keys)\u001b[0m\n\u001b[1;32m 204\u001b[0m removed_process_schema_keys \u001b[38;5;241m=\u001b[39m [subpath \u001b[38;5;241m+\u001b[39m (schema_key,) \u001b[38;5;28;01mfor\u001b[39;00m schema_key \u001b[38;5;129;01min\u001b[39;00m removed_process_keys]\n\u001b[1;32m 205\u001b[0m remove_nodes\u001b[38;5;241m.\u001b[39mextend(removed_process_schema_keys)\n\u001b[0;32m--> 207\u001b[0m graph_dict \u001b[38;5;241m=\u001b[39m \u001b[43mget_graph_dict\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 208\u001b[0m \u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mschema\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 209\u001b[0m \u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvalue\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 210\u001b[0m \u001b[43m \u001b[49m\u001b[43mcore\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcore\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 211\u001b[0m \u001b[43m \u001b[49m\u001b[43mgraph_dict\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mgraph_dict\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 212\u001b[0m \u001b[43m \u001b[49m\u001b[43mpath\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43msubpath\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 213\u001b[0m \u001b[43m \u001b[49m\u001b[43mremove_nodes\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mremove_nodes\u001b[49m\n\u001b[1;32m 214\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 216\u001b[0m \u001b[38;5;66;03m# get the place edge\u001b[39;00m\n\u001b[1;32m 217\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m node \u001b[38;5;129;01min\u001b[39;00m value\u001b[38;5;241m.\u001b[39mkeys():\n", + "File \u001b[0;32m~/code/bigraph-viz/bigraph_viz/diagram.py:171\u001b[0m, in \u001b[0;36mget_graph_dict\u001b[0;34m(schema, state, core, graph_dict, path, retain_type_keys, retain_process_keys, remove_nodes, show_process_schema_keys)\u001b[0m\n\u001b[1;32m 162\u001b[0m \u001b[38;5;28;01mcontinue\u001b[39;00m\n\u001b[1;32m 164\u001b[0m node_spec \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 165\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mname\u001b[39m\u001b[38;5;124m'\u001b[39m: key,\n\u001b[1;32m 166\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mpath\u001b[39m\u001b[38;5;124m'\u001b[39m: subpath,\n\u001b[1;32m 167\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mvalue\u001b[39m\u001b[38;5;124m'\u001b[39m: \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[1;32m 168\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mtype\u001b[39m\u001b[38;5;124m'\u001b[39m: \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 169\u001b[0m }\n\u001b[0;32m--> 171\u001b[0m is_edge \u001b[38;5;241m=\u001b[39m \u001b[43mcore\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcheck\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43medge\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mvalue\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 172\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m is_edge: \u001b[38;5;66;03m# this is a process/edge node\u001b[39;00m\n\u001b[1;32m 173\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m key \u001b[38;5;129;01min\u001b[39;00m removed_process_keys \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m retain_process_keys:\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:480\u001b[0m, in \u001b[0;36mTypeSystem.check\u001b[0;34m(self, initial_schema, state)\u001b[0m\n\u001b[1;32m 478\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcheck\u001b[39m(\u001b[38;5;28mself\u001b[39m, initial_schema, state):\n\u001b[1;32m 479\u001b[0m schema \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mretrieve(initial_schema)\n\u001b[0;32m--> 480\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcheck_state\u001b[49m\u001b[43m(\u001b[49m\u001b[43mschema\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:472\u001b[0m, in \u001b[0;36mTypeSystem.check_state\u001b[0;34m(self, schema, state)\u001b[0m\n\u001b[1;32m 465\u001b[0m schema \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39maccess(schema)\n\u001b[1;32m 467\u001b[0m check_function \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mchoose_method(\n\u001b[1;32m 468\u001b[0m schema,\n\u001b[1;32m 469\u001b[0m state,\n\u001b[1;32m 470\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mcheck\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m--> 472\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mcheck_function\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 473\u001b[0m \u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 474\u001b[0m \u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 475\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:1934\u001b[0m, in \u001b[0;36mcheck_edge\u001b[0;34m(schema, state, core)\u001b[0m\n\u001b[1;32m 1933\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcheck_edge\u001b[39m(schema, state, core):\n\u001b[0;32m-> 1934\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(state, \u001b[38;5;28mdict\u001b[39m) \u001b[38;5;129;01mand\u001b[39;00m check_ports(state, core, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124minputs\u001b[39m\u001b[38;5;124m'\u001b[39m) \u001b[38;5;129;01mand\u001b[39;00m \u001b[43mcheck_ports\u001b[49m\u001b[43m(\u001b[49m\u001b[43mstate\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcore\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43moutputs\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:1928\u001b[0m, in \u001b[0;36mcheck_ports\u001b[0;34m(state, core, key)\u001b[0m\n\u001b[1;32m 1927\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcheck_ports\u001b[39m(state, core, key):\n\u001b[0;32m-> 1928\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m key \u001b[38;5;129;01min\u001b[39;00m state \u001b[38;5;129;01mand\u001b[39;00m \u001b[43mcore\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcheck\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1929\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mwires\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1930\u001b[0m \u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m[\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:480\u001b[0m, in \u001b[0;36mTypeSystem.check\u001b[0;34m(self, initial_schema, state)\u001b[0m\n\u001b[1;32m 478\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcheck\u001b[39m(\u001b[38;5;28mself\u001b[39m, initial_schema, state):\n\u001b[1;32m 479\u001b[0m schema \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mretrieve(initial_schema)\n\u001b[0;32m--> 480\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcheck_state\u001b[49m\u001b[43m(\u001b[49m\u001b[43mschema\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:472\u001b[0m, in \u001b[0;36mTypeSystem.check_state\u001b[0;34m(self, schema, state)\u001b[0m\n\u001b[1;32m 465\u001b[0m schema \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39maccess(schema)\n\u001b[1;32m 467\u001b[0m check_function \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mchoose_method(\n\u001b[1;32m 468\u001b[0m schema,\n\u001b[1;32m 469\u001b[0m state,\n\u001b[1;32m 470\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mcheck\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m--> 472\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mcheck_function\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 473\u001b[0m \u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 474\u001b[0m \u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 475\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:1657\u001b[0m, in \u001b[0;36mcheck_tree\u001b[0;34m(schema, state, core)\u001b[0m\n\u001b[1;32m 1655\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(state, \u001b[38;5;28mdict\u001b[39m):\n\u001b[1;32m 1656\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m key, value \u001b[38;5;129;01min\u001b[39;00m state\u001b[38;5;241m.\u001b[39mitems():\n\u001b[0;32m-> 1657\u001b[0m check \u001b[38;5;241m=\u001b[39m \u001b[43mcore\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcheck\u001b[49m\u001b[43m(\u001b[49m\u001b[43m{\u001b[49m\n\u001b[1;32m 1658\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43m_type\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mtree\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1659\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43m_leaf\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mleaf_type\u001b[49m\u001b[43m}\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1660\u001b[0m \u001b[43m \u001b[49m\u001b[43mvalue\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1662\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m check:\n\u001b[1;32m 1663\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m core\u001b[38;5;241m.\u001b[39mcheck(\n\u001b[1;32m 1664\u001b[0m leaf_type,\n\u001b[1;32m 1665\u001b[0m value)\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:480\u001b[0m, in \u001b[0;36mTypeSystem.check\u001b[0;34m(self, initial_schema, state)\u001b[0m\n\u001b[1;32m 478\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcheck\u001b[39m(\u001b[38;5;28mself\u001b[39m, initial_schema, state):\n\u001b[1;32m 479\u001b[0m schema \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mretrieve(initial_schema)\n\u001b[0;32m--> 480\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcheck_state\u001b[49m\u001b[43m(\u001b[49m\u001b[43mschema\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:472\u001b[0m, in \u001b[0;36mTypeSystem.check_state\u001b[0;34m(self, schema, state)\u001b[0m\n\u001b[1;32m 465\u001b[0m schema \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39maccess(schema)\n\u001b[1;32m 467\u001b[0m check_function \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mchoose_method(\n\u001b[1;32m 468\u001b[0m schema,\n\u001b[1;32m 469\u001b[0m state,\n\u001b[1;32m 470\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mcheck\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m--> 472\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mcheck_function\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 473\u001b[0m \u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 474\u001b[0m \u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 475\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:1669\u001b[0m, in \u001b[0;36mcheck_tree\u001b[0;34m(schema, state, core)\u001b[0m\n\u001b[1;32m 1667\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m\n\u001b[1;32m 1668\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1669\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mcore\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcheck\u001b[49m\u001b[43m(\u001b[49m\u001b[43mleaf_type\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:480\u001b[0m, in \u001b[0;36mTypeSystem.check\u001b[0;34m(self, initial_schema, state)\u001b[0m\n\u001b[1;32m 478\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcheck\u001b[39m(\u001b[38;5;28mself\u001b[39m, initial_schema, state):\n\u001b[1;32m 479\u001b[0m schema \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mretrieve(initial_schema)\n\u001b[0;32m--> 480\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcheck_state\u001b[49m\u001b[43m(\u001b[49m\u001b[43mschema\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:472\u001b[0m, in \u001b[0;36mTypeSystem.check_state\u001b[0;34m(self, schema, state)\u001b[0m\n\u001b[1;32m 465\u001b[0m schema \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39maccess(schema)\n\u001b[1;32m 467\u001b[0m check_function \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mchoose_method(\n\u001b[1;32m 468\u001b[0m schema,\n\u001b[1;32m 469\u001b[0m state,\n\u001b[1;32m 470\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mcheck\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m--> 472\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mcheck_function\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 473\u001b[0m \u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 474\u001b[0m \u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 475\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:1595\u001b[0m, in \u001b[0;36mcheck_list\u001b[0;34m(schema, state, core)\u001b[0m\n\u001b[1;32m 1593\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(state, \u001b[38;5;28mlist\u001b[39m):\n\u001b[1;32m 1594\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m element \u001b[38;5;129;01min\u001b[39;00m state:\n\u001b[0;32m-> 1595\u001b[0m check \u001b[38;5;241m=\u001b[39m \u001b[43mcore\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcheck\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1596\u001b[0m \u001b[43m \u001b[49m\u001b[43melement_type\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1597\u001b[0m \u001b[43m \u001b[49m\u001b[43melement\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1599\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m check:\n\u001b[1;32m 1600\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;01mFalse\u001b[39;00m\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:480\u001b[0m, in \u001b[0;36mTypeSystem.check\u001b[0;34m(self, initial_schema, state)\u001b[0m\n\u001b[1;32m 478\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcheck\u001b[39m(\u001b[38;5;28mself\u001b[39m, initial_schema, state):\n\u001b[1;32m 479\u001b[0m schema \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mretrieve(initial_schema)\n\u001b[0;32m--> 480\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcheck_state\u001b[49m\u001b[43m(\u001b[49m\u001b[43mschema\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:467\u001b[0m, in \u001b[0;36mTypeSystem.check_state\u001b[0;34m(self, schema, state)\u001b[0m\n\u001b[1;32m 464\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcheck_state\u001b[39m(\u001b[38;5;28mself\u001b[39m, schema, state):\n\u001b[1;32m 465\u001b[0m schema \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39maccess(schema)\n\u001b[0;32m--> 467\u001b[0m check_function \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mchoose_method\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 468\u001b[0m \u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 469\u001b[0m \u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 470\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mcheck\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m 472\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m check_function(\n\u001b[1;32m 473\u001b[0m schema,\n\u001b[1;32m 474\u001b[0m state,\n\u001b[1;32m 475\u001b[0m \u001b[38;5;28mself\u001b[39m)\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:287\u001b[0m, in \u001b[0;36mTypeSystem.choose_method\u001b[0;34m(self, schema, state, method_name)\u001b[0m\n\u001b[1;32m 284\u001b[0m any_type \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39maccess(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124many\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 285\u001b[0m found \u001b[38;5;241m=\u001b[39m any_type[method_key]\n\u001b[0;32m--> 287\u001b[0m registry \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mlookup_registry\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmethod_key\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 288\u001b[0m method_function \u001b[38;5;241m=\u001b[39m registry\u001b[38;5;241m.\u001b[39maccess(\n\u001b[1;32m 289\u001b[0m found)\n\u001b[1;32m 291\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m method_function\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:73\u001b[0m, in \u001b[0;36mTypeSystem.lookup_registry\u001b[0;34m(self, underscore_key)\u001b[0m\n\u001b[1;32m 70\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mlookup_registry\u001b[39m(\u001b[38;5;28mself\u001b[39m, underscore_key):\n\u001b[1;32m 71\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Find the registry for a given underscore key\"\"\"\u001b[39;00m\n\u001b[0;32m---> 73\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mtype_registry\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mlookup_registry\u001b[49m\u001b[43m(\u001b[49m\u001b[43munderscore_key\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/registry.py:951\u001b[0m, in \u001b[0;36mTypeRegistry.lookup_registry\u001b[0;34m(self, underscore_key)\u001b[0m\n\u001b[1;32m 946\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mlookup_registry\u001b[39m(\u001b[38;5;28mself\u001b[39m, underscore_key):\n\u001b[1;32m 947\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 948\u001b[0m \u001b[38;5;124;03m access the registry for the given key\u001b[39;00m\n\u001b[1;32m 949\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m--> 951\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[43munderscore_key\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m==\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43m_type\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m:\n\u001b[1;32m 952\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\n\u001b[1;32m 953\u001b[0m root \u001b[38;5;241m=\u001b[39m underscore_key\u001b[38;5;241m.\u001b[39mstrip(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m_\u001b[39m\u001b[38;5;124m'\u001b[39m)\n", + "\u001b[0;31mRecursionError\u001b[0m: maximum recursion depth exceeded in comparison" ] } ], @@ -105,40 +122,48 @@ " },\n", " 'store1.2': {\n", " '_value': 2, \n", - " '_type': 'int',\n", + " '_type': 'integer',\n", " },\n", " 'store1.3': {\n", " '_value': 1.1, \n", " '_type': 'float',\n", " },\n", - " 'process1': {\n", - " '_outputs': {\n", - " 'port1': 'float', \n", - " 'port2': 'int',\n", - " },\n", - " 'outputs': {\n", - " 'port1': 'store1.1',\n", - " 'port2': 'store1.2',\n", - " }\n", - " },\n", + " # 'process1': {\n", + " # '_type': 'process',\n", + " # '_inputs': {\n", + " # 'port1': 'float', \n", + " # 'port2': 'integer',\n", + " # },\n", + " # '_outputs': {},\n", + " # 'inputs': {\n", + " # 'port1': ['store1.1'],\n", + " # 'port2': ['store1.2'],\n", + " # },\n", + " # 'outputs': {},\n", + " # },\n", " 'process2': {\n", + " '_type': 'process',\n", " '_outputs': {\n", " 'port1': 'float', \n", - " 'port2': 'int',\n", + " 'port2': 'integer',\n", " },\n", " 'outputs': {\n", - " 'port1': 'store1.1',\n", - " 'port2': 'store1.2',\n", + " 'port1': ['store1.1'],\n", + " 'port2': ['store1.2'],\n", " }\n", " },\n", " },\n", " 'process3': {\n", + " '_type': 'process',\n", + " '_outputs': {\n", + " 'port1': 'any'\n", + " },\n", " 'outputs': {\n", - " 'port1': 'store1',\n", + " 'port1': ['store1'],\n", " }\n", " }\n", "}\n", - "plot_bigraph(nested_composite_spec)" + "plot_bigraph(nested_composite_spec, core=core)" ] }, { @@ -274,14 +299,6 @@ "plot_settings['rankdir'] = 'LR'\n", "plot_bigraph(nested_composite_spec, **plot_settings)" ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "7eaeadd9-f04c-4199-a572-26b19ead3bca", - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": {