Skip to content

Commit

Permalink
replace deprecated usage of json() with model_dump_json() for pydanti…
Browse files Browse the repository at this point in the history
…c2 migration
  • Loading branch information
nanglo123 committed Sep 23, 2024
1 parent 8eaab77 commit 21e7a9c
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions notebooks/Hackathon Scenario 1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2628,7 +2628,7 @@
}
],
"source": [
"print(tc.model_comparison.json(indent=1))"
"print(tc.model_comparison.model_dump_json(indent=1))"
]
},
{
Expand Down Expand Up @@ -4710,7 +4710,7 @@
}
],
"source": [
"print(tc.model_comparison.json(indent=1))"
"print(tc.model_comparison.model_dump_json(indent=1))"
]
},
{
Expand All @@ -4721,7 +4721,7 @@
"outputs": [],
"source": [
"with open('mira_comparison_threeway.json', 'w') as fh:\n",
" fh.write(tc.model_comparison.json(indent=1))"
" fh.write(tc.model_comparison.model_dump_json(indent=1))"
]
},
{
Expand Down Expand Up @@ -4779,7 +4779,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
"version": "3.10.12"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion notebooks/Hackathon Scenario 4.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"outputs": [],
"source": [
"with open('mira_comparison_scenario4.json', 'w') as fh:\n",
" fh.write(tc.model_comparison.json(indent=1))"
" fh.write(tc.model_comparison.model_dump_json(indent=1))"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebooks/evaluation_2023.01/Scenario2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@
"outputs": [],
"source": [
"with open('scenario2_model_comparison.json', 'w') as fh:\n",
" fh.write(tc.model_comparison.json(indent=1))"
" fh.write(tc.model_comparison.model_dump_json(indent=1))"
]
}
],
Expand Down
8 changes: 4 additions & 4 deletions notebooks/evaluation_2023.01/Scenario3.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,9 @@
" model.to_json_file(mname, indent=1)\n",
"# Also dump the mira model jsons\n",
"with open(\"scenario3_biomd958_mira.json\", \"w\") as f:\n",
" f.write(model_958.json(indent=1))\n",
" f.write(model_958.model_dump_json(indent=1))\n",
"with open(\"scenario3_biomd960_mira.json\", \"w\") as f:\n",
" f.write(model_960.json(indent=1))"
" f.write(model_960.model_dump_json(indent=1))"
]
},
{
Expand Down Expand Up @@ -534,12 +534,12 @@
"source": [
"import json\n",
"res = {\n",
" 'graph_comparison_data': json.loads(mc.model_comparison.json()),\n",
" 'graph_comparison_data': json.loads(mc.model_comparison.model_dump_json()),\n",
" 'similarity_scores': mc.model_comparison.get_similarity_scores(),\n",
" 'model_names': model_names\n",
"}\n",
"res_filtered = {\n",
" 'graph_comparison_data': json.loads(mc_filtered.model_comparison.json()),\n",
" 'graph_comparison_data': json.loads(mc_filtered.model_comparison.model_dump_json()),\n",
" 'similarity_scores': mc_filtered.model_comparison.get_similarity_scores(),\n",
" 'model_names': model_names_filtered\n",
"}"
Expand Down
2 changes: 1 addition & 1 deletion notebooks/model_api.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"natural_conversion = NaturalConversion(subject=infected, outcome=immune)\n",
"sir_template_model = TemplateModel(templates=[controlled_conversion, natural_conversion])\n",
"sir_template_model_dict = sir_template_model.m()\n",
"print(sir_template_model.json())"
"print(sir_template_model.model_dump_json())"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions notebooks/scenarios_2024.08/eval_202301_scenario2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@
"outputs": [],
"source": [
"with open('eval_202301_scenario2_sidarthe_v_model_comparison.json', 'w') as fh:\n",
" fh.write(tc.model_comparison.json(indent=1))"
" fh.write(tc.model_comparison.model_dump_json(indent=1))"
]
}
],
Expand All @@ -451,7 +451,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.14"
"version": "3.10.12"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 21e7a9c

Please sign in to comment.