aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorarcadia-devtools <arcadia-devtools@yandex-team.ru>2022-06-21 12:02:10 +0300
committerarcadia-devtools <arcadia-devtools@yandex-team.ru>2022-06-21 12:02:10 +0300
commit510a24d09da65ac274206fe9d6544bc722c18a56 (patch)
treec24e5f2d237266122ac8843aaa462b2325271974
parentd49283ffe563f4a1f20deef863a18f8de6a275e8 (diff)
downloadydb-510a24d09da65ac274206fe9d6544bc722c18a56.tar.gz
intermediate changes
ref:c7577ae41288ba1544a9cd1f00cdeff854fe2994
-rw-r--r--build/plugins/ytest.py10
-rw-r--r--contrib/python/protobuf/py3/.dist-info/METADATA22
-rw-r--r--contrib/python/protobuf/py3/.dist-info/top_level.txt1
-rw-r--r--contrib/python/protobuf/py3/.yandex_meta/devtools.copyrights.report4
-rw-r--r--contrib/python/protobuf/py3/.yandex_meta/devtools.licenses.report24
-rw-r--r--contrib/python/protobuf/py3/.yandex_meta/licenses.list.txt39
-rw-r--r--contrib/python/protobuf/py3/LICENSE32
-rwxr-xr-xcontrib/python/protobuf/py3/google/protobuf/internal/_parameterized.py447
-rw-r--r--contrib/python/protobuf/py3/google/protobuf/pyext/README6
-rw-r--r--library/cpp/lwtrace/log.h6
-rw-r--r--library/cpp/lwtrace/log_shuttle.h1
-rw-r--r--library/cpp/lwtrace/trace_ut.cpp58
12 files changed, 188 insertions, 462 deletions
diff --git a/build/plugins/ytest.py b/build/plugins/ytest.py
index db775d8e5c..39ba91cf4d 100644
--- a/build/plugins/ytest.py
+++ b/build/plugins/ytest.py
@@ -402,16 +402,16 @@ def get_default_tidy_config(unit):
return DEFAULT_TIDY_CONFIG
-oredered_tidy_map = None
+ordered_tidy_map = None
def get_project_tidy_config(unit):
- global oredered_tidy_map
- if oredered_tidy_map is None:
- oredered_tidy_map = reversed(sorted(get_tidy_config_map(unit, PROJECT_TIDY_CONFIG_MAP_PATH).items()))
+ global ordered_tidy_map
+ if ordered_tidy_map is None:
+ ordered_tidy_map = list(reversed(sorted(get_tidy_config_map(unit, PROJECT_TIDY_CONFIG_MAP_PATH).items())))
unit_path = get_norm_unit_path(unit)
- for project_prefix, config_path in oredered_tidy_map:
+ for project_prefix, config_path in ordered_tidy_map:
if unit_path.startswith(project_prefix):
return config_path
else:
diff --git a/contrib/python/protobuf/py3/.dist-info/METADATA b/contrib/python/protobuf/py3/.dist-info/METADATA
new file mode 100644
index 0000000000..788d8931c3
--- /dev/null
+++ b/contrib/python/protobuf/py3/.dist-info/METADATA
@@ -0,0 +1,22 @@
+Metadata-Version: 2.1
+Name: protobuf
+Version: 3.18.1
+Summary: Protocol Buffers
+Home-page: https://developers.google.com/protocol-buffers/
+Download-URL: https://github.com/protocolbuffers/protobuf/releases
+Maintainer: protobuf@googlegroups.com
+Maintainer-email: protobuf@googlegroups.com
+License: 3-Clause BSD License
+Platform: UNKNOWN
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
+Requires-Python: >=3.5
+License-File: LICENSE
+
+Protocol Buffers are Google's data interchange format
+
diff --git a/contrib/python/protobuf/py3/.dist-info/top_level.txt b/contrib/python/protobuf/py3/.dist-info/top_level.txt
new file mode 100644
index 0000000000..cb429113e0
--- /dev/null
+++ b/contrib/python/protobuf/py3/.dist-info/top_level.txt
@@ -0,0 +1 @@
+google
diff --git a/contrib/python/protobuf/py3/.yandex_meta/devtools.copyrights.report b/contrib/python/protobuf/py3/.yandex_meta/devtools.copyrights.report
index 42ef206e89..739944fc48 100644
--- a/contrib/python/protobuf/py3/.yandex_meta/devtools.copyrights.report
+++ b/contrib/python/protobuf/py3/.yandex_meta/devtools.copyrights.report
@@ -47,18 +47,18 @@ BELONGS ya.make
KEEP COPYRIGHT_SERVICE_LABEL 7ddb2995f48012001146c0eb94d23367
BELONGS ya.make
License text:
- \# Copyright 2008 Google Inc. All rights reserved.
+ Copyright 2008 Google Inc. All rights reserved.
Scancode info:
Original SPDX id: COPYRIGHT_SERVICE_LABEL
Score : 100.00
Match type : COPYRIGHT
Files with this license:
+ LICENSE [1:1]
google/protobuf/__init__.py [2:2]
google/protobuf/descriptor.py [2:2]
google/protobuf/descriptor_database.py [2:2]
google/protobuf/descriptor_pool.py [2:2]
google/protobuf/internal/__init__.py [2:2]
- google/protobuf/internal/_parameterized.py [4:4]
google/protobuf/internal/api_implementation.cc [2:2]
google/protobuf/internal/api_implementation.py [2:2]
google/protobuf/internal/containers.py [2:2]
diff --git a/contrib/python/protobuf/py3/.yandex_meta/devtools.licenses.report b/contrib/python/protobuf/py3/.yandex_meta/devtools.licenses.report
index 0b960d4f1f..07e5b42b92 100644
--- a/contrib/python/protobuf/py3/.yandex_meta/devtools.licenses.report
+++ b/contrib/python/protobuf/py3/.yandex_meta/devtools.licenses.report
@@ -33,6 +33,18 @@
# FILE_INCLUDE - include all file data into licenses text file
# =======================
+KEEP BSD-3-Clause 558ea801176b2bc04fc29b71cb2d79dc
+BELONGS ya.make
+ License text:
+ License: 3-Clause BSD License
+ Scancode info:
+ Original SPDX id: BSD-3-Clause
+ Score : 100.00
+ Match type : TAG
+ Links : http://www.opensource.org/licenses/BSD-3-Clause, https://spdx.org/licenses/BSD-3-Clause
+ Files with this license:
+ .dist-info/METADATA [9:9]
+
KEEP BSD-3-Clause 6aa235708ac9f5dd8e5c6ac415fc5837
BELONGS ya.make
Note: matched license text is too long. Read it in the source files.
@@ -72,6 +84,17 @@ BELONGS ya.make
google/protobuf/pyext/unknown_fields.cc [5:29]
google/protobuf/pyext/unknown_fields.h [5:29]
+KEEP Protobuf-License 77b55cb8215e726b6ae7c1cf484bc45f
+BELONGS ya.make
+ Note: matched license text is too long. Read it in the source files.
+ Scancode info:
+ Original SPDX id: LicenseRef-scancode-protobuf
+ Score : 100.00
+ Match type : TEXT
+ Links : http://protobuf.googlecode.com/svn/trunk/COPYING.txt, https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/protobuf.LICENSE
+ Files with this license:
+ LICENSE [3:32]
+
KEEP BSD-3-Clause 8aaace038fd54f3a52b1f041f9504709
BELONGS ya.make
Note: matched license text is too long. Read it in the source files.
@@ -86,7 +109,6 @@ BELONGS ya.make
google/protobuf/descriptor_database.py [5:29]
google/protobuf/descriptor_pool.py [5:29]
google/protobuf/internal/__init__.py [5:29]
- google/protobuf/internal/_parameterized.py [7:31]
google/protobuf/internal/api_implementation.py [5:29]
google/protobuf/internal/containers.py [5:29]
google/protobuf/internal/decoder.py [5:29]
diff --git a/contrib/python/protobuf/py3/.yandex_meta/licenses.list.txt b/contrib/python/protobuf/py3/.yandex_meta/licenses.list.txt
index 81364a2ff7..ad1c145b37 100644
--- a/contrib/python/protobuf/py3/.yandex_meta/licenses.list.txt
+++ b/contrib/python/protobuf/py3/.yandex_meta/licenses.list.txt
@@ -54,9 +54,46 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+====================BSD-3-Clause====================
+License: 3-Clause BSD License
+
+
====================COPYRIGHT====================
# Copyright 2007 Google Inc. All Rights Reserved.
====================COPYRIGHT====================
-# Copyright 2008 Google Inc. All rights reserved.
+Copyright 2008 Google Inc. All rights reserved.
+
+
+====================Protobuf-License====================
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Code generated by the Protocol Buffer compiler is owned by the owner
+of the input file used when generating it. This code is not
+standalone and requires a support library to be linked with it. This
+support library is itself covered by the above license. \ No newline at end of file
diff --git a/contrib/python/protobuf/py3/LICENSE b/contrib/python/protobuf/py3/LICENSE
new file mode 100644
index 0000000000..19b305b000
--- /dev/null
+++ b/contrib/python/protobuf/py3/LICENSE
@@ -0,0 +1,32 @@
+Copyright 2008 Google Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Code generated by the Protocol Buffer compiler is owned by the owner
+of the input file used when generating it. This code is not
+standalone and requires a support library to be linked with it. This
+support library is itself covered by the above license.
diff --git a/contrib/python/protobuf/py3/google/protobuf/internal/_parameterized.py b/contrib/python/protobuf/py3/google/protobuf/internal/_parameterized.py
deleted file mode 100755
index 287ba689bf..0000000000
--- a/contrib/python/protobuf/py3/google/protobuf/internal/_parameterized.py
+++ /dev/null
@@ -1,447 +0,0 @@
-#! /usr/bin/env python
-#
-# Protocol Buffers - Google's data interchange format
-# Copyright 2008 Google Inc. All rights reserved.
-# https://developers.google.com/protocol-buffers/
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-"""Adds support for parameterized tests to Python's unittest TestCase class.
-
-A parameterized test is a method in a test case that is invoked with different
-argument tuples.
-
-A simple example:
-
- class AdditionExample(parameterized.TestCase):
- @parameterized.parameters(
- (1, 2, 3),
- (4, 5, 9),
- (1, 1, 3))
- def testAddition(self, op1, op2, result):
- self.assertEqual(result, op1 + op2)
-
-
-Each invocation is a separate test case and properly isolated just
-like a normal test method, with its own setUp/tearDown cycle. In the
-example above, there are three separate testcases, one of which will
-fail due to an assertion error (1 + 1 != 3).
-
-Parameters for individual test cases can be tuples (with positional parameters)
-or dictionaries (with named parameters):
-
- class AdditionExample(parameterized.TestCase):
- @parameterized.parameters(
- {'op1': 1, 'op2': 2, 'result': 3},
- {'op1': 4, 'op2': 5, 'result': 9},
- )
- def testAddition(self, op1, op2, result):
- self.assertEqual(result, op1 + op2)
-
-If a parameterized test fails, the error message will show the
-original test name (which is modified internally) and the arguments
-for the specific invocation, which are part of the string returned by
-the shortDescription() method on test cases.
-
-The id method of the test, used internally by the unittest framework,
-is also modified to show the arguments. To make sure that test names
-stay the same across several invocations, object representations like
-
- >>> class Foo(object):
- ... pass
- >>> repr(Foo())
- '<__main__.Foo object at 0x23d8610>'
-
-are turned into '<__main__.Foo>'. For even more descriptive names,
-especially in test logs, you can use the named_parameters decorator. In
-this case, only tuples are supported, and the first parameters has to
-be a string (or an object that returns an apt name when converted via
-str()):
-
- class NamedExample(parameterized.TestCase):
- @parameterized.named_parameters(
- ('Normal', 'aa', 'aaa', True),
- ('EmptyPrefix', '', 'abc', True),
- ('BothEmpty', '', '', True))
- def testStartsWith(self, prefix, string, result):
- self.assertEqual(result, strings.startswith(prefix))
-
-Named tests also have the benefit that they can be run individually
-from the command line:
-
- $ testmodule.py NamedExample.testStartsWithNormal
- .
- --------------------------------------------------------------------
- Ran 1 test in 0.000s
-
- OK
-
-Parameterized Classes
-=====================
-If invocation arguments are shared across test methods in a single
-TestCase class, instead of decorating all test methods
-individually, the class itself can be decorated:
-
- @parameterized.parameters(
- (1, 2, 3)
- (4, 5, 9))
- class ArithmeticTest(parameterized.TestCase):
- def testAdd(self, arg1, arg2, result):
- self.assertEqual(arg1 + arg2, result)
-
- def testSubtract(self, arg2, arg2, result):
- self.assertEqual(result - arg1, arg2)
-
-Inputs from Iterables
-=====================
-If parameters should be shared across several test cases, or are dynamically
-created from other sources, a single non-tuple iterable can be passed into
-the decorator. This iterable will be used to obtain the test cases:
-
- class AdditionExample(parameterized.TestCase):
- @parameterized.parameters(
- c.op1, c.op2, c.result for c in testcases
- )
- def testAddition(self, op1, op2, result):
- self.assertEqual(result, op1 + op2)
-
-
-Single-Argument Test Methods
-============================
-If a test method takes only one argument, the single argument does not need to
-be wrapped into a tuple:
-
- class NegativeNumberExample(parameterized.TestCase):
- @parameterized.parameters(
- -1, -3, -4, -5
- )
- def testIsNegative(self, arg):
- self.assertTrue(IsNegative(arg))
-"""
-
-__author__ = 'tmarek@google.com (Torsten Marek)'
-
-import functools
-import re
-import types
-try:
- import unittest2 as unittest
-except ImportError:
- import unittest
-import uuid
-
-try:
- # Since python 3
- import collections.abc as collections_abc
-except ImportError:
- # Won't work after python 3.8
- import collections as collections_abc
-
-ADDR_RE = re.compile(r'\<([a-zA-Z0-9_\-\.]+) object at 0x[a-fA-F0-9]+\>')
-_SEPARATOR = uuid.uuid1().hex
-_FIRST_ARG = object()
-_ARGUMENT_REPR = object()
-
-
-def _CleanRepr(obj):
- return ADDR_RE.sub(r'<\1>', repr(obj))
-
-
-# Helper function formerly from the unittest module, removed from it in
-# Python 2.7.
-def _StrClass(cls):
- return '%s.%s' % (cls.__module__, cls.__name__)
-
-
-def _NonStringIterable(obj):
- return (isinstance(obj, collections_abc.Iterable) and not
- isinstance(obj, str))
-
-
-def _FormatParameterList(testcase_params):
- if isinstance(testcase_params, collections_abc.Mapping):
- return ', '.join('%s=%s' % (argname, _CleanRepr(value))
- for argname, value in testcase_params.items())
- elif _NonStringIterable(testcase_params):
- return ', '.join(map(_CleanRepr, testcase_params))
- else:
- return _FormatParameterList((testcase_params,))
-
-
-class _ParameterizedTestIter(object):
- """Callable and iterable class for producing new test cases."""
-
- def __init__(self, test_method, testcases, naming_type):
- """Returns concrete test functions for a test and a list of parameters.
-
- The naming_type is used to determine the name of the concrete
- functions as reported by the unittest framework. If naming_type is
- _FIRST_ARG, the testcases must be tuples, and the first element must
- have a string representation that is a valid Python identifier.
-
- Args:
- test_method: The decorated test method.
- testcases: (list of tuple/dict) A list of parameter
- tuples/dicts for individual test invocations.
- naming_type: The test naming type, either _NAMED or _ARGUMENT_REPR.
- """
- self._test_method = test_method
- self.testcases = testcases
- self._naming_type = naming_type
-
- def __call__(self, *args, **kwargs):
- raise RuntimeError('You appear to be running a parameterized test case '
- 'without having inherited from parameterized.'
- 'TestCase. This is bad because none of '
- 'your test cases are actually being run.')
-
- def __iter__(self):
- test_method = self._test_method
- naming_type = self._naming_type
-
- def MakeBoundParamTest(testcase_params):
- @functools.wraps(test_method)
- def BoundParamTest(self):
- if isinstance(testcase_params, collections_abc.Mapping):
- test_method(self, **testcase_params)
- elif _NonStringIterable(testcase_params):
- test_method(self, *testcase_params)
- else:
- test_method(self, testcase_params)
-
- if naming_type is _FIRST_ARG:
- # Signal the metaclass that the name of the test function is unique
- # and descriptive.
- BoundParamTest.__x_use_name__ = True
- BoundParamTest.__name__ += str(testcase_params[0])
- testcase_params = testcase_params[1:]
- elif naming_type is _ARGUMENT_REPR:
- # __x_extra_id__ is used to pass naming information to the __new__
- # method of TestGeneratorMetaclass.
- # The metaclass will make sure to create a unique, but nondescriptive
- # name for this test.
- BoundParamTest.__x_extra_id__ = '(%s)' % (
- _FormatParameterList(testcase_params),)
- else:
- raise RuntimeError('%s is not a valid naming type.' % (naming_type,))
-
- BoundParamTest.__doc__ = '%s(%s)' % (
- BoundParamTest.__name__, _FormatParameterList(testcase_params))
- if test_method.__doc__:
- BoundParamTest.__doc__ += '\n%s' % (test_method.__doc__,)
- return BoundParamTest
- return (MakeBoundParamTest(c) for c in self.testcases)
-
-
-def _IsSingletonList(testcases):
- """True iff testcases contains only a single non-tuple element."""
- return len(testcases) == 1 and not isinstance(testcases[0], tuple)
-
-
-def _ModifyClass(class_object, testcases, naming_type):
- assert not getattr(class_object, '_id_suffix', None), (
- 'Cannot add parameters to %s,'
- ' which already has parameterized methods.' % (class_object,))
- class_object._id_suffix = id_suffix = {}
- # We change the size of __dict__ while we iterate over it,
- # which Python 3.x will complain about, so use copy().
- for name, obj in class_object.__dict__.copy().items():
- if (name.startswith(unittest.TestLoader.testMethodPrefix)
- and isinstance(obj, types.FunctionType)):
- delattr(class_object, name)
- methods = {}
- _UpdateClassDictForParamTestCase(
- methods, id_suffix, name,
- _ParameterizedTestIter(obj, testcases, naming_type))
- for name, meth in methods.items():
- setattr(class_object, name, meth)
-
-
-def _ParameterDecorator(naming_type, testcases):
- """Implementation of the parameterization decorators.
-
- Args:
- naming_type: The naming type.
- testcases: Testcase parameters.
-
- Returns:
- A function for modifying the decorated object.
- """
- def _Apply(obj):
- if isinstance(obj, type):
- _ModifyClass(
- obj,
- list(testcases) if not isinstance(testcases, collections_abc.Sequence)
- else testcases,
- naming_type)
- return obj
- else:
- return _ParameterizedTestIter(obj, testcases, naming_type)
-
- if _IsSingletonList(testcases):
- assert _NonStringIterable(testcases[0]), (
- 'Single parameter argument must be a non-string iterable')
- testcases = testcases[0]
-
- return _Apply
-
-
-def parameters(*testcases): # pylint: disable=invalid-name
- """A decorator for creating parameterized tests.
-
- See the module docstring for a usage example.
- Args:
- *testcases: Parameters for the decorated method, either a single
- iterable, or a list of tuples/dicts/objects (for tests
- with only one argument).
-
- Returns:
- A test generator to be handled by TestGeneratorMetaclass.
- """
- return _ParameterDecorator(_ARGUMENT_REPR, testcases)
-
-
-def named_parameters(*testcases): # pylint: disable=invalid-name
- """A decorator for creating parameterized tests.
-
- See the module docstring for a usage example. The first element of
- each parameter tuple should be a string and will be appended to the
- name of the test method.
-
- Args:
- *testcases: Parameters for the decorated method, either a single
- iterable, or a list of tuples.
-
- Returns:
- A test generator to be handled by TestGeneratorMetaclass.
- """
- return _ParameterDecorator(_FIRST_ARG, testcases)
-
-
-class TestGeneratorMetaclass(type):
- """Metaclass for test cases with test generators.
-
- A test generator is an iterable in a testcase that produces callables. These
- callables must be single-argument methods. These methods are injected into
- the class namespace and the original iterable is removed. If the name of the
- iterable conforms to the test pattern, the injected methods will be picked
- up as tests by the unittest framework.
-
- In general, it is supposed to be used in conjunction with the
- parameters decorator.
- """
-
- def __new__(mcs, class_name, bases, dct):
- dct['_id_suffix'] = id_suffix = {}
- for name, obj in dct.items():
- if (name.startswith(unittest.TestLoader.testMethodPrefix) and
- _NonStringIterable(obj)):
- iterator = iter(obj)
- dct.pop(name)
- _UpdateClassDictForParamTestCase(dct, id_suffix, name, iterator)
-
- return type.__new__(mcs, class_name, bases, dct)
-
-
-def _UpdateClassDictForParamTestCase(dct, id_suffix, name, iterator):
- """Adds individual test cases to a dictionary.
-
- Args:
- dct: The target dictionary.
- id_suffix: The dictionary for mapping names to test IDs.
- name: The original name of the test case.
- iterator: The iterator generating the individual test cases.
- """
- for idx, func in enumerate(iterator):
- assert callable(func), 'Test generators must yield callables, got %r' % (
- func,)
- if getattr(func, '__x_use_name__', False):
- new_name = func.__name__
- else:
- new_name = '%s%s%d' % (name, _SEPARATOR, idx)
- assert new_name not in dct, (
- 'Name of parameterized test case "%s" not unique' % (new_name,))
- dct[new_name] = func
- id_suffix[new_name] = getattr(func, '__x_extra_id__', '')
-
-
-class TestCase(unittest.TestCase):
- """Base class for test cases using the parameters decorator."""
- __metaclass__ = TestGeneratorMetaclass
-
- def _OriginalName(self):
- return self._testMethodName.split(_SEPARATOR)[0]
-
- def __str__(self):
- return '%s (%s)' % (self._OriginalName(), _StrClass(self.__class__))
-
- def id(self): # pylint: disable=invalid-name
- """Returns the descriptive ID of the test.
-
- This is used internally by the unittesting framework to get a name
- for the test to be used in reports.
-
- Returns:
- The test id.
- """
- return '%s.%s%s' % (_StrClass(self.__class__),
- self._OriginalName(),
- self._id_suffix.get(self._testMethodName, ''))
-
-
-def CoopTestCase(other_base_class):
- """Returns a new base class with a cooperative metaclass base.
-
- This enables the TestCase to be used in combination
- with other base classes that have custom metaclasses, such as
- mox.MoxTestBase.
-
- Only works with metaclasses that do not override type.__new__.
-
- Example:
-
- import google3
- import mox
-
- from google3.testing.pybase import parameterized
-
- class ExampleTest(parameterized.CoopTestCase(mox.MoxTestBase)):
- ...
-
- Args:
- other_base_class: (class) A test case base class.
-
- Returns:
- A new class object.
- """
- metaclass = type(
- 'CoopMetaclass',
- (other_base_class.__metaclass__,
- TestGeneratorMetaclass), {})
- return metaclass(
- 'CoopTestCase',
- (other_base_class, TestCase), {})
diff --git a/contrib/python/protobuf/py3/google/protobuf/pyext/README b/contrib/python/protobuf/py3/google/protobuf/pyext/README
deleted file mode 100644
index 6d61cb45bf..0000000000
--- a/contrib/python/protobuf/py3/google/protobuf/pyext/README
+++ /dev/null
@@ -1,6 +0,0 @@
-This is the 'v2' C++ implementation for python proto2.
-
-It is active when:
-
-PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp
-PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION_VERSION=2
diff --git a/library/cpp/lwtrace/log.h b/library/cpp/lwtrace/log.h
index 0e05ec6306..d8c2a221a9 100644
--- a/library/cpp/lwtrace/log.h
+++ b/library/cpp/lwtrace/log.h
@@ -448,6 +448,12 @@ namespace NLWTrace {
template <class TReader>
void ExtractItems(TReader& r) {
ReadItems(r);
+ for (TItem *i = OldBuffer->GetFront(), *e = OldBuffer->GetBack();; OldBuffer->Inc(i)) {
+ i->Clear();
+ if (i == e) {
+ break;
+ }
+ }
OldBuffer->Clear();
}
};
diff --git a/library/cpp/lwtrace/log_shuttle.h b/library/cpp/lwtrace/log_shuttle.h
index 729a38615f..8549acd833 100644
--- a/library/cpp/lwtrace/log_shuttle.h
+++ b/library/cpp/lwtrace/log_shuttle.h
@@ -201,6 +201,7 @@ namespace NLWTrace {
template <class TDepot>
void TLogShuttle<TDepot>::Clear() {
TrackLog.Clear();
+ AtomicSet(ForkFailed, 0);
}
template <class TDepot>
diff --git a/library/cpp/lwtrace/trace_ut.cpp b/library/cpp/lwtrace/trace_ut.cpp
index cb03e4fbde..afb2f4e53f 100644
--- a/library/cpp/lwtrace/trace_ut.cpp
+++ b/library/cpp/lwtrace/trace_ut.cpp
@@ -876,5 +876,63 @@ Y_UNIT_TEST_SUITE(LWTraceTrace) {
} reader;
mngr.ReadDepot("Query1", reader);
}
+
+ Y_UNIT_TEST(ShouldResetFailedForksCounterUponShuttleParking) {
+ TManager mngr(*Singleton<TProbeRegistry>(), true);
+ TQuery q;
+ bool parsed = NProtoBuf::TextFormat::ParseFromString(R"END(
+ Blocks {
+ ProbeDesc {
+ Name: "NoParam"
+ Provider: "LWTRACE_UT_PROVIDER"
+ }
+ Action {
+ RunLogShuttleAction {
+ MaxTrackLength: 100
+ ShuttlesCount: 2
+ }
+ }
+ }
+ )END", &q);
+
+ UNIT_ASSERT(parsed);
+ mngr.New("Query1", q);
+
+ struct {
+ ui32 cnt = 0;
+ void Push(TThread::TId, const TTrackLog&) {
+ ++cnt;
+ }
+ } reader;
+
+ {
+ // Run shuttle ans fail fork
+ TOrbit initial;
+ TOrbit fork1;
+ TOrbit fork2;
+
+ LWTRACK(NoParam, initial);
+ UNIT_ASSERT_VALUES_EQUAL(initial.HasShuttles(), true);
+ UNIT_ASSERT_VALUES_EQUAL(initial.Fork(fork1), true);
+ LWTRACK(IntParam, fork1, 1);
+ UNIT_ASSERT_VALUES_EQUAL(fork1.Fork(fork2), false);
+ initial.Join(fork1);
+ }
+
+ mngr.ReadDepot("Query1", reader);
+ UNIT_ASSERT_VALUES_EQUAL(reader.cnt, 0);
+
+ reader.cnt = 0;
+
+ {
+ TOrbit initial;
+
+ LWTRACK(NoParam, initial);
+ UNIT_ASSERT_VALUES_EQUAL(initial.HasShuttles(), true);
+ }
+
+ mngr.ReadDepot("Query1", reader);
+ UNIT_ASSERT_VALUES_EQUAL(reader.cnt, 1);
+ }
#endif // LWTRACE_DISABLE
}