From d3a398281c6fd1d3672036cb2d63f842d2cb28c5 Mon Sep 17 00:00:00 2001 From: Anton Samokhvalov <pg83@yandex.ru> Date: Thu, 10 Feb 2022 16:45:17 +0300 Subject: Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2. --- library/python/runtime_py3/__res.pyx | 48 ++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'library/python/runtime_py3/__res.pyx') 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" -- cgit v1.2.3