diff options
author | Stanislav Kirillov <staskirillov@gmail.com> | 2022-02-10 16:46:08 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:08 +0300 |
commit | cb68f224c46a8ee52ac3fdd2a32534b8bb8dc134 (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /util | |
parent | 92fe2b1e7bc79f7b95adef61714fc003f6ea4a1c (diff) | |
download | ydb-cb68f224c46a8ee52ac3fdd2a32534b8bb8dc134.tar.gz |
Restoring authorship annotation for Stanislav Kirillov <staskirillov@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'util')
-rw-r--r-- | util/datetime/base.pxd | 2 | ||||
-rw-r--r-- | util/generic/array_ref.pxd | 42 | ||||
-rw-r--r-- | util/generic/array_ref_ut.pyx | 56 | ||||
-rw-r--r-- | util/generic/hash.pxd | 6 | ||||
-rw-r--r-- | util/generic/hash_set.pxd | 86 | ||||
-rw-r--r-- | util/generic/hash_set_ut.pyx | 104 | ||||
-rw-r--r-- | util/generic/hash_ut.pyx | 118 | ||||
-rw-r--r-- | util/generic/ptr.pxd | 46 | ||||
-rw-r--r-- | util/generic/string.pxd | 2 | ||||
-rw-r--r-- | util/generic/vector.pxd | 2 | ||||
-rw-r--r-- | util/stream/multi.cpp | 36 | ||||
-rw-r--r-- | util/stream/multi_ut.cpp | 84 | ||||
-rw-r--r-- | util/stream/ut/ya.make | 2 | ||||
-rw-r--r-- | util/string/cast.pxd | 10 | ||||
-rw-r--r-- | util/system/atexit.cpp | 8 | ||||
-rw-r--r-- | util/system/atexit.h | 16 | ||||
-rw-r--r-- | util/system/datetime.h | 16 | ||||
-rw-r--r-- | util/system/execpath.cpp | 2 | ||||
-rw-r--r-- | util/system/thread.cpp | 10 | ||||
-rw-r--r-- | util/system/tls.h | 2 | ||||
-rw-r--r-- | util/tests/cython/ya.make | 6 | ||||
-rw-r--r-- | util/ysaveload.h | 4 |
22 files changed, 330 insertions, 330 deletions
diff --git a/util/datetime/base.pxd b/util/datetime/base.pxd index 6ced896b59..1d863b1bd8 100644 --- a/util/datetime/base.pxd +++ b/util/datetime/base.pxd @@ -3,7 +3,7 @@ from libc.stdint cimport uint64_t from libcpp cimport bool as bool_t from posix.types cimport time_t -from util.generic.string cimport TString, TStringBuf +from util.generic.string cimport TString, TStringBuf cdef extern from "<util/datetime/base.h>" nogil: diff --git a/util/generic/array_ref.pxd b/util/generic/array_ref.pxd index 47a4b3d8f2..41a4c72d69 100644 --- a/util/generic/array_ref.pxd +++ b/util/generic/array_ref.pxd @@ -1,25 +1,25 @@ from libcpp cimport bool as bool_t - -cdef extern from "util/generic/array_ref.h" nogil: - cdef cppclass TArrayRef[T]: - TArrayRef(...) except + - - T& operator[](size_t) - + +cdef extern from "util/generic/array_ref.h" nogil: + cdef cppclass TArrayRef[T]: + TArrayRef(...) except + + + T& operator[](size_t) + bool_t empty() - T* data() except + - size_t size() except + - T* begin() except + - T* end() except + - - cdef cppclass TConstArrayRef[T]: - TConstArrayRef(...) except + - - const T& operator[](size_t) - + T* data() except + + size_t size() except + + T* begin() except + + T* end() except + + + cdef cppclass TConstArrayRef[T]: + TConstArrayRef(...) except + + + const T& operator[](size_t) + bool_t empty() - const T* data() except + - size_t size() except + - const T* begin() except + - const T* end() except + + const T* data() except + + size_t size() except + + const T* begin() except + + const T* end() except + diff --git a/util/generic/array_ref_ut.pyx b/util/generic/array_ref_ut.pyx index 22222fb386..67b69a365c 100644 --- a/util/generic/array_ref_ut.pyx +++ b/util/generic/array_ref_ut.pyx @@ -1,28 +1,28 @@ -import pytest -import unittest -from util.generic.array_ref cimport TArrayRef -from util.generic.vector cimport TVector - - -class TestArrayRef(unittest.TestCase): - def test_array_data_reference(self): - array_size = 30 - cdef TVector[int] vec - for i in xrange(array_size): - vec.push_back(i) - cdef TArrayRef[int] array_ref = TArrayRef[int](vec.data(), vec.size()) - for i in xrange(array_size / 2): - array_ref[array_size - 1 - i] = array_ref[i] - for i in xrange(array_size): - self.assertEqual(array_ref[i], array_size - 1 - i) - - def test_array_vec_reference(self): - array_size = 30 - cdef TVector[int] vec - for i in xrange(array_size): - vec.push_back(i) - cdef TArrayRef[int] array_ref = TArrayRef[int](vec) - for i in xrange(array_size / 2): - array_ref[array_size - 1 - i] = array_ref[i] - for i in xrange(array_size): - self.assertEqual(array_ref[i], array_size - 1 - i)
\ No newline at end of file +import pytest +import unittest +from util.generic.array_ref cimport TArrayRef +from util.generic.vector cimport TVector + + +class TestArrayRef(unittest.TestCase): + def test_array_data_reference(self): + array_size = 30 + cdef TVector[int] vec + for i in xrange(array_size): + vec.push_back(i) + cdef TArrayRef[int] array_ref = TArrayRef[int](vec.data(), vec.size()) + for i in xrange(array_size / 2): + array_ref[array_size - 1 - i] = array_ref[i] + for i in xrange(array_size): + self.assertEqual(array_ref[i], array_size - 1 - i) + + def test_array_vec_reference(self): + array_size = 30 + cdef TVector[int] vec + for i in xrange(array_size): + vec.push_back(i) + cdef TArrayRef[int] array_ref = TArrayRef[int](vec) + for i in xrange(array_size / 2): + array_ref[array_size - 1 - i] = array_ref[i] + for i in xrange(array_size): + self.assertEqual(array_ref[i], array_size - 1 - i)
\ No newline at end of file diff --git a/util/generic/hash.pxd b/util/generic/hash.pxd index 458c3cfcae..385c10d805 100644 --- a/util/generic/hash.pxd +++ b/util/generic/hash.pxd @@ -34,7 +34,7 @@ cdef extern from "util/generic/hash.h" nogil: bint operator<=(THashMap&) bint operator>=(THashMap&) - U& at(T&) except + + U& at(T&) except + iterator begin() const_iterator const_begin "begin"() void clear() @@ -43,8 +43,8 @@ cdef extern from "util/generic/hash.h" nogil: iterator end() const_iterator const_end "end"() pair[iterator, iterator] equal_range(T&) - void erase(iterator) except + - void erase(iterator, iterator) except + + void erase(iterator) except + + void erase(iterator, iterator) except + size_t erase(T&) iterator find(T&) bint contains(T&) diff --git a/util/generic/hash_set.pxd b/util/generic/hash_set.pxd index a53ecf4fe2..d28d90cbe7 100644 --- a/util/generic/hash_set.pxd +++ b/util/generic/hash_set.pxd @@ -1,43 +1,43 @@ -from libcpp.pair cimport pair - -cdef extern from "util/generic/hash_set.h" nogil: - cdef cppclass THashSet[T]: - cppclass iterator: - T& operator*() - iterator operator++() - iterator operator--() - bint operator==(iterator) - bint operator!=(iterator) - - cppclass const_iterator(iterator): - pass - - THashSet() except + - THashSet(THashSet&) except + - THashSet(T* t) except + - THashSet& operator=(THashSet&) - - bint operator==(THashSet&) - bint operator!=(THashSet&) - bint operator<(THashSet&) - bint operator>(THashSet&) - bint operator<=(THashSet&) - bint operator>=(THashSet&) - - iterator begin() - const_iterator const_begin "begin"() - void clear() - size_t count(T&) - bint empty() - iterator end() - const_iterator const_end "end"() - 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(T) - iterator insert(iterator, T) - size_t size() - void swap(THashSet&) +from libcpp.pair cimport pair + +cdef extern from "util/generic/hash_set.h" nogil: + cdef cppclass THashSet[T]: + cppclass iterator: + T& operator*() + iterator operator++() + iterator operator--() + bint operator==(iterator) + bint operator!=(iterator) + + cppclass const_iterator(iterator): + pass + + THashSet() except + + THashSet(THashSet&) except + + THashSet(T* t) except + + THashSet& operator=(THashSet&) + + bint operator==(THashSet&) + bint operator!=(THashSet&) + bint operator<(THashSet&) + bint operator>(THashSet&) + bint operator<=(THashSet&) + bint operator>=(THashSet&) + + iterator begin() + const_iterator const_begin "begin"() + void clear() + size_t count(T&) + bint empty() + iterator end() + const_iterator const_end "end"() + 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(T) + iterator insert(iterator, T) + size_t size() + void swap(THashSet&) diff --git a/util/generic/hash_set_ut.pyx b/util/generic/hash_set_ut.pyx index e2d3dfd5c7..bdcf6284af 100644 --- a/util/generic/hash_set_ut.pyx +++ b/util/generic/hash_set_ut.pyx @@ -1,53 +1,53 @@ -# cython: c_string_type=str, c_string_encoding=utf8 - -from util.generic.hash_set cimport THashSet -from util.generic.string cimport TString - -import pytest -import unittest - -from cython.operator cimport dereference as deref - - +# cython: c_string_type=str, c_string_encoding=utf8 + +from util.generic.hash_set cimport THashSet +from util.generic.string cimport TString + +import pytest +import unittest + +from cython.operator cimport dereference as deref + + class TestHashSet(unittest.TestCase): - - def test_simple_constructor_equality_operator(self): - cdef THashSet[int] c1 - c1.insert(1) - assert c1.size() == 1 - c1.insert(2) - c1.insert(2) - c1.insert(2) - c1.insert(2) - assert c1.size() == 2 - assert c1.contains(2) - assert not c1.contains(5) - cdef THashSet[int] c2 = c1 - assert c1 == c2 - c1.insert(3) - assert c1 != c2 - c1.erase(3) - assert c1 == c2 - - def test_insert_erase(self): - cdef THashSet[TString] tmp - self.assertTrue(tmp.insert("one").second) - self.assertFalse(tmp.insert("one").second) - self.assertTrue(tmp.insert("two").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 THashSet[TString] tmp - self.assertTrue(tmp.begin() == tmp.end()) - self.assertTrue(tmp.find("1") == tmp.end()) - tmp.insert("1") - self.assertTrue(tmp.begin() != tmp.end()) - cdef THashSet[TString].iterator it = tmp.find("1") - self.assertTrue(it != tmp.end()) - self.assertEqual(deref(it), "1") - + + def test_simple_constructor_equality_operator(self): + cdef THashSet[int] c1 + c1.insert(1) + assert c1.size() == 1 + c1.insert(2) + c1.insert(2) + c1.insert(2) + c1.insert(2) + assert c1.size() == 2 + assert c1.contains(2) + assert not c1.contains(5) + cdef THashSet[int] c2 = c1 + assert c1 == c2 + c1.insert(3) + assert c1 != c2 + c1.erase(3) + assert c1 == c2 + + def test_insert_erase(self): + cdef THashSet[TString] tmp + self.assertTrue(tmp.insert("one").second) + self.assertFalse(tmp.insert("one").second) + self.assertTrue(tmp.insert("two").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 THashSet[TString] tmp + self.assertTrue(tmp.begin() == tmp.end()) + self.assertTrue(tmp.find("1") == tmp.end()) + tmp.insert("1") + self.assertTrue(tmp.begin() != tmp.end()) + cdef THashSet[TString].iterator it = tmp.find("1") + self.assertTrue(it != tmp.end()) + self.assertEqual(deref(it), "1") + diff --git a/util/generic/hash_ut.pyx b/util/generic/hash_ut.pyx index a6db1bbd78..ecf6dac2e6 100644 --- a/util/generic/hash_ut.pyx +++ b/util/generic/hash_ut.pyx @@ -1,80 +1,80 @@ # cython: c_string_type=str, c_string_encoding=utf8 from util.generic.hash cimport THashMap -from util.generic.string cimport TString - -import pytest -import unittest - -from libcpp.pair cimport pair -from cython.operator cimport dereference as deref - - +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(THashMap[TString, int] x): return x -class TestHash(unittest.TestCase): - - def test_constructors_and_assignments(self): +class TestHash(unittest.TestCase): + + def test_constructors_and_assignments(self): cdef THashMap[TString, int] c1 - c1["one"] = 1 - c1["two"] = 2 + c1["one"] = 1 + c1["two"] = 2 cdef THashMap[TString, int] c2 = THashMap[TString, int](c1) - self.assertEqual(2, c1.size()) - self.assertEqual(2, c2.size()) - self.assertEqual(1, c1.at("one")) + 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): + 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 THashMap[TString, int] base - base["one"] = 1 - base["two"] = 2 - + base["one"] = 1 + base["two"] = 2 + cdef THashMap[TString, int] c1 = THashMap[TString, int](base) - self.assertTrue(c1==base) - + self.assertTrue(c1==base) + cdef THashMap[TString, int] c2 - c2["one"] = 1 - c2["two"] = 2 - self.assertTrue(c2 == base) - - c2["three"] = 3 - self.assertTrue(c2 != base) - + c2["one"] = 1 + c2["two"] = 2 + self.assertTrue(c2 == base) + + c2["three"] = 3 + self.assertTrue(c2 != base) + cdef THashMap[TString, int] c3 = THashMap[TString, int](base) - c3["one"] = 0 - self.assertTrue(c3 != base) - - def test_insert_erase(self): + c3["one"] = 0 + self.assertTrue(c3 != base) + + def test_insert_erase(self): cdef THashMap[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): + 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 THashMap[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()) + self.assertTrue(tmp.begin() == tmp.end()) + self.assertTrue(tmp.find("1") == tmp.end()) + tmp["1"] = 1 + self.assertTrue(tmp.begin() != tmp.end()) cdef THashMap[TString, int].iterator it = tmp.find("1") - self.assertTrue(it != tmp.end()) - self.assertEqual(deref(it).second, 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) diff --git a/util/generic/ptr.pxd b/util/generic/ptr.pxd index b56edbbfc3..16e8d19144 100644 --- a/util/generic/ptr.pxd +++ b/util/generic/ptr.pxd @@ -1,26 +1,26 @@ cdef extern from "<util/generic/ptr.h>" nogil: cdef cppclass THolder[T]: - THolder(...) + THolder(...) T* Get() void Destroy() T* Release() - void Reset() + void Reset() void Reset(T*) - void Swap(THolder[T]) - - - cdef THolder[T] MakeHolder[T](...) - - - cdef cppclass TIntrusivePtr[T]: - TIntrusivePtr() - TIntrusivePtr(T*) - TIntrusivePtr& operator=(...) - void Reset(T*) - T* Get() - T* Release() - void Drop() - + void Swap(THolder[T]) + + + cdef THolder[T] MakeHolder[T](...) + + + cdef cppclass TIntrusivePtr[T]: + TIntrusivePtr() + TIntrusivePtr(T*) + TIntrusivePtr& operator=(...) + void Reset(T*) + T* Get() + T* Release() + void Drop() + cdef cppclass TIntrusiveConstPtr[T]: TIntrusiveConstPtr() @@ -31,12 +31,12 @@ cdef extern from "<util/generic/ptr.h>" nogil: void Drop() - cdef cppclass TAtomicSharedPtr[T]: - TAtomicSharedPtr() - TAtomicSharedPtr(T*) - T& operator*() - T* Get() - void Reset(T*) + cdef cppclass TAtomicSharedPtr[T]: + TAtomicSharedPtr() + TAtomicSharedPtr(T*) + T& operator*() + T* Get() + void Reset(T*) cdef TAtomicSharedPtr[T] MakeAtomicShared[T](...) diff --git a/util/generic/string.pxd b/util/generic/string.pxd index 10364659b8..c25f7392a1 100644 --- a/util/generic/string.pxd +++ b/util/generic/string.pxd @@ -5,7 +5,7 @@ cdef extern from "<util/generic/strbuf.h>" nogil: cdef cppclass TStringBuf: TStringBuf() except + TStringBuf(const char*) except + - TStringBuf(const char*, size_t) except + + TStringBuf(const char*, size_t) except + const char* data() char* Data() size_t size() diff --git a/util/generic/vector.pxd b/util/generic/vector.pxd index 791a15cf9d..99dde95d48 100644 --- a/util/generic/vector.pxd +++ b/util/generic/vector.pxd @@ -67,7 +67,7 @@ cdef extern from "<util/generic/vector.h>" nogil: size_t max_size() void pop_back() except + void push_back(T&) except + - void emplace_back(...) except + + void emplace_back(...) except + reverse_iterator rbegin() const_reverse_iterator const_rbegin "rbegin"() reverse_iterator rend() diff --git a/util/stream/multi.cpp b/util/stream/multi.cpp index 1886032560..b2354298a0 100644 --- a/util/stream/multi.cpp +++ b/util/stream/multi.cpp @@ -23,25 +23,25 @@ size_t TMultiInput::DoRead(void* buf, size_t len) { } size_t TMultiInput::DoReadTo(TString& st, char ch) { - size_t ret = C_->ReadTo(st, ch); - if (ret == st.size() + 1) { // found a symbol, not eof - return ret; - } - - C_ = N_; - N_ = &Cnull; - - if (ret == 0) { - ret += C_->ReadTo(st, ch); - } else { + size_t ret = C_->ReadTo(st, ch); + if (ret == st.size() + 1) { // found a symbol, not eof + return ret; + } + + C_ = N_; + N_ = &Cnull; + + if (ret == 0) { + ret += C_->ReadTo(st, ch); + } else { TString tmp; - ret += C_->ReadTo(tmp, ch); - st += tmp; - } - - return ret; -} - + ret += C_->ReadTo(tmp, ch); + st += tmp; + } + + return ret; +} + size_t TMultiInput::DoSkip(size_t len) { const size_t ret = C_->Skip(len); diff --git a/util/stream/multi_ut.cpp b/util/stream/multi_ut.cpp index c9c328e5e3..fc2553b533 100644 --- a/util/stream/multi_ut.cpp +++ b/util/stream/multi_ut.cpp @@ -1,51 +1,51 @@ -#include "mem.h" -#include "multi.h" -#include "str.h" +#include "mem.h" +#include "multi.h" +#include "str.h" #include <library/cpp/testing/unittest/registar.h> - + Y_UNIT_TEST_SUITE(TestMultiInput) { - struct TTestCase { - TMemoryInput Input1; - TMemoryInput Input2; - TMultiInput MultiInput; + struct TTestCase { + TMemoryInput Input1; + TMemoryInput Input2; + TMultiInput MultiInput; TTestCase(const TStringBuf in1, const TStringBuf in2) - : Input1(in1) - , Input2(in2) - , MultiInput(&Input1, &Input2) - { - } - void TestReadToResult(char c, size_t expectedRetval, + : Input1(in1) + , Input2(in2) + , MultiInput(&Input1, &Input2) + { + } + void TestReadToResult(char c, size_t expectedRetval, const TString& expectedValue, const TString& initValue = "") { TString t = initValue; - UNIT_ASSERT_VALUES_EQUAL(MultiInput.ReadTo(t, c), expectedRetval); - UNIT_ASSERT_VALUES_EQUAL(t, expectedValue); - } - }; - + UNIT_ASSERT_VALUES_EQUAL(MultiInput.ReadTo(t, c), expectedRetval); + UNIT_ASSERT_VALUES_EQUAL(t, expectedValue); + } + }; + Y_UNIT_TEST(TestReadTo) { TString t; - - TTestCase simpleCase("0123456789abc", "defghijk"); - simpleCase.TestReadToResult('7', 8, "0123456"); - simpleCase.TestReadToResult('f', 8, "89abcde"); - simpleCase.TestReadToResult('z', 5, "ghijk"); - } - + + TTestCase simpleCase("0123456789abc", "defghijk"); + simpleCase.TestReadToResult('7', 8, "0123456"); + simpleCase.TestReadToResult('f', 8, "89abcde"); + simpleCase.TestReadToResult('z', 5, "ghijk"); + } + Y_UNIT_TEST(TestReadToBetweenStreams) { - TTestCase case1("0123456789abc", "defghijk"); - case1.TestReadToResult('c', 13, "0123456789ab"); - case1.TestReadToResult('k', 8, "defghij"); - case1.TestReadToResult('z', 0, "TRASH", "TRASH"); - - TTestCase case2("0123456789abc", "defghijk"); - case2.TestReadToResult('d', 14, "0123456789abc"); - case2.TestReadToResult('j', 6, "efghi"); - case2.TestReadToResult('k', 1, "", "TRASH"); - - TTestCase case3("0123456789abc", "defghijk"); - case3.TestReadToResult('e', 15, "0123456789abcd"); - case3.TestReadToResult('j', 5, "fghi"); - case3.TestReadToResult('k', 1, "", "TRASH"); - } -} + TTestCase case1("0123456789abc", "defghijk"); + case1.TestReadToResult('c', 13, "0123456789ab"); + case1.TestReadToResult('k', 8, "defghij"); + case1.TestReadToResult('z', 0, "TRASH", "TRASH"); + + TTestCase case2("0123456789abc", "defghijk"); + case2.TestReadToResult('d', 14, "0123456789abc"); + case2.TestReadToResult('j', 6, "efghi"); + case2.TestReadToResult('k', 1, "", "TRASH"); + + TTestCase case3("0123456789abc", "defghijk"); + case3.TestReadToResult('e', 15, "0123456789abcd"); + case3.TestReadToResult('j', 5, "fghi"); + case3.TestReadToResult('k', 1, "", "TRASH"); + } +} diff --git a/util/stream/ut/ya.make b/util/stream/ut/ya.make index 7b7d03ff01..f0176dd7b4 100644 --- a/util/stream/ut/ya.make +++ b/util/stream/ut/ya.make @@ -16,7 +16,7 @@ SRCS( stream/labeled_ut.cpp stream/length_ut.cpp stream/mem_ut.cpp - stream/multi_ut.cpp + stream/multi_ut.cpp stream/printf_ut.cpp stream/str_ut.cpp stream/tokenizer_ut.cpp diff --git a/util/string/cast.pxd b/util/string/cast.pxd index c351ab8cbc..dc23619e1e 100644 --- a/util/string/cast.pxd +++ b/util/string/cast.pxd @@ -1,10 +1,10 @@ from util.generic.string cimport TString -from libcpp cimport bool as bool_t - +from libcpp cimport bool as bool_t + cdef extern from "<util/string/cast.h>" nogil: T FromString[T](const TString&) except + - bool_t TryFromString[T](const TString&, T&) except + - TString ToString[T](const T&) except + + bool_t TryFromString[T](const TString&, T&) except + + TString ToString[T](const T&) except + - cdef double StrToD(const char* b, char** se) except + + cdef double StrToD(const char* b, char** se) except + diff --git a/util/system/atexit.cpp b/util/system/atexit.cpp index 9e576dce45..74fb10b6b1 100644 --- a/util/system/atexit.cpp +++ b/util/system/atexit.cpp @@ -104,10 +104,10 @@ namespace { } } -void ManualRunAtExitFinalizers() { - OnExit(); -} - +void ManualRunAtExitFinalizers() { + OnExit(); +} + bool ExitStarted() { if (TAtExit* const atExit = AtomicGet(atExitPtr)) { return atExit->FinishStarted(); diff --git a/util/system/atexit.h b/util/system/atexit.h index a4343d5c60..eb3188615c 100644 --- a/util/system/atexit.h +++ b/util/system/atexit.h @@ -12,11 +12,11 @@ void AtExit(TTraditionalAtExitFunc func); void AtExit(TTraditionalAtExitFunc func, size_t priority); bool ExitStarted(); - -/** - * Generally it's a bad idea to call this method except for some rare cases, - * like graceful python DLL module unload. - * This function is not threadsafe. - * Calls in the moment when application is not terminating - bad idea. - */ -void ManualRunAtExitFinalizers(); + +/** + * Generally it's a bad idea to call this method except for some rare cases, + * like graceful python DLL module unload. + * This function is not threadsafe. + * Calls in the moment when application is not terminating - bad idea. + */ +void ManualRunAtExitFinalizers(); diff --git a/util/system/datetime.h b/util/system/datetime.h index e69a0ef27f..aa009974e0 100644 --- a/util/system/datetime.h +++ b/util/system/datetime.h @@ -45,14 +45,14 @@ Y_FORCE_INLINE ui64 GetCycleCount() noexcept { #if defined(_MSC_VER) // Generates the rdtscp instruction, which returns the processor time stamp. // The processor time stamp records the number of clock cycles since the last reset. - extern const bool HaveRdtscp; - - if (HaveRdtscp) { - unsigned int aux; - return __rdtscp(&aux); - } else { - return __rdtsc(); - } + extern const bool HaveRdtscp; + + if (HaveRdtscp) { + unsigned int aux; + return __rdtscp(&aux); + } else { + return __rdtsc(); + } #elif defined(_x86_64_) extern const bool HaveRdtscp; diff --git a/util/system/execpath.cpp b/util/system/execpath.cpp index 8d506808c3..33198af58b 100644 --- a/util/system/execpath.cpp +++ b/util/system/execpath.cpp @@ -145,7 +145,7 @@ static TString GetExecPathImpl() { if (FreeBSDGuessExecBasePath(getenv("PWD"), execPath)) { return execPath; } - if (FreeBSDGuessExecBasePath(NFs::CurrentWorkingDirectory(), execPath)) { + if (FreeBSDGuessExecBasePath(NFs::CurrentWorkingDirectory(), execPath)) { return execPath; } diff --git a/util/system/thread.cpp b/util/system/thread.cpp index 23653dd96d..6236746c2d 100644 --- a/util/system/thread.cpp +++ b/util/system/thread.cpp @@ -452,9 +452,9 @@ void TThread::SetCurrentThreadName(const char* name) { pthread_t thread = pthread_self(); pthread_set_name_np(thread, name); #elif defined(_linux_) - prctl(PR_SET_NAME, name, 0, 0, 0); + prctl(PR_SET_NAME, name, 0, 0, 0); #elif defined(_darwin_) - pthread_setname_np(name); + pthread_setname_np(name); #elif defined(_win_) auto api = Singleton<TWinThreadDescrAPI>(); if (api->HasAPI()) { @@ -514,18 +514,18 @@ TCurrentThreadLimits::TCurrentThreadLimits() noexcept : StackBegin(nullptr) , StackLength(0) { -#if defined(_linux_) || defined(_cygwin_) || defined(_freebsd_) +#if defined(_linux_) || defined(_cygwin_) || defined(_freebsd_) pthread_attr_t attr; pthread_attr_init(&attr); #if defined(_linux_) || defined(_cygwin_) Y_VERIFY(pthread_getattr_np(pthread_self(), &attr) == 0, "pthread_getattr failed"); #else - Y_VERIFY(pthread_attr_get_np(pthread_self(), &attr) == 0, "pthread_attr_get_np failed"); + Y_VERIFY(pthread_attr_get_np(pthread_self(), &attr) == 0, "pthread_attr_get_np failed"); #endif pthread_attr_getstack(&attr, (void**)&StackBegin, &StackLength); pthread_attr_destroy(&attr); - + #elif defined(_darwin_) StackBegin = pthread_get_stackaddr_np(pthread_self()); StackLength = pthread_get_stacksize_np(pthread_self()); diff --git a/util/system/tls.h b/util/system/tls.h index ab89a4f713..3c4f56dbeb 100644 --- a/util/system/tls.h +++ b/util/system/tls.h @@ -7,7 +7,7 @@ #include <new> -#if defined(_darwin_) +#if defined(_darwin_) #define Y_DISABLE_THRKEY_OPTIMIZATION #endif diff --git a/util/tests/cython/ya.make b/util/tests/cython/ya.make index f54b8a7f9c..b928c19026 100644 --- a/util/tests/cython/ya.make +++ b/util/tests/cython/ya.make @@ -11,15 +11,15 @@ PY_SRCS( NAMESPACE util folder/path_ut.pyx - generic/array_ref_ut.pyx + generic/array_ref_ut.pyx generic/deque_ut.pyx generic/maybe_ut.pyx generic/ptr_ut.pyx generic/string_ut.pyx generic/vector_ut.pyx generic/list_ut.pyx - generic/hash_set_ut.pyx - generic/hash_ut.pyx + generic/hash_set_ut.pyx + generic/hash_ut.pyx memory/blob_ut.pyx stream/str_ut.pyx string/cast_ut.pyx diff --git a/util/ysaveload.h b/util/ysaveload.h index 89b1d9f0d6..02efb4049b 100644 --- a/util/ysaveload.h +++ b/util/ysaveload.h @@ -491,11 +491,11 @@ public: : TBase(s) { Y_UNUSED(cnt); - P_ = this->S_.begin(); + P_ = this->S_.begin(); } inline void Insert(const TValue& v) { - P_ = this->S_.insert(P_, v); + P_ = this->S_.insert(P_, v); } private: |