Skip to content

Commit

Permalink
Further manual updates, update protected namespace for Header class
Browse files Browse the repository at this point in the history
  • Loading branch information
nanglo123 committed Sep 11, 2024
1 parent 8898942 commit 44c1699
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions mira/modeling/acsets/petri.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def __init__(self, model: Model):
continue
key = p.key if p.key else f"p_petri_{idx + 1}"
_parameters[key] = p.value
_distributions[key] = p.distribution.dict() \
_distributions[key] = p.distribution.model_dump() \
if p.distribution else None
transition_dict["tprop"]["mira_parameters"] = \
json.dumps(_parameters, sort_keys=True)
Expand Down Expand Up @@ -186,7 +186,7 @@ def __init__(self, model: Model):
key = sanitize_parameter_name(
p.key) if p.key else f"p_petri_{idx + 1}"
_parameters[key] = p.value
_distributions[key] = p.distribution.dict() \
_distributions[key] = p.distribution.model_dump() \
if p.distribution else None
obs_dict = {
'concept': json.dumps(concept_data),
Expand Down
3 changes: 2 additions & 1 deletion mira/modeling/amr/petrinet.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from copy import deepcopy
from typing import Dict, List, Optional

from pydantic import BaseModel, Field
from pydantic import BaseModel, Field, ConfigDict

from mira.metamodel import expression_to_mathml, TemplateModel, SympyExprStr
from mira.sources.amr import sanity_check_amr
Expand Down Expand Up @@ -462,6 +462,7 @@ class Ode(BaseModel):


class Header(BaseModel):
model_config = ConfigDict(protected_namespaces=())
name: str
schema_url: str = Field(..., alias='schema')
schema_name: str
Expand Down
4 changes: 2 additions & 2 deletions mira/modeling/amr/regnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
from collections import defaultdict
from typing import Dict, List, Optional, Union

import sympy
from pydantic import BaseModel, Field
from pydantic import BaseModel, Field, ConfigDict

from mira.metamodel import *

Expand Down Expand Up @@ -508,6 +507,7 @@ class RegNetModel(BaseModel):


class Header(BaseModel):
model_config = ConfigDict(protected_namespaces=())
name: str
schema_name: str
schema_url: str = Field(..., alias='schema')
Expand Down
2 changes: 1 addition & 1 deletion mira/modeling/amr/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def add_metadata_annotations(metadata, model):
return
annotations_subset = {
k: (str(v) if k in ["time_start", "time_end"] and v is not None else v)
for k, v in model.template_model.annotations.dict().items()
for k, v in model.template_model.annotations.model_dump().items()
if k not in ["name", "description"]
# name and description already have a privileged place
# in the petrinet schema so don't get added again
Expand Down

0 comments on commit 44c1699

Please sign in to comment.