File tree Expand file tree Collapse file tree 5 files changed +9
-11
lines changed
packages/models-library/src/models_library
api_schemas_dynamic_sidecar Expand file tree Collapse file tree 5 files changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -57,8 +57,8 @@ class DiskUsage(BaseModel):
5757
5858 total : ByteSize = Field (description = "total space = free + used" )
5959 used_percent : NonNegativeFloat = Field (
60- gte = 0.00 ,
61- lte = 100.00 ,
60+ ge = 0.00 ,
61+ le = 100.00 ,
6262 description = "Percent of used space relative to the total space" ,
6363 )
6464
Original file line number Diff line number Diff line change 2828
2929
3030# https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers#Registered_ports
31- class RegisteredPortInt :
32- TypeAlias = Annotated [int , Field (gt = 1024 , lt = 65535 )]
31+ RegisteredPortInt : TypeAlias = Annotated [int , Field (gt = 1024 , lt = 65535 )]
3332
3433
3534# e.g. 'v5'
Original file line number Diff line number Diff line change @@ -95,8 +95,7 @@ class JupyterHubTokenAuthentication(BaseAuthentication):
9595class NoAuthentication (BaseAuthentication ):
9696 type : Literal ["none" ] = "none"
9797
98- class Config (BaseAuthentication .Config ):
99- schema_extra : ClassVar [dict [str , Any ]] = {"examples" : [{"type" : "none" }]}
98+ model_config = ConfigDict (json_schema_extra = {"examples" : [{"type" : "none" }]})
10099
101100
102101class TLSAuthentication (BaseAuthentication ):
Original file line number Diff line number Diff line change @@ -192,7 +192,7 @@ def routing_key(self) -> str | None:
192192
193193class DynamicServiceRunningMessage (RabbitMessageBase ):
194194 channel_name : Literal ["io.simcore.service.dynamic-service-running" ] = Field (
195- default = "io.simcore.service.dynamic-service-running" , const = True
195+ default = "io.simcore.service.dynamic-service-running"
196196 )
197197
198198 project_id : ProjectID
Original file line number Diff line number Diff line change @@ -97,7 +97,8 @@ def pydantic_encoder(obj: Any) -> Any:
9797 return obj .model_dump ()
9898
9999 if is_dataclass (obj ):
100- return asdict (obj ) # type: ignore[call-overload]
100+ assert not isinstance (obj , type ) # nosec
101+ return asdict (obj )
101102
102103 # Check the class type and its superclasses for a matching encoder
103104 for base in obj .__class__ .__mro__ [:- 1 ]:
@@ -108,9 +109,8 @@ def pydantic_encoder(obj: Any) -> Any:
108109 return encoder (obj )
109110
110111 # We have exited the for loop without finding a suitable encoder
111- raise TypeError (
112- f"Object of type '{ obj .__class__ .__name__ } ' is not JSON serializable"
113- )
112+ msg = f"Object of type '{ obj .__class__ .__name__ } ' is not JSON serializable"
113+ raise TypeError (msg )
114114
115115
116116def json_dumps (
You can’t perform that action at this time.
0 commit comments