diff options
author | ivanselin <ivanselin@yandex-team.ru> | 2022-02-10 16:48:40 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:40 +0300 |
commit | e84d04727ac10dd27e5dc3d72039544902f81288 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 | |
parent | 496663edd3beee611468aedd4bb9ac100c1a118d (diff) | |
download | ydb-e84d04727ac10dd27e5dc3d72039544902f81288.tar.gz |
Restoring authorship annotation for <ivanselin@yandex-team.ru>. Commit 2 of 2.
-rw-r--r-- | contrib/python/ya.make | 4 | ||||
-rw-r--r-- | library/cpp/getopt/small/completion_generator.cpp | 18 | ||||
-rw-r--r-- | library/cpp/getopt/small/last_getopt_opts.h | 14 | ||||
-rw-r--r-- | util/datetime/base_ut.cpp | 30 | ||||
-rw-r--r-- | util/datetime/parser_ut.cpp | 40 | ||||
-rw-r--r-- | util/datetime/systime.cpp | 8 | ||||
-rw-r--r-- | util/generic/ptr.h | 2 | ||||
-rw-r--r-- | ydb/library/yql/udfs/common/digest/digest_udf.cpp | 50 | ||||
-rw-r--r-- | ydb/library/yql/udfs/common/digest/ya.make | 2 |
9 files changed, 84 insertions, 84 deletions
diff --git a/contrib/python/ya.make b/contrib/python/ya.make index 1e66d74989..d01ced9f3a 100644 --- a/contrib/python/ya.make +++ b/contrib/python/ya.make @@ -338,7 +338,7 @@ RECURSE( entrypoints enum34 environ-config - environs + environs envoy ephem escapism @@ -876,7 +876,7 @@ RECURSE( pytest-lazy-fixture pytest-localserver pytest-mock - pytest-randomly + pytest-randomly pytest-responsemock pytest-responses pytest-server-fixtures diff --git a/library/cpp/getopt/small/completion_generator.cpp b/library/cpp/getopt/small/completion_generator.cpp index 67e9b6c825..ac41988217 100644 --- a/library/cpp/getopt/small/completion_generator.cpp +++ b/library/cpp/getopt/small/completion_generator.cpp @@ -454,9 +454,9 @@ namespace NLastGetopt { TStringBuf sep = ""; for (auto& mode : modes) { if (!mode->Hidden && !mode->NoCompletion) { - line << sep << B(mode->Name); - sep = " "; - } + line << sep << B(mode->Name); + sep = " "; + } } line << "' -- ${cur}) )"; } @@ -509,10 +509,10 @@ namespace NLastGetopt { auto& line = L << "COMPREPLY+=( $(compgen -W '"; TStringBuf sep = ""; for (auto& opt : unorderedOpts) { - if (opt->IsHidden()) { - continue; - } - + if (opt->IsHidden()) { + continue; + } + for (auto& shortName : opt->GetShortNames()) { line << sep << "-" << B(TStringBuf(&shortName, 1)); sep = " "; @@ -531,7 +531,7 @@ namespace NLastGetopt { { I; for (auto& opt : unorderedOpts) { - if (opt->HasArg_ == EHasArg::NO_ARGUMENT || opt->IsHidden()) { + if (opt->HasArg_ == EHasArg::NO_ARGUMENT || opt->IsHidden()) { continue; } @@ -563,7 +563,7 @@ namespace NLastGetopt { auto& line = L << "opts='@("; TStringBuf sep = ""; for (auto& opt : unorderedOpts) { - if (opt->HasArg_ == EHasArg::NO_ARGUMENT || opt->IsHidden()) { + if (opt->HasArg_ == EHasArg::NO_ARGUMENT || opt->IsHidden()) { continue; } for (auto& shortName : opt->GetShortNames()) { diff --git a/library/cpp/getopt/small/last_getopt_opts.h b/library/cpp/getopt/small/last_getopt_opts.h index ab0672eea2..825b99c871 100644 --- a/library/cpp/getopt/small/last_getopt_opts.h +++ b/library/cpp/getopt/small/last_getopt_opts.h @@ -475,13 +475,13 @@ namespace NLastGetopt { } /** - * Get mapping for free args - */ - const TMap<ui32, TFreeArgSpec>& GetFreeArgSpecs() const { - return FreeArgSpecs_; - } - - /** + * Get mapping for free args + */ + const TMap<ui32, TFreeArgSpec>& GetFreeArgSpecs() const { + return FreeArgSpecs_; + } + + /** * Set exact expected number of free args * * @param count new value diff --git a/util/datetime/base_ut.cpp b/util/datetime/base_ut.cpp index 2815670494..afc3f802eb 100644 --- a/util/datetime/base_ut.cpp +++ b/util/datetime/base_ut.cpp @@ -512,24 +512,24 @@ Y_UNIT_TEST_SUITE(DateTimeTest) { UNIT_ASSERT_VALUES_EQUAL(i1, i2); } - - Y_UNIT_TEST(TestTimeGmDateConversion) { - tm time{}; - time_t timestamp = 0; - - // Check all days till year 2106 (max year representable if time_t is 32 bit) - while (time.tm_year < 2106 - 1900) { - timestamp += 86400; - - GmTimeR(×tamp, &time); - time_t newTimestamp = TimeGM(&time); - - UNIT_ASSERT_VALUES_EQUAL_C( + + Y_UNIT_TEST(TestTimeGmDateConversion) { + tm time{}; + time_t timestamp = 0; + + // Check all days till year 2106 (max year representable if time_t is 32 bit) + while (time.tm_year < 2106 - 1900) { + timestamp += 86400; + + GmTimeR(×tamp, &time); + time_t newTimestamp = TimeGM(&time); + + UNIT_ASSERT_VALUES_EQUAL_C( newTimestamp, timestamp, "incorrect date " << (1900 + time.tm_year) << "-" << (time.tm_mon + 1) << "-" << time.tm_mday); - } - } + } + } Y_UNIT_TEST(TestTDurationConstructorFromStdChronoDuration) { diff --git a/util/datetime/parser_ut.cpp b/util/datetime/parser_ut.cpp index fcebaf5e34..61364af997 100644 --- a/util/datetime/parser_ut.cpp +++ b/util/datetime/parser_ut.cpp @@ -451,26 +451,26 @@ Y_UNIT_TEST_SUITE(TDateTimeParseTest) { TInstant::Seconds(0) + TDuration::MicroSeconds(999999)); } - Y_UNIT_TEST(TestIso8601BigDate) { - TVector<std::pair<TString, int>> dates{ - {"2019-01-01", 17897}, - - {"2037-01-01", 24472}, - {"2050-01-01", 29220}, - - {"2099-01-01", 47117}, - {"2099-12-31", 47481}, - {"2100-01-01", 47482}, - {"2100-02-28", 47540}, - {"2100-03-01", 47541}, - }; - - for (const auto& [date, days] : dates) { - TInstant instant = TInstant::ParseIso8601(date + "T00:00:00Z"); - UNIT_ASSERT_VALUES_EQUAL(instant.Days(), days); - } - } - + Y_UNIT_TEST(TestIso8601BigDate) { + TVector<std::pair<TString, int>> dates{ + {"2019-01-01", 17897}, + + {"2037-01-01", 24472}, + {"2050-01-01", 29220}, + + {"2099-01-01", 47117}, + {"2099-12-31", 47481}, + {"2100-01-01", 47482}, + {"2100-02-28", 47540}, + {"2100-03-01", 47541}, + }; + + for (const auto& [date, days] : dates) { + TInstant instant = TInstant::ParseIso8601(date + "T00:00:00Z"); + UNIT_ASSERT_VALUES_EQUAL(instant.Days(), days); + } + } + Y_UNIT_TEST(TestHttpDate) { UNIT_ASSERT_VALUES_EQUAL( TInstant::ParseHttp("Sun, 06 Nov 1994 08:49:37 GMT"), diff --git a/util/datetime/systime.cpp b/util/datetime/systime.cpp index 6bd9442fff..6ee7e8fc6e 100644 --- a/util/datetime/systime.cpp +++ b/util/datetime/systime.cpp @@ -66,15 +66,15 @@ time_t TimeGM(const struct tm* t) { {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}, {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335}}; - // Only handles years after 1970 + // Only handles years after 1970 if (t->tm_year < 70) { return (time_t)-1; } int days = 365 * (t->tm_year - 70); - // Take into account the leap days between 1970 and YEAR-1 - days += (t->tm_year - 1 - 68) / 4 - ((t->tm_year - 1) / 100) + ((t->tm_year - 1 + 300) / 400); - + // Take into account the leap days between 1970 and YEAR-1 + days += (t->tm_year - 1 - 68) / 4 - ((t->tm_year - 1) / 100) + ((t->tm_year - 1 + 300) / 400); + if (t->tm_mon < 0 || t->tm_mon >= 12) { return (time_t)-1; } diff --git a/util/generic/ptr.h b/util/generic/ptr.h index f15f93e814..19db0e3ec5 100644 --- a/util/generic/ptr.h +++ b/util/generic/ptr.h @@ -24,7 +24,7 @@ inline void AssertTypeComplete() { // 'delete' called on pointer to incomplete type is // undefined behavior (missing destructor call/corrupted memory manager). // 'sizeof' is used to trigger compile-time error. - static_assert(sizeof(T) != 0, "Type must be complete"); + static_assert(sizeof(T) != 0, "Type must be complete"); } template <class T> diff --git a/ydb/library/yql/udfs/common/digest/digest_udf.cpp b/ydb/library/yql/udfs/common/digest/digest_udf.cpp index 6e12526d25..7487a078dd 100644 --- a/ydb/library/yql/udfs/common/digest/digest_udf.cpp +++ b/ydb/library/yql/udfs/common/digest/digest_udf.cpp @@ -19,8 +19,8 @@ #include <contrib/libs/farmhash/farmhash.h> #include <contrib/libs/xxhash/xxhash.h> -#include <contrib/libs/openssl/include/openssl/sha.h> - +#include <contrib/libs/openssl/include/openssl/sha.h> + using namespace NKikimr; using namespace NUdf; @@ -278,26 +278,26 @@ namespace { return TUnboxedValuePod(hash); } - SIMPLE_UDF(TSha1, char*(TAutoMap<char*>)) { - const auto& inputRef = args[0].AsStringRef(); - SHA_CTX sha; - SHA1_Init(&sha); - SHA1_Update(&sha, inputRef.Data(), inputRef.Size()); - unsigned char hash[SHA_DIGEST_LENGTH]; - SHA1_Final(hash, &sha); - return valueBuilder->NewString(TStringRef(reinterpret_cast<char*>(hash), sizeof(hash))); - } - - SIMPLE_UDF(TSha256, char*(TAutoMap<char*>)) { - const auto& inputRef = args[0].AsStringRef(); - SHA256_CTX sha; - SHA256_Init(&sha); - SHA256_Update(&sha, inputRef.Data(), inputRef.Size()); - unsigned char hash[SHA256_DIGEST_LENGTH]; - SHA256_Final(hash, &sha); - return valueBuilder->NewString(TStringRef(reinterpret_cast<char*>(hash), sizeof(hash))); - } - + SIMPLE_UDF(TSha1, char*(TAutoMap<char*>)) { + const auto& inputRef = args[0].AsStringRef(); + SHA_CTX sha; + SHA1_Init(&sha); + SHA1_Update(&sha, inputRef.Data(), inputRef.Size()); + unsigned char hash[SHA_DIGEST_LENGTH]; + SHA1_Final(hash, &sha); + return valueBuilder->NewString(TStringRef(reinterpret_cast<char*>(hash), sizeof(hash))); + } + + SIMPLE_UDF(TSha256, char*(TAutoMap<char*>)) { + const auto& inputRef = args[0].AsStringRef(); + SHA256_CTX sha; + SHA256_Init(&sha); + SHA256_Update(&sha, inputRef.Data(), inputRef.Size()); + unsigned char hash[SHA256_DIGEST_LENGTH]; + SHA256_Final(hash, &sha); + return valueBuilder->NewString(TStringRef(reinterpret_cast<char*>(hash), sizeof(hash))); + } + SIMPLE_UDF(TIntHash64, ui64(TAutoMap<ui64>)) { Y_UNUSED(valueBuilder); ui64 x = args[0].Get<ui64>(); @@ -372,13 +372,13 @@ namespace { TFarmHashFingerprint32, TFarmHashFingerprint64, TFarmHashFingerprint128, - TSuperFastHash, - TSha1, + TSuperFastHash, + TSha1, TSha256, TIntHash64, TXXH3, TXXH3_128 - ) + ) } diff --git a/ydb/library/yql/udfs/common/digest/ya.make b/ydb/library/yql/udfs/common/digest/ya.make index 51573ea876..53ee51c8d1 100644 --- a/ydb/library/yql/udfs/common/digest/ya.make +++ b/ydb/library/yql/udfs/common/digest/ya.make @@ -15,7 +15,7 @@ SRCS( PEERDIR( contrib/libs/farmhash contrib/libs/highwayhash - contrib/libs/openssl + contrib/libs/openssl contrib/libs/xxhash library/cpp/digest/argonish library/cpp/digest/crc32c |