summaryrefslogtreecommitdiffstats
path: root/yql/essentials/udfs/common/python/bindings/py_resource.cpp
diff options
context:
space:
mode:
authorvvvv <[email protected]>2025-10-06 13:26:25 +0300
committervvvv <[email protected]>2025-10-06 14:06:25 +0300
commiteca8ce9cb1613d5c983185c4e43c20651a9638aa (patch)
tree61ee5ae779948e61af9a7691d19eaa2c09869121 /yql/essentials/udfs/common/python/bindings/py_resource.cpp
parent4adf7eecae16a9b228b28cc5f64c27ef69ad5ec2 (diff)
YQL-20086 udfs
init commit_hash:f9684778bf1ea956965f2360b80b91edb7d4ffbe
Diffstat (limited to 'yql/essentials/udfs/common/python/bindings/py_resource.cpp')
-rw-r--r--yql/essentials/udfs/common/python/bindings/py_resource.cpp26
1 files changed, 12 insertions, 14 deletions
diff --git a/yql/essentials/udfs/common/python/bindings/py_resource.cpp b/yql/essentials/udfs/common/python/bindings/py_resource.cpp
index 050eae0c8ce..33f446aff3b 100644
--- a/yql/essentials/udfs/common/python/bindings/py_resource.cpp
+++ b/yql/essentials/udfs/common/python/bindings/py_resource.cpp
@@ -21,11 +21,11 @@ void DestroyResourceCapsule(PyObject* obj) {
/////////////////////////////////////////////////////////////////////////////
// TResource
/////////////////////////////////////////////////////////////////////////////
-class TResource final: public NUdf::TBoxedValue
-{
+class TResource final: public NUdf::TBoxedValue {
public:
TResource(PyObject* value, const NUdf::TStringRef& tag)
- : Value_(value, TPyObjectPtr::ADD_REF), Tag_(tag)
+ : Value_(value, TPyObjectPtr::ADD_REF)
+ , Tag_(tag)
{
}
@@ -52,11 +52,10 @@ private:
const char ResourceCapsuleName[] = "YqlResourceCapsule";
TPyObjectPtr ToPyResource(
- const TPyCastContext::TPtr& ctx,
- const NUdf::TType* type,
- const NUdf::TUnboxedValuePod& value)
+ const TPyCastContext::TPtr& ctx,
+ const NUdf::TType* type,
+ const NUdf::TUnboxedValuePod& value)
{
-
#if UDF_ABI_COMPATIBILITY_VERSION_CURRENT >= UDF_ABI_COMPATIBILITY_VERSION(2, 15)
NUdf::TResourceTypeInspector inpector(*ctx->PyCtx->TypeInfoHelper, type);
auto tag = inpector.GetTag();
@@ -77,10 +76,9 @@ TPyObjectPtr ToPyResource(
}
NUdf::TUnboxedValue FromPyResource(
- const TPyCastContext::TPtr& ctx,
- const NUdf::TType* type, PyObject* value)
+ const TPyCastContext::TPtr& ctx,
+ const NUdf::TType* type, PyObject* value)
{
-
#if UDF_ABI_COMPATIBILITY_VERSION_CURRENT >= UDF_ABI_COMPATIBILITY_VERSION(2, 15)
NUdf::TResourceTypeInspector inpector(*ctx->PyCtx->TypeInfoHelper, type);
auto tag = inpector.GetTag();
@@ -93,14 +91,14 @@ NUdf::TUnboxedValue FromPyResource(
auto valueTag = resource->GetResourceTag();
if (valueTag != tag) {
throw yexception() << "Mismatch of resource tag, expected: "
- << tag << ", got: " << valueTag;
+ << tag << ", got: " << valueTag;
}
return *resource;
}
- throw yexception() << "Python object " << PyObjectRepr(value) \
- << " is not a valid resource with tag " << tag;
+ throw yexception() << "Python object " << PyObjectRepr(value)
+ << " is not a valid resource with tag " << tag;
#else
Y_UNUSED(type);
if (PyCapsule_CheckExact(value)) {
@@ -113,4 +111,4 @@ NUdf::TUnboxedValue FromPyResource(
#endif
}
-} // namspace NPython
+} // namespace NPython