File tree Expand file tree Collapse file tree 3 files changed +5
-19
lines changed
packages/models-library/src/models_library/api_schemas_dynamic_scheduler
services/dynamic-scheduler/tests/unit Expand file tree Collapse file tree 3 files changed +5
-19
lines changed Original file line number Diff line number Diff line change 1- from typing import Final
2-
31from models_library .api_schemas_directorv2 .dynamic_services import DynamicServiceCreate
42from models_library .projects import ProjectID
53from models_library .projects_nodes_io import NodeID
64from models_library .resource_tracker import HardwareInfo , PricingInfo
75from models_library .services_resources import ServiceResourcesDictHelpers
86from models_library .users import UserID
97from models_library .wallets import WalletInfo
10- from pydantic import BaseModel , ConfigDict , TypeAdapter
8+ from pydantic import BaseModel , ConfigDict
119
1210
1311class DynamicServiceStart (DynamicServiceCreate ):
@@ -37,11 +35,6 @@ class DynamicServiceStart(DynamicServiceCreate):
3735 )
3836
3937
40- DynamicServiceStartAdapter : Final [TypeAdapter [DynamicServiceStart ]] = TypeAdapter (
41- DynamicServiceStart
42- )
43-
44-
4538class DynamicServiceStop (BaseModel ):
4639 user_id : UserID
4740 project_id : ProjectID
@@ -60,8 +53,3 @@ class DynamicServiceStop(BaseModel):
6053 }
6154 }
6255 )
63-
64-
65- DynamicServiceStopAdapter : Final [TypeAdapter [DynamicServiceStop ]] = TypeAdapter (
66- DynamicServiceStop
67- )
Original file line number Diff line number Diff line change 1212from models_library .api_schemas_directorv2 .dynamic_services import DynamicServiceGet
1313from models_library .api_schemas_dynamic_scheduler .dynamic_services import (
1414 DynamicServiceStart ,
15- DynamicServiceStartAdapter ,
1615 DynamicServiceStop ,
1716)
1817from models_library .api_schemas_webserver .projects_nodes import (
@@ -183,7 +182,7 @@ async def test_get_state(
183182@pytest .fixture
184183def dynamic_service_start () -> DynamicServiceStart :
185184 # one for legacy and one for new style?
186- return DynamicServiceStartAdapter .validate_python (
185+ return TypeAdapter ( DynamicServiceStart ) .validate_python (
187186 DynamicServiceStart .model_config ["json_schema_extra" ]["example" ]
188187 )
189188
Original file line number Diff line number Diff line change 44import pytest
55from models_library .api_schemas_dynamic_scheduler .dynamic_services import (
66 DynamicServiceStart ,
7- DynamicServiceStartAdapter ,
87 DynamicServiceStop ,
9- DynamicServiceStopAdapter ,
108)
119from models_library .projects_nodes_io import NodeID
10+ from pydantic import TypeAdapter
1211
1312
1413@pytest .fixture
@@ -18,7 +17,7 @@ def _(node_id: NodeID) -> DynamicServiceStart:
1817 DynamicServiceStart .model_config ["json_schema_extra" ]["example" ]
1918 )
2019 dict_data ["service_uuid" ] = f"{ node_id } "
21- return DynamicServiceStartAdapter .validate_python (dict_data )
20+ return TypeAdapter ( DynamicServiceStart ) .validate_python (dict_data )
2221
2322 return _
2423
@@ -30,6 +29,6 @@ def _(node_id: NodeID) -> DynamicServiceStop:
3029 DynamicServiceStop .model_config ["json_schema_extra" ]["example" ]
3130 )
3231 dict_data ["node_id" ] = f"{ node_id } "
33- return DynamicServiceStopAdapter .validate_python (dict_data )
32+ return TypeAdapter ( DynamicServiceStop ) .validate_python (dict_data )
3433
3534 return _
You can’t perform that action at this time.
0 commit comments