Skip to content

Commit de831c4

Browse files
fix: new syntax
1 parent 044edc5 commit de831c4

File tree

1 file changed

+29
-29
lines changed
  • packages/simcore-sdk/src/simcore_sdk/node_ports_v2

1 file changed

+29
-29
lines changed

packages/simcore-sdk/src/simcore_sdk/node_ports_v2/port.py

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -114,21 +114,21 @@ def check_value(cls, v: DataItemValue, info: ValidationInfo) -> DataItemValue:
114114
and not isinstance(v, PortLink)
115115
):
116116
if port_utils.is_file_type(property_type):
117-
if not isinstance(v, (FileLink, DownloadLink)):
118-
raise ValueError(
119-
f"{property_type!r} value does not validate against any of FileLink, DownloadLink or PortLink schemas"
120-
)
117+
if not isinstance(v, FileLink | DownloadLink):
118+
msg = f"{property_type!r} value does not validate against any of FileLink, DownloadLink or PortLink schemas"
119+
raise ValueError(msg)
121120
elif property_type == "ref_contentSchema":
122121
v, _ = validate_port_content(
123122
port_key=info.data.get("key"),
124123
value=v,
125124
unit=None,
126125
content_schema=info.data.get("content_schema", {}),
127126
)
128-
elif isinstance(v, (list, dict)):
129-
raise TypeError(
127+
elif isinstance(v, list | dict):
128+
msg = (
130129
f"Containers as {v} currently only supported within content_schema."
131130
)
131+
raise TypeError(msg)
132132
return v
133133

134134
@field_validator("value_item", "value_concrete", mode="before")
@@ -196,26 +196,26 @@ async def get_value(
196196
async def _evaluate() -> ItemValue | None:
197197
if isinstance(self.value, PortLink):
198198
# this is a link to another node's port
199-
other_port_itemvalue: None | (
200-
ItemValue
201-
) = await port_utils.get_value_link_from_port_link(
202-
self.value,
203-
# pylint: disable=protected-access
204-
self._node_ports._node_ports_creator_cb,
205-
file_link_type=file_link_type,
199+
other_port_itemvalue: None | (ItemValue) = (
200+
await port_utils.get_value_link_from_port_link(
201+
self.value,
202+
# pylint: disable=protected-access
203+
self._node_ports._node_ports_creator_cb,
204+
file_link_type=file_link_type,
205+
)
206206
)
207207

208208
return other_port_itemvalue
209209

210210
if isinstance(self.value, FileLink):
211211
# let's get the download/upload link from storage
212-
url_itemvalue: None | (
213-
AnyUrl
214-
) = await port_utils.get_download_link_from_storage(
215-
# pylint: disable=protected-access
216-
user_id=self._node_ports.user_id,
217-
value=self.value,
218-
link_type=file_link_type,
212+
url_itemvalue: None | (AnyUrl) = (
213+
await port_utils.get_download_link_from_storage(
214+
# pylint: disable=protected-access
215+
user_id=self._node_ports.user_id,
216+
value=self.value,
217+
link_type=file_link_type,
218+
)
219219
)
220220
return url_itemvalue
221221

@@ -256,15 +256,15 @@ async def _evaluate() -> ItemConcreteValue | None:
256256

257257
if isinstance(self.value, PortLink):
258258
# this is a link to another node
259-
other_port_concretevalue: None | (
260-
ItemConcreteValue
261-
) = await port_utils.get_value_from_link(
262-
# pylint: disable=protected-access
263-
key=self.key,
264-
value=self.value,
265-
file_to_key_map=self.file_to_key_map,
266-
node_port_creator=self._node_ports._node_ports_creator_cb, # noqa: SLF001
267-
progress_bar=progress_bar,
259+
other_port_concretevalue: None | (ItemConcreteValue) = (
260+
await port_utils.get_value_from_link(
261+
# pylint: disable=protected-access
262+
key=self.key,
263+
value=self.value,
264+
file_to_key_map=self.file_to_key_map,
265+
node_port_creator=self._node_ports._node_ports_creator_cb, # noqa: SLF001
266+
progress_bar=progress_bar,
267+
)
268268
)
269269
value = other_port_concretevalue
270270

0 commit comments

Comments
 (0)