Skip to content

Commit

Permalink
Address remaining issues manually
Browse files Browse the repository at this point in the history
  • Loading branch information
bgyori committed Sep 7, 2024
1 parent fe77215 commit 3867be4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
6 changes: 2 additions & 4 deletions mira/dkg/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import pystow
import requests
from neo4j import GraphDatabase, Transaction, unit_of_work
from pydantic import BaseModel, Field, validator
from pydantic import BaseModel, Field, field_validator
from tqdm import tqdm
from typing_extensions import Literal, TypeAlias

Expand Down Expand Up @@ -110,9 +110,7 @@ class Entity(BaseModel):
# Gets auto-populated
link: Optional[str] = None

# TODO[pydantic]: We couldn't refactor the `validator`, please replace it by `field_validator` manually.
# Check https://docs.pydantic.dev/dev-v2/migration/#changes-to-validators for more information.
@validator("link")
@field_validator("link")
def set_link(cls, value, values):
"""
Set the value of the ``link`` field based on the value of the ``id``
Expand Down
4 changes: 1 addition & 3 deletions mira/metamodel/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ def safe_parse_expr(s: str, local_dict=None) -> sympy.Expr:

class SympyExprStr(sympy.Expr):
@classmethod
# TODO[pydantic]: We couldn't refactor `__get_validators__`, please create the `__get_pydantic_core_schema__` manually.
# Check https://docs.pydantic.dev/latest/migration/#defining-custom-types for more information.
def __get_validators__(cls):
def __get_pydantic_core_schema__(cls):
yield cls.validate

@classmethod
Expand Down

0 comments on commit 3867be4

Please sign in to comment.