diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:17 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:17 +0300 |
commit | d3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch) | |
tree | dd4bd3ca0f36b817e96812825ffaf10d645803f2 /library/python/runtime_py3/__res.pyx | |
parent | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff) | |
download | ydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'library/python/runtime_py3/__res.pyx')
-rw-r--r-- | library/python/runtime_py3/__res.pyx | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/library/python/runtime_py3/__res.pyx b/library/python/runtime_py3/__res.pyx index 306e780b2b..97190d9f29 100644 --- a/library/python/runtime_py3/__res.pyx +++ b/library/python/runtime_py3/__res.pyx @@ -1,36 +1,36 @@ from _codecs import utf_8_decode, utf_8_encode -from libcpp cimport bool - +from libcpp cimport bool + from util.generic.string cimport TString, TStringBuf - - + + cdef extern from "library/cpp/resource/resource.h" namespace "NResource": - cdef size_t Count() except + - cdef TStringBuf KeyByIndex(size_t idx) except + + cdef size_t Count() except + + cdef TStringBuf KeyByIndex(size_t idx) except + cdef bool FindExact(const TStringBuf key, TString* result) nogil except + - - -def count(): - return Count() - - -def key_by_index(idx): - cdef TStringBuf ret = KeyByIndex(idx) - - return ret.Data()[:ret.Size()] - - -def find(s): + + +def count(): + return Count() + + +def key_by_index(idx): + cdef TStringBuf ret = KeyByIndex(idx) + + return ret.Data()[:ret.Size()] + + +def find(s): cdef TString res - + if isinstance(s, str): s = utf_8_encode(s)[0] - if FindExact(TStringBuf(s, len(s)), &res): - return res.c_str()[:res.length()] - - return None + if FindExact(TStringBuf(s, len(s)), &res): + return res.c_str()[:res.length()] + + return None include "importer.pxi" |