aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/deprecated/python
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/deprecated/python')
-rw-r--r--contrib/deprecated/python/backports-abc/.dist-info/METADATA106
-rw-r--r--contrib/deprecated/python/backports-abc/.dist-info/top_level.txt1
-rw-r--r--contrib/deprecated/python/backports-abc/LICENSE254
-rw-r--r--contrib/deprecated/python/backports-abc/README.rst46
-rw-r--r--contrib/deprecated/python/backports-abc/backports_abc.py216
-rw-r--r--contrib/deprecated/python/backports-abc/ya.make22
-rw-r--r--contrib/deprecated/python/singledispatch/.dist-info/METADATA91
-rw-r--r--contrib/deprecated/python/singledispatch/.dist-info/top_level.txt1
-rw-r--r--contrib/deprecated/python/singledispatch/LICENSE19
-rw-r--r--contrib/deprecated/python/singledispatch/README.rst46
-rw-r--r--contrib/deprecated/python/singledispatch/singledispatch/__init__.py300
-rw-r--r--contrib/deprecated/python/singledispatch/singledispatch/helpers.py217
-rw-r--r--contrib/deprecated/python/singledispatch/ya.make27
13 files changed, 0 insertions, 1346 deletions
diff --git a/contrib/deprecated/python/backports-abc/.dist-info/METADATA b/contrib/deprecated/python/backports-abc/.dist-info/METADATA
deleted file mode 100644
index 40e0734c37..0000000000
--- a/contrib/deprecated/python/backports-abc/.dist-info/METADATA
+++ /dev/null
@@ -1,106 +0,0 @@
-Metadata-Version: 2.0
-Name: backports-abc
-Version: 0.5
-Summary: A backport of recent additions to the 'collections.abc' module.
-Home-page: https://github.com/cython/backports_abc
-Author: Stefan Behnel et al.
-Author-email: cython-devel@python.org
-License: UNKNOWN
-Platform: UNKNOWN
-Classifier: Development Status :: 5 - Production/Stable
-Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: Python Software Foundation License
-Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 3
-
-=============
-ABC-Backports
-=============
-
-Usage:
-
-.. code-block:: python
-
- try:
- # ABCs live in "collections.abc" in Python >= 3.3
- from collections.abc import Coroutine, Generator
- except ImportError:
- # fall back to import from "backports_abc"
- from backports_abc import Coroutine, Generator
-
-You can also install the ABCs into the stdlib by calling the ``patch()``
-function:
-
-.. code-block:: python
-
- import backports_abc
- backports_abc.patch()
-
- try:
- # ABCs live in "collections.abc" in Python >= 3.3
- from collections.abc import Coroutine, Generator
- except ImportError:
- # fall back to import from "collections" in Python <= 3.2
- from backports_abc import Coroutine, Generator
-
-Currently, ``patch()`` provides the following names if missing:
-
-* ``collections.abc.Generator``
-* ``collections.abc.Awaitable``
-* ``collections.abc.Coroutine``
-* ``inspect.isawaitable(obj)``
-
-All of them are also available directly from the ``backports_abc``
-module namespace.
-
-In Python 2.x and Python 3.2, it patches the ``collections`` module
-instead of the ``collections.abc`` module. Any names that are already
-available when importing this module will not be overwritten.
-
-The names that were previously patched by ``patch()`` can be queried
-through the mapping in ``backports_abc.PATCHED``.
-
-Changelog
-=========
-
-0.5 (2016-11-12)
-----------------
-
-* support old-style (mro-missing) classes
-
-0.4 (2015-09-14)
-----------------
-
-* direct wheel building support
-
-* make all names available at the module level instead of requiring patching
-
-
-0.3 (2015-07-03)
-----------------
-
-* removed patching of ``inspect.iscoroutine()`` as it is not ABC based
-
-
-0.2 (2015-07-03)
-----------------
-
-* require explicit ``backports_abc.patch()`` call to do the patching
- (avoids side-effects on import and allows future configuration)
-
-* provide access to patched names through global ``PATCHED`` dict
-
-* add ABC based implementations of inspect.iscoroutine() and
- inspect.isawaitable()
-
-
-0.1 (2015-06-24)
-----------------
-
-* initial public release
-
-* provided ABCs: Generator, Coroutine, Awaitable
-
-
diff --git a/contrib/deprecated/python/backports-abc/.dist-info/top_level.txt b/contrib/deprecated/python/backports-abc/.dist-info/top_level.txt
deleted file mode 100644
index 2fff0c3c21..0000000000
--- a/contrib/deprecated/python/backports-abc/.dist-info/top_level.txt
+++ /dev/null
@@ -1 +0,0 @@
-backports_abc
diff --git a/contrib/deprecated/python/backports-abc/LICENSE b/contrib/deprecated/python/backports-abc/LICENSE
deleted file mode 100644
index 88251f5b6e..0000000000
--- a/contrib/deprecated/python/backports-abc/LICENSE
+++ /dev/null
@@ -1,254 +0,0 @@
-A. HISTORY OF THE SOFTWARE
-==========================
-
-Python was created in the early 1990s by Guido van Rossum at Stichting
-Mathematisch Centrum (CWI, see http://www.cwi.nl) in the Netherlands
-as a successor of a language called ABC. Guido remains Python's
-principal author, although it includes many contributions from others.
-
-In 1995, Guido continued his work on Python at the Corporation for
-National Research Initiatives (CNRI, see http://www.cnri.reston.va.us)
-in Reston, Virginia where he released several versions of the
-software.
-
-In May 2000, Guido and the Python core development team moved to
-BeOpen.com to form the BeOpen PythonLabs team. In October of the same
-year, the PythonLabs team moved to Digital Creations (now Zope
-Corporation, see http://www.zope.com). In 2001, the Python Software
-Foundation (PSF, see http://www.python.org/psf/) was formed, a
-non-profit organization created specifically to own Python-related
-Intellectual Property. Zope Corporation is a sponsoring member of
-the PSF.
-
-All Python releases are Open Source (see http://www.opensource.org for
-the Open Source Definition). Historically, most, but not all, Python
-releases have also been GPL-compatible; the table below summarizes
-the various releases.
-
- Release Derived Year Owner GPL-
- from compatible? (1)
-
- 0.9.0 thru 1.2 1991-1995 CWI yes
- 1.3 thru 1.5.2 1.2 1995-1999 CNRI yes
- 1.6 1.5.2 2000 CNRI no
- 2.0 1.6 2000 BeOpen.com no
- 1.6.1 1.6 2001 CNRI yes (2)
- 2.1 2.0+1.6.1 2001 PSF no
- 2.0.1 2.0+1.6.1 2001 PSF yes
- 2.1.1 2.1+2.0.1 2001 PSF yes
- 2.1.2 2.1.1 2002 PSF yes
- 2.1.3 2.1.2 2002 PSF yes
- 2.2 and above 2.1.1 2001-now PSF yes
-
-Footnotes:
-
-(1) GPL-compatible doesn't mean that we're distributing Python under
- the GPL. All Python licenses, unlike the GPL, let you distribute
- a modified version without making your changes open source. The
- GPL-compatible licenses make it possible to combine Python with
- other software that is released under the GPL; the others don't.
-
-(2) According to Richard Stallman, 1.6.1 is not GPL-compatible,
- because its license has a choice of law clause. According to
- CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1
- is "not incompatible" with the GPL.
-
-Thanks to the many outside volunteers who have worked under Guido's
-direction to make these releases possible.
-
-
-B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON
-===============================================================
-
-PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
---------------------------------------------
-
-1. This LICENSE AGREEMENT is between the Python Software Foundation
-("PSF"), and the Individual or Organization ("Licensee") accessing and
-otherwise using this software ("Python") in source or binary form and
-its associated documentation.
-
-2. Subject to the terms and conditions of this License Agreement, PSF hereby
-grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
-analyze, test, perform and/or display publicly, prepare derivative works,
-distribute, and otherwise use Python alone or in any derivative version,
-provided, however, that PSF's License Agreement and PSF's notice of copyright,
-i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-2011, 2012, 2013, 2014, 2015 Python Software Foundation; All Rights Reserved"
-are retained in Python alone or in any derivative version prepared by Licensee.
-
-3. In the event Licensee prepares a derivative work that is based on
-or incorporates Python or any part thereof, and wants to make
-the derivative work available to others as provided herein, then
-Licensee hereby agrees to include in any such work a brief summary of
-the changes made to Python.
-
-4. PSF is making Python available to Licensee on an "AS IS"
-basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
-IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
-DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
-FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
-INFRINGE ANY THIRD PARTY RIGHTS.
-
-5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
-FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
-A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
-OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
-
-6. This License Agreement will automatically terminate upon a material
-breach of its terms and conditions.
-
-7. Nothing in this License Agreement shall be deemed to create any
-relationship of agency, partnership, or joint venture between PSF and
-Licensee. This License Agreement does not grant permission to use PSF
-trademarks or trade name in a trademark sense to endorse or promote
-products or services of Licensee, or any third party.
-
-8. By copying, installing or otherwise using Python, Licensee
-agrees to be bound by the terms and conditions of this License
-Agreement.
-
-
-BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0
--------------------------------------------
-
-BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1
-
-1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an
-office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the
-Individual or Organization ("Licensee") accessing and otherwise using
-this software in source or binary form and its associated
-documentation ("the Software").
-
-2. Subject to the terms and conditions of this BeOpen Python License
-Agreement, BeOpen hereby grants Licensee a non-exclusive,
-royalty-free, world-wide license to reproduce, analyze, test, perform
-and/or display publicly, prepare derivative works, distribute, and
-otherwise use the Software alone or in any derivative version,
-provided, however, that the BeOpen Python License is retained in the
-Software, alone or in any derivative version prepared by Licensee.
-
-3. BeOpen is making the Software available to Licensee on an "AS IS"
-basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
-IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND
-DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
-FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT
-INFRINGE ANY THIRD PARTY RIGHTS.
-
-4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE
-SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS
-AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY
-DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
-
-5. This License Agreement will automatically terminate upon a material
-breach of its terms and conditions.
-
-6. This License Agreement shall be governed by and interpreted in all
-respects by the law of the State of California, excluding conflict of
-law provisions. Nothing in this License Agreement shall be deemed to
-create any relationship of agency, partnership, or joint venture
-between BeOpen and Licensee. This License Agreement does not grant
-permission to use BeOpen trademarks or trade names in a trademark
-sense to endorse or promote products or services of Licensee, or any
-third party. As an exception, the "BeOpen Python" logos available at
-http://www.pythonlabs.com/logos.html may be used according to the
-permissions granted on that web page.
-
-7. By copying, installing or otherwise using the software, Licensee
-agrees to be bound by the terms and conditions of this License
-Agreement.
-
-
-CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1
----------------------------------------
-
-1. This LICENSE AGREEMENT is between the Corporation for National
-Research Initiatives, having an office at 1895 Preston White Drive,
-Reston, VA 20191 ("CNRI"), and the Individual or Organization
-("Licensee") accessing and otherwise using Python 1.6.1 software in
-source or binary form and its associated documentation.
-
-2. Subject to the terms and conditions of this License Agreement, CNRI
-hereby grants Licensee a nonexclusive, royalty-free, world-wide
-license to reproduce, analyze, test, perform and/or display publicly,
-prepare derivative works, distribute, and otherwise use Python 1.6.1
-alone or in any derivative version, provided, however, that CNRI's
-License Agreement and CNRI's notice of copyright, i.e., "Copyright (c)
-1995-2001 Corporation for National Research Initiatives; All Rights
-Reserved" are retained in Python 1.6.1 alone or in any derivative
-version prepared by Licensee. Alternately, in lieu of CNRI's License
-Agreement, Licensee may substitute the following text (omitting the
-quotes): "Python 1.6.1 is made available subject to the terms and
-conditions in CNRI's License Agreement. This Agreement together with
-Python 1.6.1 may be located on the Internet using the following
-unique, persistent identifier (known as a handle): 1895.22/1013. This
-Agreement may also be obtained from a proxy server on the Internet
-using the following URL: http://hdl.handle.net/1895.22/1013".
-
-3. In the event Licensee prepares a derivative work that is based on
-or incorporates Python 1.6.1 or any part thereof, and wants to make
-the derivative work available to others as provided herein, then
-Licensee hereby agrees to include in any such work a brief summary of
-the changes made to Python 1.6.1.
-
-4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS"
-basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
-IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND
-DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
-FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT
-INFRINGE ANY THIRD PARTY RIGHTS.
-
-5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
-1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
-A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1,
-OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
-
-6. This License Agreement will automatically terminate upon a material
-breach of its terms and conditions.
-
-7. This License Agreement shall be governed by the federal
-intellectual property law of the United States, including without
-limitation the federal copyright law, and, to the extent such
-U.S. federal law does not apply, by the law of the Commonwealth of
-Virginia, excluding Virginia's conflict of law provisions.
-Notwithstanding the foregoing, with regard to derivative works based
-on Python 1.6.1 that incorporate non-separable material that was
-previously distributed under the GNU General Public License (GPL), the
-law of the Commonwealth of Virginia shall govern this License
-Agreement only as to issues arising under or with respect to
-Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this
-License Agreement shall be deemed to create any relationship of
-agency, partnership, or joint venture between CNRI and Licensee. This
-License Agreement does not grant permission to use CNRI trademarks or
-trade name in a trademark sense to endorse or promote products or
-services of Licensee, or any third party.
-
-8. By clicking on the "ACCEPT" button where indicated, or by copying,
-installing or otherwise using Python 1.6.1, Licensee agrees to be
-bound by the terms and conditions of this License Agreement.
-
- ACCEPT
-
-
-CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2
---------------------------------------------------
-
-Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam,
-The Netherlands. All rights reserved.
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Stichting Mathematisch
-Centrum or CWI not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior
-permission.
-
-STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
-THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
-FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
-OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/contrib/deprecated/python/backports-abc/README.rst b/contrib/deprecated/python/backports-abc/README.rst
deleted file mode 100644
index 06cf94aefd..0000000000
--- a/contrib/deprecated/python/backports-abc/README.rst
+++ /dev/null
@@ -1,46 +0,0 @@
-=============
-ABC-Backports
-=============
-
-Usage:
-
-.. code-block:: python
-
- try:
- # ABCs live in "collections.abc" in Python >= 3.3
- from collections.abc import Coroutine, Generator
- except ImportError:
- # fall back to import from "backports_abc"
- from backports_abc import Coroutine, Generator
-
-You can also install the ABCs into the stdlib by calling the ``patch()``
-function:
-
-.. code-block:: python
-
- import backports_abc
- backports_abc.patch()
-
- try:
- # ABCs live in "collections.abc" in Python >= 3.3
- from collections.abc import Coroutine, Generator
- except ImportError:
- # fall back to import from "collections" in Python <= 3.2
- from backports_abc import Coroutine, Generator
-
-Currently, ``patch()`` provides the following names if missing:
-
-* ``collections.abc.Generator``
-* ``collections.abc.Awaitable``
-* ``collections.abc.Coroutine``
-* ``inspect.isawaitable(obj)``
-
-All of them are also available directly from the ``backports_abc``
-module namespace.
-
-In Python 2.x and Python 3.2, it patches the ``collections`` module
-instead of the ``collections.abc`` module. Any names that are already
-available when importing this module will not be overwritten.
-
-The names that were previously patched by ``patch()`` can be queried
-through the mapping in ``backports_abc.PATCHED``.
diff --git a/contrib/deprecated/python/backports-abc/backports_abc.py b/contrib/deprecated/python/backports-abc/backports_abc.py
deleted file mode 100644
index da4cb32983..0000000000
--- a/contrib/deprecated/python/backports-abc/backports_abc.py
+++ /dev/null
@@ -1,216 +0,0 @@
-"""
-Patch recently added ABCs into the standard lib module
-``collections.abc`` (Py3) or ``collections`` (Py2).
-
-Usage::
-
- import backports_abc
- backports_abc.patch()
-
-or::
-
- try:
- from collections.abc import Generator
- except ImportError:
- from backports_abc import Generator
-"""
-
-try:
- import collections.abc as _collections_abc
-except ImportError:
- import collections as _collections_abc
-
-
-def get_mro(cls):
- try:
- return cls.__mro__
- except AttributeError:
- return old_style_mro(cls)
-
-
-def old_style_mro(cls):
- yield cls
- for base in cls.__bases__:
- for c in old_style_mro(base):
- yield c
-
-
-def mk_gen():
- from abc import abstractmethod
-
- required_methods = (
- '__iter__', '__next__' if hasattr(iter(()), '__next__') else 'next',
- 'send', 'throw', 'close')
-
- class Generator(_collections_abc.Iterator):
- __slots__ = ()
-
- if '__next__' in required_methods:
- def __next__(self):
- return self.send(None)
- else:
- def next(self):
- return self.send(None)
-
- @abstractmethod
- def send(self, value):
- raise StopIteration
-
- @abstractmethod
- def throw(self, typ, val=None, tb=None):
- if val is None:
- if tb is None:
- raise typ
- val = typ()
- if tb is not None:
- val = val.with_traceback(tb)
- raise val
-
- def close(self):
- try:
- self.throw(GeneratorExit)
- except (GeneratorExit, StopIteration):
- pass
- else:
- raise RuntimeError('generator ignored GeneratorExit')
-
- @classmethod
- def __subclasshook__(cls, C):
- if cls is Generator:
- mro = get_mro(C)
- for method in required_methods:
- for base in mro:
- if method in base.__dict__:
- break
- else:
- return NotImplemented
- return True
- return NotImplemented
-
- generator = type((lambda: (yield))())
- Generator.register(generator)
- return Generator
-
-
-def mk_awaitable():
- from abc import abstractmethod, ABCMeta
-
- @abstractmethod
- def __await__(self):
- yield
-
- @classmethod
- def __subclasshook__(cls, C):
- if cls is Awaitable:
- for B in get_mro(C):
- if '__await__' in B.__dict__:
- if B.__dict__['__await__']:
- return True
- break
- return NotImplemented
-
- # calling metaclass directly as syntax differs in Py2/Py3
- Awaitable = ABCMeta('Awaitable', (), {
- '__slots__': (),
- '__await__': __await__,
- '__subclasshook__': __subclasshook__,
- })
-
- return Awaitable
-
-
-def mk_coroutine():
- from abc import abstractmethod
-
- class Coroutine(Awaitable):
- __slots__ = ()
-
- @abstractmethod
- def send(self, value):
- """Send a value into the coroutine.
- Return next yielded value or raise StopIteration.
- """
- raise StopIteration
-
- @abstractmethod
- def throw(self, typ, val=None, tb=None):
- """Raise an exception in the coroutine.
- Return next yielded value or raise StopIteration.
- """
- if val is None:
- if tb is None:
- raise typ
- val = typ()
- if tb is not None:
- val = val.with_traceback(tb)
- raise val
-
- def close(self):
- """Raise GeneratorExit inside coroutine.
- """
- try:
- self.throw(GeneratorExit)
- except (GeneratorExit, StopIteration):
- pass
- else:
- raise RuntimeError('coroutine ignored GeneratorExit')
-
- @classmethod
- def __subclasshook__(cls, C):
- if cls is Coroutine:
- mro = get_mro(C)
- for method in ('__await__', 'send', 'throw', 'close'):
- for base in mro:
- if method in base.__dict__:
- break
- else:
- return NotImplemented
- return True
- return NotImplemented
-
- return Coroutine
-
-
-###
-# make all ABCs available in this module
-
-try:
- Generator = _collections_abc.Generator
-except AttributeError:
- Generator = mk_gen()
-
-try:
- Awaitable = _collections_abc.Awaitable
-except AttributeError:
- Awaitable = mk_awaitable()
-
-try:
- Coroutine = _collections_abc.Coroutine
-except AttributeError:
- Coroutine = mk_coroutine()
-
-try:
- from inspect import isawaitable
-except ImportError:
- def isawaitable(obj):
- return isinstance(obj, Awaitable)
-
-
-###
-# allow patching the stdlib
-
-PATCHED = {}
-
-
-def patch(patch_inspect=True):
- """
- Main entry point for patching the ``collections.abc`` and ``inspect``
- standard library modules.
- """
- PATCHED['collections.abc.Generator'] = _collections_abc.Generator = Generator
- PATCHED['collections.abc.Coroutine'] = _collections_abc.Coroutine = Coroutine
- PATCHED['collections.abc.Awaitable'] = _collections_abc.Awaitable = Awaitable
-
- if patch_inspect:
- import inspect
- PATCHED['inspect.isawaitable'] = inspect.isawaitable = isawaitable
diff --git a/contrib/deprecated/python/backports-abc/ya.make b/contrib/deprecated/python/backports-abc/ya.make
deleted file mode 100644
index cc0330f80d..0000000000
--- a/contrib/deprecated/python/backports-abc/ya.make
+++ /dev/null
@@ -1,22 +0,0 @@
-# Generated by devtools/yamaker (pypi).
-
-PY2_LIBRARY()
-
-VERSION(0.5)
-
-LICENSE(PSF-2.0)
-
-NO_LINT()
-
-PY_SRCS(
- TOP_LEVEL
- backports_abc.py
-)
-
-RESOURCE_FILES(
- PREFIX contrib/deprecated/python/backports-abc/
- .dist-info/METADATA
- .dist-info/top_level.txt
-)
-
-END()
diff --git a/contrib/deprecated/python/singledispatch/.dist-info/METADATA b/contrib/deprecated/python/singledispatch/.dist-info/METADATA
deleted file mode 100644
index 280d474d35..0000000000
--- a/contrib/deprecated/python/singledispatch/.dist-info/METADATA
+++ /dev/null
@@ -1,91 +0,0 @@
-Metadata-Version: 2.1
-Name: singledispatch
-Version: 3.7.0
-Summary: Backport functools.singledispatch from Python 3.4 to Python 2.6-3.3.
-Home-page: https://github.com/jaraco/singledispatch
-Author: Jason R. Coombs
-Author-email: jaraco@jaraco.com
-License: UNKNOWN
-Keywords: single,dispatch,generic,functions,singledispatch,genericfunctions,decorator,backport
-Platform: UNKNOWN
-Classifier: Development Status :: 5 - Production/Stable
-Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: MIT License
-Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.6
-Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.2
-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
-Classifier: Programming Language :: Python :: 3.8
-Classifier: Programming Language :: Python :: 3.9
-Classifier: Programming Language :: Python :: 3.10
-Requires-Python: >=2.6
-License-File: LICENSE
-Requires-Dist: six
-Requires-Dist: ordereddict ; python_version < "2.7"
-Provides-Extra: docs
-Requires-Dist: sphinx ; extra == 'docs'
-Requires-Dist: jaraco.packaging (>=8.2) ; extra == 'docs'
-Requires-Dist: rst.linker (>=1.9) ; extra == 'docs'
-Provides-Extra: testing
-Requires-Dist: pytest (>=4.6) ; extra == 'testing'
-Requires-Dist: pytest-flake8 ; extra == 'testing'
-Requires-Dist: pytest-cov ; extra == 'testing'
-Requires-Dist: pytest-black (>=0.3.7) ; (platform_python_implementation != "PyPy") and extra == 'testing'
-Requires-Dist: unittest2 ; (python_version < "3") and extra == 'testing'
-Requires-Dist: pytest-checkdocs (>=2.4) ; (python_version > "3.6") and extra == 'testing'
-
-.. image:: https://img.shields.io/pypi/v/singledispatch.svg
- :target: `PyPI link`_
-
-.. image:: https://img.shields.io/pypi/pyversions/singledispatch.svg
- :target: `PyPI link`_
-
-.. _PyPI link: https://pypi.org/project/singledispatch
-
-.. image:: https://github.com/jaraco/singledispatch/workflows/tests/badge.svg
- :target: https://github.com/jaraco/singledispatch/actions?query=workflow%3A%22tests%22
- :alt: tests
-
-.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
- :target: https://github.com/psf/black
- :alt: Code style: Black
-
-.. .. image:: https://readthedocs.org/projects/skeleton/badge/?version=latest
-.. :target: https://skeleton.readthedocs.io/en/latest/?badge=latest
-
-.. image:: https://img.shields.io/badge/skeleton-2021-informational
- :target: https://blog.jaraco.com/skeleton
-
-`PEP 443 <http://www.python.org/dev/peps/pep-0443/>`_ proposed to expose
-a mechanism in the ``functools`` standard library module in Python 3.4
-that provides a simple form of generic programming known as
-single-dispatch generic functions.
-
-This library is a backport of this functionality and its evolution.
-
-Refer to the `upstream documentation
-<http://docs.python.org/3/library/functools.html#functools.singledispatch>`_
-for API guidance. To use the backport, simply use
-``from singledispatch import singledispatch, singledispatchmethod`` in place of
-``from functools import singledispatch, singledispatchmethod``.
-
-
-
-Maintenance
------------
-
-This backport is maintained on Github by Jason R. Coombs, one of the
-members of the core CPython team:
-
-* `repository <https://github.com/jaraco/singledispatch>`_
-
-* `issue tracker <https://github.com/jaraco/singledispatch/issues>`_
-
-
diff --git a/contrib/deprecated/python/singledispatch/.dist-info/top_level.txt b/contrib/deprecated/python/singledispatch/.dist-info/top_level.txt
deleted file mode 100644
index ebb5ff79be..0000000000
--- a/contrib/deprecated/python/singledispatch/.dist-info/top_level.txt
+++ /dev/null
@@ -1 +0,0 @@
-singledispatch
diff --git a/contrib/deprecated/python/singledispatch/LICENSE b/contrib/deprecated/python/singledispatch/LICENSE
deleted file mode 100644
index 353924be0e..0000000000
--- a/contrib/deprecated/python/singledispatch/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright Jason R. Coombs
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to
-deal in the Software without restriction, including without limitation the
-rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-sell copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-IN THE SOFTWARE.
diff --git a/contrib/deprecated/python/singledispatch/README.rst b/contrib/deprecated/python/singledispatch/README.rst
deleted file mode 100644
index 05084c85fc..0000000000
--- a/contrib/deprecated/python/singledispatch/README.rst
+++ /dev/null
@@ -1,46 +0,0 @@
-.. image:: https://img.shields.io/pypi/v/singledispatch.svg
- :target: `PyPI link`_
-
-.. image:: https://img.shields.io/pypi/pyversions/singledispatch.svg
- :target: `PyPI link`_
-
-.. _PyPI link: https://pypi.org/project/singledispatch
-
-.. image:: https://github.com/jaraco/singledispatch/workflows/tests/badge.svg
- :target: https://github.com/jaraco/singledispatch/actions?query=workflow%3A%22tests%22
- :alt: tests
-
-.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
- :target: https://github.com/psf/black
- :alt: Code style: Black
-
-.. .. image:: https://readthedocs.org/projects/skeleton/badge/?version=latest
-.. :target: https://skeleton.readthedocs.io/en/latest/?badge=latest
-
-.. image:: https://img.shields.io/badge/skeleton-2021-informational
- :target: https://blog.jaraco.com/skeleton
-
-`PEP 443 <http://www.python.org/dev/peps/pep-0443/>`_ proposed to expose
-a mechanism in the ``functools`` standard library module in Python 3.4
-that provides a simple form of generic programming known as
-single-dispatch generic functions.
-
-This library is a backport of this functionality and its evolution.
-
-Refer to the `upstream documentation
-<http://docs.python.org/3/library/functools.html#functools.singledispatch>`_
-for API guidance. To use the backport, simply use
-``from singledispatch import singledispatch, singledispatchmethod`` in place of
-``from functools import singledispatch, singledispatchmethod``.
-
-
-
-Maintenance
------------
-
-This backport is maintained on Github by Jason R. Coombs, one of the
-members of the core CPython team:
-
-* `repository <https://github.com/jaraco/singledispatch>`_
-
-* `issue tracker <https://github.com/jaraco/singledispatch/issues>`_
diff --git a/contrib/deprecated/python/singledispatch/singledispatch/__init__.py b/contrib/deprecated/python/singledispatch/singledispatch/__init__.py
deleted file mode 100644
index f6ec6eaebe..0000000000
--- a/contrib/deprecated/python/singledispatch/singledispatch/__init__.py
+++ /dev/null
@@ -1,300 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-from __future__ import unicode_literals
-
-__all__ = ['singledispatch', 'singledispatchmethod']
-
-from weakref import WeakKeyDictionary
-
-from .helpers import MappingProxyType, get_cache_token, get_type_hints, update_wrapper
-
-################################################################################
-### singledispatch() - single-dispatch generic function decorator
-################################################################################
-
-def _c3_merge(sequences):
- """Merges MROs in *sequences* to a single MRO using the C3 algorithm.
-
- Adapted from http://www.python.org/download/releases/2.3/mro/.
-
- """
- result = []
- while True:
- sequences = [s for s in sequences if s] # purge empty sequences
- if not sequences:
- return result
- for s1 in sequences: # find merge candidates among seq heads
- candidate = s1[0]
- for s2 in sequences:
- if candidate in s2[1:]:
- candidate = None
- break # reject the current head, it appears later
- else:
- break
- if candidate is None:
- raise RuntimeError("Inconsistent hierarchy")
- result.append(candidate)
- # remove the chosen candidate
- for seq in sequences:
- if seq[0] == candidate:
- del seq[0]
-
-def _c3_mro(cls, abcs=None):
- """Computes the method resolution order using extended C3 linearization.
-
- If no *abcs* are given, the algorithm works exactly like the built-in C3
- linearization used for method resolution.
-
- If given, *abcs* is a list of abstract base classes that should be inserted
- into the resulting MRO. Unrelated ABCs are ignored and don't end up in the
- result. The algorithm inserts ABCs where their functionality is introduced,
- i.e. issubclass(cls, abc) returns True for the class itself but returns
- False for all its direct base classes. Implicit ABCs for a given class
- (either registered or inferred from the presence of a special method like
- __len__) are inserted directly after the last ABC explicitly listed in the
- MRO of said class. If two implicit ABCs end up next to each other in the
- resulting MRO, their ordering depends on the order of types in *abcs*.
-
- """
- for i, base in enumerate(reversed(cls.__bases__)):
- if hasattr(base, '__abstractmethods__'):
- boundary = len(cls.__bases__) - i
- break # Bases up to the last explicit ABC are considered first.
- else:
- boundary = 0
- abcs = list(abcs) if abcs else []
- explicit_bases = list(cls.__bases__[:boundary])
- abstract_bases = []
- other_bases = list(cls.__bases__[boundary:])
- for base in abcs:
- if issubclass(cls, base) and not any(
- issubclass(b, base) for b in cls.__bases__
- ):
- # If *cls* is the class that introduces behaviour described by
- # an ABC *base*, insert said ABC to its MRO.
- abstract_bases.append(base)
- for base in abstract_bases:
- abcs.remove(base)
- explicit_c3_mros = [_c3_mro(base, abcs=abcs) for base in explicit_bases]
- abstract_c3_mros = [_c3_mro(base, abcs=abcs) for base in abstract_bases]
- other_c3_mros = [_c3_mro(base, abcs=abcs) for base in other_bases]
- return _c3_merge(
- [[cls]] +
- explicit_c3_mros + abstract_c3_mros + other_c3_mros +
- [explicit_bases] + [abstract_bases] + [other_bases]
- )
-
-def _compose_mro(cls, types):
- """Calculates the method resolution order for a given class *cls*.
-
- Includes relevant abstract base classes (with their respective bases) from
- the *types* iterable. Uses a modified C3 linearization algorithm.
-
- """
- bases = set(cls.__mro__)
- # Remove entries which are already present in the __mro__ or unrelated.
- def is_related(typ):
- return (typ not in bases and hasattr(typ, '__mro__')
- and issubclass(cls, typ))
- types = [n for n in types if is_related(n)]
- # Remove entries which are strict bases of other entries (they will end up
- # in the MRO anyway.
- def is_strict_base(typ):
- for other in types:
- if typ != other and typ in other.__mro__:
- return True
- return False
- types = [n for n in types if not is_strict_base(n)]
- # Subclasses of the ABCs in *types* which are also implemented by
- # *cls* can be used to stabilize ABC ordering.
- type_set = set(types)
- mro = []
- for typ in types:
- found = []
- for sub in filter(_safe, typ.__subclasses__()):
- if sub not in bases and issubclass(cls, sub):
- found.append([s for s in sub.__mro__ if s in type_set])
- if not found:
- mro.append(typ)
- continue
- # Favor subclasses with the biggest number of useful bases
- found.sort(key=len, reverse=True)
- for sub in found:
- for subcls in sub:
- if subcls not in mro:
- mro.append(subcls)
- return _c3_mro(cls, abcs=mro)
-
-
-def _safe(class_):
- """
- Return if the class is safe for testing as subclass. Ref #2.
- """
- return not getattr(class_, '__origin__', None)
-
-
-def _find_impl(cls, registry):
- """Returns the best matching implementation from *registry* for type *cls*.
-
- Where there is no registered implementation for a specific type, its method
- resolution order is used to find a more generic implementation.
-
- Note: if *registry* does not contain an implementation for the base
- *object* type, this function may return None.
-
- """
- mro = _compose_mro(cls, registry.keys())
- match = None
- for t in mro:
- if match is not None:
- # If *match* is an implicit ABC but there is another unrelated,
- # equally matching implicit ABC, refuse the temptation to guess.
- if (t in registry and t not in cls.__mro__
- and match not in cls.__mro__
- and not issubclass(match, t)):
- raise RuntimeError("Ambiguous dispatch: {0} or {1}".format(
- match, t))
- break
- if t in registry:
- match = t
- return registry.get(match)
-
-def _validate_annotation(annotation):
- """Determine if an annotation is valid for registration.
-
- An annotation is considered valid for use in registration if it is an
- instance of ``type`` and not a generic type from ``typing``.
- """
- try:
- # In Python earlier than 3.7, the classes in typing are considered
- # instances of type, but they invalid for registering single dispatch
- # functions so check against GenericMeta instead.
- from typing import GenericMeta
- valid = not isinstance(annotation, GenericMeta)
- except ImportError:
- # In Python 3.7+, classes in typing are not instances of type.
- valid = isinstance(annotation, type)
- return valid
-
-def singledispatch(func):
- """Single-dispatch generic function decorator.
-
- Transforms a function into a generic function, which can have different
- behaviours depending upon the type of its first argument. The decorated
- function acts as the default implementation, and additional
- implementations can be registered using the register() attribute of the
- generic function.
- """
- registry = {}
- dispatch_cache = WeakKeyDictionary()
- def ns(): pass
- ns.cache_token = None
-
- def dispatch(cls):
- """generic_func.dispatch(cls) -> <function implementation>
-
- Runs the dispatch algorithm to return the best available implementation
- for the given *cls* registered on *generic_func*.
-
- """
- if ns.cache_token is not None:
- current_token = get_cache_token()
- if ns.cache_token != current_token:
- dispatch_cache.clear()
- ns.cache_token = current_token
- try:
- impl = dispatch_cache[cls]
- except KeyError:
- try:
- impl = registry[cls]
- except KeyError:
- impl = _find_impl(cls, registry)
- dispatch_cache[cls] = impl
- return impl
-
- def register(cls, func=None):
- """generic_func.register(cls, func) -> func
-
- Registers a new implementation for the given *cls* on a *generic_func*.
-
- """
- if func is None:
- if isinstance(cls, type):
- return lambda f: register(cls, f)
- ann = getattr(cls, '__annotations__', {})
- if not ann:
- raise TypeError(
- "Invalid first argument to `register()`: {cls!r}. "
- "Use either `@register(some_class)` or plain `@register` "
- "on an annotated function.".format(**locals())
- )
- func = cls
-
- argname, cls = next(iter(get_type_hints(func).items()))
- if not _validate_annotation(cls):
- raise TypeError(
- "Invalid annotation for {argname!r}. "
- "{cls!r} is not a class.".format(**locals())
- )
- registry[cls] = func
- if ns.cache_token is None and hasattr(cls, '__abstractmethods__'):
- ns.cache_token = get_cache_token()
- dispatch_cache.clear()
- return func
-
- def wrapper(*args, **kw):
- if not args:
- raise TypeError('{0} requires at least '
- '1 positional argument'.format(funcname))
-
- return dispatch(args[0].__class__)(*args, **kw)
-
- funcname = getattr(func, '__name__', 'singledispatch function')
- registry[object] = func
- wrapper.register = register
- wrapper.dispatch = dispatch
- wrapper.registry = MappingProxyType(registry)
- wrapper._clear_cache = dispatch_cache.clear
- update_wrapper(wrapper, func)
- return wrapper
-
-
-# Descriptor version
-class singledispatchmethod(object):
- """Single-dispatch generic method descriptor.
-
- Supports wrapping existing descriptors and handles non-descriptor
- callables as instance methods.
- """
-
- def __init__(self, func):
- if not callable(func) and not hasattr(func, "__get__"):
- raise TypeError("{!r} is not callable or a descriptor".format(func))
-
- self.dispatcher = singledispatch(func)
- self.func = func
-
- def register(self, cls, method=None):
- """generic_method.register(cls, func) -> func
-
- Registers a new implementation for the given *cls* on a *generic_method*.
- """
- return self.dispatcher.register(cls, func=method)
-
- def __get__(self, obj, cls=None):
- def _method(*args, **kwargs):
- method = self.dispatcher.dispatch(args[0].__class__)
- return method.__get__(obj, cls)(*args, **kwargs)
-
- _method.__isabstractmethod__ = self.__isabstractmethod__
- _method.register = self.register
- update_wrapper(_method, self.func)
- return _method
-
- @property
- def __isabstractmethod__(self):
- return getattr(self.func, '__isabstractmethod__', False)
diff --git a/contrib/deprecated/python/singledispatch/singledispatch/helpers.py b/contrib/deprecated/python/singledispatch/singledispatch/helpers.py
deleted file mode 100644
index 74e73b1799..0000000000
--- a/contrib/deprecated/python/singledispatch/singledispatch/helpers.py
+++ /dev/null
@@ -1,217 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-from __future__ import unicode_literals
-
-import sys
-from abc import ABCMeta
-
-try:
- from collections.abc import MutableMapping
-except ImportError:
- from collections import MutableMapping
-
-try:
- from collections import UserDict
-except ImportError:
- from UserDict import UserDict
-try:
- from collections import OrderedDict
-except ImportError:
- from ordereddict import OrderedDict
-try:
- from thread import get_ident
-except ImportError:
- try:
- from _thread import get_ident
- except ImportError:
- from _dummy_thread import get_ident
-
-
-def recursive_repr(fillvalue='...'):
- 'Decorator to make a repr function return fillvalue for a recursive call'
-
- def decorating_function(user_function):
- repr_running = set()
-
- def wrapper(self):
- key = id(self), get_ident()
- if key in repr_running:
- return fillvalue
- repr_running.add(key)
- try:
- result = user_function(self)
- finally:
- repr_running.discard(key)
- return result
-
- # Can't use functools.wraps() here because of bootstrap issues
- wrapper.__module__ = getattr(user_function, '__module__')
- wrapper.__doc__ = getattr(user_function, '__doc__')
- wrapper.__name__ = getattr(user_function, '__name__')
- wrapper.__annotations__ = getattr(user_function, '__annotations__', {})
- return wrapper
-
- return decorating_function
-
-
-class ChainMap(MutableMapping):
- ''' A ChainMap groups multiple dicts (or other mappings) together
- to create a single, updateable view.
-
- The underlying mappings are stored in a list. That list is public and can
- accessed or updated using the *maps* attribute. There is no other state.
-
- Lookups search the underlying mappings successively until a key is found.
- In contrast, writes, updates, and deletions only operate on the first
- mapping.
-
- '''
-
- def __init__(self, *maps):
- '''Initialize a ChainMap by setting *maps* to the given mappings.
- If no mappings are provided, a single empty dictionary is used.
-
- '''
- self.maps = list(maps) or [{}] # always at least one map
-
- def __missing__(self, key):
- raise KeyError(key)
-
- def __getitem__(self, key):
- for mapping in self.maps:
- try:
- return mapping[key] # can't use 'key in mapping' with defaultdict
- except KeyError:
- pass
- return self.__missing__(key) # support subclasses that define __missing__
-
- def get(self, key, default=None):
- return self[key] if key in self else default
-
- def __len__(self):
- return len(set().union(*self.maps)) # reuses stored hash values if possible
-
- def __iter__(self):
- return iter(set().union(*self.maps))
-
- def __contains__(self, key):
- return any(key in m for m in self.maps)
-
- @recursive_repr()
- def __repr__(self):
- return '{0.__class__.__name__}({1})'.format(
- self, ', '.join(map(repr, self.maps)))
-
- @classmethod
- def fromkeys(cls, iterable, *args):
- 'Create a ChainMap with a single dict created from the iterable.'
- return cls(dict.fromkeys(iterable, *args))
-
- def copy(self):
- 'New ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]'
- return self.__class__(self.maps[0].copy(), *self.maps[1:])
-
- __copy__ = copy
-
- def new_child(self): # like Django's Context.push()
- 'New ChainMap with a new dict followed by all previous maps.'
- return self.__class__({}, *self.maps)
-
- @property
- def parents(self): # like Django's Context.pop()
- 'New ChainMap from maps[1:].'
- return self.__class__(*self.maps[1:])
-
- def __setitem__(self, key, value):
- self.maps[0][key] = value
-
- def __delitem__(self, key):
- try:
- del self.maps[0][key]
- except KeyError:
- raise KeyError('Key not found in the first mapping: {!r}'.format(key))
-
- def popitem(self):
- 'Remove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty.'
- try:
- return self.maps[0].popitem()
- except KeyError:
- raise KeyError('No keys found in the first mapping.')
-
- def pop(self, key, *args):
- 'Remove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].'
- try:
- return self.maps[0].pop(key, *args)
- except KeyError:
- raise KeyError('Key not found in the first mapping: {!r}'.format(key))
-
- def clear(self):
- 'Clear maps[0], leaving maps[1:] intact.'
- self.maps[0].clear()
-
-
-class MappingProxyType(UserDict):
- def __init__(self, data):
- UserDict.__init__(self)
- self.data = data
-
-
-try:
- from abc import get_cache_token
-except ImportError:
- def get_cache_token():
- return ABCMeta._abc_invalidation_counter
-
-
-class Support(object):
- def dummy(self):
- pass
-
- def cpython_only(self, func):
- if 'PyPy' in sys.version:
- return self.dummy
- return func
-
-
-def get_type_hints(func):
- # only import typing if annotation parsing is necessary
- from typing import get_type_hints
- return get_type_hints(func) or getattr(func, '__annotations__', {})
-
-
-WRAPPER_ASSIGNMENTS = ('__module__', '__name__', '__qualname__', '__doc__',
- '__annotations__')
-WRAPPER_UPDATES = ('__dict__',)
-def update_wrapper(wrapper,
- wrapped,
- assigned = WRAPPER_ASSIGNMENTS,
- updated = WRAPPER_UPDATES):
- """Update a wrapper function to look like the wrapped function
-
- wrapper is the function to be updated
- wrapped is the original function
- assigned is a tuple naming the attributes assigned directly
- from the wrapped function to the wrapper function (defaults to
- functools.WRAPPER_ASSIGNMENTS)
- updated is a tuple naming the attributes of the wrapper that
- are updated with the corresponding attribute from the wrapped
- function (defaults to functools.WRAPPER_UPDATES)
- """
- for attr in assigned:
- try:
- value = getattr(wrapped, attr)
- except AttributeError:
- pass
- else:
- setattr(wrapper, attr, value)
- for attr in updated:
- getattr(wrapper, attr).update(getattr(wrapped, attr, {}))
- # Issue #17482: set __wrapped__ last so we don't inadvertently copy it
- # from the wrapped function when updating __dict__
- wrapper.__wrapped__ = wrapped
- # Return the wrapper so this can be used as a decorator via partial()
- return wrapper
diff --git a/contrib/deprecated/python/singledispatch/ya.make b/contrib/deprecated/python/singledispatch/ya.make
deleted file mode 100644
index ee683e8690..0000000000
--- a/contrib/deprecated/python/singledispatch/ya.make
+++ /dev/null
@@ -1,27 +0,0 @@
-# Generated by devtools/yamaker (pypi).
-
-PY2_LIBRARY()
-
-VERSION(3.7.0)
-
-LICENSE(MIT)
-
-PEERDIR(
- contrib/python/six
-)
-
-NO_LINT()
-
-PY_SRCS(
- TOP_LEVEL
- singledispatch/__init__.py
- singledispatch/helpers.py
-)
-
-RESOURCE_FILES(
- PREFIX contrib/deprecated/python/singledispatch/
- .dist-info/METADATA
- .dist-info/top_level.txt
-)
-
-END()