Skip to content

Commit a1be63c

Browse files
fix mypy
1 parent 2941dea commit a1be63c

28 files changed

+139
-95
lines changed

packages/models-library/src/models_library/api_schemas_catalog/services.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ class ServiceUpdate(ServiceMetaDataEditable, ServiceAccessRights):
3131
1: {
3232
"execute_access": False,
3333
"write_access": False,
34-
},
34+
}, # type: ignore[dict-item]
3535
2: {
3636
"execute_access": True,
3737
"write_access": True,
38-
},
38+
}, # type: ignore[dict-item]
3939
44: {
4040
"execute_access": False,
4141
"write_access": False,
42-
},
42+
}, # type: ignore[dict-item]
4343
},
4444
# ServiceMetaData = ServiceCommonData +
4545
"name": "My Human Readable Service Name",

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ class ClusterCreate(BaseCluster):
143143
"password": "somepassword",
144144
},
145145
"accessRights": {
146-
154: CLUSTER_ADMIN_RIGHTS,
147-
12: CLUSTER_MANAGER_RIGHTS,
148-
7899: CLUSTER_USER_RIGHTS,
146+
154: CLUSTER_ADMIN_RIGHTS, # type: ignore[dict-item]
147+
12: CLUSTER_MANAGER_RIGHTS, # type: ignore[dict-item]
148+
7899: CLUSTER_USER_RIGHTS, # type: ignore[dict-item]
149149
},
150150
},
151151
]
@@ -189,9 +189,9 @@ class ClusterPatch(BaseCluster):
189189
},
190190
{
191191
"accessRights": {
192-
154: CLUSTER_ADMIN_RIGHTS,
193-
12: CLUSTER_MANAGER_RIGHTS,
194-
7899: CLUSTER_USER_RIGHTS,
192+
154: CLUSTER_ADMIN_RIGHTS, # type: ignore[dict-item]
193+
12: CLUSTER_MANAGER_RIGHTS, # type: ignore[dict-item]
194+
7899: CLUSTER_USER_RIGHTS, # type: ignore[dict-item]
195195
},
196196
},
197197
]

packages/models-library/src/models_library/api_schemas_directorv2/dynamic_services.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,22 @@ class DynamicServiceCreate(ServiceDetails):
6767
"can_save": True,
6868
"service_resources": ServiceResourcesDictHelpers.model_config[
6969
"json_schema_extra"
70-
]["examples"][0],
70+
]["examples"][
71+
0
72+
], # type: ignore [index]
7173
"wallet_info": WalletInfo.model_config["json_schema_extra"]["examples"][
7274
0
73-
],
75+
], # type: ignore [index]
7476
"pricing_info": PricingInfo.model_config["json_schema_extra"][
7577
"examples"
76-
][0],
78+
][
79+
0
80+
], # type: ignore [index]
7781
"hardware_info": HardwareInfo.model_config["json_schema_extra"][
7882
"examples"
79-
][0],
83+
][
84+
0
85+
], # type: ignore [index]
8086
}
8187
}
8288
)

packages/models-library/src/models_library/api_schemas_directorv2/services.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class ServiceExtras(BaseModel):
6565
{"node_requirements": node_example}
6666
for node_example in NodeRequirements.model_config["json_schema_extra"][
6767
"examples"
68-
]
68+
] # type: ignore[index,union-attr]
6969
]
7070
+ [
7171
{
@@ -78,7 +78,7 @@ class ServiceExtras(BaseModel):
7878
}
7979
for node_example in NodeRequirements.model_config["json_schema_extra"][
8080
"examples"
81-
]
81+
] # type: ignore[index,dict-item, union-attr]
8282
]
8383
+ [
8484
{
@@ -92,7 +92,7 @@ class ServiceExtras(BaseModel):
9292
}
9393
for node_example in NodeRequirements.model_config["json_schema_extra"][
9494
"examples"
95-
]
95+
] # type: ignore[index,union-attr]
9696
]
9797
}
9898
)

