diff options
author | Anton Samokhvalov <[email protected]> | 2022-02-10 16:45:15 +0300 |
---|---|---|
committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:45:15 +0300 |
commit | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch) | |
tree | da2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /library/python/runtime_py3/__res.pyx | |
parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) |
Restoring authorship annotation for Anton Samokhvalov <[email protected]>. Commit 1 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 97190d9f293..306e780b2b2 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" |