diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-05-30 08:17:58 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-05-30 08:26:12 +0300 |
commit | 01f2411babd0705e4aac13107b58c66687199ea7 (patch) | |
tree | 78a3e8965fe1d0236278c9259c841c5ae5e048cc | |
parent | e19b28ad3cdf1f5a497ce4da91bcaa66b8497e1a (diff) | |
download | ydb-01f2411babd0705e4aac13107b58c66687199ea7.tar.gz |
Intermediate changes
11 files changed, 76 insertions, 39 deletions
diff --git a/contrib/python/hypothesis/py3/.dist-info/METADATA b/contrib/python/hypothesis/py3/.dist-info/METADATA index f04833c544..31be46f1d4 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.102.1 +Version: 6.102.4 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/choicetree.py b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/choicetree.py index c5de31ab3a..d7645e1889 100644 --- a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/choicetree.py +++ b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/choicetree.py @@ -12,7 +12,7 @@ from collections import defaultdict from random import Random from typing import Callable, Dict, Iterable, List, Optional, Sequence -from hypothesis.internal.conjecture.junkdrawer import LazySequenceCopy, pop_random +from hypothesis.internal.conjecture.junkdrawer import LazySequenceCopy def prefix_selection_order( @@ -41,7 +41,8 @@ def random_selection_order(random: Random) -> Callable[[int, int], Iterable[int] def selection_order(depth: int, n: int) -> Iterable[int]: pending = LazySequenceCopy(range(n)) while pending: - yield pop_random(random, pending) + i = random.randrange(0, len(pending)) + yield pending.pop(i) return selection_order diff --git a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/datatree.py b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/datatree.py index 85b78ec54d..3a9061ec35 100644 --- a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/datatree.py +++ b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/datatree.py @@ -755,7 +755,14 @@ class DataTree: attempts = 0 while True: if attempts <= 10: - (v, buf) = self._draw(ir_type, kwargs, random=random) + try: + (v, buf) = self._draw(ir_type, kwargs, random=random) + except StopTest: # pragma: no cover + # it is possible that drawing from a fresh data can + # overrun BUFFER_SIZE, due to eg unlucky rejection sampling + # of integer probes. Retry these cases. + attempts += 1 + continue else: (v, buf) = self._draw_from_cache( ir_type, kwargs, key=id(current_node), random=random @@ -781,9 +788,13 @@ class DataTree: attempts = 0 while True: if attempts <= 10: - (v, buf) = self._draw( - branch.ir_type, branch.kwargs, random=random - ) + try: + (v, buf) = self._draw( + branch.ir_type, branch.kwargs, random=random + ) + except StopTest: # pragma: no cover + attempts += 1 + continue else: (v, buf) = self._draw_from_cache( branch.ir_type, branch.kwargs, key=id(branch), random=random diff --git a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/junkdrawer.py b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/junkdrawer.py index 61f9f37e51..716b5d3d82 100644 --- a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/junkdrawer.py +++ b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/junkdrawer.py @@ -31,6 +31,8 @@ from typing import ( overload, ) +from sortedcontainers import SortedList + from hypothesis.errors import HypothesisWarning ARRAY_CODES = ["B", "H", "I", "L", "Q", "O"] @@ -199,27 +201,36 @@ class LazySequenceCopy: in O(1) time. The full list API is not supported yet but there's no reason in principle it couldn't be.""" - __mask: Optional[Dict[int, int]] - def __init__(self, values: Sequence[int]): self.__values = values self.__len = len(values) - self.__mask = None + self.__mask: Optional[Dict[int, int]] = None + self.__popped_indices: Optional[SortedList] = None def __len__(self) -> int: - return self.__len + if self.__popped_indices is None: + return self.__len + return self.__len - len(self.__popped_indices) - def pop(self) -> int: + def pop(self, i: int = -1) -> int: if len(self) == 0: raise IndexError("Cannot pop from empty list") - result = self[-1] - self.__len -= 1 + i = self.__underlying_index(i) + + v = None if self.__mask is not None: - self.__mask.pop(self.__len, None) - return result + v = self.__mask.pop(i, None) + if v is None: + v = self.__values[i] + + if self.__popped_indices is None: + self.__popped_indices = SortedList() + self.__popped_indices.add(i) + return v def __getitem__(self, i: int) -> int: - i = self.__check_index(i) + i = self.__underlying_index(i) + default = self.__values[i] if self.__mask is None: return default @@ -227,18 +238,34 @@ class LazySequenceCopy: return self.__mask.get(i, default) def __setitem__(self, i: int, v: int) -> None: - i = self.__check_index(i) + i = self.__underlying_index(i) if self.__mask is None: self.__mask = {} self.__mask[i] = v - def __check_index(self, i: int) -> int: + def __underlying_index(self, i: int) -> int: n = len(self) if i < -n or i >= n: raise IndexError(f"Index {i} out of range [0, {n})") if i < 0: i += n assert 0 <= i < n + + if self.__popped_indices is not None: + # given an index i in the popped representation of the list, compute + # its corresponding index in the underlying list. given + # l = [1, 4, 2, 10, 188] + # l.pop(3) + # l.pop(1) + # assert l == [1, 2, 188] + # + # we want l[i] == self.__values[f(i)], where f is this function. + assert len(self.__popped_indices) <= len(self.__values) + + for idx in self.__popped_indices: + if idx > i: + break + i += 1 return i @@ -345,14 +372,6 @@ def find_integer(f: Callable[[int], bool]) -> int: return lo -def pop_random(random: Random, seq: LazySequenceCopy) -> int: - """Remove and return a random element of seq. This runs in O(1) but leaves - the sequence in an arbitrary order.""" - i = random.randrange(0, len(seq)) - swap(seq, i, len(seq) - 1) - return seq.pop() - - class NotFound(Exception): pass diff --git a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/pareto.py b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/pareto.py index b43e6df5bc..a0451d7f86 100644 --- a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/pareto.py +++ b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/pareto.py @@ -179,8 +179,7 @@ class ParetoFront: failures = 0 while i + 1 < len(front) and failures < 10: j = self.__random.randrange(i + 1, len(front)) - swap(front, j, len(front) - 1) - candidate = front.pop() + candidate = front.pop(j) dom = dominance(data, candidate) assert dom != DominanceRelation.RIGHT_DOMINATES if dom == DominanceRelation.LEFT_DOMINATES: diff --git a/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/collections.py b/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/collections.py index 90ffca6ca7..5d43390630 100644 --- a/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/collections.py +++ b/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/collections.py @@ -287,12 +287,8 @@ class UniqueSampledListStrategy(UniqueListStrategy): remaining = LazySequenceCopy(self.element_strategy.elements) while remaining and should_draw.more(): - i = len(remaining) - 1 - j = data.draw_integer(0, i) - if j != i: - remaining[i], remaining[j] = remaining[j], remaining[i] - value = self.element_strategy._transform(remaining.pop()) - + j = data.draw_integer(0, len(remaining) - 1) + value = self.element_strategy._transform(remaining.pop(j)) if value is not filter_not_satisfied and all( key(value) not in seen for key, seen in zip(self.keys, seen_sets) ): diff --git a/contrib/python/hypothesis/py3/hypothesis/version.py b/contrib/python/hypothesis/py3/hypothesis/version.py index 1da3483a7d..6f39e34255 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, 102, 1) +__version_info__ = (6, 102, 4) __version__ = ".".join(map(str, __version_info__)) diff --git a/contrib/python/hypothesis/py3/ya.make b/contrib/python/hypothesis/py3/ya.make index 79efe78dc3..f2c0ffc956 100644 --- a/contrib/python/hypothesis/py3/ya.make +++ b/contrib/python/hypothesis/py3/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(6.102.1) +VERSION(6.102.4) LICENSE(MPL-2.0) diff --git a/contrib/python/zope.interface/py3/.dist-info/METADATA b/contrib/python/zope.interface/py3/.dist-info/METADATA index 90aae5b9d9..50651bb9eb 100644 --- a/contrib/python/zope.interface/py3/.dist-info/METADATA +++ b/contrib/python/zope.interface/py3/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: zope.interface -Version: 6.3 +Version: 6.4 Summary: Interfaces for Python Home-page: https://github.com/zopefoundation/zope.interface Author: Zope Foundation and Contributors @@ -75,6 +75,14 @@ For detailed documentation, please see https://zopeinterface.readthedocs.io/en/l Changes ========= +6.4 (2024-05-15) +================ + +- Adjust for incompatible changes in Python 3.13b1. + (`#292 <https://github.com/zopefoundation/zope.interface/issues/292>`) + +- Build windows wheels on GHA. + 6.3 (2024-04-12) ================ diff --git a/contrib/python/zope.interface/py3/ya.make b/contrib/python/zope.interface/py3/ya.make index 1bc58aab0a..a751087116 100644 --- a/contrib/python/zope.interface/py3/ya.make +++ b/contrib/python/zope.interface/py3/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(6.3) +VERSION(6.4) LICENSE(ZPL-2.1) diff --git a/contrib/python/zope.interface/py3/zope/interface/interface.py b/contrib/python/zope.interface/py3/zope/interface/interface.py index 733e3954fe..8e0d9ad2b7 100644 --- a/contrib/python/zope.interface/py3/zope/interface/interface.py +++ b/contrib/python/zope.interface/py3/zope/interface/interface.py @@ -802,6 +802,9 @@ class InterfaceClass(_InterfaceClassBase): # __static_attributes__: Python 3.13a6+ # https://github.com/python/cpython/pull/115913 '__static_attributes__', + # __firstlineno__: Python 3.13b1+ + # https://github.com/python/cpython/pull/118475 + '__firstlineno__', ) and aval is not _decorator_non_return } |