diff options
author | say <say@yandex-team.com> | 2023-03-31 10:07:15 +0300 |
---|---|---|
committer | say <say@yandex-team.com> | 2023-03-31 10:07:15 +0300 |
commit | e163b69a87c70baac07bd99142916735e0c283fa (patch) | |
tree | 73e22c0f9e975ff6dc70f38534ec84588587d25c /library/cpp/pybind/pod.h | |
parent | 6be8bf780352147bcac5afec43505883b69229a0 (diff) | |
download | ydb-e163b69a87c70baac07bd99142916735e0c283fa.tar.gz |
Swith flake8 to custom lint schema
Diffstat (limited to 'library/cpp/pybind/pod.h')
-rw-r--r-- | library/cpp/pybind/pod.h | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/library/cpp/pybind/pod.h b/library/cpp/pybind/pod.h deleted file mode 100644 index 90165fdbec6..00000000000 --- a/library/cpp/pybind/pod.h +++ /dev/null @@ -1,53 +0,0 @@ -#pragma once - -#define PY_SSIZE_T_CLEAN -#include <Python.h> -#include "attr.h" -#include "typedesc.h" - -namespace NPyBind { - struct TPOD { - TPyObjectPtr Dict; - - TPOD() - : Dict(PyDict_New(), true) - { - } - bool SetAttr(const char* name, PyObject* value) { - return PyDict_SetItemString(Dict.Get(), name, value) == 0; - } - PyObject* GetAttr(const char* name) const { - PyObject* res = PyDict_GetItemString(Dict.Get(), name); - Py_XINCREF(res); - return res; - } - }; - - class TPODTraits: public NPyBind::TPythonType<TPOD, TPOD, TPODTraits> { - private: - typedef TPythonType<TPOD, TPOD, TPODTraits> MyParent; - friend class TPythonType<TPOD, TPOD, TPODTraits>; - TPODTraits(); - - public: - static TPOD* GetObject(TPOD& obj) { - return &obj; - } - }; - - template <> - inline bool FromPyObject<TPOD*>(PyObject* obj, TPOD*& res) { - res = TPODTraits::CastToObject(obj); - if (res == nullptr) - return false; - return true; - } - template <> - inline bool FromPyObject<const TPOD*>(PyObject* obj, const TPOD*& res) { - res = TPODTraits::CastToObject(obj); - if (res == nullptr) - return false; - return true; - } - -} |