diff options
author | imunkin <imunkin@yandex-team.com> | 2024-11-08 10:00:23 +0300 |
---|---|---|
committer | imunkin <imunkin@yandex-team.com> | 2024-11-08 10:12:13 +0300 |
commit | a784a2f943d6e15caa6241e2e96d80aac6dbf375 (patch) | |
tree | 05f1e5366c916b988a8afb75bdab8ddeee0f6e6d /yql/essentials/udfs/common/python/bindings/py_cast.h | |
parent | d70137a7b530ccaa52834274913bbb5a3d1ca06e (diff) | |
download | ydb-a784a2f943d6e15caa6241e2e96d80aac6dbf375.tar.gz |
Move yql/udfs/common/ to /yql/essentials YQL-19206
Except the following directories:
* clickhouse/client
* datetime
* knn
* roaring
commit_hash:c7da95636144d28db109d6b17ddc762e9bacb59f
Diffstat (limited to 'yql/essentials/udfs/common/python/bindings/py_cast.h')
-rw-r--r-- | yql/essentials/udfs/common/python/bindings/py_cast.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/yql/essentials/udfs/common/python/bindings/py_cast.h b/yql/essentials/udfs/common/python/bindings/py_cast.h new file mode 100644 index 0000000000..e6850c7404 --- /dev/null +++ b/yql/essentials/udfs/common/python/bindings/py_cast.h @@ -0,0 +1,45 @@ +#pragma once + +#include "py_ptr.h" +#include "py_ctx.h" + +#include <util/generic/typetraits.h> + +namespace NPython { + +template <typename T> +TPyObjectPtr PyCast(typename TTypeTraits<T>::TFuncParam value); + +template <typename T> +T PyCast(PyObject* value); + +template <typename T> +bool TryPyCast(PyObject* value, T& result); + +template <typename T> +TPyObjectPtr ToPyUnicode(const T& value); + +TPyObjectPtr ToPyObject( + const TPyCastContext::TPtr& ctx, + const NKikimr::NUdf::TType* type, + const NKikimr::NUdf::TUnboxedValuePod& value); + +NKikimr::NUdf::TUnboxedValue FromPyObject( + const TPyCastContext::TPtr& ctx, + const NKikimr::NUdf::TType* type, + PyObject* value); + +TPyObjectPtr ToPyArgs( + const TPyCastContext::TPtr& ctx, + const NKikimr::NUdf::TType* type, + const NKikimr::NUdf::TUnboxedValuePod* args, + const NKikimr::NUdf::TCallableTypeInspector& inspector); + +void FromPyArgs( + const TPyCastContext::TPtr& ctx, + const NKikimr::NUdf::TType* type, + PyObject* pyArgs, + NKikimr::NUdf::TUnboxedValue* cArgs, + const NKikimr::NUdf::TCallableTypeInspector& inspector); + +} // namspace NPython |