diff options
author | Sergey Lisitsyn <lisitsyn@hey.com> | 2022-02-10 16:48:19 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:19 +0300 |
commit | c9e1915ecc1c41fac307cfc13afbd8b06c44f3df (patch) | |
tree | 7e5132d6c718fb78b6631d3d3798c7cf5785bf5e | |
parent | 04f02f891129c1f4e70d2ba4a3c0f9b1978b5f36 (diff) | |
download | ydb-c9e1915ecc1c41fac307cfc13afbd8b06c44f3df.tar.gz |
Restoring authorship annotation for Sergey Lisitsyn <lisitsyn@hey.com>. Commit 1 of 2.
-rw-r--r-- | build/ya.conf.json | 26 | ||||
-rw-r--r-- | contrib/python/ya.make | 4 | ||||
-rw-r--r-- | contrib/tools/cython/Cython/Compiler/PyrexTypes.py | 4 | ||||
-rw-r--r-- | contrib/tools/cython/Cython/Utility/CppConvert.pyx | 92 | ||||
-rw-r--r-- | util/generic/map.pxd | 92 | ||||
-rw-r--r-- | util/generic/map_ut.pyx | 164 | ||||
-rw-r--r-- | util/generic/ptr.h | 2 |
7 files changed, 192 insertions, 192 deletions
diff --git a/build/ya.conf.json b/build/ya.conf.json index 5f7cc875d6..d10f8c56c1 100644 --- a/build/ya.conf.json +++ b/build/ya.conf.json @@ -4561,7 +4561,7 @@ "default": true } ] - }, + }, "contexts_difference": { "tools": { "contexts_difference": { @@ -4668,14 +4668,14 @@ } ] }, - "crypta": { - "tools": { + "crypta": { + "tools": { "crypta": { "bottle": "crypta", "executable": "crypta" } - }, - "platforms": [ + }, + "platforms": [ { "host": { "os": "LINUX" @@ -4688,7 +4688,7 @@ }, "default": true } - ] + ] }, "apphost": { "tools": { @@ -7270,7 +7270,7 @@ "graphs_difference" ] } - }, + }, "contexts_difference": { "formula": { "sandbox_id": 1128937263, @@ -7315,16 +7315,16 @@ ] } }, - "crypta": { - "formula": { + "crypta": { + "formula": { "sandbox_id": 550700694, - "match": "crypta" - }, - "executable": { + "match": "crypta" + }, + "executable": { "crypta": [ "crypta" ] - } + } }, "apphost": { "formula": { diff --git a/contrib/python/ya.make b/contrib/python/ya.make index d01ced9f3a..b325ca0a76 100644 --- a/contrib/python/ya.make +++ b/contrib/python/ya.make @@ -602,7 +602,7 @@ RECURSE( M2Crypto m3u8 Mako - marisa_trie + marisa_trie markdown2 Markdown MarkupSafe @@ -1020,7 +1020,7 @@ RECURSE( spdx-tools spidev spintop-openhtf - splunk-sdk-python + splunk-sdk-python sqlalchemy SQLAlchemy-Continuum sqlalchemy-stubs diff --git a/contrib/tools/cython/Cython/Compiler/PyrexTypes.py b/contrib/tools/cython/Cython/Compiler/PyrexTypes.py index 3d4931cea6..8accaa976b 100644 --- a/contrib/tools/cython/Cython/Compiler/PyrexTypes.py +++ b/contrib/tools/cython/Cython/Compiler/PyrexTypes.py @@ -3497,8 +3497,8 @@ builtin_cpp_conversions = { # arcadia_cpp_conversions "TMaybe": 1, "TVector": 1, - "THashMap": 2, - "TMap": 2, + "THashMap": 2, + "TMap": 2, } class CppClassType(CType): diff --git a/contrib/tools/cython/Cython/Utility/CppConvert.pyx b/contrib/tools/cython/Cython/Utility/CppConvert.pyx index 5f7859dd0e..eb62577d9d 100644 --- a/contrib/tools/cython/Cython/Utility/CppConvert.pyx +++ b/contrib/tools/cython/Cython/Utility/CppConvert.pyx @@ -336,49 +336,49 @@ cdef dict {{cname}}(const THashMap[X,Y]& s): result[key_value.first] = key_value.second cython.operator.preincrement(iter) return result - - -#################### arcadia_TMap.from_py #################### - -cdef extern from *: - cdef cppclass pair "std::pair" [T, U]: - pair(T&, U&) - cdef cppclass TMap [T, U]: - void insert(pair[T, U]&) - - -@cname("{{cname}}") -cdef TMap[X,Y] {{cname}}(object o) except *: - cdef dict d = o - cdef TMap[X,Y] m - for key, value in d.iteritems(): - m.insert(pair[X,Y](<X>key, <Y>value)) - return m - - -#################### arcadia_TMap.to_py #################### - -cimport cython - -cdef extern from *: - cdef cppclass TMap [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}}") -cdef dict {{cname}}(const TMap[X,Y]& s): - cdef dict result = {} - cdef const TMap[X,Y].value_type *key_value - cdef TMap[X,Y].const_iterator iter = s.begin() - while iter != s.end(): - key_value = &cython.operator.dereference(iter) - result[key_value.first] = key_value.second - cython.operator.preincrement(iter) - return result + + +#################### arcadia_TMap.from_py #################### + +cdef extern from *: + cdef cppclass pair "std::pair" [T, U]: + pair(T&, U&) + cdef cppclass TMap [T, U]: + void insert(pair[T, U]&) + + +@cname("{{cname}}") +cdef TMap[X,Y] {{cname}}(object o) except *: + cdef dict d = o + cdef TMap[X,Y] m + for key, value in d.iteritems(): + m.insert(pair[X,Y](<X>key, <Y>value)) + return m + + +#################### arcadia_TMap.to_py #################### + +cimport cython + +cdef extern from *: + cdef cppclass TMap [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}}") +cdef dict {{cname}}(const TMap[X,Y]& s): + cdef dict result = {} + cdef const TMap[X,Y].value_type *key_value + cdef TMap[X,Y].const_iterator iter = s.begin() + while iter != s.end(): + key_value = &cython.operator.dereference(iter) + result[key_value.first] = key_value.second + cython.operator.preincrement(iter) + return result diff --git a/util/generic/map.pxd b/util/generic/map.pxd index 5c9fc32804..3d9e2bdb91 100644 --- a/util/generic/map.pxd +++ b/util/generic/map.pxd @@ -1,46 +1,46 @@ -from libcpp.pair cimport pair - -cdef extern from "util/generic/map.h" nogil: - cdef cppclass TMap[T, U]: - cppclass iterator: - pair[T, U]& operator*() - iterator operator++() - iterator operator--() - bint operator==(iterator) - bint operator!=(iterator) - - cppclass const_iterator(iterator): - pass - - TMap() except + - TMap(TMap&) except + - U& operator[](T&) - TMap& operator=(TMap&) - - bint operator==(TMap&) - bint operator!=(TMap&) - bint operator<(TMap&) - bint operator>(TMap&) - bint operator<=(TMap&) - bint operator>=(TMap&) - - U& at(T&) except + - iterator begin() - const_iterator const_begin "begin"() - void clear() - size_t count(T&) - bint empty() - iterator end() - const_iterator const_end "end"() - pair[iterator, iterator] equal_range(T&) - void erase(iterator) except + - void erase(iterator, iterator) except + - size_t erase(T&) - iterator find(T&) - bint contains(T&) - const_iterator const_find "find"(T&) - pair[iterator, bint] insert(pair[T, U]) # XXX pair[T,U]& - iterator insert(iterator, pair[T, U]) # XXX pair[T,U]& - size_t max_size() - size_t size() - void swap(TMap&) +from libcpp.pair cimport pair + +cdef extern from "util/generic/map.h" nogil: + cdef cppclass TMap[T, U]: + cppclass iterator: + pair[T, U]& operator*() + iterator operator++() + iterator operator--() + bint operator==(iterator) + bint operator!=(iterator) + + cppclass const_iterator(iterator): + pass + + TMap() except + + TMap(TMap&) except + + U& operator[](T&) + TMap& operator=(TMap&) + + bint operator==(TMap&) + bint operator!=(TMap&) + bint operator<(TMap&) + bint operator>(TMap&) + bint operator<=(TMap&) + bint operator>=(TMap&) + + U& at(T&) except + + iterator begin() + const_iterator const_begin "begin"() + void clear() + size_t count(T&) + bint empty() + iterator end() + const_iterator const_end "end"() + pair[iterator, iterator] equal_range(T&) + void erase(iterator) except + + void erase(iterator, iterator) except + + size_t erase(T&) + iterator find(T&) + bint contains(T&) + const_iterator const_find "find"(T&) + pair[iterator, bint] insert(pair[T, U]) # XXX pair[T,U]& + iterator insert(iterator, pair[T, U]) # XXX pair[T,U]& + size_t max_size() + size_t size() + void swap(TMap&) diff --git a/util/generic/map_ut.pyx b/util/generic/map_ut.pyx index d6ec29724d..8f7f280e6a 100644 --- a/util/generic/map_ut.pyx +++ b/util/generic/map_ut.pyx @@ -1,82 +1,82 @@ -from util.generic.map cimport TMap -from util.generic.string cimport TString - -import pytest -import unittest - -from libcpp.pair cimport pair -from cython.operator cimport dereference as deref - - -def _check_convert(TMap[TString, int] x): - return x - - -class TestMap(unittest.TestCase): - - def test_constructors_and_assignments(self): - cdef TMap[TString, int] c1 - c1["one"] = 1 - c1["two"] = 2 - cdef TMap[TString, int] c2 = TMap[TString, int](c1) - self.assertEqual(2, c1.size()) - self.assertEqual(2, c2.size()) - self.assertEqual(1, c1.at("one")) - self.assertTrue(c1.contains("two")) - self.assertTrue(c2.contains("one")) - self.assertEqual(2, c2.at("two")) - c2["three"] = 3 - c1 = c2 - self.assertEqual(3, c1.size()) - self.assertEqual(3, c2.size()) - self.assertEqual(3, c1.at("three")) - - def test_equality_operator(self): - cdef TMap[TString, int] base - base["one"] = 1 - base["two"] = 2 - - cdef TMap[TString, int] c1 = TMap[TString, int](base) - self.assertTrue(c1==base) - - cdef TMap[TString, int] c2 - c2["one"] = 1 - c2["two"] = 2 - self.assertTrue(c2 == base) - - c2["three"] = 3 - self.assertTrue(c2 != base) - - cdef TMap[TString, int] c3 = TMap[TString, int](base) - c3["one"] = 0 - self.assertTrue(c3 != base) - - def test_insert_erase(self): - cdef TMap[TString, int] tmp - self.assertTrue(tmp.insert(pair[TString, int]("one", 0)).second) - self.assertFalse(tmp.insert(pair[TString, int]("one", 1)).second) - self.assertTrue(tmp.insert(pair[TString, int]("two", 2)).second) - cdef TString one = "one" - cdef TString two = "two" - self.assertEqual(tmp.erase(one), 1) - self.assertEqual(tmp.erase(two), 1) - self.assertEqual(tmp.size(), 0) - self.assertTrue(tmp.empty()) - - def test_iterators_and_find(self): - cdef TMap[TString, int] tmp - self.assertTrue(tmp.begin() == tmp.end()) - self.assertTrue(tmp.find("1") == tmp.end()) - tmp["1"] = 1 - self.assertTrue(tmp.begin() != tmp.end()) - cdef TMap[TString, int].iterator it = tmp.find("1") - self.assertTrue(it != tmp.end()) - self.assertEqual(deref(it).second, 1) - - def test_convert(self): - src = {'foo': 1, 'bar': 42} - self.assertEqual(_check_convert(src), src) - - bad_src = {'foo': 1, 'bar': 'baz'} - with self.assertRaises(TypeError): - _check_convert(bad_src) +from util.generic.map cimport TMap +from util.generic.string cimport TString + +import pytest +import unittest + +from libcpp.pair cimport pair +from cython.operator cimport dereference as deref + + +def _check_convert(TMap[TString, int] x): + return x + + +class TestMap(unittest.TestCase): + + def test_constructors_and_assignments(self): + cdef TMap[TString, int] c1 + c1["one"] = 1 + c1["two"] = 2 + cdef TMap[TString, int] c2 = TMap[TString, int](c1) + self.assertEqual(2, c1.size()) + self.assertEqual(2, c2.size()) + self.assertEqual(1, c1.at("one")) + self.assertTrue(c1.contains("two")) + self.assertTrue(c2.contains("one")) + self.assertEqual(2, c2.at("two")) + c2["three"] = 3 + c1 = c2 + self.assertEqual(3, c1.size()) + self.assertEqual(3, c2.size()) + self.assertEqual(3, c1.at("three")) + + def test_equality_operator(self): + cdef TMap[TString, int] base + base["one"] = 1 + base["two"] = 2 + + cdef TMap[TString, int] c1 = TMap[TString, int](base) + self.assertTrue(c1==base) + + cdef TMap[TString, int] c2 + c2["one"] = 1 + c2["two"] = 2 + self.assertTrue(c2 == base) + + c2["three"] = 3 + self.assertTrue(c2 != base) + + cdef TMap[TString, int] c3 = TMap[TString, int](base) + c3["one"] = 0 + self.assertTrue(c3 != base) + + def test_insert_erase(self): + cdef TMap[TString, int] tmp + self.assertTrue(tmp.insert(pair[TString, int]("one", 0)).second) + self.assertFalse(tmp.insert(pair[TString, int]("one", 1)).second) + self.assertTrue(tmp.insert(pair[TString, int]("two", 2)).second) + cdef TString one = "one" + cdef TString two = "two" + self.assertEqual(tmp.erase(one), 1) + self.assertEqual(tmp.erase(two), 1) + self.assertEqual(tmp.size(), 0) + self.assertTrue(tmp.empty()) + + def test_iterators_and_find(self): + cdef TMap[TString, int] tmp + self.assertTrue(tmp.begin() == tmp.end()) + self.assertTrue(tmp.find("1") == tmp.end()) + tmp["1"] = 1 + self.assertTrue(tmp.begin() != tmp.end()) + cdef TMap[TString, int].iterator it = tmp.find("1") + self.assertTrue(it != tmp.end()) + self.assertEqual(deref(it).second, 1) + + def test_convert(self): + src = {'foo': 1, 'bar': 42} + self.assertEqual(_check_convert(src), src) + + bad_src = {'foo': 1, 'bar': 'baz'} + with self.assertRaises(TypeError): + _check_convert(bad_src) diff --git a/util/generic/ptr.h b/util/generic/ptr.h index 19db0e3ec5..4288d3918c 100644 --- a/util/generic/ptr.h +++ b/util/generic/ptr.h @@ -499,7 +499,7 @@ public: } inline ~TIntrusivePtr() { - UnRef(); + UnRef(); } inline TIntrusivePtr(const TIntrusivePtr& p) noexcept |