Skip to content

Commit 7be9541

Browse files
committed
fixes after merge
1 parent cf95d81 commit 7be9541

File tree

5 files changed

+9
-11
lines changed

5 files changed

+9
-11
lines changed

packages/models-library/src/models_library/api_schemas_dynamic_sidecar/telemetry.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
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'

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ class JupyterHubTokenAuthentication(BaseAuthentication):
9595
class 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

102101
class TLSAuthentication(BaseAuthentication):

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def routing_key(self) -> str | None:
192192

193193
class 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

packages/models-library/src/models_library/utils/json_serialization.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff 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

116116
def json_dumps(

0 commit comments

Comments
 (0)