diff options
author | vvvv <[email protected]> | 2025-10-06 13:26:25 +0300 |
---|---|---|
committer | vvvv <[email protected]> | 2025-10-06 14:06:25 +0300 |
commit | eca8ce9cb1613d5c983185c4e43c20651a9638aa (patch) | |
tree | 61ee5ae779948e61af9a7691d19eaa2c09869121 /yql/essentials/udfs/common/python/bindings/py_utils.cpp | |
parent | 4adf7eecae16a9b228b28cc5f64c27ef69ad5ec2 (diff) |
YQL-20086 udfs
init
commit_hash:f9684778bf1ea956965f2360b80b91edb7d4ffbe
Diffstat (limited to 'yql/essentials/udfs/common/python/bindings/py_utils.cpp')
-rw-r--r-- | yql/essentials/udfs/common/python/bindings/py_utils.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/yql/essentials/udfs/common/python/bindings/py_utils.cpp b/yql/essentials/udfs/common/python/bindings/py_utils.cpp index d1e0e8b4846..412aebb874b 100644 --- a/yql/essentials/udfs/common/python/bindings/py_utils.cpp +++ b/yql/essentials/udfs/common/python/bindings/py_utils.cpp @@ -8,12 +8,11 @@ #include <regex> - namespace NPython { TPyObjectPtr PyRepr(TStringBuf asciiStr, bool intern) { for (auto c : asciiStr) { - Y_ABORT_UNLESS((c&0x80) == 0, "expected ascii"); + Y_ABORT_UNLESS((c & 0x80) == 0, "expected ascii"); } Py_ssize_t size = static_cast<Py_ssize_t>(asciiStr.size()); @@ -41,7 +40,7 @@ TString PyObjectRepr(PyObject* value) { static constexpr std::string_view truncSuffix = "(truncated)"; const TPyObjectPtr repr(PyObject_Repr(value)); if (!repr) { - return TString("repr error: ") + GetLastErrorAsString(); + return TString("repr error: ") + GetLastErrorAsString(); } TString string; @@ -64,11 +63,13 @@ bool HasEncodingCookie(const TString& source) { // static std::regex encodingRe( - "^[ \\t\\v]*#.*?coding[:=][ \\t]*[-_.a-zA-Z0-9]+.*"); + "^[ \\t\\v]*#.*?coding[:=][ \\t]*[-_.a-zA-Z0-9]+.*"); int i = 0; - for (const auto& it: StringSplitter(source).Split('\n')) { - if (i++ == 2) break; + for (const auto& it : StringSplitter(source).Split('\n')) { + if (i++ == 2) { + break; + } TStringBuf line = it.Token(); if (std::regex_match(line.begin(), line.end(), encodingRe)) { @@ -86,4 +87,4 @@ void PyCleanup() { PySys_SetObject("last_traceback", Py_None); } -} // namspace NPython +} // namespace NPython |