diff options
author | Mikhail Borisov <borisov.mikhail@gmail.com> | 2022-02-10 16:45:39 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:39 +0300 |
commit | a6a92afe03e02795227d2641b49819b687f088f8 (patch) | |
tree | f6984a1d27d5a7ec88a6fdd6e20cd5b7693b6ece /contrib/tools/cython | |
parent | c6dc8b8bd530985bc4cce0137e9a5de32f1087cb (diff) | |
download | ydb-a6a92afe03e02795227d2641b49819b687f088f8.tar.gz |
Restoring authorship annotation for Mikhail Borisov <borisov.mikhail@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'contrib/tools/cython')
-rw-r--r-- | contrib/tools/cython/Cython/Compiler/Main.py | 4 | ||||
-rw-r--r-- | contrib/tools/cython/Cython/Compiler/PyrexTypes.py | 16 | ||||
-rw-r--r-- | contrib/tools/cython/Cython/Includes/numpy.pxd | 4 | ||||
-rw-r--r-- | contrib/tools/cython/Cython/Utility/CppConvert.pyx | 158 |
4 files changed, 91 insertions, 91 deletions
diff --git a/contrib/tools/cython/Cython/Compiler/Main.py b/contrib/tools/cython/Cython/Compiler/Main.py index af873843b5..92f939137e 100644 --- a/contrib/tools/cython/Cython/Compiler/Main.py +++ b/contrib/tools/cython/Cython/Compiler/Main.py @@ -206,7 +206,7 @@ class Context(object): if not pxd_pathname: if debug_find_module: print("...looking for pxd file") - pxd_pathname = self.find_pxd_file(qualified_name, pos) + pxd_pathname = self.find_pxd_file(qualified_name, pos) if debug_find_module: print("......found %s" % pxd_pathname) if not pxd_pathname and need_pxd: @@ -238,7 +238,7 @@ class Context(object): pass return scope - def find_pxd_file(self, qualified_name, pos, sys_path=False): + def find_pxd_file(self, qualified_name, pos, sys_path=False): # Search include path (and sys.path if sys_path is True) for # the .pxd file corresponding to the given fully-qualified # module name. diff --git a/contrib/tools/cython/Cython/Compiler/PyrexTypes.py b/contrib/tools/cython/Cython/Compiler/PyrexTypes.py index 3d4931cea6..192781c4ce 100644 --- a/contrib/tools/cython/Cython/Compiler/PyrexTypes.py +++ b/contrib/tools/cython/Cython/Compiler/PyrexTypes.py @@ -3482,7 +3482,7 @@ class CStructOrUnionType(CType): return expr_code return super(CStructOrUnionType, self).cast_code(expr_code) -cpp_string_conversions = ("std::string", "TString", "TStringBuf") +cpp_string_conversions = ("std::string", "TString", "TStringBuf") builtin_cpp_conversions = { # type element template params @@ -3574,10 +3574,10 @@ class CppClassType(CType): if self.cname in cpp_string_conversions: cls = 'string' tags = type_identifier(self), - elif self.cname.startswith('std::'): - cls = self.cname[5:] + elif self.cname.startswith('std::'): + cls = self.cname[5:] else: - cls = 'arcadia_' + self.cname + cls = 'arcadia_' + self.cname cname = '__pyx_convert_%s_from_py_%s' % (cls, '__and_'.join(tags)) context.update({ 'cname': cname, @@ -3619,12 +3619,12 @@ class CppClassType(CType): cls = 'string' prefix = 'PyObject_' # gets specialised by explicit type casts in CoerceToPyTypeNode tags = type_identifier(self), - elif self.cname.startswith('std::'): + elif self.cname.startswith('std::'): cls = self.cname[5:] prefix = '' - else: - cls = 'arcadia_' + self.cname - prefix = '' + else: + cls = 'arcadia_' + self.cname + prefix = '' cname = "__pyx_convert_%s%s_to_py_%s" % (prefix, cls, "____".join(tags)) context.update({ 'cname': cname, diff --git a/contrib/tools/cython/Cython/Includes/numpy.pxd b/contrib/tools/cython/Cython/Includes/numpy.pxd index 789669dac1..5a317fb4c8 100644 --- a/contrib/tools/cython/Cython/Includes/numpy.pxd +++ b/contrib/tools/cython/Cython/Includes/numpy.pxd @@ -923,8 +923,8 @@ cdef extern from "numpy/ufuncobject.h": void **data int ntypes int check_return - char *name - char *types + char *name + char *types char *doc void *ptr PyObject *obj diff --git a/contrib/tools/cython/Cython/Utility/CppConvert.pyx b/contrib/tools/cython/Cython/Utility/CppConvert.pyx index 5f7859dd0e..4f89c038d4 100644 --- a/contrib/tools/cython/Cython/Utility/CppConvert.pyx +++ b/contrib/tools/cython/Cython/Utility/CppConvert.pyx @@ -207,8 +207,8 @@ cdef object {{cname}}(const map[X,Y]& s): o[key_value.first] = key_value.second cython.operator.preincrement(iter) return o - - + + #################### complex.from_py #################### cdef extern from *: @@ -237,105 +237,105 @@ cdef object {{cname}}(const std_complex[X]& z): return tmp -#################### arcadia_TMaybe.from_py #################### - -cdef extern from *: - cdef cppclass TMaybe [T]: - TMaybe() - TMaybe(T&) - TMaybe& operator =(T&) - -@cname("{{cname}}") -cdef TMaybe[X] {{cname}}(object o) except *: - cdef TMaybe[X] result - if o is not None: +#################### arcadia_TMaybe.from_py #################### + +cdef extern from *: + cdef cppclass TMaybe [T]: + TMaybe() + TMaybe(T&) + TMaybe& operator =(T&) + +@cname("{{cname}}") +cdef TMaybe[X] {{cname}}(object o) except *: + cdef TMaybe[X] result + if o is not None: result = <X>o - return result - -#################### arcadia_TMaybe.to_py #################### - -cdef extern from *: - cdef cppclass TMaybe [T]: - bint Defined() - T& GetRef() - -@cname("{{cname}}") -cdef object {{cname}}(const TMaybe[X]& s): - if s.Defined(): + return result + +#################### arcadia_TMaybe.to_py #################### + +cdef extern from *: + cdef cppclass TMaybe [T]: + bint Defined() + T& GetRef() + +@cname("{{cname}}") +cdef object {{cname}}(const TMaybe[X]& s): + if s.Defined(): return s.GetRef() - return None - - + return None + + #################### arcadia_TVector.from_py #################### - -cdef extern from *: + +cdef extern from *: cdef cppclass TVector [T]: - void push_back(T&) - -@cname("{{cname}}") + void push_back(T&) + +@cname("{{cname}}") cdef TVector[X] {{cname}}(object o) except *: cdef TVector[X] v - for item in o: + for item in o: v.push_back(<X>item) - return v - - + return v + + #################### arcadia_TVector.to_py #################### - -cdef extern from *: + +cdef extern from *: cdef cppclass TVector [T]: - size_t size() - T& operator[](size_t) - -@cname("{{cname}}") + size_t size() + T& operator[](size_t) + +@cname("{{cname}}") cdef object {{cname}}(const TVector[X]& v): return [v[i] for i in range(v.size())] - - + + #################### arcadia_THashMap.from_py #################### - -cdef extern from *: - cdef cppclass pair "std::pair" [T, U]: - pair(T&, U&) + +cdef extern from *: + cdef cppclass pair "std::pair" [T, U]: + pair(T&, U&) cdef cppclass THashMap [T, U]: - void insert(pair[T, U]&) - - -@cname("{{cname}}") + void insert(pair[T, U]&) + + +@cname("{{cname}}") cdef THashMap[X,Y] {{cname}}(object o) except *: - cdef dict d = o + cdef dict d = o cdef THashMap[X,Y] m - for key, value in d.iteritems(): + for key, value in d.iteritems(): m.insert(pair[X,Y](<X>key, <Y>value)) - return m - - + return m + + #################### arcadia_THashMap.to_py #################### - -cimport cython - -cdef extern from *: + +cimport cython + +cdef extern from *: cdef cppclass THashMap [T, U]: - cppclass value_type: - T first - U second - cppclass const_iterator: - value_type& operator*() - const_iterator operator++() - bint operator!=(const_iterator) - const_iterator begin() - const_iterator end() - -@cname("{{cname}}") + cppclass value_type: + T first + U second + cppclass const_iterator: + value_type& operator*() + const_iterator operator++() + bint operator!=(const_iterator) + const_iterator begin() + const_iterator end() + +@cname("{{cname}}") cdef dict {{cname}}(const THashMap[X,Y]& s): - cdef dict result = {} + cdef dict result = {} 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) + while iter != s.end(): + key_value = &cython.operator.dereference(iter) result[key_value.first] = key_value.second - cython.operator.preincrement(iter) - return result + cython.operator.preincrement(iter) + return result #################### arcadia_TMap.from_py #################### |