Skip to content

Commit 02f4d22

Browse files
author
Andrei Neagu
committed
fixed deprecation warnings
1 parent 698e1e4 commit 02f4d22

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

packages/models-library/src/models_library/services_types.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
from typing import Annotated, TypeAlias
1+
from typing import Annotated, Any, TypeAlias
22
from uuid import uuid4
33

44
import arrow
5-
from pydantic import StringConstraints, ValidationInfo
5+
from pydantic import GetCoreSchemaHandler, StringConstraints, ValidationInfo
6+
from pydantic_core import CoreSchema, core_schema
67

78
from .basic_regex import PROPERTY_KEY_RE, SIMPLE_VERSION_RE
89
from .services_regex import (
@@ -59,8 +60,10 @@ def create(cls) -> "RunID":
5960
return cls(run_id_format)
6061

6162
@classmethod
62-
def __get_validators__(cls):
63-
yield cls.validate
63+
def __get_pydantic_core_schema__(
64+
cls, source_type: Any, handler: GetCoreSchemaHandler
65+
) -> CoreSchema:
66+
return core_schema.no_info_after_validator_function(cls, handler(str))
6467

6568
@classmethod
6669
def validate(cls, v: "RunID | str", _: ValidationInfo) -> "RunID":

services/dynamic-sidecar/src/simcore_service_dynamic_sidecar/models/shared_store.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ async def _persist_to_disk(self) -> None:
3030
async with aiofiles.open(
3131
self._shared_store_dir / STORE_FILE_NAME, "w"
3232
) as data_file:
33-
await data_file.write(self.json())
33+
await data_file.write(self.model_dump_json())
3434

3535
def post_init(self, shared_store_dir: Path):
3636
self._shared_store_dir = shared_store_dir

services/dynamic-sidecar/tests/unit/test_core_settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def test_settings_with_node_ports_storage_auth(
7373
assert (
7474
settings.NODE_PORTS_STORAGE_AUTH.STORAGE_PASSWORD.get_secret_value() == "passwd"
7575
)
76-
assert "passwd" not in settings.NODE_PORTS_STORAGE_AUTH.json()
76+
assert "passwd" not in settings.NODE_PORTS_STORAGE_AUTH.model_dump_json()
7777

7878

7979
@pytest.mark.parametrize("envs", [{}])

0 commit comments

Comments
 (0)