Fokko commented on code in PR #3418:
URL: https://github.com/apache/iceberg-python/pull/3418#discussion_r3947486614


##########
pyiceberg/catalog/rest/__init__.py:
##########
@@ -442,6 +453,111 @@ class ListViewsResponse(IcebergBaseModel):
 _PLANNING_RESPONSE_ADAPTER = TypeAdapter(PlanningResponse)
 
 
+_T = TypeVar("_T", int, float)
+
+
+def _parse_connection_property(
+    properties: Properties,
+    property_name: str,
+    converter: Callable[[Any], _T],
+    type_description: str,
+    is_invalid: Callable[[_T], bool],
+    range_description: str,
+) -> _T | None:
+    raw_value = properties.get(property_name)
+    if raw_value is None:
+        return None
+    try:
+        value = converter(raw_value)
+    except (TypeError, ValueError) as e:
+        raise ValueError(f"`{property_name}` must be {type_description}, got: 
{raw_value!r}") from e
+    if is_invalid(value):
+        raise ValueError(f"`{property_name}` must be {range_description}, got: 
{value}")
+    return value

Review Comment:
   Sorry for not flagging this earlier, but we can drop this, and re-use the 
methods in `pyiceberg/utils/properties.py`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to