Browse Source

Restoring authorship annotation for <smosker@yandex-team.ru>. Commit 1 of 2.

smosker 3 years ago
parent
commit
dd14d17a74

+ 1 - 1
build/rules/contrib_deps.policy

@@ -49,7 +49,7 @@ ALLOW contrib/python/horovod/horovod/common/syms -> library/python/symbols/regis
 ALLOW contrib/python/opensfm -> library/cpp/vl_feat
 ALLOW contrib/python/Wand/ImageMagick -> library/python/symbols/registry
 ALLOW contrib/nginx/modules/nginx-rtmp-module -> library/cpp/json
-ALLOW contrib/python/gino -> library/python/pyscopg2
+ALLOW contrib/python/gino -> library/python/pyscopg2 
 ALLOW contrib/python/psycopg2/tests -> mail/devpack
 ALLOW contrib/python/asn1crypto -> library/python/symbols/crypto
 ALLOW contrib/python/win_unicode_console -> library/python/symbols/win_unicode_console

+ 5 - 5
build/rules/contrib_python.policy

@@ -17,8 +17,8 @@ ALLOW intranet/search/core -> contrib/python/django/django-1.11
 ALLOW intranet/search/settings -> contrib/python/django/django-1.11
 ALLOW intranet/sync_tools/tests -> contrib/python/django/django-1.11
 ALLOW intranet/wiki -> contrib/python/django/django-1.11
-ALLOW intranet/plan/src -> contrib/python/django/django-1.11
-ALLOW intranet/plan -> contrib/python/django/django-1.11
+ALLOW intranet/plan/src -> contrib/python/django/django-1.11 
+ALLOW intranet/plan -> contrib/python/django/django-1.11 
 ALLOW library/python/django_alive -> contrib/python/django/django-1.11
 ALLOW library/python/django_celery_monitoring -> contrib/python/django/django-1.11
 ALLOW library/python/django_mds -> contrib/python/django/django-1.11
@@ -202,7 +202,7 @@ DENY .* -> contrib/python/pyrepl
 # because match with contrib/python/pycrypto
 ALLOW .* -> contrib/python/pycryptodome
 # pycrypto deprecated
-ALLOW intranet/domenator/src -> contrib/python/pycrypto
+ALLOW intranet/domenator/src -> contrib/python/pycrypto 
 ALLOW intranet/yandex_directory/src -> contrib/python/pycrypto
 ALLOW addappter/backend -> contrib/python/pycrypto
 ALLOW adfox -> contrib/python/pycrypto
@@ -376,8 +376,8 @@ ALLOW health/yamd/health_import -> contrib/python/sqlalchemy/sqlalchemy-1.2
 ALLOW health/yamd/libs/data_layer -> contrib/python/sqlalchemy/sqlalchemy-1.2
 ALLOW health/yamd/pills_postgresql_db/data_layer -> contrib/python/sqlalchemy/sqlalchemy-1.2
 ALLOW infra/cores/app -> contrib/python/sqlalchemy/sqlalchemy-1.2
-ALLOW intranet/watcher/alembic -> contrib/python/sqlalchemy/sqlalchemy-1.2
-ALLOW intranet/watcher/src -> contrib/python/sqlalchemy/sqlalchemy-1.2
+ALLOW intranet/watcher/alembic -> contrib/python/sqlalchemy/sqlalchemy-1.2 
+ALLOW intranet/watcher/src -> contrib/python/sqlalchemy/sqlalchemy-1.2 
 ALLOW intranet/domenator/migrations -> contrib/python/sqlalchemy/sqlalchemy-1.2
 ALLOW intranet/trip/alembic -> contrib/python/sqlalchemy/sqlalchemy-1.2
 ALLOW intranet/trip/src -> contrib/python/sqlalchemy/sqlalchemy-1.2

+ 1 - 1
build/ya.conf.json

