aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/more-itertools
diff options
context:
space:
mode:
authorAlexander Smirnov <alex@ydb.tech>2024-09-26 14:44:45 +0000
committerAlexander Smirnov <alex@ydb.tech>2024-09-26 14:44:45 +0000
commitc853e78c5e416ede1d99665049657f2e304872e4 (patch)
treeb6e2e59629b8e0f863eec9a700121ca3f7416f28 /contrib/python/more-itertools
parent7d208c76420539a7e44f2393c66e7d0444744517 (diff)
parent47e779420bb80722978c1ffd518245bffd886a50 (diff)
downloadydb-c853e78c5e416ede1d99665049657f2e304872e4.tar.gz
Merge branch 'rightlib' into mergelibs-240926-1443
Diffstat (limited to 'contrib/python/more-itertools')
-rw-r--r--contrib/python/more-itertools/py3/.dist-info/METADATA2
-rw-r--r--contrib/python/more-itertools/py3/more_itertools/__init__.py2
-rw-r--r--contrib/python/more-itertools/py3/more_itertools/more.py2
-rw-r--r--contrib/python/more-itertools/py3/more_itertools/more.pyi6
-rw-r--r--contrib/python/more-itertools/py3/more_itertools/recipes.py7
-rw-r--r--contrib/python/more-itertools/py3/tests/test_recipes.py19
-rw-r--r--contrib/python/more-itertools/py3/ya.make2
7 files changed, 31 insertions, 9 deletions
diff --git a/contrib/python/more-itertools/py3/.dist-info/METADATA b/contrib/python/more-itertools/py3/.dist-info/METADATA
index c346b40880..a06c9b0a57 100644
--- a/contrib/python/more-itertools/py3/.dist-info/METADATA
+++ b/contrib/python/more-itertools/py3/.dist-info/METADATA
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: more-itertools
-Version: 10.4.0
+Version: 10.5.0
Summary: More routines for operating on iterables, beyond itertools
Keywords: itertools,iterator,iteration,filter,peek,peekable,chunk,chunked
Author-email: Erik Rose <erikrose@grinchcentral.com>
diff --git a/contrib/python/more-itertools/py3/more_itertools/__init__.py b/contrib/python/more-itertools/py3/more_itertools/__init__.py
index 2e2fcbbe7b..583fb57457 100644
--- a/contrib/python/more-itertools/py3/more_itertools/__init__.py
+++ b/contrib/python/more-itertools/py3/more_itertools/__init__.py
@@ -3,4 +3,4 @@
from .more import * # noqa
from .recipes import * # noqa
-__version__ = '10.4.0'
+__version__ = '10.5.0'
diff --git a/contrib/python/more-itertools/py3/more_itertools/more.py b/contrib/python/more-itertools/py3/more_itertools/more.py
index 3bf2c76b76..64fab26185 100644
--- a/contrib/python/more-itertools/py3/more_itertools/more.py
+++ b/contrib/python/more-itertools/py3/more_itertools/more.py
@@ -3017,7 +3017,7 @@ def circular_shifts(iterable, steps=1):
n = len(buffer)
n //= math.gcd(n, steps)
- for __ in repeat(None, n):
+ for _ in repeat(None, n):
buffer.rotate(steps)
yield tuple(buffer)
diff --git a/contrib/python/more-itertools/py3/more_itertools/more.pyi b/contrib/python/more-itertools/py3/more_itertools/more.pyi
index f1a155dce7..66e6938e13 100644
--- a/contrib/python/more-itertools/py3/more_itertools/more.pyi
+++ b/contrib/python/more-itertools/py3/more_itertools/more.pyi
@@ -3,8 +3,8 @@
from __future__ import annotations
import sys
+import types
-from types import TracebackType
from typing import (
Any,
Callable,
@@ -42,7 +42,7 @@ _Raisable = BaseException | Type[BaseException]
# The type of isinstance's second argument (from typeshed builtins)
if sys.version_info >= (3, 10):
- _ClassInfo = type | UnionType | tuple[_ClassInfo, ...]
+ _ClassInfo = type | types.UnionType | tuple[_ClassInfo, ...]
else:
_ClassInfo = type | tuple[_ClassInfo, ...]
@@ -619,7 +619,7 @@ class callback_iter(Generic[_T], Iterator[_T]):
self,
exc_type: Type[BaseException] | None,
exc_value: BaseException | None,
- traceback: TracebackType | None,
+ traceback: types.TracebackType | None,
) -> bool | None: ...
def __iter__(self) -> callback_iter[_T]: ...
def __next__(self) -> _T: ...
diff --git a/contrib/python/more-itertools/py3/more_itertools/recipes.py b/contrib/python/more-itertools/py3/more_itertools/recipes.py
index a21a1f5d88..67f76fa899 100644
--- a/contrib/python/more-itertools/py3/more_itertools/recipes.py
+++ b/contrib/python/more-itertools/py3/more_itertools/recipes.py
@@ -218,7 +218,12 @@ def all_equal(iterable, key=None):
True
"""
- return len(list(islice(groupby(iterable, key), 2))) <= 1
+ iterator = groupby(iterable, key)
+ for first in iterator:
+ for second in iterator:
+ return False
+ return True
+ return True
def quantify(iterable, pred=bool):
diff --git a/contrib/python/more-itertools/py3/tests/test_recipes.py b/contrib/python/more-itertools/py3/tests/test_recipes.py
index d3762d49db..684a6fcd0b 100644
--- a/contrib/python/more-itertools/py3/tests/test_recipes.py
+++ b/contrib/python/more-itertools/py3/tests/test_recipes.py
@@ -2,11 +2,12 @@ from decimal import Decimal
from doctest import DocTestSuite
from fractions import Fraction
from functools import reduce
-from itertools import combinations, count, permutations
+from itertools import combinations, count, groupby, permutations
from operator import mul
from math import factorial
from sys import version_info
from unittest import TestCase, skipIf
+from unittest.mock import patch
import more_itertools as mi
@@ -158,6 +159,22 @@ class AllEqualTests(TestCase):
self.assertTrue(mi.all_equal('4٤໔4৪', key=int))
self.assertFalse(mi.all_equal('Abc', key=str.casefold))
+ @patch('more_itertools.recipes.groupby', autospec=True)
+ def test_groupby_calls(self, mock_groupby):
+ next_count = 0
+
+ class _groupby(groupby):
+ def __next__(true_self):
+ nonlocal next_count
+ next_count += 1
+ return super().__next__()
+
+ mock_groupby.side_effect = _groupby
+ iterable = iter('aaaaa')
+ self.assertTrue(mi.all_equal(iterable))
+ self.assertEqual(list(iterable), [])
+ self.assertEqual(next_count, 2)
+
class QuantifyTests(TestCase):
"""Tests for ``quantify()``"""
diff --git a/contrib/python/more-itertools/py3/ya.make b/contrib/python/more-itertools/py3/ya.make
index ee8f86bc14..45df93175b 100644
--- a/contrib/python/more-itertools/py3/ya.make
+++ b/contrib/python/more-itertools/py3/ya.make
@@ -2,7 +2,7 @@
PY3_LIBRARY()
-VERSION(10.4.0)
+VERSION(10.5.0)
LICENSE(MIT)