summaryrefslogtreecommitdiffstats
path: root/yql/essentials/udfs/common/python/bindings/py_dict.h
blob: c1337cc5ec42f1a3a6bac9915a8ea18f9f4605f5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#pragma once

#include "py_ptr.h"
#include "py_ctx.h"

namespace NPython {

extern PyTypeObject PyLazyDictType;
extern PyTypeObject PyLazySetType;

TPyObjectPtr ToPyLazyDict(
    const TPyCastContext::TPtr& castCtx,
    const NKikimr::NUdf::TType* keyType,
    const NKikimr::NUdf::TType* payloadType,
    const NKikimr::NUdf::TUnboxedValuePod& value);

TPyObjectPtr ToPyLazySet(
    const TPyCastContext::TPtr& castCtx,
    const NKikimr::NUdf::TType* itemType,
    const NKikimr::NUdf::TUnboxedValuePod& value);

NKikimr::NUdf::TUnboxedValue FromPyMapping(
    const TPyCastContext::TPtr& castCtx,
    const NKikimr::NUdf::TType* keyType,
    const NKikimr::NUdf::TType* payType,
    PyObject* map);

NKikimr::NUdf::TUnboxedValue FromPyDict(
    const TPyCastContext::TPtr& castCtx,
    const NKikimr::NUdf::TType* keyType,
    const NKikimr::NUdf::TType* payType,
    PyObject* dict);

NKikimr::NUdf::TUnboxedValue FromPySet(
    const TPyCastContext::TPtr& castCtx,
    const NKikimr::NUdf::TType* itemType,
    PyObject* set);

NKikimr::NUdf::TUnboxedValue FromPySequence(
    const TPyCastContext::TPtr& castCtx,
    const NKikimr::NUdf::TType* keyType,
    PyObject* sequence);

NKikimr::NUdf::TUnboxedValue FromPySequence(
    const TPyCastContext::TPtr& castCtx,
    const NKikimr::NUdf::TType* itemType,
    const NKikimr::NUdf::TDataTypeId keyType,
    PyObject* sequence);

} // namespace NPython