@@ -5899,7 +5899,7 @@
         "releaser": {
             "formula": {
                 "sandbox_id": [
-                    1026890210
+                    1026890210 
                 ],
                 "match": "releaser"
             },

+ 11 - 11
contrib/python/attrs/attr/__init__.py

@@ -9,15 +9,15 @@ from ._cmp import cmp_using
 from ._config import get_run_validators, set_run_validators
 from ._funcs import asdict, assoc, astuple, evolve, has, resolve_types
 from ._make import (
-    NOTHING,
-    Attribute,
-    Factory,
-    attrib,
-    attrs,
-    fields,
-    fields_dict,
-    make_class,
-    validate,
+    NOTHING, 
+    Attribute, 
+    Factory, 
+    attrib, 
+    attrs, 
+    fields, 
+    fields_dict, 
+    make_class, 
+    validate, 
 )
 from ._version_info import VersionInfo
 
@@ -27,8 +27,8 @@ __version_info__ = VersionInfo._from_version_string(__version__)
 
 __title__ = "attrs"
 __description__ = "Classes Without Boilerplate"
-__url__ = "https://www.attrs.org/"
-__uri__ = __url__
+__url__ = "https://www.attrs.org/" 
+__uri__ = __url__ 
 __doc__ = __description__ + " <" + __uri__ + ">"
 
 __author__ = "Hynek Schlawack"

+ 26 - 26
contrib/python/attrs/attr/_compat.py

@@ -14,7 +14,7 @@ if PYPY or sys.version_info[:2] >= (3, 6):
     ordered_dict = dict
 else:
     from collections import OrderedDict
-
+ 
     ordered_dict = OrderedDict
 
 
@@ -51,45 +51,45 @@ if PY2:
 
         def __setitem__(self, key, val):
             # We gently pretend we're a Python 3 mappingproxy.
-            raise TypeError(
-                "'mappingproxy' object does not support item assignment"
-            )
+            raise TypeError( 
+                "'mappingproxy' object does not support item assignment" 
+            ) 
 
         def update(self, _):
             # We gently pretend we're a Python 3 mappingproxy.
-            raise AttributeError(
-                "'mappingproxy' object has no attribute 'update'"
-            )
+            raise AttributeError( 
+                "'mappingproxy' object has no attribute 'update'" 
+            ) 
 
         def __delitem__(self, _):
             # We gently pretend we're a Python 3 mappingproxy.
-            raise TypeError(
-                "'mappingproxy' object does not support item deletion"
-            )
+            raise TypeError( 
+                "'mappingproxy' object does not support item deletion" 
+            ) 
 
         def clear(self):
             # We gently pretend we're a Python 3 mappingproxy.
-            raise AttributeError(
-                "'mappingproxy' object has no attribute 'clear'"
-            )
+            raise AttributeError( 
+                "'mappingproxy' object has no attribute 'clear'" 
+            ) 
 
         def pop(self, key, default=None):
             # We gently pretend we're a Python 3 mappingproxy.
-            raise AttributeError(
-                "'mappingproxy' object has no attribute 'pop'"
-            )
+            raise AttributeError( 
+                "'mappingproxy' object has no attribute 'pop'" 
+            ) 
 
         def popitem(self):
             # We gently pretend we're a Python 3 mappingproxy.
-            raise AttributeError(
-                "'mappingproxy' object has no attribute 'popitem'"
-            )
+            raise AttributeError( 
+                "'mappingproxy' object has no attribute 'popitem'" 
+            ) 
 
         def setdefault(self, key, default=None):
             # We gently pretend we're a Python 3 mappingproxy.
-            raise AttributeError(
-                "'mappingproxy' object has no attribute 'setdefault'"
-            )
+            raise AttributeError( 
+                "'mappingproxy' object has no attribute 'setdefault'" 
+            ) 
 
         def __repr__(self):
             # Override to be identical to the Python 3 version.
@@ -105,8 +105,8 @@ if PY2:
         We only warn on Python 3 because we are not aware of any concrete
         consequences of not setting the cell on Python 2.
         """
-
-
+ 
+ 
 else:  # Python 3 and later.
     from collections.abc import Mapping, Sequence  # noqa
 
@@ -144,10 +144,10 @@ def make_set_closure_cell():
     # pypy makes this easy. (It also supports the logic below, but
     # why not do the easy/fast thing?)
     if PYPY:
-
+ 
         def set_closure_cell(cell, value):
             cell.__setstate__((value,))
-
+ 
         return set_closure_cell
 
     # Otherwise gotta do it the hard way.

+ 104 - 104
contrib/python/attrs/attr/_funcs.py

@@ -7,14 +7,14 @@ from ._make import NOTHING, _obj_setattr, fields
 from .exceptions import AttrsAttributeNotFoundError
 
 
-def asdict(
-    inst,
-    recurse=True,
-    filter=None,
-    dict_factory=dict,
-    retain_collection_types=False,
+def asdict( 
+    inst, 
+    recurse=True, 
+    filter=None, 
+    dict_factory=dict, 
+    retain_collection_types=False, 
     value_serializer=None,
-):
+): 
     """
     Return the ``attrs`` attribute values of *inst* as a dict.
 
@@ -59,49 +59,49 @@ def asdict(
 
         if recurse is True:
             if has(v.__class__):
-                rv[a.name] = asdict(
+                rv[a.name] = asdict( 
                     v,
                     True,
                     filter,
                     dict_factory,
                     retain_collection_types,
                     value_serializer,
-                )
+                ) 
             elif isinstance(v, (tuple, list, set, frozenset)):
                 cf = v.__class__ if retain_collection_types is True else list
-                rv[a.name] = cf(
-                    [
-                        _asdict_anything(
+                rv[a.name] = cf( 
+                    [ 
+                        _asdict_anything( 
                             i,
                             filter,
                             dict_factory,
                             retain_collection_types,
                             value_serializer,
-                        )
-                        for i in v
-                    ]
-                )
+                        ) 
+                        for i in v 
+                    ] 
+                ) 
             elif isinstance(v, dict):
                 df = dict_factory
-                rv[a.name] = df(
-                    (
-                        _asdict_anything(
+                rv[a.name] = df( 
+                    ( 
+                        _asdict_anything( 
                             kk,
                             filter,
                             df,
                             retain_collection_types,
                             value_serializer,
-                        ),
-                        _asdict_anything(
+                        ), 
+                        _asdict_anything( 
                             vv,
                             filter,
                             df,
                             retain_collection_types,
                             value_serializer,
-                        ),
-                    )
-                    for kk, vv in iteritems(v)
-                )
+                        ), 
+                    ) 
+                    for kk, vv in iteritems(v) 
+                ) 
             else:
                 rv[a.name] = v
         else:
@@ -117,10 +117,10 @@ def _asdict_anything(
     value_serializer,
 ):
     """
-    ``asdict`` only works on attrs instances, this works on anything.
-    """
-    if getattr(val.__class__, "__attrs_attrs__", None) is not None:
-        # Attrs class.
+    ``asdict`` only works on attrs instances, this works on anything. 
+    """ 
+    if getattr(val.__class__, "__attrs_attrs__", None) is not None: 
+        # Attrs class. 
         rv = asdict(
             val,
             True,
@@ -130,48 +130,48 @@ def _asdict_anything(
             value_serializer,
         )
     elif isinstance(val, (tuple, list, set, frozenset)):
-        cf = val.__class__ if retain_collection_types is True else list
-        rv = cf(
-            [
-                _asdict_anything(
+        cf = val.__class__ if retain_collection_types is True else list 
+        rv = cf( 
+            [ 
+                _asdict_anything( 
                     i,
                     filter,
                     dict_factory,
                     retain_collection_types,
                     value_serializer,
-                )
-                for i in val
-            ]
-        )
-    elif isinstance(val, dict):
-        df = dict_factory
-        rv = df(
-            (
+                ) 
+                for i in val 
+            ] 
+        ) 
+    elif isinstance(val, dict): 
+        df = dict_factory 
+        rv = df( 
+            ( 
                 _asdict_anything(
                     kk, filter, df, retain_collection_types, value_serializer
                 ),
                 _asdict_anything(
                     vv, filter, df, retain_collection_types, value_serializer
                 ),
-            )
-            for kk, vv in iteritems(val)
-        )
-    else:
-        rv = val
+            ) 
+            for kk, vv in iteritems(val) 
+        ) 
+    else: 
+        rv = val 
         if value_serializer is not None:
             rv = value_serializer(None, None, rv)
 
-    return rv
-
-
-def astuple(
-    inst,
-    recurse=True,
-    filter=None,
-    tuple_factory=tuple,
-    retain_collection_types=False,
-):
-    """
+    return rv 
+ 
+ 
+def astuple( 
+    inst, 
+    recurse=True, 
+    filter=None, 
+    tuple_factory=tuple, 
+    retain_collection_types=False, 
+): 
+    """ 
     Return the ``attrs`` attribute values of *inst* as a tuple.
 
     Optionally recurse into other ``attrs``-decorated classes.
@@ -206,56 +206,56 @@ def astuple(
             continue
         if recurse is True:
             if has(v.__class__):
-                rv.append(
-                    astuple(
-                        v,
-                        recurse=True,
-                        filter=filter,
-                        tuple_factory=tuple_factory,
-                        retain_collection_types=retain,
-                    )
-                )
+                rv.append( 
+                    astuple( 
+                        v, 
+                        recurse=True, 
+                        filter=filter, 
+                        tuple_factory=tuple_factory, 
+                        retain_collection_types=retain, 
+                    ) 
+                ) 
             elif isinstance(v, (tuple, list, set, frozenset)):
                 cf = v.__class__ if retain is True else list
-                rv.append(
-                    cf(
-                        [
-                            astuple(
-                                j,
-                                recurse=True,
-                                filter=filter,
-                                tuple_factory=tuple_factory,
-                                retain_collection_types=retain,
-                            )
-                            if has(j.__class__)
-                            else j
-                            for j in v
-                        ]
-                    )
-                )
+                rv.append( 
+                    cf( 
+                        [ 
+                            astuple( 
+                                j, 
+                                recurse=True, 
+                                filter=filter, 
+                                tuple_factory=tuple_factory, 
+                                retain_collection_types=retain, 
+                            ) 
+                            if has(j.__class__) 
+                            else j 
+                            for j in v 
+                        ] 
+                    ) 
+                ) 
             elif isinstance(v, dict):
                 df = v.__class__ if retain is True else dict
-                rv.append(
-                    df(
+                rv.append( 
+                    df( 
                         (
                             astuple(
                                 kk,
                                 tuple_factory=tuple_factory,
-                                retain_collection_types=retain,
-                            )
-                            if has(kk.__class__)
-                            else kk,
+                                retain_collection_types=retain, 
+                            ) 
+                            if has(kk.__class__) 
+                            else kk, 
                             astuple(
                                 vv,
                                 tuple_factory=tuple_factory,
-                                retain_collection_types=retain,
-                            )
-                            if has(vv.__class__)
-                            else vv,
+                                retain_collection_types=retain, 
+                            ) 
+                            if has(vv.__class__) 
+                            else vv, 
                         )
-                        for kk, vv in iteritems(v)
-                    )
-                )
+                        for kk, vv in iteritems(v) 
+                    ) 
+                ) 
             else:
                 rv.append(v)
         else:
@@ -294,21 +294,21 @@ def assoc(inst, **changes):
         Use `evolve` instead.
     """
     import warnings
-
-    warnings.warn(
-        "assoc is deprecated and will be removed after 2018/01.",
-        DeprecationWarning,
-        stacklevel=2,
-    )
+ 
+    warnings.warn( 
+        "assoc is deprecated and will be removed after 2018/01.", 
+        DeprecationWarning, 
+        stacklevel=2, 
+    ) 
     new = copy.copy(inst)
     attrs = fields(inst.__class__)
     for k, v in iteritems(changes):
         a = getattr(attrs, k, NOTHING)
         if a is NOTHING:
             raise AttrsAttributeNotFoundError(
-                "{k} is not an attrs attribute on {cl}.".format(
-                    k=k, cl=new.__class__
-                )
+                "{k} is not an attrs attribute on {cl}.".format( 
+                    k=k, cl=new.__class__ 
+                ) 
             )
         _obj_setattr(new, k, v)
     return new

File diff suppressed because it is too large
+ 254 - 254
contrib/python/attrs/attr/_make.py


+ 51 - 51
contrib/python/attrs/attr/converters.py

@@ -7,7 +7,7 @@ from __future__ import absolute_import, division, print_function
 from ._compat import PY2
 from ._make import NOTHING, Factory, pipe
 
-
+ 
 if not PY2:
     import inspect
     import typing
@@ -31,7 +31,7 @@ def optional(converter):
     :param callable converter: the converter that is used for non-``None``
         values.
 
-    .. versionadded:: 17.1.0
+    .. versionadded:: 17.1.0 
     """
 
     def optional_converter(val):
@@ -57,55 +57,55 @@ def optional(converter):
                 ]
 
     return optional_converter
-
-
-def default_if_none(default=NOTHING, factory=None):
-    """
-    A converter that allows to replace ``None`` values by *default* or the
-    result of *factory*.
-
-    :param default: Value to be used if ``None`` is passed. Passing an instance
+ 
+ 
+def default_if_none(default=NOTHING, factory=None): 
+    """ 
+    A converter that allows to replace ``None`` values by *default* or the 
+    result of *factory*. 
+ 
+    :param default: Value to be used if ``None`` is passed. Passing an instance 
        of `attr.Factory` is supported, however the ``takes_self`` option
-       is *not*.
+       is *not*. 
     :param callable factory: A callable that takes no parameters whose result
-       is used if ``None`` is passed.
-
-    :raises TypeError: If **neither** *default* or *factory* is passed.
-    :raises TypeError: If **both** *default* and *factory* are passed.
+       is used if ``None`` is passed. 
+ 
+    :raises TypeError: If **neither** *default* or *factory* is passed. 
+    :raises TypeError: If **both** *default* and *factory* are passed. 
     :raises ValueError: If an instance of `attr.Factory` is passed with
-       ``takes_self=True``.
-
-    .. versionadded:: 18.2.0
-    """
-    if default is NOTHING and factory is None:
-        raise TypeError("Must pass either `default` or `factory`.")
-
-    if default is not NOTHING and factory is not None:
-        raise TypeError(
-            "Must pass either `default` or `factory` but not both."
-        )
-
-    if factory is not None:
-        default = Factory(factory)
-
-    if isinstance(default, Factory):
-        if default.takes_self:
-            raise ValueError(
-                "`takes_self` is not supported by default_if_none."
-            )
-
-        def default_if_none_converter(val):
-            if val is not None:
-                return val
-
-            return default.factory()
-
-    else:
-
-        def default_if_none_converter(val):
-            if val is not None:
-                return val
-
-            return default
-
-    return default_if_none_converter
+       ``takes_self=True``. 
+ 
+    .. versionadded:: 18.2.0 
+    """ 
+    if default is NOTHING and factory is None: 
+        raise TypeError("Must pass either `default` or `factory`.") 
+ 
+    if default is not NOTHING and factory is not None: 
+        raise TypeError( 
+            "Must pass either `default` or `factory` but not both." 
+        ) 
+ 
+    if factory is not None: 
+        default = Factory(factory) 
+ 
+    if isinstance(default, Factory): 
+        if default.takes_self: 
+            raise ValueError( 
+                "`takes_self` is not supported by default_if_none." 
+            ) 
+ 
+        def default_if_none_converter(val): 
+            if val is not None: 
+                return val 
+ 
+            return default.factory() 
+ 
+    else: 
+ 
+        def default_if_none_converter(val): 
+            if val is not None: 
+                return val 
+ 
+            return default 
+ 
+    return default_if_none_converter 

+ 8 - 8
contrib/python/attrs/attr/exceptions.py

@@ -11,7 +11,7 @@ class FrozenError(AttributeError):
 
     .. versionadded:: 20.1.0
     """
-
+ 
     msg = "can't set attribute"
     args = [msg]
 
@@ -64,15 +64,15 @@ class UnannotatedAttributeError(RuntimeError):
 
     .. versionadded:: 17.3.0
     """
-
-
-class PythonTooOldError(RuntimeError):
-    """
+ 
+ 
+class PythonTooOldError(RuntimeError): 
+    """ 
     It was attempted to use an ``attrs`` feature that requires a newer Python
     version.
-
-    .. versionadded:: 18.2.0
-    """
+ 
+    .. versionadded:: 18.2.0 
+    """ 
 
 
 class NotCallableError(TypeError):

+ 31 - 31
contrib/python/attrs/attr/validators.py

@@ -34,20 +34,20 @@ class _InstanceOfValidator(object):
         if not isinstance(value, self.type):
             raise TypeError(
                 "'{name}' must be {type!r} (got {value!r} that is a "
-                "{actual!r}).".format(
-                    name=attr.name,
-                    type=self.type,
-                    actual=value.__class__,
-                    value=value,
-                ),
-                attr,
-                self.type,
-                value,
+                "{actual!r}).".format( 
+                    name=attr.name, 
+                    type=self.type, 
+                    actual=value.__class__, 
+                    value=value, 
+                ), 
+                attr, 
+                self.type, 
+                value, 
             )
 
     def __repr__(self):
-        return "<instance_of validator for type {type!r}>".format(
-            type=self.type
+        return "<instance_of validator for type {type!r}>".format( 
+            type=self.type 
         )
 
 
@@ -150,17 +150,17 @@ class _ProvidesValidator(object):
         if not self.interface.providedBy(value):
             raise TypeError(
                 "'{name}' must provide {interface!r} which {value!r} "
-                "doesn't.".format(
-                    name=attr.name, interface=self.interface, value=value
-                ),
-                attr,
-                self.interface,
-                value,
+                "doesn't.".format( 
+                    name=attr.name, interface=self.interface, value=value 
+                ), 
+                attr, 
+                self.interface, 
+                value, 
             )
 
     def __repr__(self):
-        return "<provides validator for interface {interface!r}>".format(
-            interface=self.interface
+        return "<provides validator for interface {interface!r}>".format( 
+            interface=self.interface 
         )
 
 
@@ -192,8 +192,8 @@ class _OptionalValidator(object):
         self.validator(inst, attr, value)
 
     def __repr__(self):
-        return "<optional validator for {what} or None>".format(
-            what=repr(self.validator)
+        return "<optional validator for {what} or None>".format( 
+            what=repr(self.validator) 
         )
 
 
@@ -220,21 +220,21 @@ class _InValidator(object):
     options = attrib()
 
     def __call__(self, inst, attr, value):
-        try:
-            in_options = value in self.options
+        try: 
+            in_options = value in self.options 
         except TypeError:  # e.g. `1 in "abc"`
-            in_options = False
-
-        if not in_options:
+            in_options = False 
+ 
+        if not in_options: 
             raise ValueError(
-                "'{name}' must be in {options!r} (got {value!r})".format(
-                    name=attr.name, options=self.options, value=value
-                )
+                "'{name}' must be in {options!r} (got {value!r})".format( 
+                    name=attr.name, options=self.options, value=value 
+                ) 
             )
 
     def __repr__(self):
-        return "<in_ validator with options {options!r}>".format(
-            options=self.options
+        return "<in_ validator with options {options!r}>".format( 
+            options=self.options 
         )
 
 

Some files were not shown because too many files changed in this diff