packages/models-library/src/models_library/api_schemas_dynamic_scheduler/dynamic_services.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,22 @@ class DynamicServiceStart(DynamicServiceCreate):
2828
"simcore_user_agent": "",
2929
"service_resources": ServiceResourcesDictHelpers.model_config[
3030
"json_schema_extra"
31-
]["examples"][0],
31+
]["examples"][
32+
0
33+
], # type: ignore [index]
3234
"wallet_info": WalletInfo.model_config["json_schema_extra"]["examples"][
3335
0
34-
],
36+
], # type: ignore [index]
3537
"pricing_info": PricingInfo.model_config["json_schema_extra"][
3638
"examples"
37-
][0],
39+
][
40+
0
41+
], # type: ignore [index]
3842
"hardware_info": HardwareInfo.model_config["json_schema_extra"][
3943
"examples"
40-
][0],
44+
][
45+
0
46+
], # type: ignore [index]
4147
}
4248
}
4349
)

packages/models-library/src/models_library/api_schemas_invitations/invitations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class ApiInvitationContentAndLink(ApiInvitationContent):
3838
model_config = ConfigDict(
3939
json_schema_extra={
4040
"example": {
41-
**ApiInvitationContent.model_config["json_schema_extra"]["example"],
41+
**ApiInvitationContent.model_config["json_schema_extra"]["example"], # type: ignore[index,dict-item]
4242
"invitation_url": "https://foo.com/#/registration?invitation=1234",
4343
}
4444
}

packages/models-library/src/models_library/api_schemas_resource_usage_tracker/pricing_plans.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,17 @@ class PricingUnitGet(BaseModel):
3131
"unit_name": "SMALL",
3232
"unit_extra_info": UnitExtraInfo.model_config["json_schema_extra"][
3333
"examples"
34-
][0],
34+
][
35+
0
36+
], # type: ignore[index]
3537
"current_cost_per_unit": 5.7,
3638
"current_cost_per_unit_id": 1,
3739
"default": True,
3840
"specific_info": hw_config_example,
3941
}
4042
for hw_config_example in HardwareInfo.model_config["json_schema_extra"][
4143
"examples"
42-
]
44+
] # type: ignore[index,union-attr]
4345
]
4446
}
4547
)
@@ -70,7 +72,9 @@ class PricingPlanGet(BaseModel):
7072
}
7173
for pricing_unit_get_example in PricingUnitGet.model_config[
7274
"json_schema_extra"
73-
]["examples"]
75+
][
76+
"examples"
77+
] # type: ignore[index,union-attr]
7478
]
7579
}
7680
)

packages/models-library/src/models_library/api_schemas_webserver/catalog.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from ..services_io import ServiceInput, ServiceOutput
88
from ..services_types import ServicePortKey
99
from ..utils.change_case import snake_to_camel
10-
from ..utils.json_serialization import json_dumps, json_loads
1110
from ._base import InputSchema, OutputSchema
1211

1312
ServiceInputKey: TypeAlias = ServicePortKey
@@ -23,14 +22,9 @@ class _BaseCommonApiExtension(BaseModel):
2322
None,
2423
description="Short name for the unit for display (html-compatible), if available",
2524
)
26-
# TODO[pydantic]: The following keys were removed: `json_dumps`, `json_loads`.
27-
# Check https://docs.pydantic.dev/dev-v2/migration/#changes-to-config for more information.
25+
2826
model_config = ConfigDict(
29-
alias_generator=snake_to_camel,
30-
populate_by_name=True,
31-
extra="forbid",
32-
json_dumps=json_dumps,
33-
json_loads=json_loads,
27+
alias_generator=snake_to_camel, populate_by_name=True, extra="forbid"
3428
)
3529

3630

