common: Move all_same into _itertools

master
Felix Stupp 10 months ago
parent 0bdc11d5b2
commit f91f15e81f
Signed by: zocker
GPG Key ID: 93E1BD26F6B02FB7

@ -3,7 +3,6 @@ import subprocess
import sys
from typing import (
IO,
Iterable,
Literal,
Optional,
Sequence,
@ -12,12 +11,6 @@ from typing import (
)
def all_same(iterable: Iterable) -> bool:
it = iter(iterable)
first = next(it)
return all(first == elem for elem in it)
def call(
args: Sequence[str],
check: bool = True,

@ -1,4 +1,5 @@
from ._itertools import (
all_same,
fix_iter,
iter_lookahead,
limit_iter,
@ -6,6 +7,7 @@ from ._itertools import (
__all__ = [
"all_same",
"fix_iter",
"iter_lookahead",
"limit_iter",

@ -13,6 +13,15 @@ from typing import (
T = TypeVar("T")
# check Iterable for same values
def all_same(iterable: Iterable) -> bool:
it = iter(iterable)
first = next(it)
return all(first == elem for elem in it)
# fix Iterables

Loading…
Cancel
Save