diff options
author | Vlad Yaroslavlev <vladon@vladon.com> | 2022-02-10 16:46:23 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:23 +0300 |
commit | 706b83ed7de5a473436620367af31fc0ceecde07 (patch) | |
tree | 103305d30dec77e8f6367753367f59b3cd68f9f1 /contrib/tools/cython/Cython/Utility | |
parent | 918e8a1574070d0ec733f0b76cfad8f8892ad2e5 (diff) | |
download | ydb-706b83ed7de5a473436620367af31fc0ceecde07.tar.gz |
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 1 of 2.
Diffstat (limited to 'contrib/tools/cython/Cython/Utility')
-rw-r--r-- | contrib/tools/cython/Cython/Utility/CppConvert.pyx | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/contrib/tools/cython/Cython/Utility/CppConvert.pyx b/contrib/tools/cython/Cython/Utility/CppConvert.pyx index 5f7859dd0e..080a5abae2 100644 --- a/contrib/tools/cython/Cython/Utility/CppConvert.pyx +++ b/contrib/tools/cython/Cython/Utility/CppConvert.pyx @@ -266,56 +266,56 @@ cdef object {{cname}}(const TMaybe[X]& s): return None -#################### arcadia_TVector.from_py #################### +#################### arcadia_TVector.from_py #################### cdef extern from *: - cdef cppclass TVector [T]: + cdef cppclass TVector [T]: void push_back(T&) @cname("{{cname}}") -cdef TVector[X] {{cname}}(object o) except *: - cdef TVector[X] v +cdef TVector[X] {{cname}}(object o) except *: + cdef TVector[X] v for item in o: v.push_back(<X>item) return v -#################### arcadia_TVector.to_py #################### +#################### arcadia_TVector.to_py #################### cdef extern from *: - cdef cppclass TVector [T]: + cdef cppclass TVector [T]: size_t size() T& operator[](size_t) @cname("{{cname}}") -cdef object {{cname}}(const TVector[X]& v): +cdef object {{cname}}(const TVector[X]& v): return [v[i] for i in range(v.size())] -#################### arcadia_THashMap.from_py #################### +#################### arcadia_THashMap.from_py #################### cdef extern from *: cdef cppclass pair "std::pair" [T, U]: pair(T&, U&) - cdef cppclass THashMap [T, U]: + cdef cppclass THashMap [T, U]: void insert(pair[T, U]&) @cname("{{cname}}") -cdef THashMap[X,Y] {{cname}}(object o) except *: +cdef THashMap[X,Y] {{cname}}(object o) except *: cdef dict d = o - cdef THashMap[X,Y] m + cdef THashMap[X,Y] m for key, value in d.iteritems(): m.insert(pair[X,Y](<X>key, <Y>value)) return m -#################### arcadia_THashMap.to_py #################### +#################### arcadia_THashMap.to_py #################### cimport cython cdef extern from *: - cdef cppclass THashMap [T, U]: + cdef cppclass THashMap [T, U]: cppclass value_type: T first U second @@ -327,10 +327,10 @@ cdef extern from *: const_iterator end() @cname("{{cname}}") -cdef dict {{cname}}(const THashMap[X,Y]& s): +cdef dict {{cname}}(const THashMap[X,Y]& s): cdef dict result = {} - cdef const THashMap[X,Y].value_type *key_value - cdef THashMap[X,Y].const_iterator iter = s.begin() + cdef const THashMap[X,Y].value_type *key_value + cdef THashMap[X,Y].const_iterator iter = s.begin() while iter != s.end(): key_value = &cython.operator.dereference(iter) result[key_value.first] = key_value.second |