MCPcopy Create free account
hub / github.com/catboost/catboost / Has

Function Has

library/python/runtime_py3/__res.cpp:98–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98PyObject* Has(PyObject* self[[maybe_unused]], PyObject *const* args, Py_ssize_t nargs) noexcept {
99 if (nargs != 1) {
100 PyErr_Format(PyExc_TypeError, "__res.has takes 1 positional arguments but %z were given", nargs);
101 return nullptr;
102 }
103
104 TStringBuf key;
105 if (PyUnicode_Check(args[0])) {
106 Py_ssize_t sz;
107 const char* data = PyUnicode_AsUTF8AndSize(args[0], &sz);
108 if (sz < 0) {
109 return nullptr;
110 }
111 key = {data, static_cast<size_t>(sz)};
112 } else {
113 char* data = nullptr;
114 Py_ssize_t sz;
115 if (PyBytes_AsStringAndSize(args[0], &data, &sz) != 0) {
116 return nullptr;
117 }
118 key = {data, static_cast<size_t>(sz)};
119 }
120
121 return CallWithErrorTranslation([&]{
122 int res = NResource::Has(key);
123 return PyBool_FromLong(res);
124 });
125}
126
127}
128

Callers 15

EraseMethod · 0.85
InitCustomMethod · 0.85
InitializeMethod · 0.85
GetOrElseMethod · 0.85
GetOrElseMethod · 0.85
AddMethod · 0.85
Y_UNIT_TESTFunction · 0.85
BlobByKeyMethod · 0.85
HasLazyMethod · 0.85
HasLazyMethod · 0.85
mode_calcFunction · 0.85
mode_dataset_statisticsFunction · 0.85

Calls 2

CallWithErrorTranslationFunction · 0.85
PyUnicode_AsUTF8AndSizeFunction · 0.50

Tested by

no test coverage detected