Skip to content

Commit

Permalink
Use model_config when pydantic v2 (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
sneakers-the-rat committed Apr 3, 2024
1 parent 8ff23ec commit 28de033
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/curies/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@
from pydantic import BaseModel, Field
from pytrie import StringTrie

from ._pydantic_compat import field_validator, get_field_validator_values
from ._pydantic_compat import PYDANTIC_V1, field_validator, get_field_validator_values

if not PYDANTIC_V1:
from pydantic import ConfigDict

if TYPE_CHECKING: # pragma: no cover
import pandas
Expand Down Expand Up @@ -201,10 +204,15 @@ class notion of parsed reference (instead of merely stringified
..., description="The local unique identifier used in a compact URI (CURIE)."
)

class Config:
"""Pydantic configuration for references."""
if PYDANTIC_V1:

class Config:
"""Pydantic configuration for references."""

frozen = True
frozen = True

else:
model_config = ConfigDict(frozen=True)

@property
def curie(self) -> str:
Expand Down

0 comments on commit 28de033

Please sign in to comment.