@@ -105,7 +99,9 @@ class ServiceOutputGet(ServiceOutput, _BaseCommonApiExtension):
10599
_EXAMPLE_FILEPICKER: dict[str, Any] = {
106100
**api_schemas_catalog_services.ServiceGet.model_config["json_schema_extra"][
107101
"examples"
108-
][1],
102+
][
103+
1
104+
], # type: ignore[index,dict-item]
109105
"inputs": {},
110106
"outputs": {
111107
"outFile": {
@@ -122,7 +118,9 @@ class ServiceOutputGet(ServiceOutput, _BaseCommonApiExtension):
122118
_EXAMPLE_SLEEPER: dict[str, Any] = {
123119
**api_schemas_catalog_services.ServiceGet.model_config["json_schema_extra"][
124120
"examples"
125-
][0],
121+
][
122+
0
123+
], # type: ignore[index,dict-item]
126124
"inputs": {
127125
"input_1": {
128126
"displayOrder": 1,
@@ -259,17 +257,19 @@ class CatalogServiceGet(api_schemas_catalog_services.ServiceGetV2):
259257
"example": {
260258
**api_schemas_catalog_services.ServiceGetV2.model_config[
261259
"json_schema_extra"
262-
]["examples"][0],
260+
]["examples"][
261+
0
262+
], # type: ignore[index,dict-item]
263263
"inputs": {
264264
f"input{i}": example
265265
for i, example in enumerate(
266-
ServiceInputGet.model_config["json_schema_extra"]["examples"]
266+
ServiceInputGet.model_config["json_schema_extra"]["examples"] # type: ignore[index,arg-type]
267267
)
268268
},
269269
"outputs": {
270270
"outFile": ServiceOutputGet.model_config["json_schema_extra"][
271271
"example"
272-
]
272+
] # type: ignore[index]
273273
},
274274
}
275275
},

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,21 +58,21 @@ class CallbacksMapping(BaseModel):
5858
"metrics": None,
5959
"before_shutdown": [],
6060
},
61-
{"metrics": UserServiceCommand.model_config["json_schema_extra"]["examples"][0]},
61+
{"metrics": UserServiceCommand.model_config["json_schema_extra"]["examples"][0]}, # type: ignore [index]
6262
{
63-
"metrics": UserServiceCommand.model_config["json_schema_extra"]["examples"][0],
63+
"metrics": UserServiceCommand.model_config["json_schema_extra"]["examples"][0], # type: ignore [index]
6464
"before_shutdown": [
65-
UserServiceCommand.model_config["json_schema_extra"]["examples"][0],
66-
UserServiceCommand.model_config["json_schema_extra"]["examples"][1],
65+
UserServiceCommand.model_config["json_schema_extra"]["examples"][0], # type: ignore [index]
66+
UserServiceCommand.model_config["json_schema_extra"]["examples"][1], # type: ignore [index]
6767
],
6868
},
6969
{
70-
"metrics": UserServiceCommand.model_config["json_schema_extra"]["examples"][0],
70+
"metrics": UserServiceCommand.model_config["json_schema_extra"]["examples"][0], # type: ignore [index]
7171
"before_shutdown": [
72-
UserServiceCommand.model_config["json_schema_extra"]["examples"][0],
73-
UserServiceCommand.model_config["json_schema_extra"]["examples"][1],
72+
UserServiceCommand.model_config["json_schema_extra"]["examples"][0], # type: ignore [index]
73+
UserServiceCommand.model_config["json_schema_extra"]["examples"][1], # type: ignore [index]
7474
],
75-
"inactivity": UserServiceCommand.model_config["json_schema_extra"]["examples"][0],
75+
"inactivity": UserServiceCommand.model_config["json_schema_extra"]["examples"][0], # type: ignore [index]
7676
},
7777
]
7878
},

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,9 @@ class Cluster(BaseCluster):
191191
"endpoint": "https://registry.osparc-development.fake.dev",
192192
"authentication": {"type": "kerberos"},
193193
"access_rights": {
194-
154: CLUSTER_ADMIN_RIGHTS,
195-
12: CLUSTER_MANAGER_RIGHTS,
196-
7899: CLUSTER_USER_RIGHTS,
194+
154: CLUSTER_ADMIN_RIGHTS, # type: ignore[dict-item]
195+
12: CLUSTER_MANAGER_RIGHTS, # type: ignore[dict-item]
196+
7899: CLUSTER_USER_RIGHTS, # type: ignore[dict-item]
197197
},
198198
},
199199
{
@@ -208,9 +208,9 @@ class Cluster(BaseCluster):
208208
"api_token": "some_fake_token",
209209
},
210210
"access_rights": {
211-
154: CLUSTER_ADMIN_RIGHTS,
212-
12: CLUSTER_MANAGER_RIGHTS,
213-
7899: CLUSTER_USER_RIGHTS,
211+
154: CLUSTER_ADMIN_RIGHTS, # type: ignore[dict-item]
212+
12: CLUSTER_MANAGER_RIGHTS, # type: ignore[dict-item]
213+
7899: CLUSTER_USER_RIGHTS, # type: ignore[dict-item]
214214
},
215215
},
216216
]

0 commit comments

Comments
 (0)