diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-04-23 11:33:26 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-04-23 11:44:26 +0300 |
commit | 788be0726a19c2cbb4153cadd5a530fdaabf1cf9 (patch) | |
tree | fdfc620643a7ef071fcc4da70aee7c9dca086ecf /contrib/python | |
parent | b3463ec39aa72198a0df194f2d4a58a96e583aad (diff) | |
download | ydb-788be0726a19c2cbb4153cadd5a530fdaabf1cf9.tar.gz |
Intermediate changes
Diffstat (limited to 'contrib/python')
25 files changed, 138 insertions, 81 deletions
diff --git a/contrib/python/future/py2/.dist-info/METADATA b/contrib/python/future/py2/.dist-info/METADATA index 124bf500d0..3d0e5512c6 100644 --- a/contrib/python/future/py2/.dist-info/METADATA +++ b/contrib/python/future/py2/.dist-info/METADATA @@ -1,13 +1,13 @@ Metadata-Version: 2.1 Name: future -Version: 0.18.3 +Version: 1.0.0 Summary: Clean single-source support for Python 3 and 2 Home-page: https://python-future.org Author: Ed Schofield Author-email: ed@pythoncharmers.com License: MIT +Project-URL: Source, https://github.com/PythonCharmers/python-future Keywords: future past python3 migration futurize backport six 2to3 modernize pasteurize 3to2 -Platform: UNKNOWN Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.6 @@ -18,11 +18,17 @@ 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 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 Classifier: License :: OSI Approved Classifier: License :: OSI Approved :: MIT License -Classifier: Development Status :: 4 - Beta +Classifier: Development Status :: 6 - Mature Classifier: Intended Audience :: Developers Requires-Python: >=2.6, !=3.0.*, !=3.1.*, !=3.2.* +License-File: LICENSE.txt future: Easy, safe support for Python 2/3 compatibility @@ -78,7 +84,7 @@ Automatic conversion -------------------- An included script called `futurize -<http://python-future.org/automatic_conversion.html>`_ aids in converting +<https://python-future.org/automatic_conversion.html>`_ aids in converting code (from either Python 2 or Python 3) to code compatible with both platforms. It is similar to ``python-modernize`` but goes further in providing Python 3 compatibility through the use of the backported types @@ -88,22 +94,19 @@ and builtin functions in ``future``. Documentation ------------- -See: http://python-future.org +See: https://python-future.org Credits ------- :Author: Ed Schofield, Jordan M. Adler, et al -:Sponsor: Python Charmers Pty Ltd, Australia, and Python Charmers Pte - Ltd, Singapore. http://pythoncharmers.com -:Others: See docs/credits.rst or http://python-future.org/credits.html +:Sponsor: Python Charmers: https://pythoncharmers.com +:Others: See docs/credits.rst or https://python-future.org/credits.html Licensing --------- -Copyright 2013-2019 Python Charmers Pty Ltd, Australia. +Copyright 2013-2024 Python Charmers, Australia. The software is distributed under an MIT licence. See LICENSE.txt. - - diff --git a/contrib/python/future/py2/.dist-info/entry_points.txt b/contrib/python/future/py2/.dist-info/entry_points.txt index 45d1a880fb..74aec276c8 100644 --- a/contrib/python/future/py2/.dist-info/entry_points.txt +++ b/contrib/python/future/py2/.dist-info/entry_points.txt @@ -1,4 +1,3 @@ [console_scripts] futurize = libfuturize.main:main pasteurize = libpasteurize.main:main - diff --git a/contrib/python/future/py2/LICENSE.txt b/contrib/python/future/py2/LICENSE.txt index 4c904dba8f..275cafd303 100644 --- a/contrib/python/future/py2/LICENSE.txt +++ b/contrib/python/future/py2/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2013-2019 Python Charmers Pty Ltd, Australia +Copyright (c) 2013-2024 Python Charmers, Australia Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/contrib/python/future/py2/README.rst b/contrib/python/future/py2/README.rst index 1ab43e53d7..a3aceb7d4a 100644 --- a/contrib/python/future/py2/README.rst +++ b/contrib/python/future/py2/README.rst @@ -3,11 +3,8 @@ Overview: Easy, clean, reliable Python 2/3 compatibility ======================================================== -.. image:: https://travis-ci.org/PythonCharmers/python-future.svg?branch=master - :target: https://travis-ci.org/PythonCharmers/python-future - -.. image:: https://readthedocs.org/projects/python-future/badge/?version=latest - :target: https://python-future.readthedocs.io/en/latest/?badge=latest +.. image:: https://github.com/PythonCharmers/python-future/actions/workflows/ci.yml/badge.svg?branch=master + :target: https://github.com/PythonCharmers/python-future/actions/workflows/ci.yml?query=branch%3Amaster ``python-future`` is the missing compatibility layer between Python 2 and Python 3. It allows you to use a single, clean Python 3.x-compatible @@ -19,9 +16,21 @@ ports of features from Python 3 and 2. It also comes with ``futurize`` and either Py2 or Py3 code easily to support both Python 2 and 3 in a single clean Py3-style codebase, module by module. -Notable projects that use ``python-future`` for Python 2/3 compatibility -are `Mezzanine <http://mezzanine.jupo.org/>`_ and `ObsPy -<http://obspy.org>`_. +The ``python-future`` project has been downloaded over 1.7 billion times. + +.. _status + +Status +------ + +The ``python-future`` project was created in 2013 to attempt to save Python from +the schism of version incompatibility that was threatening to tear apart the +language (as Perl 6 contributed to the death of Perl). + +That time is now past. Thanks to a huge porting effort across the Python +community, Python 3 eventually thrived. Python 2 reached its end of life in +2020 and the ``python-future`` package should no longer be necessary. Use it to +help with porting legacy code to Python 3 but don't depend on it for new code. .. _features: @@ -223,11 +232,14 @@ into this code which runs on both Py2 and Py3: name = input() greet(name) +The first four lines have no effect under Python 3 and can be removed from +the codebase when Python 2 compatibility is no longer required. + See :ref:`forwards-conversion` and :ref:`backwards-conversion` for more details. Automatic translation ---------------------- +~~~~~~~~~~~~~~~~~~~~~ The ``past`` package can automatically translate some simple Python 2 modules to Python 3 upon import. The goal is to support the "long tail" of @@ -264,10 +276,9 @@ properly to a Python 2/3 compatible codebase using a tool like Note: the auto-translation feature is still in alpha; it needs more testing and development, and will likely never be perfect. -For more info, see :ref:`translation`. Pre-commit hooks ----------------- +~~~~~~~~~~~~~~~~ `Pre-commit <https://pre-commit.com/>`_ is a framework for managing and maintaining multi-language pre-commit hooks. @@ -304,23 +315,25 @@ Licensing :Author: Ed Schofield, Jordan M. Adler, et al -:Copyright: 2013-2019 Python Charmers Pty Ltd, Australia. +:Copyright: 2013-2024 Python Charmers, Australia. -:Sponsors: Python Charmers Pty Ltd, Australia, and Python Charmers Pte - Ltd, Singapore. http://pythoncharmers.com +:Sponsors: Python Charmers: https://pythoncharmers.com - Pinterest https://opensource.pinterest.com/ + Pinterest https://opensource.pinterest.com -:Licence: MIT. See ``LICENSE.txt`` or `here <http://python-future.org/credits.html>`_. +:Licence: MIT. See ``LICENSE.txt`` or `here <https://python-future.org/credits.html>`_. -:Other credits: See `here <http://python-future.org/credits.html>`_. +:Other credits: See `here <https://python-future.org/credits.html>`_. +Docs +---- +See the docs `here <https://python-future.org>`_. Next steps ---------- If you are new to Python-Future, check out the `Quickstart Guide -<http://python-future.org/quickstart.html>`_. +<https://python-future.org/quickstart.html>`_. For an update on changes in the latest version, see the `What's New -<http://python-future.org/whatsnew.html>`_ page. +<https://python-future.org/whatsnew.html>`_ page. diff --git a/contrib/python/future/py2/future/__init__.py b/contrib/python/future/py2/future/__init__.py index b609299a7a..b097fd81eb 100644 --- a/contrib/python/future/py2/future/__init__.py +++ b/contrib/python/future/py2/future/__init__.py @@ -52,7 +52,7 @@ Automatic conversion -------------------- An included script called `futurize -<http://python-future.org/automatic_conversion.html>`_ aids in converting +<https://python-future.org/automatic_conversion.html>`_ aids in converting code (from either Python 2 or Python 3) to code compatible with both platforms. It is similar to ``python-modernize`` but goes further in providing Python 3 compatibility through the use of the backported types @@ -62,21 +62,20 @@ and builtin functions in ``future``. Documentation ------------- -See: http://python-future.org +See: https://python-future.org Credits ------- :Author: Ed Schofield, Jordan M. Adler, et al -:Sponsor: Python Charmers Pty Ltd, Australia, and Python Charmers Pte - Ltd, Singapore. http://pythoncharmers.com -:Others: See docs/credits.rst or http://python-future.org/credits.html +:Sponsor: Python Charmers: https://pythoncharmers.com +:Others: See docs/credits.rst or https://python-future.org/credits.html Licensing --------- -Copyright 2013-2019 Python Charmers Pty Ltd, Australia. +Copyright 2013-2024 Python Charmers, Australia. The software is distributed under an MIT licence. See LICENSE.txt. """ @@ -84,10 +83,10 @@ The software is distributed under an MIT licence. See LICENSE.txt. __title__ = 'future' __author__ = 'Ed Schofield' __license__ = 'MIT' -__copyright__ = 'Copyright 2013-2019 Python Charmers Pty Ltd' -__ver_major__ = 0 -__ver_minor__ = 18 -__ver_patch__ = 3 +__copyright__ = 'Copyright 2013-2024 Python Charmers (https://pythoncharmers.com)' +__ver_major__ = 1 +__ver_minor__ = 0 +__ver_patch__ = 0 __ver_sub__ = '' __version__ = "%d.%d.%d%s" % (__ver_major__, __ver_minor__, __ver_patch__, __ver_sub__) diff --git a/contrib/python/future/py2/future/backports/datetime.py b/contrib/python/future/py2/future/backports/datetime.py index 3261014e05..8cd62ddfa5 100644 --- a/contrib/python/future/py2/future/backports/datetime.py +++ b/contrib/python/future/py2/future/backports/datetime.py @@ -689,7 +689,7 @@ class date(object): @classmethod def fromordinal(cls, n): - """Contruct a date from a proleptic Gregorian ordinal. + """Construct a date from a proleptic Gregorian ordinal. January 1 of year 1 is day 1. Only the year, month and day are non-zero in the result. diff --git a/contrib/python/future/py2/future/backports/email/_header_value_parser.py b/contrib/python/future/py2/future/backports/email/_header_value_parser.py index 43957edc12..59b1b318f3 100644 --- a/contrib/python/future/py2/future/backports/email/_header_value_parser.py +++ b/contrib/python/future/py2/future/backports/email/_header_value_parser.py @@ -2867,7 +2867,7 @@ def parse_content_type_header(value): _find_mime_parameters(ctype, value) return ctype ctype.append(token) - # XXX: If we really want to follow the formal grammer we should make + # XXX: If we really want to follow the formal grammar we should make # mantype and subtype specialized TokenLists here. Probably not worth it. if not value or value[0] != '/': ctype.defects.append(errors.InvalidHeaderDefect( diff --git a/contrib/python/future/py2/future/backports/email/parser.py b/contrib/python/future/py2/future/backports/email/parser.py index df1c6e2868..79f0e5a33e 100644 --- a/contrib/python/future/py2/future/backports/email/parser.py +++ b/contrib/python/future/py2/future/backports/email/parser.py @@ -26,7 +26,7 @@ class Parser(object): textual representation of the message. The string must be formatted as a block of RFC 2822 headers and header - continuation lines, optionally preceeded by a `Unix-from' header. The + continuation lines, optionally preceded by a `Unix-from' header. The header block is terminated either by the end of the string or by a blank line. @@ -92,7 +92,7 @@ class BytesParser(object): textual representation of the message. The input must be formatted as a block of RFC 2822 headers and header - continuation lines, optionally preceeded by a `Unix-from' header. The + continuation lines, optionally preceded by a `Unix-from' header. The header block is terminated either by the end of the input or by a blank line. diff --git a/contrib/python/future/py2/future/backports/http/cookiejar.py b/contrib/python/future/py2/future/backports/http/cookiejar.py index 0ad80a0258..a39242c082 100644 --- a/contrib/python/future/py2/future/backports/http/cookiejar.py +++ b/contrib/python/future/py2/future/backports/http/cookiejar.py @@ -1851,7 +1851,7 @@ def lwp_cookie_str(cookie): class LWPCookieJar(FileCookieJar): """ The LWPCookieJar saves a sequence of "Set-Cookie3" lines. - "Set-Cookie3" is the format used by the libwww-perl libary, not known + "Set-Cookie3" is the format used by the libwww-perl library, not known to be compatible with any browser, but which is easy to read and doesn't lose information about RFC 2965 cookies. diff --git a/contrib/python/future/py2/future/backports/xmlrpc/client.py b/contrib/python/future/py2/future/backports/xmlrpc/client.py index b0b8f5e19e..5c2cee0958 100644 --- a/contrib/python/future/py2/future/backports/xmlrpc/client.py +++ b/contrib/python/future/py2/future/backports/xmlrpc/client.py @@ -134,10 +134,11 @@ from __future__ import (absolute_import, division, print_function, from future.builtins import bytes, dict, int, range, str import base64 -# Py2.7 compatibility hack -base64.encodebytes = base64.encodestring -base64.decodebytes = base64.decodestring import sys +if sys.version_info < (3, 9): + # Py2.7 compatibility hack + base64.encodebytes = base64.encodestring + base64.decodebytes = base64.decodestring import time from datetime import datetime from future.backports.http import client as http_client @@ -1254,7 +1255,7 @@ class Transport(object): # Send HTTP request. # # @param host Host descriptor (URL or (URL, x509 info) tuple). - # @param handler Targer RPC handler (a path relative to host) + # @param handler Target RPC handler (a path relative to host) # @param request_body The XML-RPC request body # @param debug Enable debugging if debug is true. # @return An HTTPConnection. diff --git a/contrib/python/future/py2/future/builtins/__init__.py b/contrib/python/future/py2/future/builtins/__init__.py index 8bc1649d2f..1734cd45fe 100644 --- a/contrib/python/future/py2/future/builtins/__init__.py +++ b/contrib/python/future/py2/future/builtins/__init__.py @@ -2,7 +2,7 @@ A module that brings in equivalents of the new and modified Python 3 builtins into Py2. Has no effect on Py3. -See the docs `here <http://python-future.org/what-else.html>`_ +See the docs `here <https://python-future.org/what-else.html>`_ (``docs/what-else.rst``) for more information. """ diff --git a/contrib/python/future/py2/future/moves/_dummy_thread.py b/contrib/python/future/py2/future/moves/_dummy_thread.py index 688d249bbe..6633f42e0c 100644 --- a/contrib/python/future/py2/future/moves/_dummy_thread.py +++ b/contrib/python/future/py2/future/moves/_dummy_thread.py @@ -1,8 +1,13 @@ from __future__ import absolute_import -from future.utils import PY3 +from future.utils import PY3, PY39_PLUS -if PY3: - from _dummy_thread import * + +if PY39_PLUS: + # _dummy_thread and dummy_threading modules were both deprecated in + # Python 3.7 and removed in Python 3.9 + from _thread import * +elif PY3: + from _dummy_thread import * else: __future_module__ = True from dummy_thread import * diff --git a/contrib/python/future/py2/future/moves/multiprocessing.py b/contrib/python/future/py2/future/moves/multiprocessing.py new file mode 100644 index 0000000000..a871b676f4 --- /dev/null +++ b/contrib/python/future/py2/future/moves/multiprocessing.py @@ -0,0 +1,7 @@ +from __future__ import absolute_import +from future.utils import PY3 + +from multiprocessing import * +if not PY3: + __future_module__ = True + from multiprocessing.queues import SimpleQueue diff --git a/contrib/python/future/py2/future/standard_library/__init__.py b/contrib/python/future/py2/future/standard_library/__init__.py index cff02f9594..d467aaf492 100644 --- a/contrib/python/future/py2/future/standard_library/__init__.py +++ b/contrib/python/future/py2/future/standard_library/__init__.py @@ -17,7 +17,7 @@ And then these normal Py3 imports work on both Py3 and Py2:: import socketserver import winreg # on Windows only import test.support - import html, html.parser, html.entites + import html, html.parser, html.entities import http, http.client, http.server import http.cookies, http.cookiejar import urllib.parse, urllib.request, urllib.response, urllib.error, urllib.robotparser @@ -33,6 +33,7 @@ And then these normal Py3 imports work on both Py3 and Py2:: from collections import OrderedDict, Counter, ChainMap # even on Py2.6 from subprocess import getoutput, getstatusoutput from subprocess import check_output # even on Py2.6 + from multiprocessing import SimpleQueue (The renamed modules and functions are still available under their old names on Python 2.) @@ -62,9 +63,12 @@ from __future__ import absolute_import, division, print_function import sys import logging -import imp +# imp was deprecated in python 3.6 +if sys.version_info >= (3, 6): + import importlib as imp +else: + import imp import contextlib -import types import copy import os @@ -108,6 +112,7 @@ RENAMES = { 'future.moves.socketserver': 'socketserver', 'ConfigParser': 'configparser', 'repr': 'reprlib', + 'multiprocessing.queues': 'multiprocessing', # 'FileDialog': 'tkinter.filedialog', # 'tkFileDialog': 'tkinter.filedialog', # 'SimpleDialog': 'tkinter.simpledialog', @@ -125,7 +130,7 @@ RENAMES = { # 'Tkinter': 'tkinter', '_winreg': 'winreg', 'thread': '_thread', - 'dummy_thread': '_dummy_thread', + 'dummy_thread': '_dummy_thread' if sys.version_info < (3, 9) else '_thread', # 'anydbm': 'dbm', # causes infinite import loop # 'whichdb': 'dbm', # causes infinite import loop # anydbm and whichdb are handled by fix_imports2 @@ -184,6 +189,7 @@ MOVES = [('collections', 'UserList', 'UserList', 'UserList'), ('itertools', 'filterfalse','itertools', 'ifilterfalse'), ('itertools', 'zip_longest','itertools', 'izip_longest'), ('sys', 'intern','__builtin__', 'intern'), + ('multiprocessing', 'SimpleQueue', 'multiprocessing.queues', 'SimpleQueue'), # The re module has no ASCII flag in Py2, but this is the default. # Set re.ASCII to a zero constant. stat.ST_MODE just happens to be one # (and it exists on Py2.6+). diff --git a/contrib/python/future/py2/future/types/newint.py b/contrib/python/future/py2/future/types/newint.py index 04a411e933..ebc5715e2b 100644 --- a/contrib/python/future/py2/future/types/newint.py +++ b/contrib/python/future/py2/future/types/newint.py @@ -223,9 +223,11 @@ class newint(with_metaclass(BaseNewInt, long)): def __rpow__(self, other): value = super(newint, self).__rpow__(other) - if value is NotImplemented: + if isint(value): + return newint(value) + elif value is NotImplemented: return other ** long(self) - return newint(value) + return value def __lshift__(self, other): if not isint(other): @@ -318,7 +320,7 @@ class newint(with_metaclass(BaseNewInt, long)): bits = length * 8 num = (2**bits) + self if num <= 0: - raise OverflowError("int too smal to convert") + raise OverflowError("int too small to convert") else: if self < 0: raise OverflowError("can't convert negative int to unsigned") diff --git a/contrib/python/future/py2/future/types/newrange.py b/contrib/python/future/py2/future/types/newrange.py index 6d4ebe2f8f..dc5eb80222 100644 --- a/contrib/python/future/py2/future/types/newrange.py +++ b/contrib/python/future/py2/future/types/newrange.py @@ -105,7 +105,7 @@ class newrange(Sequence): raise ValueError('%r is not in range' % value) def count(self, value): - """Return the number of ocurrences of integer `value` + """Return the number of occurrences of integer `value` in the sequence this range represents.""" # a value can occur exactly zero or one times return int(value in self) diff --git a/contrib/python/future/py2/past/__init__.py b/contrib/python/future/py2/past/__init__.py index 1471303933..54619e0a60 100644 --- a/contrib/python/future/py2/past/__init__.py +++ b/contrib/python/future/py2/past/__init__.py @@ -75,12 +75,12 @@ Credits ------- :Author: Ed Schofield, Jordan M. Adler, et al -:Sponsor: Python Charmers Pty Ltd, Australia: http://pythoncharmers.com +:Sponsor: Python Charmers: https://pythoncharmers.com Licensing --------- -Copyright 2013-2019 Python Charmers Pty Ltd, Australia. +Copyright 2013-2024 Python Charmers, Australia. The software is distributed under an MIT licence. See LICENSE.txt. """ diff --git a/contrib/python/future/py2/past/builtins/misc.py b/contrib/python/future/py2/past/builtins/misc.py index 3600695c0a..0b8e6a986c 100644 --- a/contrib/python/future/py2/past/builtins/misc.py +++ b/contrib/python/future/py2/past/builtins/misc.py @@ -1,11 +1,13 @@ from __future__ import unicode_literals import inspect +import sys import math import numbers from future.utils import PY2, PY3, exec_ + if PY2: from collections import Mapping else: @@ -103,13 +105,12 @@ if PY3: return '0' + builtins.oct(number)[2:] raw_input = input - - try: + # imp was deprecated in python 3.6 + if sys.version_info >= (3, 6): from importlib import reload - except ImportError: + else: # for python2, python3 <= 3.4 from imp import reload - unicode = str unichr = chr xrange = range diff --git a/contrib/python/future/py2/ya.make b/contrib/python/future/py2/ya.make index f537724340..3761f69874 100644 --- a/contrib/python/future/py2/ya.make +++ b/contrib/python/future/py2/ya.make @@ -2,7 +2,7 @@ PY2_LIBRARY() -VERSION(0.18.3) +VERSION(1.0.0) LICENSE(MIT) @@ -105,6 +105,7 @@ PY_SRCS( future/moves/http/cookies.py future/moves/http/server.py future/moves/itertools.py + future/moves/multiprocessing.py future/moves/pickle.py future/moves/queue.py future/moves/reprlib.py diff --git a/contrib/python/hypothesis/py3/.dist-info/METADATA b/contrib/python/hypothesis/py3/.dist-info/METADATA index a4cff64dd9..5c622375cd 100644 --- a/contrib/python/hypothesis/py3/.dist-info/METADATA +++ b/contrib/python/hypothesis/py3/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: hypothesis -Version: 6.100.0 +Version: 6.100.1 Summary: A library for property-based testing Home-page: https://hypothesis.works Author: David R. MacIver and Zac Hatfield-Dodds diff --git a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/data.py b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/data.py index 701105bd5e..93f7758ba2 100644 --- a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/data.py +++ b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/data.py @@ -91,6 +91,9 @@ DRAW_FLOAT_LABEL = calc_label_from_name("drawing a float") FLOAT_STRATEGY_DO_DRAW_LABEL = calc_label_from_name( "getting another float in FloatStrategy" ) +INTEGER_WEIGHTED_DISTRIBUTION = calc_label_from_name( + "drawing from a weighted distribution in integers" +) InterestingOrigin = Tuple[ Type[BaseException], str, int, Tuple[Any, ...], Tuple[Tuple[Any, ...], ...] @@ -1673,6 +1676,7 @@ class HypothesisProvider(PrimitiveProvider): center: Optional[int] = None, forced: Optional[int] = None, fake_forced: bool = False, + _vary_effective_size: bool = True, ) -> int: assert lower <= upper assert forced is None or lower <= forced <= upper @@ -1709,14 +1713,27 @@ class HypothesisProvider(PrimitiveProvider): bits = gap.bit_length() probe = gap + 1 - if bits > 24 and self.draw_boolean( - 7 / 8, forced=None if forced is None else False, fake_forced=fake_forced + if ( + bits > 24 + and _vary_effective_size + and self.draw_boolean( + 7 / 8, forced=None if forced is None else False, fake_forced=fake_forced + ) ): + self._cd.start_example(INTEGER_WEIGHTED_DISTRIBUTION) # For large ranges, we combine the uniform random distribution from draw_bits # with a weighting scheme with moderate chance. Cutoff at 2 ** 24 so that our # choice of unicode characters is uniform but the 32bit distribution is not. idx = INT_SIZES_SAMPLER.sample(self._cd) - bits = min(bits, INT_SIZES[idx]) + force_bits = min(bits, INT_SIZES[idx]) + forced = self._draw_bounded_integer( + lower=center if above else max(lower, center - 2**force_bits - 1), + upper=center if not above else min(upper, center + 2**force_bits - 1), + _vary_effective_size=False, + ) + self._cd.stop_example() + + assert lower <= forced <= upper while probe > gap: self._cd.start_example(INTEGER_RANGE_DRAW_LABEL) diff --git a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/datatree.py b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/datatree.py index 6ab4c2783f..c22cd0b294 100644 --- a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/datatree.py +++ b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/datatree.py @@ -30,6 +30,7 @@ from hypothesis.internal.conjecture.data import ( Status, StringKWargs, ) +from hypothesis.internal.escalation import InterestingOrigin from hypothesis.internal.floats import ( count_between_floats, float_to_int, @@ -83,8 +84,8 @@ class Branch: class Conclusion: """Represents a transition to a finished state.""" - status = attr.ib() - interesting_origin = attr.ib() + status: Status = attr.ib() + interesting_origin: Optional[InterestingOrigin] = attr.ib() # The number of max children where, beyond this, it is practically impossible @@ -1043,8 +1044,9 @@ class TreeRecordingObserver(DataObserver): or new_transition.status != Status.VALID ): raise Flaky( - f"Inconsistent test results! Test case was {node.transition!r} " - f"on first run but {new_transition!r} on second" + f"Inconsistent results from replaying a test case!\n" + f" last: {node.transition.status.name} from {node.transition.interesting_origin}\n" + f" this: {new_transition.status.name} from {new_transition.interesting_origin}" ) else: node.transition = new_transition diff --git a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/pareto.py b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/pareto.py index 146b1b56f4..b43e6df5bc 100644 --- a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/pareto.py +++ b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/pareto.py @@ -133,10 +133,11 @@ class ParetoFront: """Attempts to add ``data`` to the pareto front. Returns True if ``data`` is now in the front, including if data is already in the collection, and False otherwise""" - data = data.as_result() if data.status < Status.VALID: return False + data = data.as_result() + if not self.front: self.front.add(data) return True diff --git a/contrib/python/hypothesis/py3/hypothesis/version.py b/contrib/python/hypothesis/py3/hypothesis/version.py index 158a440f0a..be22825634 100644 --- a/contrib/python/hypothesis/py3/hypothesis/version.py +++ b/contrib/python/hypothesis/py3/hypothesis/version.py @@ -8,5 +8,5 @@ # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at https://mozilla.org/MPL/2.0/. -__version_info__ = (6, 100, 0) +__version_info__ = (6, 100, 1) __version__ = ".".join(map(str, __version_info__)) diff --git a/contrib/python/hypothesis/py3/ya.make b/contrib/python/hypothesis/py3/ya.make index 986fc7ae78..c899d543fd 100644 --- a/contrib/python/hypothesis/py3/ya.make +++ b/contrib/python/hypothesis/py3/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(6.100.0) +VERSION(6.100.1) LICENSE(MPL-2.0) |