diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
commit | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch) | |
tree | 64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/python/protobuf/py2 | |
parent | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff) | |
download | ydb-e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/python/protobuf/py2')
3 files changed, 25 insertions, 25 deletions
diff --git a/contrib/python/protobuf/py2/google/protobuf/internal/_parameterized.py b/contrib/python/protobuf/py2/google/protobuf/internal/_parameterized.py index 6fcb11527e..4cba1d479d 100755 --- a/contrib/python/protobuf/py2/google/protobuf/internal/_parameterized.py +++ b/contrib/python/protobuf/py2/google/protobuf/internal/_parameterized.py @@ -156,13 +156,13 @@ import uuid import six -try: - # Since python 3 - import collections.abc as collections_abc -except ImportError: - # Won't work after python 3.8 - import collections as collections_abc - +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() @@ -180,12 +180,12 @@ def _StrClass(cls): def _NonStringIterable(obj): - return (isinstance(obj, collections_abc.Iterable) and not + return (isinstance(obj, collections_abc.Iterable) and not isinstance(obj, six.string_types)) def _FormatParameterList(testcase_params): - if isinstance(testcase_params, collections_abc.Mapping): + 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): @@ -228,7 +228,7 @@ class _ParameterizedTestIter(object): def MakeBoundParamTest(testcase_params): @functools.wraps(test_method) def BoundParamTest(self): - if isinstance(testcase_params, collections_abc.Mapping): + if isinstance(testcase_params, collections_abc.Mapping): test_method(self, **testcase_params) elif _NonStringIterable(testcase_params): test_method(self, *testcase_params) @@ -297,7 +297,7 @@ def _ParameterDecorator(naming_type, testcases): if isinstance(obj, type): _ModifyClass( obj, - list(testcases) if not isinstance(testcases, collections_abc.Sequence) + list(testcases) if not isinstance(testcases, collections_abc.Sequence) else testcases, naming_type) return obj diff --git a/contrib/python/protobuf/py2/google/protobuf/internal/containers.py b/contrib/python/protobuf/py2/google/protobuf/internal/containers.py index 8cfd4cda5a..92793490bb 100644 --- a/contrib/python/protobuf/py2/google/protobuf/internal/containers.py +++ b/contrib/python/protobuf/py2/google/protobuf/internal/containers.py @@ -43,15 +43,15 @@ are: __author__ = 'petar@google.com (Petar Petrov)' import sys -try: +try: # This fallback applies for all versions of Python before 3.3 import collections.abc as collections_abc -except ImportError: +except ImportError: import collections as collections_abc if sys.version_info[0] < 3: - # We would use collections_abc.MutableMapping all the time, but in Python 2 - # it doesn't define __slots__. This causes two significant problems: + # We would use collections_abc.MutableMapping all the time, but in Python 2 + # it doesn't define __slots__. This causes two significant problems: # # 1. we can't disallow arbitrary attribute assignment, even if our derived # classes *do* define __slots__. @@ -64,7 +64,7 @@ if sys.version_info[0] < 3: # verbatim, except that: # 1. We declare __slots__. # 2. We don't declare this as a virtual base class. The classes defined - # in collections_abc are the interesting base classes, not us. + # in collections_abc are the interesting base classes, not us. # # Note: deriving from object is critical. It is the only thing that makes # this a true type, allowing us to derive from it in C++ cleanly and making @@ -111,7 +111,7 @@ if sys.version_info[0] < 3: __hash__ = None def __eq__(self, other): - if not isinstance(other, collections_abc.Mapping): + if not isinstance(other, collections_abc.Mapping): return NotImplemented return dict(self.items()) == dict(other.items()) @@ -178,13 +178,13 @@ if sys.version_info[0] < 3: self[key] = default return default - collections_abc.Mapping.register(Mapping) - collections_abc.MutableMapping.register(MutableMapping) + collections_abc.Mapping.register(Mapping) + collections_abc.MutableMapping.register(MutableMapping) else: # In Python 3 we can just use MutableMapping directly, because it defines # __slots__. - MutableMapping = collections_abc.MutableMapping + MutableMapping = collections_abc.MutableMapping class BaseContainer(object): diff --git a/contrib/python/protobuf/py2/google/protobuf/pyext/message.cc b/contrib/python/protobuf/py2/google/protobuf/pyext/message.cc index c9b2211f3a..8b41ca47dd 100644 --- a/contrib/python/protobuf/py2/google/protobuf/pyext/message.cc +++ b/contrib/python/protobuf/py2/google/protobuf/pyext/message.cc @@ -2996,12 +2996,12 @@ bool InitProto2MessageModule(PyObject *m) { m, "RepeatedCompositeContainer", reinterpret_cast<PyObject*>(&RepeatedCompositeContainer_Type)); - // Register them as MutableSequence. -#if PY_MAJOR_VERSION >= 3 - ScopedPyObjectPtr collections(PyImport_ImportModule("collections.abc")); -#else + // Register them as MutableSequence. +#if PY_MAJOR_VERSION >= 3 + ScopedPyObjectPtr collections(PyImport_ImportModule("collections.abc")); +#else ScopedPyObjectPtr collections(PyImport_ImportModule("collections")); -#endif +#endif if (collections == NULL) { return false; } |