Browse Source

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

zubchick 3 years ago
parent
commit
dd8b8ab59e

+ 30 - 30
build/ya.conf.json

@@ -453,9 +453,9 @@
         },
         "grpc_cli": {
             "description": "GRPC command-line tool"
-        },
-        "buf": {
-            "description": "Protobuf lint and breaking change detector"
+        }, 
+        "buf": { 
+            "description": "Protobuf lint and breaking change detector" 
         },
         "iceflame": {
             "description": "Performance data collection and analysis"
@@ -5539,22 +5539,22 @@
                     "default": true
                 }
             ]
-        },
-        "buf": {
-            "tools": {
-                "buf": {
-                    "bottle": "buf",
-                    "executable": "buf"
-                }
-            },
-            "platforms": [
-                {
-                    "host": {
-                        "os": "LINUX"
-                    },
-                    "default": true
-                }
-            ]
+        }, 
+        "buf": { 
+            "tools": { 
+                "buf": { 
+                    "bottle": "buf", 
+                    "executable": "buf" 
+                } 
+            }, 
+            "platforms": [ 
+                { 
+                    "host": { 
+                        "os": "LINUX" 
+                    }, 
+                    "default": true 
+                } 
+            ] 
         },
         "iceflame": {
             "tools": {
@@ -7862,17 +7862,17 @@
                     "grpc_cli"
                 ]
             }
