diff options
author | AlexSm <alex@ydb.tech> | 2024-01-04 15:09:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-04 15:09:05 +0100 |
commit | dab291146f6cd7d35684e3a1150e5bb1c412982c (patch) | |
tree | 36ef35f6cacb6432845a4a33f940c95871036b32 /contrib/python | |
parent | 63660ad5e7512029fd0218e7a636580695a24e1f (diff) | |
download | ydb-dab291146f6cd7d35684e3a1150e5bb1c412982c.tar.gz |
Library import 5, delete go dependencies (#832)
* Library import 5, delete go dependencies
* Fix yt client
Diffstat (limited to 'contrib/python')
54 files changed, 669 insertions, 731 deletions
diff --git a/contrib/python/aiohttp/aiohttp/cookiejar.py b/contrib/python/aiohttp/aiohttp/cookiejar.py index 0a2656634d..fe0ef586a5 100644 --- a/contrib/python/aiohttp/aiohttp/cookiejar.py +++ b/contrib/python/aiohttp/aiohttp/cookiejar.py @@ -54,7 +54,7 @@ class CookieJar(AbstractCookieJar): MAX_TIME = datetime.datetime.max.replace(tzinfo=datetime.timezone.utc) - MAX_32BIT_TIME = datetime.datetime.utcfromtimestamp(2 ** 31 - 1) + MAX_32BIT_TIME = datetime.datetime(2038, 1, 19, 3, 14, 7) def __init__( self, diff --git a/contrib/python/clickhouse-connect/.dist-info/METADATA b/contrib/python/clickhouse-connect/.dist-info/METADATA index 5fa5eb3be3..7d7c0d1841 100644 --- a/contrib/python/clickhouse-connect/.dist-info/METADATA +++ b/contrib/python/clickhouse-connect/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: clickhouse-connect -Version: 0.6.22 +Version: 0.6.23 Summary: ClickHouse Database Core Driver for Python, Pandas, and Superset Home-page: https://github.com/ClickHouse/clickhouse-connect Author: ClickHouse Inc. diff --git a/contrib/python/clickhouse-connect/clickhouse_connect/__version__.py b/contrib/python/clickhouse-connect/clickhouse_connect/__version__.py index 82bda8ba8d..35ae43369d 100644 --- a/contrib/python/clickhouse-connect/clickhouse_connect/__version__.py +++ b/contrib/python/clickhouse-connect/clickhouse_connect/__version__.py @@ -1 +1 @@ -version = '0.6.22' +version = '0.6.23' diff --git a/contrib/python/clickhouse-connect/clickhouse_connect/cc_sqlalchemy/datatypes/sqltypes.py b/contrib/python/clickhouse-connect/clickhouse_connect/cc_sqlalchemy/datatypes/sqltypes.py index dc4fd0895e..403ec20ca5 100644 --- a/contrib/python/clickhouse-connect/clickhouse_connect/cc_sqlalchemy/datatypes/sqltypes.py +++ b/contrib/python/clickhouse-connect/clickhouse_connect/cc_sqlalchemy/datatypes/sqltypes.py @@ -198,6 +198,10 @@ class UUID(ChSqlaType, UserDefinedType): python_type = None +class Nothing(ChSqlaType, UserDefinedType): + python_type = None + + class Point(ChSqlaType, UserDefinedType): python_type = None diff --git a/contrib/python/clickhouse-connect/clickhouse_connect/driver/npquery.py b/contrib/python/clickhouse-connect/clickhouse_connect/driver/npquery.py index 1c063e4082..b037749566 100644 --- a/contrib/python/clickhouse-connect/clickhouse_connect/driver/npquery.py +++ b/contrib/python/clickhouse-connect/clickhouse_connect/driver/npquery.py @@ -94,6 +94,7 @@ class NumpyResult(Closable): def close_df(self): pieces = list(self._df_stream()) + pieces = [piece for piece in pieces if not piece.empty] if len(pieces) > 1: self._df_result = pd.concat(pieces, ignore_index=True) elif len(pieces) == 1: diff --git a/contrib/python/clickhouse-connect/ya.make b/contrib/python/clickhouse-connect/ya.make index ddab31e4d9..5087f8af8a 100644 --- a/contrib/python/clickhouse-connect/ya.make +++ b/contrib/python/clickhouse-connect/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(0.6.22) +VERSION(0.6.23) LICENSE(Apache-2.0) diff --git a/contrib/python/frozenlist/.dist-info/METADATA b/contrib/python/frozenlist/.dist-info/METADATA index 0c9ca3b06f..60603d5a5a 100644 --- a/contrib/python/frozenlist/.dist-info/METADATA +++ b/contrib/python/frozenlist/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: frozenlist -Version: 1.4.0 +Version: 1.4.1 Summary: A list-like structure which implements collections.abc.MutableSequence Home-page: https://github.com/aio-libs/frozenlist Maintainer: aiohttp team <team@aiohttp.org> @@ -15,23 +15,26 @@ Project-URL: Docs: Changelog, https://github.com/aio-libs/frozenlist/blob/master Project-URL: Docs: RTD, https://frozenlist.aio-libs.org Project-URL: GitHub: issues, https://github.com/aio-libs/frozenlist/issues Project-URL: GitHub: repo, https://github.com/aio-libs/frozenlist -Classifier: License :: OSI Approved :: Apache Software License +Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: Apache Software License +Classifier: Operating System :: POSIX +Classifier: Operating System :: MacOS :: MacOS X +Classifier: Operating System :: Microsoft :: Windows +Classifier: Programming Language :: Cython Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 -Classifier: Development Status :: 5 - Production/Stable -Classifier: Operating System :: POSIX -Classifier: Operating System :: MacOS :: MacOS X -Classifier: Operating System :: Microsoft :: Windows +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy Requires-Python: >=3.8 Description-Content-Type: text/x-rst License-File: LICENSE -========== frozenlist ========== @@ -60,7 +63,7 @@ frozenlist :alt: Matrix Space — #aio-libs-space:matrix.org Introduction -============ +------------ ``frozenlist.FrozenList`` is a list-like structure which implements ``collections.abc.MutableSequence``. The list is *mutable* until ``FrozenList.freeze`` @@ -117,29 +120,29 @@ The library requires Python 3.8 or newer. Documentation -============= +------------- https://frozenlist.aio-libs.org Communication channels -====================== +---------------------- We have a *Matrix Space* `#aio-libs-space:matrix.org <https://matrix.to/#/%23aio-libs-space:matrix.org>`_ which is also accessible via Gitter. Requirements -============ +------------ - Python >= 3.8 License -======= +------- ``frozenlist`` is offered under the Apache 2 license. Source code -=========== +----------- The project is hosted on GitHub_ @@ -148,3 +151,270 @@ Please file an issue in the `bug tracker or have some suggestions to improve the library. .. _GitHub: https://github.com/aio-libs/frozenlist + +========= +Changelog +========= + +.. + You should *NOT* be adding new change log entries to this file, this + file is managed by towncrier. You *may* edit previous change logs to + fix problems like typo corrections or such. + To add a new change log entry, please see + https://pip.pypa.io/en/latest/development/contributing/#news-entries + we named the news folder "changes". + + WARNING: Don't drop the next directive! + +.. towncrier release notes start + +1.4.1 (2023-12-15) +================== + +Packaging updates and notes for downstreams +------------------------------------------- + +- Declared Python 3.12 and PyPy 3.8-3.10 supported officially + in the distribution package metadata. + + + *Related issues and pull requests on GitHub:* + `#553 <https://github.com/aio-libs/yarl/issues/553>`__. + +- Replaced the packaging is replaced from an old-fashioned ``setup.py`` to an + in-tree `PEP 517 <https://peps.python.org/pep-517>`__ build backend -- by `@webknjaz <https://github.com/sponsors/webknjaz>`__. + + Whenever the end-users or downstream packagers need to build ``frozenlist`` + from source (a Git checkout or an sdist), they may pass a ``config_settings`` + flag ``pure-python``. If this flag is not set, a C-extension will be built + and included into the distribution. + + Here is how this can be done with ``pip``: + + .. code-block:: console + + $ python3 -m pip install . --config-settings=pure-python= + + This will also work with ``-e | --editable``. + + The same can be achieved via ``pypa/build``: + + .. code-block:: console + + $ python3 -m build --config-setting=pure-python= + + Adding ``-w | --wheel`` can force ``pypa/build`` produce a wheel from source + directly, as opposed to building an ``sdist`` and then building from it. + + + *Related issues and pull requests on GitHub:* + `#560 <https://github.com/aio-libs/yarl/issues/560>`__. + + +Contributor-facing changes +-------------------------- + +- It is now possible to request line tracing in Cython builds using the + ``with-cython-tracing`` `PEP 517 <https://peps.python.org/pep-517>`__ config setting + -- `@webknjaz <https://github.com/sponsors/webknjaz>`__. + + This can be used in CI and development environment to measure coverage + on Cython modules, but is not normally useful to the end-users or + downstream packagers. + + Here's a usage example: + + .. code-block:: console + + $ python3 -Im pip install . --config-settings=with-cython-tracing=true + + For editable installs, this setting is on by default. Otherwise, it's + off unless requested explicitly. + + The following produces C-files required for the Cython coverage + plugin to map the measurements back to the PYX-files: + + .. code-block:: console + + $ python -Im pip install -e . + + Alternatively, the ``FROZENLIST_CYTHON_TRACING=1`` environment variable + can be set to do the same as the `PEP 517 <https://peps.python.org/pep-517>`__ config setting. + + + *Related issues and pull requests on GitHub:* + `#560 <https://github.com/aio-libs/yarl/issues/560>`__. + +- Coverage collection has been implemented for the Cython modules + -- by `@webknjaz <https://github.com/sponsors/webknjaz>`__. + + It will also be reported to Codecov from any non-release CI jobs. + + + *Related issues and pull requests on GitHub:* + `#561 <https://github.com/aio-libs/yarl/issues/561>`__. + +- A step-by-step ``Release Guide`` guide has + been added, describing how to release *frozenlist* -- by `@webknjaz <https://github.com/sponsors/webknjaz>`__. + + This is primarily targeting the maintainers. + + + *Related issues and pull requests on GitHub:* + `#563 <https://github.com/aio-libs/yarl/issues/563>`__. + +- Detailed ``Contributing Guidelines`` on + authoring the changelog fragments have been published in the + documentation -- by `@webknjaz <https://github.com/sponsors/webknjaz>`__. + + + *Related issues and pull requests on GitHub:* + `#564 <https://github.com/aio-libs/yarl/issues/564>`__. + + +---- + + +1.4.0 (2023-07-12) +================== + +The published source distribution package became buildable +under Python 3.12. + + +---- + + +Bugfixes +-------- + +- Removed an unused ``typing.Tuple`` import + `#411 <https://github.com/aio-libs/frozenlist/issues/411>`_ + + +Deprecations and Removals +------------------------- + +- Dropped Python 3.7 support. + `#413 <https://github.com/aio-libs/frozenlist/issues/413>`_ + + +Misc +---- + +- `#410 <https://github.com/aio-libs/frozenlist/issues/410>`_, `#433 <https://github.com/aio-libs/frozenlist/issues/433>`_ + + +---- + + +1.3.3 (2022-11-08) +================== + +- Fixed CI runs when creating a new release, where new towncrier versions + fail when the current version section is already present. + + +---- + + +1.3.2 (2022-11-08) +================== + +Misc +---- + +- Updated the CI runs to better check for test results and to avoid deprecated syntax. `#327 <https://github.com/aio-libs/frozenlist/issues/327>`_ + + +---- + + +1.3.1 (2022-08-02) +================== + +The published source distribution package became buildable +under Python 3.11. + + +---- + + +1.3.0 (2022-01-18) +================== + +Bugfixes +-------- + +- Do not install C sources with binary distributions. + `#250 <https://github.com/aio-libs/frozenlist/issues/250>`_ + + +Deprecations and Removals +------------------------- + +- Dropped Python 3.6 support + `#274 <https://github.com/aio-libs/frozenlist/issues/274>`_ + + +---- + + +1.2.0 (2021-10-16) +================== + +Features +-------- + +- ``FrozenList`` now supports being used as a generic type as per PEP 585, e.g. ``frozen_int_list: FrozenList[int]`` (requires Python 3.9 or newer). + `#172 <https://github.com/aio-libs/frozenlist/issues/172>`_ +- Added support for Python 3.10. + `#227 <https://github.com/aio-libs/frozenlist/issues/227>`_ +- Started shipping platform-specific wheels with the ``musl`` tag targeting typical Alpine Linux runtimes. + `#227 <https://github.com/aio-libs/frozenlist/issues/227>`_ +- Started shipping platform-specific arm64 wheels for Apple Silicon. + `#227 <https://github.com/aio-libs/frozenlist/issues/227>`_ + + +---- + + +1.1.1 (2020-11-14) +================== + +Bugfixes +-------- + +- Provide x86 Windows wheels. + `#169 <https://github.com/aio-libs/frozenlist/issues/169>`_ + + +---- + + +1.1.0 (2020-10-13) +================== + +Features +-------- + +- Add support for hashing of a frozen list. + `#136 <https://github.com/aio-libs/frozenlist/issues/136>`_ + +- Support Python 3.8 and 3.9. + +- Provide wheels for ``aarch64``, ``i686``, ``ppc64le``, ``s390x`` architectures on + Linux as well as ``x86_64``. + + +---- + + +1.0.0 (2019-11-09) +================== + +Deprecations and Removals +------------------------- + +- Dropped support for Python 3.5; only 3.6, 3.7 and 3.8 are supported going forward. + `#24 <https://github.com/aio-libs/frozenlist/issues/24>`_ diff --git a/contrib/python/frozenlist/README.rst b/contrib/python/frozenlist/README.rst index 0e864cf28d..e325c85473 100644 --- a/contrib/python/frozenlist/README.rst +++ b/contrib/python/frozenlist/README.rst @@ -1,4 +1,3 @@ -========== frozenlist ========== @@ -27,7 +26,7 @@ frozenlist :alt: Matrix Space — #aio-libs-space:matrix.org Introduction -============ +------------ ``frozenlist.FrozenList`` is a list-like structure which implements ``collections.abc.MutableSequence``. The list is *mutable* until ``FrozenList.freeze`` @@ -84,29 +83,29 @@ The library requires Python 3.8 or newer. Documentation -============= +------------- https://frozenlist.aio-libs.org Communication channels -====================== +---------------------- We have a *Matrix Space* `#aio-libs-space:matrix.org <https://matrix.to/#/%23aio-libs-space:matrix.org>`_ which is also accessible via Gitter. Requirements -============ +------------ - Python >= 3.8 License -======= +------- ``frozenlist`` is offered under the Apache 2 license. Source code -=========== +----------- The project is hosted on GitHub_ diff --git a/contrib/python/frozenlist/frozenlist/__init__.py b/contrib/python/frozenlist/frozenlist/__init__.py index 152356588d..c0f71368ba 100644 --- a/contrib/python/frozenlist/frozenlist/__init__.py +++ b/contrib/python/frozenlist/frozenlist/__init__.py @@ -5,7 +5,7 @@ from collections.abc import MutableSequence from functools import total_ordering from typing import Type -__version__ = "1.4.0" +__version__ = "1.4.1" __all__ = ("FrozenList", "PyFrozenList") # type: Tuple[str, ...] @@ -86,10 +86,10 @@ class FrozenList(MutableSequence): PyFrozenList = FrozenList -try: - from ._frozenlist import FrozenList as CFrozenList # type: ignore - - if not NO_EXTENSIONS: # pragma: no cover +if not NO_EXTENSIONS: + try: + from ._frozenlist import FrozenList as CFrozenList # type: ignore + except ImportError: # pragma: no cover + pass + else: FrozenList = CFrozenList # type: ignore -except ImportError: # pragma: no cover - pass diff --git a/contrib/python/frozenlist/tests/test_frozenlist.py b/contrib/python/frozenlist/tests/test_frozenlist.py index f3b1a8a4df..403d3ec858 100644 --- a/contrib/python/frozenlist/tests/test_frozenlist.py +++ b/contrib/python/frozenlist/tests/test_frozenlist.py @@ -1,3 +1,6 @@ +# FIXME: +# mypy: disable-error-code="misc" + from collections.abc import MutableSequence import pytest @@ -85,7 +88,7 @@ class FrozenListMixin: def test_lt(self) -> None: _list = self.FrozenList([1]) - assert _list <= [3] + assert _list < [3] def test_ge(self) -> None: _list = self.FrozenList([1]) @@ -239,8 +242,8 @@ class FrozenListMixin: class TestFrozenList(FrozenListMixin): - FrozenList = FrozenList + FrozenList = FrozenList # type: ignore[assignment] # FIXME class TestFrozenListPy(FrozenListMixin): - FrozenList = PyFrozenList + FrozenList = PyFrozenList # type: ignore[assignment] # FIXME diff --git a/contrib/python/frozenlist/ya.make b/contrib/python/frozenlist/ya.make index 4928a9f7da..e737af0b3f 100644 --- a/contrib/python/frozenlist/ya.make +++ b/contrib/python/frozenlist/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(1.4.0) +VERSION(1.4.1) LICENSE(Apache-2.0) diff --git a/contrib/python/httpcore/.dist-info/METADATA b/contrib/python/httpcore/.dist-info/METADATA index 3776738caf..07eab9de21 100644 --- a/contrib/python/httpcore/.dist-info/METADATA +++ b/contrib/python/httpcore/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: httpcore -Version: 0.18.0 +Version: 1.0.2 Summary: A minimal low-level HTTP client. Project-URL: Documentation, https://www.encode.io/httpcore Project-URL: Homepage, https://www.encode.io/httpcore/ @@ -21,16 +21,19 @@ Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 Classifier: Topic :: Internet :: WWW/HTTP Requires-Python: >=3.8 -Requires-Dist: anyio<5.0,>=3.0 Requires-Dist: certifi Requires-Dist: h11<0.15,>=0.13 -Requires-Dist: sniffio==1.* +Provides-Extra: asyncio +Requires-Dist: anyio<5.0,>=4.0; extra == 'asyncio' Provides-Extra: http2 Requires-Dist: h2<5,>=3; extra == 'http2' Provides-Extra: socks Requires-Dist: socksio==1.*; extra == 'socks' +Provides-Extra: trio +Requires-Dist: trio<0.23.0,>=0.22.0; extra == 'trio' Description-Content-Type: text/markdown # HTTP Core @@ -70,16 +73,10 @@ For HTTP/1.1 only support, install with: $ pip install httpcore ``` -For HTTP/1.1 and HTTP/2 support, install with: +There are also a number of optional extras available... ```shell -$ pip install httpcore[http2] -``` - -For SOCKS proxy support, install with: - -```shell -$ pip install httpcore[socks] +$ pip install httpcore['asyncio,trio,http2,socks'] ``` # Sending requests @@ -124,12 +121,59 @@ The motivation for `httpcore` is: * To provide a reusable low-level client library, that other packages can then build on top of. * To provide a *really clear interface split* between the networking code and client logic, so that each is easier to understand and reason about in isolation. + +## Dependencies + +The `httpcore` package has the following dependencies... + +* `h11` +* `certifi` + +And the following optional extras... + +* `anyio` - Required by `pip install httpcore['asyncio']`. +* `trio` - Required by `pip install httpcore['trio']`. +* `h2` - Required by `pip install httpcore['http2']`. +* `socksio` - Required by `pip install httpcore['socks']`. + +## Versioning + +We use [SEMVER for our versioning policy](https://semver.org/). + +For changes between package versions please see our [project changelog](CHANGELOG.md). + +We recommend pinning your requirements either the most current major version, or a more specific version range: + +```python +pip install 'httpcore==1.*' +``` # Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## 1.0.2 (November 10th, 2023) + +- Fix `float("inf")` timeouts in `Event.wait` function. (#846) + +## 1.0.1 (November 3rd, 2023) + +- Fix pool timeout to account for the total time spent retrying. (#823) +- Raise a neater RuntimeError when the correct async deps are not installed. (#826) +- Add support for synchronous TLS-in-TLS streams. (#840) + +## 1.0.0 (October 6th, 2023) + +From version 1.0 our async support is now optional, as the package has minimal dependencies by default. + +For async support use either `pip install 'httpcore[asyncio]'` or `pip install 'httpcore[trio]'`. + +The project versioning policy is now explicitly governed by SEMVER. See https://semver.org/. + +- Async support becomes fully optional. (#809) +- Add support for Python 3.12. (#807) + ## 0.18.0 (September 8th, 2023) - Add support for HTTPS proxies. (#745, #786) diff --git a/contrib/python/httpcore/README.md b/contrib/python/httpcore/README.md index 66a2150016..e7bfd5838f 100644 --- a/contrib/python/httpcore/README.md +++ b/contrib/python/httpcore/README.md @@ -35,16 +35,10 @@ For HTTP/1.1 only support, install with: $ pip install httpcore ``` -For HTTP/1.1 and HTTP/2 support, install with: +There are also a number of optional extras available... ```shell -$ pip install httpcore[http2] -``` - -For SOCKS proxy support, install with: - -```shell -$ pip install httpcore[socks] +$ pip install httpcore['asyncio,trio,http2,socks'] ``` # Sending requests @@ -89,3 +83,29 @@ The motivation for `httpcore` is: * To provide a reusable low-level client library, that other packages can then build on top of. * To provide a *really clear interface split* between the networking code and client logic, so that each is easier to understand and reason about in isolation. + +## Dependencies + +The `httpcore` package has the following dependencies... + +* `h11` +* `certifi` + +And the following optional extras... + +* `anyio` - Required by `pip install httpcore['asyncio']`. +* `trio` - Required by `pip install httpcore['trio']`. +* `h2` - Required by `pip install httpcore['http2']`. +* `socksio` - Required by `pip install httpcore['socks']`. + +## Versioning + +We use [SEMVER for our versioning policy](https://semver.org/). + +For changes between package versions please see our [project changelog](CHANGELOG.md). + +We recommend pinning your requirements either the most current major version, or a more specific version range: + +```python +pip install 'httpcore==1.*' +``` diff --git a/contrib/python/httpcore/httpcore/__init__.py b/contrib/python/httpcore/httpcore/__init__.py index 65abe9716a..eb3e577186 100644 --- a/contrib/python/httpcore/httpcore/__init__.py +++ b/contrib/python/httpcore/httpcore/__init__.py @@ -130,7 +130,7 @@ __all__ = [ "WriteError", ] -__version__ = "0.18.0" +__version__ = "1.0.2" __locals = locals() diff --git a/contrib/python/httpcore/httpcore/_async/connection_pool.py b/contrib/python/httpcore/httpcore/_async/connection_pool.py index ddc0510e60..0320c6d80e 100644 --- a/contrib/python/httpcore/httpcore/_async/connection_pool.py +++ b/contrib/python/httpcore/httpcore/_async/connection_pool.py @@ -1,11 +1,12 @@ import ssl import sys +import time from types import TracebackType from typing import AsyncIterable, AsyncIterator, Iterable, List, Optional, Type from .._backends.auto import AutoBackend from .._backends.base import SOCKET_OPTION, AsyncNetworkBackend -from .._exceptions import ConnectionNotAvailable, UnsupportedProtocol +from .._exceptions import ConnectionNotAvailable, PoolTimeout, UnsupportedProtocol from .._models import Origin, Request, Response from .._synchronization import AsyncEvent, AsyncLock, AsyncShieldCancellation from .connection import AsyncHTTPConnection @@ -220,6 +221,13 @@ class AsyncConnectionPool(AsyncRequestInterface): ) status = RequestStatus(request) + timeouts = request.extensions.get("timeout", {}) + timeout = timeouts.get("pool", None) + + if timeout is not None: + deadline = time.monotonic() + timeout + else: + deadline = float("inf") async with self._pool_lock: self._requests.append(status) @@ -227,8 +235,6 @@ class AsyncConnectionPool(AsyncRequestInterface): await self._attempt_to_acquire_connection(status) while True: - timeouts = request.extensions.get("timeout", {}) - timeout = timeouts.get("pool", None) try: connection = await status.wait_for_connection(timeout=timeout) except BaseException as exc: @@ -263,6 +269,10 @@ class AsyncConnectionPool(AsyncRequestInterface): else: break + timeout = deadline - time.monotonic() + if timeout < 0: + raise PoolTimeout # pragma: nocover + # When we return the response, we wrap the stream in a special class # that handles notifying the connection pool once the response # has been released. @@ -316,6 +326,10 @@ class AsyncConnectionPool(AsyncRequestInterface): self._requests = [] async def __aenter__(self) -> "AsyncConnectionPool": + # Acquiring the pool lock here ensures that we have the + # correct dependencies installed as early as possible. + async with self._pool_lock: + pass return self async def __aexit__( diff --git a/contrib/python/httpcore/httpcore/_backends/auto.py b/contrib/python/httpcore/httpcore/_backends/auto.py index b612ba071c..3ac05f4da0 100644 --- a/contrib/python/httpcore/httpcore/_backends/auto.py +++ b/contrib/python/httpcore/httpcore/_backends/auto.py @@ -1,15 +1,14 @@ import typing from typing import Optional -import sniffio - +from .._synchronization import current_async_library from .base import SOCKET_OPTION, AsyncNetworkBackend, AsyncNetworkStream class AutoBackend(AsyncNetworkBackend): async def _init_backend(self) -> None: if not (hasattr(self, "_backend")): - backend = sniffio.current_async_library() + backend = current_async_library() if backend == "trio": from .trio import TrioBackend diff --git a/contrib/python/httpcore/httpcore/_backends/sync.py b/contrib/python/httpcore/httpcore/_backends/sync.py index f2dbd32afa..7b7b417dc1 100644 --- a/contrib/python/httpcore/httpcore/_backends/sync.py +++ b/contrib/python/httpcore/httpcore/_backends/sync.py @@ -145,12 +145,6 @@ class SyncStream(NetworkStream): server_hostname: typing.Optional[str] = None, timeout: typing.Optional[float] = None, ) -> NetworkStream: - if isinstance(self._sock, ssl.SSLSocket): # pragma: no cover - raise RuntimeError( - "Attempted to add a TLS layer on top of the existing " - "TLS stream, which is not supported by httpcore package" - ) - exc_map: ExceptionMapping = { socket.timeout: ConnectTimeout, OSError: ConnectError, diff --git a/contrib/python/httpcore/httpcore/_sync/connection_pool.py b/contrib/python/httpcore/httpcore/_sync/connection_pool.py index dbcaff1fcf..ccfb8d2220 100644 --- a/contrib/python/httpcore/httpcore/_sync/connection_pool.py +++ b/contrib/python/httpcore/httpcore/_sync/connection_pool.py @@ -1,11 +1,12 @@ import ssl import sys +import time from types import TracebackType from typing import Iterable, Iterator, Iterable, List, Optional, Type from .._backends.sync import SyncBackend from .._backends.base import SOCKET_OPTION, NetworkBackend -from .._exceptions import ConnectionNotAvailable, UnsupportedProtocol +from .._exceptions import ConnectionNotAvailable, PoolTimeout, UnsupportedProtocol from .._models import Origin, Request, Response from .._synchronization import Event, Lock, ShieldCancellation from .connection import HTTPConnection @@ -220,6 +221,13 @@ class ConnectionPool(RequestInterface): ) status = RequestStatus(request) + timeouts = request.extensions.get("timeout", {}) + timeout = timeouts.get("pool", None) + + if timeout is not None: + deadline = time.monotonic() + timeout + else: + deadline = float("inf") with self._pool_lock: self._requests.append(status) @@ -227,8 +235,6 @@ class ConnectionPool(RequestInterface): self._attempt_to_acquire_connection(status) while True: - timeouts = request.extensions.get("timeout", {}) - timeout = timeouts.get("pool", None) try: connection = status.wait_for_connection(timeout=timeout) except BaseException as exc: @@ -263,6 +269,10 @@ class ConnectionPool(RequestInterface): else: break + timeout = deadline - time.monotonic() + if timeout < 0: + raise PoolTimeout # pragma: nocover + # When we return the response, we wrap the stream in a special class # that handles notifying the connection pool once the response # has been released. @@ -316,6 +326,10 @@ class ConnectionPool(RequestInterface): self._requests = [] def __enter__(self) -> "ConnectionPool": + # Acquiring the pool lock here ensures that we have the + # correct dependencies installed as early as possible. + with self._pool_lock: + pass return self def __exit__( diff --git a/contrib/python/httpcore/httpcore/_synchronization.py b/contrib/python/httpcore/httpcore/_synchronization.py index bae27c1b11..119d89fc0d 100644 --- a/contrib/python/httpcore/httpcore/_synchronization.py +++ b/contrib/python/httpcore/httpcore/_synchronization.py @@ -2,8 +2,6 @@ import threading from types import TracebackType from typing import Optional, Type -import sniffio - from ._exceptions import ExceptionMapping, PoolTimeout, map_exceptions # Our async synchronization primatives use either 'anyio' or 'trio' depending @@ -20,6 +18,32 @@ except ImportError: # pragma: nocover anyio = None # type: ignore +def current_async_library() -> str: + # Determine if we're running under trio or asyncio. + # See https://sniffio.readthedocs.io/en/latest/ + try: + import sniffio + except ImportError: # pragma: nocover + environment = "asyncio" + else: + environment = sniffio.current_async_library() + + if environment not in ("asyncio", "trio"): # pragma: nocover + raise RuntimeError("Running under an unsupported async environment.") + + if environment == "asyncio" and anyio is None: # pragma: nocover + raise RuntimeError( + "Running with asyncio requires installation of 'httpcore[asyncio]'." + ) + + if environment == "trio" and trio is None: # pragma: nocover + raise RuntimeError( + "Running with trio requires installation of 'httpcore[trio]'." + ) + + return environment + + class AsyncLock: def __init__(self) -> None: self._backend = "" @@ -29,18 +53,10 @@ class AsyncLock: Detect if we're running under 'asyncio' or 'trio' and create a lock with the correct implementation. """ - self._backend = sniffio.current_async_library() + self._backend = current_async_library() if self._backend == "trio": - if trio is None: # pragma: nocover - raise RuntimeError( - "Running under trio, requires the 'trio' package to be installed." - ) self._trio_lock = trio.Lock() - else: - if anyio is None: # pragma: nocover - raise RuntimeError( - "Running under asyncio requires the 'anyio' package to be installed." - ) + elif self._backend == "asyncio": self._anyio_lock = anyio.Lock() async def __aenter__(self) -> "AsyncLock": @@ -49,7 +65,7 @@ class AsyncLock: if self._backend == "trio": await self._trio_lock.acquire() - else: + elif self._backend == "asyncio": await self._anyio_lock.acquire() return self @@ -62,7 +78,7 @@ class AsyncLock: ) -> None: if self._backend == "trio": self._trio_lock.release() - else: + elif self._backend == "asyncio": self._anyio_lock.release() @@ -75,18 +91,10 @@ class AsyncEvent: Detect if we're running under 'asyncio' or 'trio' and create a lock with the correct implementation. """ - self._backend = sniffio.current_async_library() + self._backend = current_async_library() if self._backend == "trio": - if trio is None: # pragma: nocover - raise RuntimeError( - "Running under trio requires the 'trio' package to be installed." - ) self._trio_event = trio.Event() - else: - if anyio is None: # pragma: nocover - raise RuntimeError( - "Running under asyncio requires the 'anyio' package to be installed." - ) + elif self._backend == "asyncio": self._anyio_event = anyio.Event() def set(self) -> None: @@ -95,7 +103,7 @@ class AsyncEvent: if self._backend == "trio": self._trio_event.set() - else: + elif self._backend == "asyncio": self._anyio_event.set() async def wait(self, timeout: Optional[float] = None) -> None: @@ -103,22 +111,12 @@ class AsyncEvent: self.setup() if self._backend == "trio": - if trio is None: # pragma: nocover - raise RuntimeError( - "Running under trio requires the 'trio' package to be installed." - ) - trio_exc_map: ExceptionMapping = {trio.TooSlowError: PoolTimeout} timeout_or_inf = float("inf") if timeout is None else timeout with map_exceptions(trio_exc_map): with trio.fail_after(timeout_or_inf): await self._trio_event.wait() - else: - if anyio is None: # pragma: nocover - raise RuntimeError( - "Running under asyncio requires the 'anyio' package to be installed." - ) - + elif self._backend == "asyncio": anyio_exc_map: ExceptionMapping = {TimeoutError: PoolTimeout} with map_exceptions(anyio_exc_map): with anyio.fail_after(timeout): @@ -135,22 +133,12 @@ class AsyncSemaphore: Detect if we're running under 'asyncio' or 'trio' and create a semaphore with the correct implementation. """ - self._backend = sniffio.current_async_library() + self._backend = current_async_library() if self._backend == "trio": - if trio is None: # pragma: nocover - raise RuntimeError( - "Running under trio requires the 'trio' package to be installed." - ) - self._trio_semaphore = trio.Semaphore( initial_value=self._bound, max_value=self._bound ) - else: - if anyio is None: # pragma: nocover - raise RuntimeError( - "Running under asyncio requires the 'anyio' package to be installed." - ) - + elif self._backend == "asyncio": self._anyio_semaphore = anyio.Semaphore( initial_value=self._bound, max_value=self._bound ) @@ -161,13 +149,13 @@ class AsyncSemaphore: if self._backend == "trio": await self._trio_semaphore.acquire() - else: + elif self._backend == "asyncio": await self._anyio_semaphore.acquire() async def release(self) -> None: if self._backend == "trio": self._trio_semaphore.release() - else: + elif self._backend == "asyncio": self._anyio_semaphore.release() @@ -184,27 +172,17 @@ class AsyncShieldCancellation: Detect if we're running under 'asyncio' or 'trio' and create a shielded scope with the correct implementation. """ - self._backend = sniffio.current_async_library() + self._backend = current_async_library() if self._backend == "trio": - if trio is None: # pragma: nocover - raise RuntimeError( - "Running under trio requires the 'trio' package to be installed." - ) - self._trio_shield = trio.CancelScope(shield=True) - else: - if anyio is None: # pragma: nocover - raise RuntimeError( - "Running under asyncio requires the 'anyio' package to be installed." - ) - + elif self._backend == "asyncio": self._anyio_shield = anyio.CancelScope(shield=True) def __enter__(self) -> "AsyncShieldCancellation": if self._backend == "trio": self._trio_shield.__enter__() - else: + elif self._backend == "asyncio": self._anyio_shield.__enter__() return self @@ -216,7 +194,7 @@ class AsyncShieldCancellation: ) -> None: if self._backend == "trio": self._trio_shield.__exit__(exc_type, exc_value, traceback) - else: + elif self._backend == "asyncio": self._anyio_shield.__exit__(exc_type, exc_value, traceback) @@ -248,6 +226,8 @@ class Event: self._event.set() def wait(self, timeout: Optional[float] = None) -> None: + if timeout == float("inf"): # pragma: no cover + timeout = None if not self._event.wait(timeout=timeout): raise PoolTimeout() # pragma: nocover diff --git a/contrib/python/httpcore/ya.make b/contrib/python/httpcore/ya.make index e8516afe10..de7a3ac5a2 100644 --- a/contrib/python/httpcore/ya.make +++ b/contrib/python/httpcore/ya.make @@ -2,15 +2,13 @@ PY3_LIBRARY() -VERSION(0.18.0) +VERSION(1.0.2) LICENSE(BSD-3-Clause) PEERDIR( - contrib/python/anyio contrib/python/certifi contrib/python/h11 - contrib/python/sniffio ) NO_LINT() diff --git a/contrib/python/httplib2/py2/.dist-info/METADATA b/contrib/python/httplib2/py2/.dist-info/METADATA index 325c6f76b7..933bfa0bda 100644 --- a/contrib/python/httplib2/py2/.dist-info/METADATA +++ b/contrib/python/httplib2/py2/.dist-info/METADATA @@ -1,12 +1,11 @@ Metadata-Version: 2.1 Name: httplib2 -Version: 0.20.4 +Version: 0.22.0 Summary: A comprehensive HTTP client library. Home-page: https://github.com/httplib2/httplib2 Author: Joe Gregorio Author-email: joe@bitworking.org License: MIT -Platform: UNKNOWN Classifier: Development Status :: 4 - Beta Classifier: Environment :: Web Environment Classifier: Intended Audience :: Developers @@ -22,6 +21,8 @@ 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 +Classifier: Programming Language :: Python :: 3.11 Classifier: Topic :: Internet :: WWW/HTTP Classifier: Topic :: Software Development :: Libraries Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* @@ -72,5 +73,3 @@ A comprehensive HTTP client library, ``httplib2`` supports many features left ou **Unit Tested** A large and growing set of unit tests. - - diff --git a/contrib/python/httplib2/py2/README.md b/contrib/python/httplib2/py2/README.md index 329c4a4892..61936996c1 100644 --- a/contrib/python/httplib2/py2/README.md +++ b/contrib/python/httplib2/py2/README.md @@ -4,6 +4,8 @@ Introduction httplib2 is a comprehensive HTTP client library, httplib2.py supports many features left out of other HTTP libraries. +If you want to help this project by bug report or code change, [contribution guidelines](contributing.md) may contain useful information. + ### HTTP and HTTPS HTTPS support is only available if the socket module was diff --git a/contrib/python/httplib2/py2/httplib2/__init__.py b/contrib/python/httplib2/py2/httplib2/__init__.py index a9f793d6e8..0f36fabbc8 100644 --- a/contrib/python/httplib2/py2/httplib2/__init__.py +++ b/contrib/python/httplib2/py2/httplib2/__init__.py @@ -17,9 +17,10 @@ __contributors__ = [ "Sam Ruby", "Louis Nyffenegger", "Alex Yu", + "Lai Han", ] __license__ = "MIT" -__version__ = "0.20.4" +__version__ = "0.22.0" import base64 import calendar @@ -467,7 +468,10 @@ def _decompressContent(response, new_content): if encoding == "gzip": content = gzip.GzipFile(fileobj=StringIO.StringIO(new_content)).read() if encoding == "deflate": - content = zlib.decompress(content, -zlib.MAX_WBITS) + try: + content = zlib.decompress(content, zlib.MAX_WBITS) + except (IOError, zlib.error): + content = zlib.decompress(content, -zlib.MAX_WBITS) response["content-length"] = str(len(content)) # Record the historical presence of the encoding in a way the won't interfere. response["-content-encoding"] = response["content-encoding"] diff --git a/contrib/python/httplib2/py2/ya.make b/contrib/python/httplib2/py2/ya.make index 773b4e514b..7b99907baf 100644 --- a/contrib/python/httplib2/py2/ya.make +++ b/contrib/python/httplib2/py2/ya.make @@ -1,19 +1,16 @@ -# Edited to peerdir certifi, dispatch between py2 and py3, remove -# certs.txt. - PY2_LIBRARY() -LICENSE(MIT) - -VERSION(0.20.4) +VERSION(0.22.0) -NO_LINT() +LICENSE(MIT) PEERDIR( contrib/python/certifi contrib/python/pyparsing ) +NO_LINT() + PY_SRCS( TOP_LEVEL httplib2/__init__.py diff --git a/contrib/python/matplotlib/py2/matplotlib/__init__.py b/contrib/python/matplotlib/py2/matplotlib/__init__.py index f561dfd012..506f634d4d 100644 --- a/contrib/python/matplotlib/py2/matplotlib/__init__.py +++ b/contrib/python/matplotlib/py2/matplotlib/__init__.py @@ -104,7 +104,10 @@ from __future__ import absolute_import, division, print_function import six import atexit -from collections import MutableMapping +try: + from collections.abc import MutableMapping +except ImportError: + from collections import MutableMapping import contextlib import distutils.version import functools diff --git a/contrib/python/matplotlib/py2/matplotlib/_version.py b/contrib/python/matplotlib/py2/matplotlib/_version.py index 73a3f6fbf3..ea4bce57c9 100644 --- a/contrib/python/matplotlib/py2/matplotlib/_version.py +++ b/contrib/python/matplotlib/py2/matplotlib/_version.py @@ -1,460 +1,21 @@ -# This file helps to compute a version number in source trees obtained from -# git-archive tarball (such as those provided by githubs download-from-tag -# feature). Distribution tarballs (built by setup.py sdist) and build -# directories (produced by setup.py build) will contain a much shorter file -# that just contains the computed version number. +# This file was generated by 'versioneer.py' (0.15) from +# revision-control system data, or from the parent directory name of an +# unpacked source archive. Distribution tarballs contain a pre-generated copy +# of this file. -# This file is released into the public domain. Generated by -# versioneer-0.15 (https://github.com/warner/python-versioneer) - -import errno -import os -import re -import subprocess +import json import sys - -def get_keywords(): - # these strings will be replaced by git during git-archive. - # setup.py/versioneer.py will grep for the variable names, so they must - # each be defined on a line of their own. _version.py will just call - # get_keywords(). - git_refnames = " (tag: v2.2.4)" - git_full = "bff1e4b201baf34df3f3a6fbb408f0e2c1068dd9" - keywords = {"refnames": git_refnames, "full": git_full} - return keywords - - -class VersioneerConfig: - pass - - -def get_config(): - # these strings are filled in when 'setup.py versioneer' creates - # _version.py - cfg = VersioneerConfig() - cfg.VCS = "git" - cfg.style = "pep440-post" - cfg.tag_prefix = "v" - cfg.parentdir_prefix = "matplotlib-" - cfg.versionfile_source = "lib/matplotlib/_version.py" - cfg.verbose = False - return cfg - - -class NotThisMethod(Exception): - pass - - -LONG_VERSION_PY = {} -HANDLERS = {} - - -def register_vcs_handler(vcs, method): # decorator - def decorate(f): - if vcs not in HANDLERS: - HANDLERS[vcs] = {} - HANDLERS[vcs][method] = f - return f - return decorate - - -def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False): - assert isinstance(commands, list) - p = None - for c in commands: - try: - dispcmd = str([c] + args) - # remember shell=False, so use git.cmd on windows, not just git - p = subprocess.Popen([c] + args, cwd=cwd, stdout=subprocess.PIPE, - stderr=(subprocess.PIPE if hide_stderr - else None)) - break - except EnvironmentError: - e = sys.exc_info()[1] - if e.errno == errno.ENOENT: - continue - if verbose: - print("unable to run %s" % dispcmd) - print(e) - return None - else: - if verbose: - print("unable to find command, tried %s" % (commands,)) - return None - stdout = p.communicate()[0].strip() - if sys.version_info[0] >= 3: - stdout = stdout.decode() - if p.returncode != 0: - if verbose: - print("unable to run %s (error)" % dispcmd) - return None - return stdout - - -def versions_from_parentdir(parentdir_prefix, root, verbose): - # Source tarballs conventionally unpack into a directory that includes - # both the project name and a version string. - dirname = os.path.basename(root) - if not dirname.startswith(parentdir_prefix): - if verbose: - print("guessing rootdir is '%s', but '%s' doesn't start with " - "prefix '%s'" % (root, dirname, parentdir_prefix)) - raise NotThisMethod("rootdir doesn't start with parentdir_prefix") - return {"version": dirname[len(parentdir_prefix):], - "full-revisionid": None, - "dirty": False, "error": None} - - -@register_vcs_handler("git", "get_keywords") -def git_get_keywords(versionfile_abs): - # the code embedded in _version.py can just fetch the value of these - # keywords. When used from setup.py, we don't want to import _version.py, - # so we do it with a regexp instead. This function is not used from - # _version.py. - keywords = {} - try: - f = open(versionfile_abs, "r") - for line in f.readlines(): - if line.strip().startswith("git_refnames ="): - mo = re.search(r'=\s*"(.*)"', line) - if mo: - keywords["refnames"] = mo.group(1) - if line.strip().startswith("git_full ="): - mo = re.search(r'=\s*"(.*)"', line) - if mo: - keywords["full"] = mo.group(1) - f.close() - except EnvironmentError: - pass - return keywords - - -@register_vcs_handler("git", "keywords") -def git_versions_from_keywords(keywords, tag_prefix, verbose): - if not keywords: - raise NotThisMethod("no keywords at all, weird") - refnames = keywords["refnames"].strip() - if refnames.startswith("$Format"): - if verbose: - print("keywords are unexpanded, not using") - raise NotThisMethod("unexpanded keywords, not a git-archive tarball") - refs = set([r.strip() for r in refnames.strip("()").split(",")]) - # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of - # just "foo-1.0". If we see a "tag: " prefix, prefer those. - TAG = "tag: " - tags = set([r[len(TAG):] for r in refs if r.startswith(TAG)]) - if not tags: - # Either we're using git < 1.8.3, or there really are no tags. We use - # a heuristic: assume all version tags have a digit. The old git %d - # expansion behaves like git log --decorate=short and strips out the - # refs/heads/ and refs/tags/ prefixes that would let us distinguish - # between branches and tags. By ignoring refnames without digits, we - # filter out many common branch names like "release" and - # "stabilization", as well as "HEAD" and "master". - tags = set([r for r in refs if re.search(r'\d', r)]) - if verbose: - print("discarding '%s', no digits" % ",".join(refs-tags)) - if verbose: - print("likely tags: %s" % ",".join(sorted(tags))) - for ref in sorted(tags): - # sorting will prefer e.g. "2.0" over "2.0rc1" - if ref.startswith(tag_prefix): - r = ref[len(tag_prefix):] - if verbose: - print("picking %s" % r) - return {"version": r, - "full-revisionid": keywords["full"].strip(), - "dirty": False, "error": None - } - # no suitable tags, so version is "0+unknown", but full hex is still there - if verbose: - print("no suitable tags, using unknown + full revision id") - return {"version": "0+unknown", - "full-revisionid": keywords["full"].strip(), - "dirty": False, "error": "no suitable tags"} - - -@register_vcs_handler("git", "pieces_from_vcs") -def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): - # this runs 'git' from the root of the source tree. This only gets called - # if the git-archive 'subst' keywords were *not* expanded, and - # _version.py hasn't already been rewritten with a short version string, - # meaning we're inside a checked out source tree. - - if not os.path.exists(os.path.join(root, ".git")): - if verbose: - print("no .git in %s" % root) - raise NotThisMethod("no .git directory") - - GITS = ["git"] - if sys.platform == "win32": - GITS = ["git.cmd", "git.exe"] - # if there is a tag, this yields TAG-NUM-gHEX[-dirty] - # if there are no tags, this yields HEX[-dirty] (no NUM) - describe_out = run_command(GITS, ["describe", "--tags", "--dirty", - "--always", "--long"], - cwd=root) - # --long was added in git-1.5.5 - if describe_out is None: - raise NotThisMethod("'git describe' failed") - describe_out = describe_out.strip() - full_out = run_command(GITS, ["rev-parse", "HEAD"], cwd=root) - if full_out is None: - raise NotThisMethod("'git rev-parse' failed") - full_out = full_out.strip() - - pieces = {} - pieces["long"] = full_out - pieces["short"] = full_out[:7] # maybe improved later - pieces["error"] = None - - # parse describe_out. It will be like TAG-NUM-gHEX[-dirty] or HEX[-dirty] - # TAG might have hyphens. - git_describe = describe_out - - # look for -dirty suffix - dirty = git_describe.endswith("-dirty") - pieces["dirty"] = dirty - if dirty: - git_describe = git_describe[:git_describe.rindex("-dirty")] - - # now we have TAG-NUM-gHEX or HEX - - if "-" in git_describe: - # TAG-NUM-gHEX - mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe) - if not mo: - # unparseable. Maybe git-describe is misbehaving? - pieces["error"] = ("unable to parse git-describe output: '%s'" - % describe_out) - return pieces - - # tag - full_tag = mo.group(1) - if not full_tag.startswith(tag_prefix): - if verbose: - fmt = "tag '%s' doesn't start with prefix '%s'" - print(fmt % (full_tag, tag_prefix)) - pieces["error"] = ("tag '%s' doesn't start with prefix '%s'" - % (full_tag, tag_prefix)) - return pieces - pieces["closest-tag"] = full_tag[len(tag_prefix):] - - # distance: number of commits since tag - pieces["distance"] = int(mo.group(2)) - - # commit: short hex revision ID - pieces["short"] = mo.group(3) - - else: - # HEX: no tags - pieces["closest-tag"] = None - count_out = run_command(GITS, ["rev-list", "HEAD", "--count"], - cwd=root) - pieces["distance"] = int(count_out) # total number of commits - - return pieces - - -def plus_or_dot(pieces): - if "+" in pieces.get("closest-tag", ""): - return "." - return "+" - - -def render_pep440(pieces): - # now build up version string, with post-release "local version - # identifier". Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you - # get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty - - # exceptions: - # 1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty] - - if pieces["closest-tag"]: - rendered = pieces["closest-tag"] - if pieces["distance"] or pieces["dirty"]: - rendered += plus_or_dot(pieces) - rendered += "%d.g%s" % (pieces["distance"], pieces["short"]) - if pieces["dirty"]: - rendered += ".dirty" - else: - # exception #1 - rendered = "0+untagged.%d.g%s" % (pieces["distance"], - pieces["short"]) - if pieces["dirty"]: - rendered += ".dirty" - return rendered - - -def render_pep440_pre(pieces): - # TAG[.post.devDISTANCE] . No -dirty - - # exceptions: - # 1: no tags. 0.post.devDISTANCE - - if pieces["closest-tag"]: - rendered = pieces["closest-tag"] - if pieces["distance"]: - rendered += ".post.dev%d" % pieces["distance"] - else: - # exception #1 - rendered = "0.post.dev%d" % pieces["distance"] - return rendered - - -def render_pep440_post(pieces): - # TAG[.postDISTANCE[.dev0]+gHEX] . The ".dev0" means dirty. Note that - # .dev0 sorts backwards (a dirty tree will appear "older" than the - # corresponding clean one), but you shouldn't be releasing software with - # -dirty anyways. - - # exceptions: - # 1: no tags. 0.postDISTANCE[.dev0] - - if pieces["closest-tag"]: - rendered = pieces["closest-tag"] - if pieces["distance"] or pieces["dirty"]: - rendered += ".post%d" % pieces["distance"] - if pieces["dirty"]: - rendered += ".dev0" - rendered += plus_or_dot(pieces) - rendered += "g%s" % pieces["short"] - else: - # exception #1 - rendered = "0.post%d" % pieces["distance"] - if pieces["dirty"]: - rendered += ".dev0" - rendered += "+g%s" % pieces["short"] - return rendered - - -def render_pep440_old(pieces): - # TAG[.postDISTANCE[.dev0]] . The ".dev0" means dirty. - - # exceptions: - # 1: no tags. 0.postDISTANCE[.dev0] - - if pieces["closest-tag"]: - rendered = pieces["closest-tag"] - if pieces["distance"] or pieces["dirty"]: - rendered += ".post%d" % pieces["distance"] - if pieces["dirty"]: - rendered += ".dev0" - else: - # exception #1 - rendered = "0.post%d" % pieces["distance"] - if pieces["dirty"]: - rendered += ".dev0" - return rendered - - -def render_git_describe(pieces): - # TAG[-DISTANCE-gHEX][-dirty], like 'git describe --tags --dirty - # --always' - - # exceptions: - # 1: no tags. HEX[-dirty] (note: no 'g' prefix) - - if pieces["closest-tag"]: - rendered = pieces["closest-tag"] - if pieces["distance"]: - rendered += "-%d-g%s" % (pieces["distance"], pieces["short"]) - else: - # exception #1 - rendered = pieces["short"] - if pieces["dirty"]: - rendered += "-dirty" - return rendered - - -def render_git_describe_long(pieces): - # TAG-DISTANCE-gHEX[-dirty], like 'git describe --tags --dirty - # --always -long'. The distance/hash is unconditional. - - # exceptions: - # 1: no tags. HEX[-dirty] (note: no 'g' prefix) - - if pieces["closest-tag"]: - rendered = pieces["closest-tag"] - rendered += "-%d-g%s" % (pieces["distance"], pieces["short"]) - else: - # exception #1 - rendered = pieces["short"] - if pieces["dirty"]: - rendered += "-dirty" - return rendered - - -def render(pieces, style): - if pieces["error"]: - return {"version": "unknown", - "full-revisionid": pieces.get("long"), - "dirty": None, - "error": pieces["error"]} - - if not style or style == "default": - style = "pep440" # the default - - if style == "pep440": - rendered = render_pep440(pieces) - elif style == "pep440-pre": - rendered = render_pep440_pre(pieces) - elif style == "pep440-post": - rendered = render_pep440_post(pieces) - elif style == "pep440-old": - rendered = render_pep440_old(pieces) - elif style == "git-describe": - rendered = render_git_describe(pieces) - elif style == "git-describe-long": - rendered = render_git_describe_long(pieces) - else: - raise ValueError("unknown style '%s'" % style) - - return {"version": rendered, "full-revisionid": pieces["long"], - "dirty": pieces["dirty"], "error": None} +version_json = ''' +{ + "dirty": false, + "error": null, + "full-revisionid": "61e004913460345d108b60506a4deb9f8380eeab", + "version": "2.2.5" +} +''' # END VERSION_JSON def get_versions(): - # I am in _version.py, which lives at ROOT/VERSIONFILE_SOURCE. If we have - # __file__, we can work backwards from there to the root. Some - # py2exe/bbfreeze/non-CPython implementations don't do __file__, in which - # case we can only use expanded keywords. - - cfg = get_config() - verbose = cfg.verbose - - try: - return git_versions_from_keywords(get_keywords(), cfg.tag_prefix, - verbose) - except NotThisMethod: - pass - - try: - root = os.path.realpath(__file__) - # versionfile_source is the relative path from the top of the source - # tree (where the .git directory might live) to this file. Invert - # this to find the root from __file__. - for i in cfg.versionfile_source.split('/'): - root = os.path.dirname(root) - except NameError: - return {"version": "0+unknown", "full-revisionid": None, - "dirty": None, - "error": "unable to find root of source tree"} - - try: - pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose) - return render(pieces, cfg.style) - except NotThisMethod: - pass - - try: - if cfg.parentdir_prefix: - return versions_from_parentdir(cfg.parentdir_prefix, root, verbose) - except NotThisMethod: - pass - - return {"version": "0+unknown", "full-revisionid": None, - "dirty": None, - "error": "unable to compute version"} + return json.loads(version_json) diff --git a/contrib/python/matplotlib/py2/matplotlib/backends/backend_qt5.py b/contrib/python/matplotlib/py2/matplotlib/backends/backend_qt5.py index f70bf6f1dc..20b0b5bc1b 100644 --- a/contrib/python/matplotlib/py2/matplotlib/backends/backend_qt5.py +++ b/contrib/python/matplotlib/py2/matplotlib/backends/backend_qt5.py @@ -506,7 +506,8 @@ class FigureCanvasQT(QtWidgets.QWidget, FigureCanvasBase): # current event loop in order to ensure thread affinity and to # accumulate multiple draw requests from event handling. # TODO: queued signal connection might be safer than singleShot - if not (self._draw_pending or self._is_drawing): + if not (getattr(self, '_draw_pending', False) or + getattr(self, '_is_drawing', False)): self._draw_pending = True QtCore.QTimer.singleShot(0, self._draw_idle) diff --git a/contrib/python/matplotlib/py2/matplotlib/backends/backend_qt5agg.py b/contrib/python/matplotlib/py2/matplotlib/backends/backend_qt5agg.py index 826156e678..d2166d58c8 100644 --- a/contrib/python/matplotlib/py2/matplotlib/backends/backend_qt5agg.py +++ b/contrib/python/matplotlib/py2/matplotlib/backends/backend_qt5agg.py @@ -68,7 +68,7 @@ class FigureCanvasQTAgg(FigureCanvasAgg, FigureCanvasQT): if hasattr(qimage, 'setDevicePixelRatio'): # Not available on Qt4 or some older Qt5. qimage.setDevicePixelRatio(self._dpi_ratio) - origin = QtCore.QPoint(l, self.renderer.height - t) + origin = QtCore.QPoint(int(l), int(self.renderer.height - t)) painter.drawImage(origin / self._dpi_ratio, qimage) self._draw_rect_callback(painter) diff --git a/contrib/python/matplotlib/py2/matplotlib/backends/qt_editor/figureoptions.py b/contrib/python/matplotlib/py2/matplotlib/backends/qt_editor/figureoptions.py index 40572c8bd8..f0050d3675 100644 --- a/contrib/python/matplotlib/py2/matplotlib/backends/qt_editor/figureoptions.py +++ b/contrib/python/matplotlib/py2/matplotlib/backends/qt_editor/figureoptions.py @@ -222,7 +222,7 @@ def figure_edit(axes, parent=None): rgba = mcolors.to_rgba(color) line.set_alpha(None) line.set_color(rgba) - if marker is not 'none': + if marker != 'none': line.set_marker(marker) line.set_markersize(markersize) line.set_markerfacecolor(markerfacecolor) diff --git a/contrib/python/matplotlib/py2/matplotlib/cbook/__init__.py b/contrib/python/matplotlib/py2/matplotlib/cbook/__init__.py index dcb2d0549d..7de81661c5 100644 --- a/contrib/python/matplotlib/py2/matplotlib/cbook/__init__.py +++ b/contrib/python/matplotlib/py2/matplotlib/cbook/__init__.py @@ -11,6 +11,11 @@ from __future__ import absolute_import, division, print_function import six from six.moves import xrange, zip import collections +try: + import collections.abc as cabc +except ImportError: + import collections as cabc + import contextlib import datetime import errno @@ -2061,7 +2066,36 @@ def _check_1d(x): return np.atleast_1d(x) else: try: - x[:, None] + # work around + # https://github.com/pandas-dev/pandas/issues/27775 which + # means the shape of multi-dimensional slicing is not as + # expected. That this ever worked was an unintentional + # quirk of pandas and will raise an exception in the + # future. This slicing warns in pandas >= 1.0rc0 via + # https://github.com/pandas-dev/pandas/pull/30588 + # + # < 1.0rc0 : x[:, None].ndim == 1, no warning, custom type + # >= 1.0rc1 : x[:, None].ndim == 2, warns, numpy array + # future : x[:, None] -> raises + # + # This code should correctly identify and coerce to a + # numpy array all pandas versions. + with warnings.catch_warnings(record=True) as w: + warnings.filterwarnings( + "always", + category=DeprecationWarning, + message='Support for multi-dimensional indexing') + + ndim = x[:, None].ndim + # we have definitely hit a pandas index or series object + # cast to a numpy array. + if len(w) > 0: + return np.asanyarray(x) + # We have likely hit a pandas object, or at least + # something where 2D slicing does not result in a 2D + # object. + if ndim < 2: + return np.atleast_1d(x) return x except (IndexError, TypeError): return np.atleast_1d(x) @@ -2287,7 +2321,8 @@ def pts_to_midstep(x, *args): The x location of the steps. May be empty. y1, ..., yp : array - y arrays to be turned into steps; all must be the same length as ``x``. + y arrays to be turned into steps; all must be the same length as + ``x``. Returns ------- @@ -2346,7 +2381,7 @@ def index_of(y): def safe_first_element(obj): - if isinstance(obj, collections.Iterator): + if isinstance(obj, cabc.Iterator): # needed to accept `array.flat` as input. # np.flatiter reports as an instance of collections.Iterator # but can still be indexed via []. @@ -2363,7 +2398,8 @@ def safe_first_element(obj): def sanitize_sequence(data): """Converts dictview object to list""" - return list(data) if isinstance(data, collections.MappingView) else data + return (list(data) if isinstance(data, cabc.MappingView) + else data) def normalize_kwargs(kw, alias_mapping=None, required=(), forbidden=(), diff --git a/contrib/python/matplotlib/py2/matplotlib/colors.py b/contrib/python/matplotlib/py2/matplotlib/colors.py index 32e282f6f5..d6cd04fdbc 100644 --- a/contrib/python/matplotlib/py2/matplotlib/colors.py +++ b/contrib/python/matplotlib/py2/matplotlib/colors.py @@ -50,7 +50,10 @@ from __future__ import (absolute_import, division, print_function, import six from six.moves import zip -from collections import Sized +try: + from collections.abc import Sized +except ImportError: + from collections import Sized import itertools import re import warnings @@ -1682,7 +1685,7 @@ class LightSource(object): # visually appears better than a "hard" clip. intensity -= imin intensity /= (imax - imin) - intensity = np.clip(intensity, 0, 1, intensity) + intensity = np.clip(intensity, 0, 1) return intensity diff --git a/contrib/python/matplotlib/py2/matplotlib/contour.py b/contrib/python/matplotlib/py2/matplotlib/contour.py index f6fdfd61c2..e03bdaeae6 100644 --- a/contrib/python/matplotlib/py2/matplotlib/contour.py +++ b/contrib/python/matplotlib/py2/matplotlib/contour.py @@ -7,7 +7,9 @@ from __future__ import (absolute_import, division, print_function, import six from six.moves import xrange +from numbers import Integral import warnings + import matplotlib as mpl import numpy as np from numpy import ma @@ -868,7 +870,7 @@ class ContourSet(cm.ScalarMappable, ContourLabeler): self.logscale = True if norm is None: norm = colors.LogNorm() - if self.extend is not 'neither': + if self.extend != 'neither': raise ValueError('extend kwarg does not work yet with log ' ' scale') else: @@ -1206,21 +1208,15 @@ class ContourSet(cm.ScalarMappable, ContourLabeler): self._auto = False if self.levels is None: if len(args) == 0: - lev = self._autolev(7) + levels_arg = 7 # Default, hard-wired. else: - level_arg = args[0] - try: - if type(level_arg) == int: - lev = self._autolev(level_arg) - else: - lev = np.asarray(level_arg).astype(np.float64) - except: - raise TypeError( - "Last {0} arg must give levels; see help({0})" - .format(fn)) - self.levels = lev + levels_arg = args[0] + else: + levels_arg = self.levels + if isinstance(levels_arg, Integral): + self.levels = self._autolev(levels_arg) else: - self.levels = np.asarray(self.levels).astype(np.float64) + self.levels = np.asarray(levels_arg).astype(np.float64) if not self.filled: inside = (self.levels > self.zmin) & (self.levels < self.zmax) diff --git a/contrib/python/matplotlib/py2/matplotlib/font_manager.py b/contrib/python/matplotlib/py2/matplotlib/font_manager.py index 5900fc9b18..2ba1a50638 100644 --- a/contrib/python/matplotlib/py2/matplotlib/font_manager.py +++ b/contrib/python/matplotlib/py2/matplotlib/font_manager.py @@ -43,8 +43,10 @@ License : matplotlib license (PSF compatible) The font directory code is from ttfquery, see license/LICENSE_TTFQUERY. """ - -from collections import Iterable +try: + from collections.abc import Iterable +except ImportError: + from collections import Iterable import json import os import sys diff --git a/contrib/python/matplotlib/py2/matplotlib/lines.py b/contrib/python/matplotlib/py2/matplotlib/lines.py index dac18d4985..91edd5f89d 100644 --- a/contrib/python/matplotlib/py2/matplotlib/lines.py +++ b/contrib/python/matplotlib/py2/matplotlib/lines.py @@ -811,10 +811,10 @@ class Line2D(Artist): self.recache() self._transform_path(subslice) tpath, affine = (self._get_transformed_path() - .get_transformed_path_and_affine()) + .get_transformed_points_and_affine()) else: tpath, affine = (self._get_transformed_path() - .get_transformed_path_and_affine()) + .get_transformed_points_and_affine()) if len(tpath.vertices): # subsample the markers if markevery is not None diff --git a/contrib/python/matplotlib/py2/matplotlib/markers.py b/contrib/python/matplotlib/py2/matplotlib/markers.py index ff27c4b253..3669922026 100644 --- a/contrib/python/matplotlib/py2/matplotlib/markers.py +++ b/contrib/python/matplotlib/py2/matplotlib/markers.py @@ -88,8 +88,10 @@ from __future__ import (absolute_import, division, print_function, import six from six.moves import xrange - -from collections import Sized +try: + from collections.abc import Sized +except ImportError: + from collections import Sized import numpy as np diff --git a/contrib/python/matplotlib/py2/matplotlib/pyplot.py b/contrib/python/matplotlib/py2/matplotlib/pyplot.py index fb5928dc65..22411701c9 100644 --- a/contrib/python/matplotlib/py2/matplotlib/pyplot.py +++ b/contrib/python/matplotlib/py2/matplotlib/pyplot.py @@ -2419,7 +2419,7 @@ def matshow(A, fignum=None, **kwargs): """ A = np.asanyarray(A) - if fignum is False or fignum is 0: + if fignum is False or fignum == 0: ax = gca() else: # Extract actual aspect ratio of array and make appropriately sized figure diff --git a/contrib/python/matplotlib/py2/matplotlib/rcsetup.py b/contrib/python/matplotlib/py2/matplotlib/rcsetup.py index f8d5ad5036..902db1c43f 100644 --- a/contrib/python/matplotlib/py2/matplotlib/rcsetup.py +++ b/contrib/python/matplotlib/py2/matplotlib/rcsetup.py @@ -16,8 +16,10 @@ parameter set listed here should also be visited to the from __future__ import absolute_import, division, print_function import six - -from collections import Iterable, Mapping +try: + from collections.abc import Iterable, Mapping +except ImportError: + from collections import Iterable, Mapping from functools import reduce import operator import os diff --git a/contrib/python/matplotlib/py2/matplotlib/sphinxext/plot_directive.py b/contrib/python/matplotlib/py2/matplotlib/sphinxext/plot_directive.py index 434bc50aee..2e50d5aaa6 100644 --- a/contrib/python/matplotlib/py2/matplotlib/sphinxext/plot_directive.py +++ b/contrib/python/matplotlib/py2/matplotlib/sphinxext/plot_directive.py @@ -357,7 +357,7 @@ def remove_coding(text): TEMPLATE = """ {{ source_code }} -{{ only_html }} +.. only:: html {% if source_link or (html_show_formats and not multi_image) %} ( @@ -393,27 +393,15 @@ TEMPLATE = """ {{ caption }} {% endfor %} -{{ only_latex }} +.. only:: not html {% for img in images %} - {% if 'pdf' in img.formats -%} - .. figure:: {{ build_dir }}/{{ img.basename }}.pdf + .. figure:: {{ build_dir }}/{{ img.basename }}.* {% for option in options -%} {{ option }} {% endfor %} {{ caption }} - {% endif -%} - {% endfor %} - -{{ only_texinfo }} - - {% for img in images %} - .. image:: {{ build_dir }}/{{ img.basename }}.png - {% for option in options -%} - {{ option }} - {% endfor %} - {% endfor %} """ @@ -813,10 +801,6 @@ def run(arguments, content, options, state_machine, state, lineno): ':%s: %s' % (key, val) for key, val in six.iteritems(options) if key in ('alt', 'height', 'width', 'scale', 'align', 'class')] - only_html = ".. only:: html" - only_latex = ".. only:: latex" - only_texinfo = ".. only:: texinfo" - # Not-None src_link signals the need for a source link in the generated # html if j == 0 and config.plot_html_show_source_link: @@ -830,9 +814,6 @@ def run(arguments, content, options, state_machine, state, lineno): build_dir=build_dir_link, source_link=src_link, multi_image=len(images) > 1, - only_html=only_html, - only_latex=only_latex, - only_texinfo=only_texinfo, options=opts, images=images, source_code=source_code, diff --git a/contrib/python/matplotlib/py2/mpl_toolkits/axes_grid1/axes_grid.py b/contrib/python/matplotlib/py2/mpl_toolkits/axes_grid1/axes_grid.py index dde0e8dd7c..d7e4fa8768 100644 --- a/contrib/python/matplotlib/py2/mpl_toolkits/axes_grid1/axes_grid.py +++ b/contrib/python/matplotlib/py2/mpl_toolkits/axes_grid1/axes_grid.py @@ -484,7 +484,7 @@ class ImageGrid(Grid): if ngrids is None: ngrids = self._nrows * self._ncols else: - if not 0 <= ngrids < self._nrows * self._ncols: + if not 0 < ngrids <= self._nrows * self._ncols: raise Exception self.ngrids = ngrids diff --git a/contrib/python/matplotlib/py2/src/_png.cpp b/contrib/python/matplotlib/py2/src/_png.cpp index 1dcbf713f2..ea7bf32efe 100644 --- a/contrib/python/matplotlib/py2/src/_png.cpp +++ b/contrib/python/matplotlib/py2/src/_png.cpp @@ -1,14 +1,11 @@ /* -*- mode: c++; c-basic-offset: 4 -*- */ -// this code is heavily adapted from the paint license, which is in -// the file paint.license (BSD compatible) included in this -// distribution. TODO, add license file to MANIFEST.in and CVS - /* For linux, png.h must be imported before Python.h because png.h needs to be the one to define setjmp. Undefining _POSIX_C_SOURCE and _XOPEN_SOURCE stops a couple of harmless warnings. */ +#define PY_SSIZE_T_CLEAN extern "C" { # include <png.h> @@ -139,6 +136,9 @@ const char *Py_write_png__doc__ = " Byte string containing the PNG content if None was passed in for\n" " file, otherwise None is returned.\n"; +// this code is heavily adapted from +// https://www.object-craft.com.au/projects/paint/ which licensed under the +// (BSD compatible) LICENSE_PAINT which is included in this distribution. static PyObject *Py_write_png(PyObject *self, PyObject *args, PyObject *kwds) { numpy::array_view<unsigned char, 3> buffer; diff --git a/contrib/python/matplotlib/py2/src/_tkagg.cpp b/contrib/python/matplotlib/py2/src/_tkagg.cpp index ad5289b3d6..106f1398b3 100644 --- a/contrib/python/matplotlib/py2/src/_tkagg.cpp +++ b/contrib/python/matplotlib/py2/src/_tkagg.cpp @@ -7,7 +7,7 @@ * See LICENSE/LICENSE.PIL for details. * */ - +#define PY_SSIZE_T_CLEAN #include <Python.h> #include <cstdlib> #include <cstdio> diff --git a/contrib/python/matplotlib/py2/src/_ttconv.cpp b/contrib/python/matplotlib/py2/src/_ttconv.cpp index e0aa4611d2..e18c8a53ca 100644 --- a/contrib/python/matplotlib/py2/src/_ttconv.cpp +++ b/contrib/python/matplotlib/py2/src/_ttconv.cpp @@ -5,7 +5,7 @@ Python wrapper for TrueType conversion library in ../ttconv. */ - +#define PY_SSIZE_T_CLEAN #include "mplutils.h" #include <Python.h> diff --git a/contrib/python/matplotlib/py2/src/file_compat.h b/contrib/python/matplotlib/py2/src/file_compat.h index 691133dcbb..114279fb1a 100644 --- a/contrib/python/matplotlib/py2/src/file_compat.h +++ b/contrib/python/matplotlib/py2/src/file_compat.h @@ -1,6 +1,6 @@ #ifndef __FILE_COMPAT_H__ #define __FILE_COMPAT_H__ - +#define PY_SSIZE_T_CLEAN #include <Python.h> #include <stdio.h> #include "numpy/npy_common.h" diff --git a/contrib/python/matplotlib/py2/src/ft2font.h b/contrib/python/matplotlib/py2/src/ft2font.h index c60d5432cf..072428ceed 100644 --- a/contrib/python/matplotlib/py2/src/ft2font.h +++ b/contrib/python/matplotlib/py2/src/ft2font.h @@ -18,8 +18,8 @@ extern "C" { /* By definition, FT_FIXED as 2 16bit values stored in a single long. */ -#define FIXED_MAJOR(val) (long)((val & 0xffff000) >> 16) -#define FIXED_MINOR(val) (long)(val & 0xffff) +#define FIXED_MAJOR(val) (signed short)((val & 0xffff0000) >> 16) +#define FIXED_MINOR(val) (unsigned short)(val & 0xffff) // the FreeType string rendered into a width, height buffer class FT2Image diff --git a/contrib/python/matplotlib/py2/src/ft2font_wrapper.cpp b/contrib/python/matplotlib/py2/src/ft2font_wrapper.cpp index 49c33b7943..d0e516ad02 100644 --- a/contrib/python/matplotlib/py2/src/ft2font_wrapper.cpp +++ b/contrib/python/matplotlib/py2/src/ft2font_wrapper.cpp @@ -276,7 +276,7 @@ static void PyGlyph_dealloc(PyGlyph *self) static PyObject *PyGlyph_get_bbox(PyGlyph *self, void *closure) { return Py_BuildValue( - "iiii", self->bbox.xMin, self->bbox.yMin, self->bbox.xMax, self->bbox.yMax); + "llll", self->bbox.xMin, self->bbox.yMin, self->bbox.xMax, self->bbox.yMax); } static PyTypeObject *PyGlyph_init_type(PyObject *m, PyTypeObject *type) @@ -1026,7 +1026,7 @@ static PyObject *PyFT2Font_get_sfnt(PyFT2Font *self, PyObject *args, PyObject *k } PyObject *key = Py_BuildValue( - "iiii", sfnt.platform_id, sfnt.encoding_id, sfnt.language_id, sfnt.name_id); + "HHHH", sfnt.platform_id, sfnt.encoding_id, sfnt.language_id, sfnt.name_id); if (key == NULL) { Py_DECREF(names); return NULL; @@ -1090,7 +1090,7 @@ static PyObject *PyFT2Font_get_ps_font_info(PyFT2Font *self, PyObject *args, PyO return NULL; } - return Py_BuildValue("sssssliii", + return Py_BuildValue("ssssslbhH", fontinfo.version ? fontinfo.version : "", fontinfo.notice ? fontinfo.notice : "", fontinfo.full_name ? fontinfo.full_name : "", @@ -1135,8 +1135,8 @@ static PyObject *PyFT2Font_get_sfnt_table(PyFT2Font *self, PyObject *args, PyObj switch (tag) { case 0: { char head_dict[] = - "{s:(h,h), s:(h,h), s:l, s:l, s:i, s:i," - "s:(l,l), s:(l,l), s:h, s:h, s:h, s:h, s:i, s:i, s:h, s:h, s:h}"; + "{s:(h,H), s:(h,H), s:l, s:l, s:H, s:H," + "s:(l,l), s:(l,l), s:h, s:h, s:h, s:h, s:H, s:H, s:h, s:h, s:h}"; TT_Header *t = (TT_Header *)table; return Py_BuildValue(head_dict, "version", @@ -1150,9 +1150,9 @@ static PyObject *PyFT2Font_get_sfnt_table(PyFT2Font *self, PyObject *args, PyObj "magicNumber", t->Magic_Number, "flags", - (unsigned)t->Flags, + t->Flags, "unitsPerEm", - (unsigned)t->Units_Per_EM, + t->Units_Per_EM, "created", t->Created[0], t->Created[1], @@ -1168,9 +1168,9 @@ static PyObject *PyFT2Font_get_sfnt_table(PyFT2Font *self, PyObject *args, PyObj "yMax", t->yMax, "macStyle", - (unsigned)t->Mac_Style, + t->Mac_Style, "lowestRecPPEM", - (unsigned)t->Lowest_Rec_PPEM, + t->Lowest_Rec_PPEM, "fontDirectionHint", t->Font_Direction, "indexToLocFormat", @@ -1180,64 +1180,64 @@ static PyObject *PyFT2Font_get_sfnt_table(PyFT2Font *self, PyObject *args, PyObj } case 1: { char maxp_dict[] = - "{s:(h,h), s:i, s:i, s:i, s:i, s:i, s:i," - "s:i, s:i, s:i, s:i, s:i, s:i, s:i, s:i}"; + "{s:(h,H), s:H, s:H, s:H, s:H, s:H, s:H," + "s:H, s:H, s:H, s:H, s:H, s:H, s:H, s:H}"; TT_MaxProfile *t = (TT_MaxProfile *)table; return Py_BuildValue(maxp_dict, "version", FIXED_MAJOR(t->version), FIXED_MINOR(t->version), "numGlyphs", - (unsigned)t->numGlyphs, + t->numGlyphs, "maxPoints", - (unsigned)t->maxPoints, + t->maxPoints, "maxContours", - (unsigned)t->maxContours, + t->maxContours, "maxComponentPoints", - (unsigned)t->maxCompositePoints, + t->maxCompositePoints, "maxComponentContours", - (unsigned)t->maxCompositeContours, + t->maxCompositeContours, "maxZones", - (unsigned)t->maxZones, + t->maxZones, "maxTwilightPoints", - (unsigned)t->maxTwilightPoints, + t->maxTwilightPoints, "maxStorage", - (unsigned)t->maxStorage, + t->maxStorage, "maxFunctionDefs", - (unsigned)t->maxFunctionDefs, + t->maxFunctionDefs, "maxInstructionDefs", - (unsigned)t->maxInstructionDefs, + t->maxInstructionDefs, "maxStackElements", - (unsigned)t->maxStackElements, + t->maxStackElements, "maxSizeOfInstructions", - (unsigned)t->maxSizeOfInstructions, + t->maxSizeOfInstructions, "maxComponentElements", - (unsigned)t->maxComponentElements, + t->maxComponentElements, "maxComponentDepth", - (unsigned)t->maxComponentDepth); + t->maxComponentDepth); } case 2: { #if PY3K char os_2_dict[] = - "{s:h, s:h, s:h, s:h, s:h, s:h, s:h, s:h," - "s:h, s:h, s:h, s:h, s:h, s:h, s:h, s:h, s:y#, s:(llll)," - "s:y#, s:h, s:h, s:h}"; + "{s:H, s:h, s:H, s:H, s:H, s:h, s:h, s:h," + "s:h, s:h, s:h, s:h, s:h, s:h, s:h, s:h, s:y#, s:(kkkk)," + "s:y#, s:H, s:H, s:H}"; #else char os_2_dict[] = - "{s:h, s:h, s:h, s:h, s:h, s:h, s:h, s:h," - "s:h, s:h, s:h, s:h, s:h, s:h, s:h, s:h, s:s#, s:(llll)," - "s:s#, s:h, s:h, s:h}"; + "{s:H, s:h, s:H, s:H, s:H, s:h, s:h, s:h," + "s:h, s:h, s:h, s:h, s:h, s:h, s:h, s:h, s:s#, s:(kkkk)," + "s:s#, s:H, s:H, s:H}"; #endif TT_OS2 *t = (TT_OS2 *)table; return Py_BuildValue(os_2_dict, "version", - (unsigned)t->version, + t->version, "xAvgCharWidth", t->xAvgCharWidth, "usWeightClass", - (unsigned)t->usWeightClass, + t->usWeightClass, "usWidthClass", - (unsigned)t->usWidthClass, + t->usWidthClass, "fsType", t->fsType, "ySubscriptXSize", @@ -1264,26 +1264,26 @@ static PyObject *PyFT2Font_get_sfnt_table(PyFT2Font *self, PyObject *args, PyObj t->sFamilyClass, "panose", t->panose, - 10, + Py_ssize_t(10), "ulCharRange", - (unsigned long)t->ulUnicodeRange1, - (unsigned long)t->ulUnicodeRange2, - (unsigned long)t->ulUnicodeRange3, - (unsigned long)t->ulUnicodeRange4, + t->ulUnicodeRange1, + t->ulUnicodeRange2, + t->ulUnicodeRange3, + t->ulUnicodeRange4, "achVendID", t->achVendID, - 4, + Py_ssize_t(4), "fsSelection", - (unsigned)t->fsSelection, + t->fsSelection, "fsFirstCharIndex", - (unsigned)t->usFirstCharIndex, + t->usFirstCharIndex, "fsLastCharIndex", - (unsigned)t->usLastCharIndex); + t->usLastCharIndex); } case 3: { char hhea_dict[] = - "{s:(h,h), s:h, s:h, s:h, s:i, s:h, s:h, s:h," - "s:h, s:h, s:h, s:h, s:i}"; + "{s:(h,H), s:h, s:h, s:h, s:H, s:h, s:h, s:h," + "s:h, s:h, s:h, s:h, s:H}"; TT_HoriHeader *t = (TT_HoriHeader *)table; return Py_BuildValue(hhea_dict, "version", @@ -1296,7 +1296,7 @@ static PyObject *PyFT2Font_get_sfnt_table(PyFT2Font *self, PyObject *args, PyObj "lineGap", t->Line_Gap, "advanceWidthMax", - (unsigned)t->advance_Width_Max, + t->advance_Width_Max, "minLeftBearing", t->min_Left_Side_Bearing, "minRightBearing", @@ -1312,12 +1312,12 @@ static PyObject *PyFT2Font_get_sfnt_table(PyFT2Font *self, PyObject *args, PyObj "metricDataFormat", t->metric_Data_Format, "numOfLongHorMetrics", - (unsigned)t->number_Of_HMetrics); + t->number_Of_HMetrics); } case 4: { char vhea_dict[] = - "{s:(h,h), s:h, s:h, s:h, s:i, s:h, s:h, s:h," - "s:h, s:h, s:h, s:h, s:i}"; + "{s:(h,H), s:h, s:h, s:h, s:H, s:h, s:h, s:h," + "s:h, s:h, s:h, s:h, s:H}"; TT_VertHeader *t = (TT_VertHeader *)table; return Py_BuildValue(vhea_dict, "version", @@ -1330,7 +1330,7 @@ static PyObject *PyFT2Font_get_sfnt_table(PyFT2Font *self, PyObject *args, PyObj "vertTypoLineGap", t->Line_Gap, "advanceHeightMax", - (unsigned)t->advance_Height_Max, + t->advance_Height_Max, "minTopSideBearing", t->min_Top_Side_Bearing, "minBottomSizeBearing", @@ -1346,10 +1346,10 @@ static PyObject *PyFT2Font_get_sfnt_table(PyFT2Font *self, PyObject *args, PyObj "metricDataFormat", t->metric_Data_Format, "numOfLongVerMetrics", - (unsigned)t->number_Of_VMetrics); + t->number_Of_VMetrics); } case 5: { - char post_dict[] = "{s:(h,h), s:(h,h), s:h, s:h, s:k, s:k, s:k, s:k, s:k}"; + char post_dict[] = "{s:(h,H), s:(h,H), s:h, s:h, s:k, s:k, s:k, s:k, s:k}"; TT_Postscript *t = (TT_Postscript *)table; return Py_BuildValue(post_dict, "format", @@ -1376,12 +1376,12 @@ static PyObject *PyFT2Font_get_sfnt_table(PyFT2Font *self, PyObject *args, PyObj case 6: { #if PY3K char pclt_dict[] = - "{s:(h,h), s:k, s:H, s:H, s:H, s:H, s:H, s:H, s:y, s:y, s:b, s:b, " - "s:b}"; + "{s:(h,H), s:k, s:H, s:H, s:H, s:H, s:H, s:H, s:y#, s:y#, s:b, " + "s:b, s:b}"; #else char pclt_dict[] = - "{s:(h,h), s:k, s:H, s:H, s:H, s:H, s:H, s:H, s:s, s:s, s:b, s:b, " - "s:b}"; + "{s:(h,H), s:k, s:H, s:H, s:H, s:H, s:H, s:H, s:s#, s:s#, s:b, " + "s:b, s:b}"; #endif TT_PCLT *t = (TT_PCLT *)table; return Py_BuildValue(pclt_dict, @@ -1404,8 +1404,10 @@ static PyObject *PyFT2Font_get_sfnt_table(PyFT2Font *self, PyObject *args, PyObj t->SymbolSet, "typeFace", t->TypeFace, + Py_ssize_t(16), "characterComplement", t->CharacterComplement, + Py_ssize_t(8), "strokeWeight", t->StrokeWeight, "widthType", @@ -1528,7 +1530,8 @@ static PyObject *PyFT2Font_get_bbox(PyFT2Font *self, void *closure) { FT_BBox *bbox = &(self->x->get_face()->bbox); - return Py_BuildValue("iiii", bbox->xMin, bbox->yMin, bbox->xMax, bbox->yMax); + return Py_BuildValue("llll", + bbox->xMin, bbox->yMin, bbox->xMax, bbox->yMax); } static PyObject *PyFT2Font_ascender(PyFT2Font *self, void *closure) diff --git a/contrib/python/matplotlib/py2/src/mplutils.h b/contrib/python/matplotlib/py2/src/mplutils.h index 140a815634..4b59e08bbd 100644 --- a/contrib/python/matplotlib/py2/src/mplutils.h +++ b/contrib/python/matplotlib/py2/src/mplutils.h @@ -4,6 +4,7 @@ #ifndef _MPLUTILS_H #define _MPLUTILS_H +#define PY_SSIZE_T_CLEAN #if defined(_MSC_VER) && _MSC_VER <= 1600 typedef unsigned __int8 uint8_t; diff --git a/contrib/python/matplotlib/py2/src/numpy_cpp.h b/contrib/python/matplotlib/py2/src/numpy_cpp.h index 03b4a695d1..75f773ee58 100644 --- a/contrib/python/matplotlib/py2/src/numpy_cpp.h +++ b/contrib/python/matplotlib/py2/src/numpy_cpp.h @@ -2,7 +2,7 @@ #ifndef _NUMPY_CPP_H_ #define _NUMPY_CPP_H_ - +#define PY_SSIZE_T_CLEAN /*************************************************************************** * This file is based on original work by Mark Wiebe, available at: * diff --git a/contrib/python/matplotlib/py2/src/py_adaptors.h b/contrib/python/matplotlib/py2/src/py_adaptors.h index 8eaa7ad6c7..3d0dbdab45 100644 --- a/contrib/python/matplotlib/py2/src/py_adaptors.h +++ b/contrib/python/matplotlib/py2/src/py_adaptors.h @@ -2,7 +2,7 @@ #ifndef __PY_ADAPTORS_H__ #define __PY_ADAPTORS_H__ - +#define PY_SSIZE_T_CLEAN /*************************************************************************** * This module contains a number of C++ classes that adapt Python data * structures to C++ and Agg-friendly interfaces. diff --git a/contrib/python/matplotlib/py2/src/py_converters.cpp b/contrib/python/matplotlib/py2/src/py_converters.cpp index c36fc59f59..2d5d415a2c 100644 --- a/contrib/python/matplotlib/py2/src/py_converters.cpp +++ b/contrib/python/matplotlib/py2/src/py_converters.cpp @@ -1,5 +1,5 @@ #define NO_IMPORT_ARRAY - +#define PY_SSIZE_T_CLEAN #include "py_converters.h" #include "numpy_cpp.h" diff --git a/contrib/python/matplotlib/py2/src/qhull_wrap.c b/contrib/python/matplotlib/py2/src/qhull_wrap.c index 9cbaf64f01..836a16c555 100644 --- a/contrib/python/matplotlib/py2/src/qhull_wrap.c +++ b/contrib/python/matplotlib/py2/src/qhull_wrap.c @@ -5,6 +5,7 @@ * triangulation, construct an instance of the matplotlib.tri.Triangulation * class without specifying a triangles array. */ +#define PY_SSIZE_T_CLEAN #include "Python.h" #include "numpy/noprefix.h" #include "qhull_ra.h" diff --git a/contrib/python/matplotlib/py2/ya.make b/contrib/python/matplotlib/py2/ya.make index 7242059690..1d5ee4878b 100644 --- a/contrib/python/matplotlib/py2/ya.make +++ b/contrib/python/matplotlib/py2/ya.make @@ -2,7 +2,7 @@ PY2_LIBRARY() LICENSE(PSF-2.0) -VERSION(2.2.4) +VERSION(2.2.5) PEERDIR( contrib/deprecated/python/backports.functools-lru-cache diff --git a/contrib/python/protobuf/py3/google/protobuf/internal/well_known_types.py b/contrib/python/protobuf/py3/google/protobuf/internal/well_known_types.py index f14f1527ca..8af0665abc 100644 --- a/contrib/python/protobuf/py3/google/protobuf/internal/well_known_types.py +++ b/contrib/python/protobuf/py3/google/protobuf/internal/well_known_types.py @@ -95,7 +95,7 @@ class Any(object): return '/' in self.type_url and self.TypeName() == descriptor.full_name -_EPOCH_DATETIME = datetime.utcfromtimestamp(0) +_EPOCH_DATETIME = datetime(1970, 1, 1, tzinfo=None) class Timestamp(object): diff --git a/contrib/python/protobuf/py3/google/protobuf/pyext/__init__.py b/contrib/python/protobuf/py3/google/protobuf/pyext/__init__.py index e69de29bb2..0cb9329b2c 100644 --- a/contrib/python/protobuf/py3/google/protobuf/pyext/__init__.py +++ b/contrib/python/protobuf/py3/google/protobuf/pyext/__init__.py @@ -0,0 +1,4 @@ +import warnings + +with warnings.catch_warnings(action="ignore", category=DeprecationWarning): + import google.protobuf.pyext._message diff --git a/contrib/python/python-dateutil/py3/dateutil/tz/tz.py b/contrib/python/python-dateutil/py3/dateutil/tz/tz.py index c67f56d465..84504cf8eb 100644 --- a/contrib/python/python-dateutil/py3/dateutil/tz/tz.py +++ b/contrib/python/python-dateutil/py3/dateutil/tz/tz.py @@ -34,7 +34,7 @@ except ImportError: from warnings import warn ZERO = datetime.timedelta(0) -EPOCH = datetime.datetime.utcfromtimestamp(0) +EPOCH = datetime.datetime(1970, 1, 1, tzinfo=None) EPOCHORDINAL = EPOCH.toordinal() |