-        },
-        "buf": {
-            "formula": {
-                "sandbox_id": 813444352,
-                "match": "buf"
-            },
-            "executable": {
-                "buf": [
-                    "buf"
-                ]
-            }
+        }, 
+        "buf": { 
+            "formula": { 
+                "sandbox_id": 813444352, 
+                "match": "buf" 
+            }, 
+            "executable": { 
+                "buf": [ 
+                    "buf" 
+                ] 
+            } 
         },
         "iceflame": {
             "formula": {

+ 4 - 4
contrib/python/attrs/.dist-info/METADATA

@@ -36,12 +36,12 @@ Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
 Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
-Description-Content-Type: text/x-rst
+Description-Content-Type: text/x-rst 
 Provides-Extra: dev
 Requires-Dist: coverage[toml] (>=5.0.2) ; extra == 'dev'
 Requires-Dist: hypothesis ; extra == 'dev'
 Requires-Dist: pympler ; extra == 'dev'
-Requires-Dist: pytest (>=4.3.0) ; extra == 'dev'
+Requires-Dist: pytest (>=4.3.0) ; extra == 'dev' 
 Requires-Dist: six ; extra == 'dev'
 Requires-Dist: mypy ; extra == 'dev'
 Requires-Dist: pytest-mypy-plugins ; extra == 'dev'
@@ -59,7 +59,7 @@ Provides-Extra: tests
 Requires-Dist: coverage[toml] (>=5.0.2) ; extra == 'tests'
 Requires-Dist: hypothesis ; extra == 'tests'
 Requires-Dist: pympler ; extra == 'tests'
-Requires-Dist: pytest (>=4.3.0) ; extra == 'tests'
+Requires-Dist: pytest (>=4.3.0) ; extra == 'tests' 
 Requires-Dist: six ; extra == 'tests'
 Requires-Dist: mypy ; extra == 'tests'
 Requires-Dist: pytest-mypy-plugins ; extra == 'tests'
@@ -128,7 +128,7 @@ After *declaring* your attributes ``attrs`` gives you:
 
 - a concise and explicit overview of the class's attributes,
 - a nice human-readable ``__repr__``,
-- a complete set of comparison methods (equality and ordering),
+- a complete set of comparison methods (equality and ordering), 
 - an initializer,
 - and much more,
 

+ 1 - 1
contrib/python/attrs/README.rst

@@ -72,7 +72,7 @@ After *declaring* your attributes ``attrs`` gives you:
 
 - a concise and explicit overview of the class's attributes,
 - a nice human-readable ``__repr__``,
-- a complete set of comparison methods (equality and ordering),
+- a complete set of comparison methods (equality and ordering), 
 - an initializer,
 - and much more,
 

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

@@ -23,7 +23,7 @@ from ._version_info import VersionInfo
 
 
 __version__ = "21.2.0"
-__version_info__ = VersionInfo._from_version_string(__version__)
+__version_info__ = VersionInfo._from_version_string(__version__) 
 
 __title__ = "attrs"
 __description__ = "Classes Without Boilerplate"

+ 229 - 229
contrib/python/attrs/attr/__init__.pyi

@@ -1,50 +1,50 @@
 import sys
 
-from typing import (
-    Any,
-    Callable,
-    Dict,
-    Generic,
-    List,
+from typing import ( 
+    Any, 
+    Callable, 
+    Dict, 
+    Generic, 
+    List, 
     Mapping,
-    Optional,
-    Sequence,
-    Tuple,
-    Type,
-    TypeVar,
-    Union,
-    overload,
-)
-
-# `import X as X` is required to make these public
+    Optional, 
+    Sequence, 
+    Tuple, 
+    Type, 
+    TypeVar, 
+    Union, 
+    overload, 
+) 
+ 
+# `import X as X` is required to make these public 
 from . import converters as converters
-from . import exceptions as exceptions
-from . import filters as filters
+from . import exceptions as exceptions 
+from . import filters as filters 
 from . import setters as setters
-from . import validators as validators
+from . import validators as validators 
 from ._version_info import VersionInfo
-
-
-__version__: str
-__version_info__: VersionInfo
-__title__: str
-__description__: str
-__url__: str
-__uri__: str
-__author__: str
-__email__: str
-__license__: str
-__copyright__: str
-
-_T = TypeVar("_T")
-_C = TypeVar("_C", bound=type)
-
+ 
+
+__version__: str 
+__version_info__: VersionInfo 
+__title__: str 
+__description__: str 
+__url__: str 
+__uri__: str 
+__author__: str 
+__email__: str 
+__license__: str 
+__copyright__: str 
+ 
+_T = TypeVar("_T") 
+_C = TypeVar("_C", bound=type) 
+ 
 _EqOrderType = Union[bool, Callable[[Any], Any]]
-_ValidatorType = Callable[[Any, Attribute[_T], _T], Any]
+_ValidatorType = Callable[[Any, Attribute[_T], _T], Any] 
 _ConverterType = Callable[[Any], Any]
-_FilterType = Callable[[Attribute[_T], _T], bool]
-_ReprType = Callable[[Any], str]
-_ReprArgType = Union[bool, _ReprType]
+_FilterType = Callable[[Attribute[_T], _T], bool] 
+_ReprType = Callable[[Any], str] 
+_ReprArgType = Union[bool, _ReprType] 
 _OnSetAttrType = Callable[[Any, Attribute[Any], Any], Any]
 _OnSetAttrArgType = Union[
     _OnSetAttrType, List[_OnSetAttrType], setters._NoOpType
@@ -53,18 +53,18 @@ _FieldTransformer = Callable[[type, List[Attribute[Any]]], List[Attribute[Any]]]
 # FIXME: in reality, if multiple validators are passed they must be in a list
 # or tuple, but those are invariant and so would prevent subtypes of
 # _ValidatorType from working when passed in a list or tuple.
-_ValidatorArgType = Union[_ValidatorType[_T], Sequence[_ValidatorType[_T]]]
-
-# _make --
-
-NOTHING: object
-
+_ValidatorArgType = Union[_ValidatorType[_T], Sequence[_ValidatorType[_T]]] 
+ 
+# _make -- 
+ 
+NOTHING: object 
+ 
 # NOTE: Factory lies about its return type to make this possible:
 # `x: List[int] # = Factory(list)`
-# Work around mypy issue #4554 in the common case by using an overload.
+# Work around mypy issue #4554 in the common case by using an overload. 
 if sys.version_info >= (3, 8):
     from typing import Literal
-
+ 
     @overload
     def Factory(factory: Callable[[], _T]) -> _T: ...
     @overload
@@ -102,124 +102,124 @@ def __dataclass_transform__(
     field_descriptors: Tuple[Union[type, Callable[..., Any]], ...] = (()),
 ) -> Callable[[_T], _T]: ...
 
-class Attribute(Generic[_T]):
-    name: str
-    default: Optional[_T]
-    validator: Optional[_ValidatorType[_T]]
-    repr: _ReprArgType
+class Attribute(Generic[_T]): 
+    name: str 
+    default: Optional[_T] 
+    validator: Optional[_ValidatorType[_T]] 
+    repr: _ReprArgType 
     cmp: _EqOrderType
     eq: _EqOrderType
     order: _EqOrderType
-    hash: Optional[bool]
-    init: bool
+    hash: Optional[bool] 
+    init: bool 
     converter: Optional[_ConverterType]
-    metadata: Dict[Any, Any]
-    type: Optional[Type[_T]]
-    kw_only: bool
+    metadata: Dict[Any, Any] 
+    type: Optional[Type[_T]] 
+    kw_only: bool 
     on_setattr: _OnSetAttrType
-
+ 
     def evolve(self, **changes: Any) -> "Attribute[Any]": ...
 
-# NOTE: We had several choices for the annotation to use for type arg:
-# 1) Type[_T]
-#   - Pros: Handles simple cases correctly
+# NOTE: We had several choices for the annotation to use for type arg: 
+# 1) Type[_T] 
+#   - Pros: Handles simple cases correctly 
 #   - Cons: Might produce less informative errors in the case of conflicting
 #     TypeVars e.g. `attr.ib(default='bad', type=int)`
-# 2) Callable[..., _T]
-#   - Pros: Better error messages than #1 for conflicting TypeVars
-#   - Cons: Terrible error messages for validator checks.
-#   e.g. attr.ib(type=int, validator=validate_str)
-#        -> error: Cannot infer function type argument
-# 3) type (and do all of the work in the mypy plugin)
-#   - Pros: Simple here, and we could customize the plugin with our own errors.
-#   - Cons: Would need to write mypy plugin code to handle all the cases.
-# We chose option #1.
-
-# `attr` lies about its return type to make the following possible:
-#     attr()    -> Any
-#     attr(8)   -> int
-#     attr(validator=<some callable>)  -> Whatever the callable expects.
-# This makes this type of assignments possible:
-#     x: int = attr(8)
-#
+# 2) Callable[..., _T] 
+#   - Pros: Better error messages than #1 for conflicting TypeVars 
+#   - Cons: Terrible error messages for validator checks. 
+#   e.g. attr.ib(type=int, validator=validate_str) 
+#        -> error: Cannot infer function type argument 
+# 3) type (and do all of the work in the mypy plugin) 
+#   - Pros: Simple here, and we could customize the plugin with our own errors. 
+#   - Cons: Would need to write mypy plugin code to handle all the cases. 
+# We chose option #1. 
+ 
+# `attr` lies about its return type to make the following possible: 
+#     attr()    -> Any 
+#     attr(8)   -> int 
+#     attr(validator=<some callable>)  -> Whatever the callable expects. 
+# This makes this type of assignments possible: 
+#     x: int = attr(8) 
+# 
 # This form catches explicit None or no default but with no other arguments
 # returns Any.
-@overload
-def attrib(
-    default: None = ...,
-    validator: None = ...,
-    repr: _ReprArgType = ...,
+@overload 
+def attrib( 
+    default: None = ..., 
+    validator: None = ..., 
+    repr: _ReprArgType = ..., 
     cmp: Optional[_EqOrderType] = ...,
-    hash: Optional[bool] = ...,
-    init: bool = ...,
-    metadata: Optional[Mapping[Any, Any]] = ...,
-    type: None = ...,
-    converter: None = ...,
-    factory: None = ...,
-    kw_only: bool = ...,
+    hash: Optional[bool] = ..., 
+    init: bool = ..., 
+    metadata: Optional[Mapping[Any, Any]] = ..., 
+    type: None = ..., 
+    converter: None = ..., 
+    factory: None = ..., 
+    kw_only: bool = ..., 
     eq: Optional[_EqOrderType] = ...,
     order: Optional[_EqOrderType] = ...,
     on_setattr: Optional[_OnSetAttrArgType] = ...,
-) -> Any: ...
-
+) -> Any: ... 
+ 
 # This form catches an explicit None or no default and infers the type from the
 # other arguments.
-@overload
-def attrib(
-    default: None = ...,
-    validator: Optional[_ValidatorArgType[_T]] = ...,
-    repr: _ReprArgType = ...,
+@overload 
+def attrib( 
+    default: None = ..., 
+    validator: Optional[_ValidatorArgType[_T]] = ..., 
+    repr: _ReprArgType = ..., 
     cmp: Optional[_EqOrderType] = ...,
-    hash: Optional[bool] = ...,
-    init: bool = ...,
-    metadata: Optional[Mapping[Any, Any]] = ...,
-    type: Optional[Type[_T]] = ...,
+    hash: Optional[bool] = ..., 
+    init: bool = ..., 
+    metadata: Optional[Mapping[Any, Any]] = ..., 
+    type: Optional[Type[_T]] = ..., 
     converter: Optional[_ConverterType] = ...,
-    factory: Optional[Callable[[], _T]] = ...,
-    kw_only: bool = ...,
+    factory: Optional[Callable[[], _T]] = ..., 
+    kw_only: bool = ..., 
     eq: Optional[_EqOrderType] = ...,
     order: Optional[_EqOrderType] = ...,
     on_setattr: Optional[_OnSetAttrArgType] = ...,
-) -> _T: ...
-
-# This form catches an explicit default argument.
-@overload
-def attrib(
-    default: _T,
-    validator: Optional[_ValidatorArgType[_T]] = ...,
-    repr: _ReprArgType = ...,
+) -> _T: ... 
+ 
+# This form catches an explicit default argument. 
+@overload 
+def attrib( 
+    default: _T, 
+    validator: Optional[_ValidatorArgType[_T]] = ..., 
+    repr: _ReprArgType = ..., 
     cmp: Optional[_EqOrderType] = ...,
-    hash: Optional[bool] = ...,
-    init: bool = ...,
-    metadata: Optional[Mapping[Any, Any]] = ...,
-    type: Optional[Type[_T]] = ...,
+    hash: Optional[bool] = ..., 
+    init: bool = ..., 
+    metadata: Optional[Mapping[Any, Any]] = ..., 
+    type: Optional[Type[_T]] = ..., 
     converter: Optional[_ConverterType] = ...,
-    factory: Optional[Callable[[], _T]] = ...,
-    kw_only: bool = ...,
+    factory: Optional[Callable[[], _T]] = ..., 
+    kw_only: bool = ..., 
     eq: Optional[_EqOrderType] = ...,
     order: Optional[_EqOrderType] = ...,
     on_setattr: Optional[_OnSetAttrArgType] = ...,
-) -> _T: ...
-
-# This form covers type=non-Type: e.g. forward references (str), Any
-@overload
-def attrib(
-    default: Optional[_T] = ...,
-    validator: Optional[_ValidatorArgType[_T]] = ...,
-    repr: _ReprArgType = ...,
+) -> _T: ... 
+ 
+# This form covers type=non-Type: e.g. forward references (str), Any 
+@overload 
+def attrib( 
+    default: Optional[_T] = ..., 
+    validator: Optional[_ValidatorArgType[_T]] = ..., 
+    repr: _ReprArgType = ..., 
     cmp: Optional[_EqOrderType] = ...,
-    hash: Optional[bool] = ...,
-    init: bool = ...,
-    metadata: Optional[Mapping[Any, Any]] = ...,
-    type: object = ...,
+    hash: Optional[bool] = ..., 
+    init: bool = ..., 
+    metadata: Optional[Mapping[Any, Any]] = ..., 
+    type: object = ..., 
     converter: Optional[_ConverterType] = ...,
-    factory: Optional[Callable[[], _T]] = ...,
-    kw_only: bool = ...,
+    factory: Optional[Callable[[], _T]] = ..., 
+    kw_only: bool = ..., 
     eq: Optional[_EqOrderType] = ...,
     order: Optional[_EqOrderType] = ...,
     on_setattr: Optional[_OnSetAttrArgType] = ...,
-) -> Any: ...
-@overload
+) -> Any: ... 
+@overload 
 def field(
     *,
     default: None = ...,
@@ -292,22 +292,22 @@ def field(
 ) -> Any: ...
 @overload
 @__dataclass_transform__(order_default=True, field_descriptors=(attrib, field))
-def attrs(
-    maybe_cls: _C,
-    these: Optional[Dict[str, Any]] = ...,
-    repr_ns: Optional[str] = ...,
-    repr: bool = ...,
+def attrs( 
+    maybe_cls: _C, 
+    these: Optional[Dict[str, Any]] = ..., 
+    repr_ns: Optional[str] = ..., 
+    repr: bool = ..., 
     cmp: Optional[_EqOrderType] = ...,
-    hash: Optional[bool] = ...,
-    init: bool = ...,
-    slots: bool = ...,
-    frozen: bool = ...,
-    weakref_slot: bool = ...,
-    str: bool = ...,
-    auto_attribs: bool = ...,
-    kw_only: bool = ...,
-    cache_hash: bool = ...,
-    auto_exc: bool = ...,
+    hash: Optional[bool] = ..., 
+    init: bool = ..., 
+    slots: bool = ..., 
+    frozen: bool = ..., 
+    weakref_slot: bool = ..., 
+    str: bool = ..., 
+    auto_attribs: bool = ..., 
+    kw_only: bool = ..., 
+    cache_hash: bool = ..., 
+    auto_exc: bool = ..., 
     eq: Optional[_EqOrderType] = ...,
     order: Optional[_EqOrderType] = ...,
     auto_detect: bool = ...,
@@ -315,25 +315,25 @@ def attrs(
     getstate_setstate: Optional[bool] = ...,
     on_setattr: Optional[_OnSetAttrArgType] = ...,
     field_transformer: Optional[_FieldTransformer] = ...,
-) -> _C: ...
-@overload
+) -> _C: ... 
+@overload 
 @__dataclass_transform__(order_default=True, field_descriptors=(attrib, field))
-def attrs(
-    maybe_cls: None = ...,
-    these: Optional[Dict[str, Any]] = ...,
-    repr_ns: Optional[str] = ...,
-    repr: bool = ...,
+def attrs( 
+    maybe_cls: None = ..., 
+    these: Optional[Dict[str, Any]] = ..., 
+    repr_ns: Optional[str] = ..., 
+    repr: bool = ..., 
     cmp: Optional[_EqOrderType] = ...,
-    hash: Optional[bool] = ...,
-    init: bool = ...,
-    slots: bool = ...,
-    frozen: bool = ...,
-    weakref_slot: bool = ...,
-    str: bool = ...,
-    auto_attribs: bool = ...,
-    kw_only: bool = ...,
-    cache_hash: bool = ...,
-    auto_exc: bool = ...,
+    hash: Optional[bool] = ..., 
+    init: bool = ..., 
+    slots: bool = ..., 
+    frozen: bool = ..., 
+    weakref_slot: bool = ..., 
+    str: bool = ..., 
+    auto_attribs: bool = ..., 
+    kw_only: bool = ..., 
+    cache_hash: bool = ..., 
+    auto_exc: bool = ..., 
     eq: Optional[_EqOrderType] = ...,
     order: Optional[_EqOrderType] = ...,
     auto_detect: bool = ...,
@@ -341,7 +341,7 @@ def attrs(
     getstate_setstate: Optional[bool] = ...,
     on_setattr: Optional[_OnSetAttrArgType] = ...,
     field_transformer: Optional[_FieldTransformer] = ...,
-) -> Callable[[_C], _C]: ...
+) -> Callable[[_C], _C]: ... 
 @overload
 @__dataclass_transform__(field_descriptors=(attrib, field))
 def define(
@@ -390,86 +390,86 @@ def define(
     on_setattr: Optional[_OnSetAttrArgType] = ...,
     field_transformer: Optional[_FieldTransformer] = ...,
 ) -> Callable[[_C], _C]: ...
-
+ 
 mutable = define
 frozen = define  # they differ only in their defaults
 
-# TODO: add support for returning NamedTuple from the mypy plugin
-class _Fields(Tuple[Attribute[Any], ...]):
-    def __getattr__(self, name: str) -> Attribute[Any]: ...
-
-def fields(cls: type) -> _Fields: ...
-def fields_dict(cls: type) -> Dict[str, Attribute[Any]]: ...
-def validate(inst: Any) -> None: ...
+# TODO: add support for returning NamedTuple from the mypy plugin 
+class _Fields(Tuple[Attribute[Any], ...]): 
+    def __getattr__(self, name: str) -> Attribute[Any]: ... 
+ 
+def fields(cls: type) -> _Fields: ... 
+def fields_dict(cls: type) -> Dict[str, Attribute[Any]]: ... 
+def validate(inst: Any) -> None: ... 
 def resolve_types(
     cls: _C,
     globalns: Optional[Dict[str, Any]] = ...,
     localns: Optional[Dict[str, Any]] = ...,
     attribs: Optional[List[Attribute[Any]]] = ...,
 ) -> _C: ...
-
-# TODO: add support for returning a proper attrs class from the mypy plugin
+ 
+# TODO: add support for returning a proper attrs class from the mypy plugin 
 # we use Any instead of _CountingAttr so that e.g. `make_class('Foo',
 # [attr.ib()])` is valid
-def make_class(
-    name: str,
-    attrs: Union[List[str], Tuple[str, ...], Dict[str, Any]],
-    bases: Tuple[type, ...] = ...,
-    repr_ns: Optional[str] = ...,
-    repr: bool = ...,
+def make_class( 
+    name: str, 
+    attrs: Union[List[str], Tuple[str, ...], Dict[str, Any]], 
+    bases: Tuple[type, ...] = ..., 
+    repr_ns: Optional[str] = ..., 
+    repr: bool = ..., 
     cmp: Optional[_EqOrderType] = ...,
-    hash: Optional[bool] = ...,
-    init: bool = ...,
-    slots: bool = ...,
-    frozen: bool = ...,
-    weakref_slot: bool = ...,
-    str: bool = ...,
-    auto_attribs: bool = ...,
-    kw_only: bool = ...,
-    cache_hash: bool = ...,
-    auto_exc: bool = ...,
+    hash: Optional[bool] = ..., 
+    init: bool = ..., 
+    slots: bool = ..., 
+    frozen: bool = ..., 
+    weakref_slot: bool = ..., 
+    str: bool = ..., 
+    auto_attribs: bool = ..., 
+    kw_only: bool = ..., 
+    cache_hash: bool = ..., 
+    auto_exc: bool = ..., 
     eq: Optional[_EqOrderType] = ...,
     order: Optional[_EqOrderType] = ...,
     collect_by_mro: bool = ...,
     on_setattr: Optional[_OnSetAttrArgType] = ...,
     field_transformer: Optional[_FieldTransformer] = ...,
-) -> type: ...
-
-# _funcs --
-
-# TODO: add support for returning TypedDict from the mypy plugin
+) -> type: ... 
+ 
+# _funcs -- 
+ 
+# TODO: add support for returning TypedDict from the mypy plugin 
 # FIXME: asdict/astuple do not honor their factory args. Waiting on one of
 # these:
-# https://github.com/python/mypy/issues/4236
-# https://github.com/python/typing/issues/253
-def asdict(
-    inst: Any,
-    recurse: bool = ...,
-    filter: Optional[_FilterType[Any]] = ...,
-    dict_factory: Type[Mapping[Any, Any]] = ...,
-    retain_collection_types: bool = ...,
+# https://github.com/python/mypy/issues/4236 
+# https://github.com/python/typing/issues/253 
+def asdict( 
+    inst: Any, 
+    recurse: bool = ..., 
+    filter: Optional[_FilterType[Any]] = ..., 
+    dict_factory: Type[Mapping[Any, Any]] = ..., 
+    retain_collection_types: bool = ..., 
     value_serializer: Optional[Callable[[type, Attribute[Any], Any], Any]] = ...,
-) -> Dict[str, Any]: ...
-
-# TODO: add support for returning NamedTuple from the mypy plugin
-def astuple(
-    inst: Any,
-    recurse: bool = ...,
-    filter: Optional[_FilterType[Any]] = ...,
-    tuple_factory: Type[Sequence[Any]] = ...,
-    retain_collection_types: bool = ...,
-) -> Tuple[Any, ...]: ...
-def has(cls: type) -> bool: ...
-def assoc(inst: _T, **changes: Any) -> _T: ...
-def evolve(inst: _T, **changes: Any) -> _T: ...
-
-# _config --
-
-def set_run_validators(run: bool) -> None: ...
-def get_run_validators() -> bool: ...
-
-# aliases --
-
-s = attributes = attrs
-ib = attr = attrib
-dataclass = attrs  # Technically, partial(attrs, auto_attribs=True) ;)
+) -> Dict[str, Any]: ... 
+ 
+# TODO: add support for returning NamedTuple from the mypy plugin 
+def astuple( 
+    inst: Any, 
+    recurse: bool = ..., 
+    filter: Optional[_FilterType[Any]] = ..., 
+    tuple_factory: Type[Sequence[Any]] = ..., 
+    retain_collection_types: bool = ..., 
+) -> Tuple[Any, ...]: ... 
+def has(cls: type) -> bool: ... 
+def assoc(inst: _T, **changes: Any) -> _T: ... 
+def evolve(inst: _T, **changes: Any) -> _T: ... 
+ 
+# _config -- 
+ 
+def set_run_validators(run: bool) -> None: ... 
+def get_run_validators() -> bool: ... 
+ 
+# aliases -- 
+ 
+s = attributes = attrs 
+ib = attr = attrib 
+dataclass = attrs  # Technically, partial(attrs, auto_attribs=True) ;) 

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

@@ -19,7 +19,7 @@ else:
 
 
 if PY2:
-    from collections import Mapping, Sequence
+    from collections import Mapping, Sequence 
 
     from UserDict import IterableUserDict
 
@@ -116,8 +116,8 @@ else:  # Python 3 and later.
         consequences of not setting the cell on Python 2.
         """
         warnings.warn(
-            "Running interpreter doesn't sufficiently support code object "
-            "introspection.  Some features like bare super() or accessing "
+            "Running interpreter doesn't sufficiently support code object " 
+            "introspection.  Some features like bare super() or accessing " 
             "__class__ will not work with slotted classes.",
             RuntimeWarning,
             stacklevel=2,
@@ -138,105 +138,105 @@ else:  # Python 3 and later.
 
 
 def make_set_closure_cell():
-    """Return a function of two arguments (cell, value) which sets
-    the value stored in the closure cell `cell` to `value`.
+    """Return a function of two arguments (cell, value) which sets 
+    the value stored in the closure cell `cell` to `value`. 
     """
-    # pypy makes this easy. (It also supports the logic below, but
-    # why not do the easy/fast thing?)
+    # 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.
-
-    # Create a function that will set its first cellvar to `value`.
-    def set_first_cellvar_to(value):
-        x = value
-        return
-
-        # This function will be eliminated as dead code, but
-        # not before its reference to `x` forces `x` to be
-        # represented as a closure cell rather than a local.
-        def force_x_to_be_a_cell():  # pragma: no cover
-            return x
-
-    try:
-        # Extract the code object and make sure our assumptions about
-        # the closure behavior are correct.
-        if PY2:
-            co = set_first_cellvar_to.func_code
-        else:
-            co = set_first_cellvar_to.__code__
-        if co.co_cellvars != ("x",) or co.co_freevars != ():
-            raise AssertionError  # pragma: no cover
-
-        # Convert this code object to a code object that sets the
-        # function's first _freevar_ (not cellvar) to the argument.
-        if sys.version_info >= (3, 8):
-            # CPython 3.8+ has an incompatible CodeType signature
-            # (added a posonlyargcount argument) but also added
-            # CodeType.replace() to do this without counting parameters.
-            set_first_freevar_code = co.replace(
-                co_cellvars=co.co_freevars, co_freevars=co.co_cellvars
-            )
-        else:
-            args = [co.co_argcount]
-            if not PY2:
-                args.append(co.co_kwonlyargcount)
-            args.extend(
-                [
-                    co.co_nlocals,
-                    co.co_stacksize,
-                    co.co_flags,
-                    co.co_code,
-                    co.co_consts,
-                    co.co_names,
-                    co.co_varnames,
-                    co.co_filename,
-                    co.co_name,
-                    co.co_firstlineno,
-                    co.co_lnotab,
-                    # These two arguments are reversed:
-                    co.co_cellvars,
-                    co.co_freevars,
-                ]
-            )
-            set_first_freevar_code = types.CodeType(*args)
-
-        def set_closure_cell(cell, value):
-            # Create a function using the set_first_freevar_code,
-            # whose first closure cell is `cell`. Calling it will
-            # change the value of that cell.
-            setter = types.FunctionType(
-                set_first_freevar_code, {}, "setter", (), (cell,)
-            )
-            # And call it to set the cell.
-            setter(value)
-
-        # Make sure it works on this interpreter:
-        def make_func_with_cell():
-            x = None
-
-            def func():
-                return x  # pragma: no cover
-
-            return func
-
-        if PY2:
-            cell = make_func_with_cell().func_closure[0]
-        else:
-            cell = make_func_with_cell().__closure__[0]
-        set_closure_cell(cell, 100)
-        if cell.cell_contents != 100:
-            raise AssertionError  # pragma: no cover
-
-    except Exception:
-        return just_warn
+        return set_closure_cell 
+ 
+    # Otherwise gotta do it the hard way. 
+ 
+    # Create a function that will set its first cellvar to `value`. 
+    def set_first_cellvar_to(value): 
+        x = value 
+        return 
+ 
+        # This function will be eliminated as dead code, but 
+        # not before its reference to `x` forces `x` to be 
+        # represented as a closure cell rather than a local. 
+        def force_x_to_be_a_cell():  # pragma: no cover 
+            return x 
+ 
+    try: 
+        # Extract the code object and make sure our assumptions about 
+        # the closure behavior are correct. 
+        if PY2: 
+            co = set_first_cellvar_to.func_code 
+        else: 
+            co = set_first_cellvar_to.__code__ 
+        if co.co_cellvars != ("x",) or co.co_freevars != (): 
+            raise AssertionError  # pragma: no cover 
+ 
+        # Convert this code object to a code object that sets the 
+        # function's first _freevar_ (not cellvar) to the argument. 
+        if sys.version_info >= (3, 8): 
+            # CPython 3.8+ has an incompatible CodeType signature 
+            # (added a posonlyargcount argument) but also added 
+            # CodeType.replace() to do this without counting parameters. 
+            set_first_freevar_code = co.replace( 
+                co_cellvars=co.co_freevars, co_freevars=co.co_cellvars 
+            ) 
+        else: 
+            args = [co.co_argcount] 
+            if not PY2: 
+                args.append(co.co_kwonlyargcount) 
+            args.extend( 
+                [ 
+                    co.co_nlocals, 
+                    co.co_stacksize, 
+                    co.co_flags, 
+                    co.co_code, 
+                    co.co_consts, 
+                    co.co_names, 
+                    co.co_varnames, 
+                    co.co_filename, 
+                    co.co_name, 
+                    co.co_firstlineno, 
+                    co.co_lnotab, 
+                    # These two arguments are reversed: 
+                    co.co_cellvars, 
+                    co.co_freevars, 
+                ] 
+            ) 
+            set_first_freevar_code = types.CodeType(*args) 
+ 
+        def set_closure_cell(cell, value): 
+            # Create a function using the set_first_freevar_code, 
+            # whose first closure cell is `cell`. Calling it will 
+            # change the value of that cell. 
+            setter = types.FunctionType( 
+                set_first_freevar_code, {}, "setter", (), (cell,) 
+            ) 
+            # And call it to set the cell. 
+            setter(value) 
+ 
+        # Make sure it works on this interpreter: 
+        def make_func_with_cell(): 
+            x = None 
+ 
+            def func(): 
+                return x  # pragma: no cover 
+ 
+            return func 
+ 
+        if PY2: 
+            cell = make_func_with_cell().func_closure[0] 
+        else: 
+            cell = make_func_with_cell().__closure__[0] 
+        set_closure_cell(cell, 100) 
+        if cell.cell_contents != 100: 
+            raise AssertionError  # pragma: no cover 
+ 
+    except Exception: 
+        return just_warn 
     else:
-        return set_closure_cell
+        return set_closure_cell 
 
 
 set_closure_cell = make_set_closure_cell()

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

@@ -25,7 +25,7 @@ def asdict(
         ``attrs``-decorated.
     :param callable filter: A callable whose return code determines whether an
         attribute or element is included (``True``) or dropped (``False``).  Is
-        called with the `attr.Attribute` as the first argument and the
+        called with the `attr.Attribute` as the first argument and the 
         value as the second argument.
     :param callable dict_factory: A callable to produce dictionaries from.  For
         example, to produce ordered dictionaries instead of normal Python
@@ -181,7 +181,7 @@ def astuple(
         ``attrs``-decorated.
     :param callable filter: A callable whose return code determines whether an
         attribute or element is included (``True``) or dropped (``False``).  Is
-        called with the `attr.Attribute` as the first argument and the
+        called with the `attr.Attribute` as the first argument and the 
         value as the second argument.
     :param callable tuple_factory: A callable to produce tuples from.  For
         example, to produce lists instead of tuples.
@@ -271,7 +271,7 @@ def has(cls):
     :param type cls: Class to introspect.
     :raise TypeError: If *cls* is not a class.
 
-    :rtype: bool
+    :rtype: bool 
     """
     return getattr(cls, "__attrs_attrs__", None) is not None
 
@@ -291,7 +291,7 @@ def assoc(inst, **changes):
         class.
 
     ..  deprecated:: 17.1.0
-        Use `evolve` instead.
+        Use `evolve` instead. 
     """
     import warnings
 

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


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

@@ -65,14 +65,14 @@ def default_if_none(default=NOTHING, factory=None):
     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
+       of `attr.Factory` is supported, however the ``takes_self`` option 
        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.
-    :raises ValueError: If an instance of `attr.Factory` is passed with
+    :raises ValueError: If an instance of `attr.Factory` is passed with 
        ``takes_self=True``.
 
     .. versionadded:: 18.2.0

+ 6 - 6
contrib/python/attrs/attr/converters.pyi

@@ -1,13 +1,13 @@
 from typing import Callable, Optional, TypeVar, overload
 
-from . import _ConverterType
-
-
-_T = TypeVar("_T")
+from . import _ConverterType 
+ 
 
+_T = TypeVar("_T") 
+ 
 def pipe(*validators: _ConverterType) -> _ConverterType: ...
 def optional(converter: _ConverterType) -> _ConverterType: ...
-@overload
+@overload 
 def default_if_none(default: _T) -> _ConverterType: ...
-@overload
+@overload 
 def default_if_none(*, factory: Callable[[], _T]) -> _ConverterType: ...

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