PHP 8.2.30
Preview: _itertools.py Size: 884 B
/opt/alt/python312/lib/python3.12/site-packages/setuptools/_vendor/importlib_resources/_itertools.py

from itertools import filterfalse

from typing import (
    Callable,
    Iterable,
    Iterator,
    Optional,
    Set,
    TypeVar,
    Union,
)

# Type and type variable definitions
_T = TypeVar('_T')
_U = TypeVar('_U')


def unique_everseen(
    iterable: Iterable[_T], key: Optional[Callable[[_T], _U]] = None
) -> Iterator[_T]:
    "List unique elements, preserving order. Remember all elements ever seen."
    # unique_everseen('AAAABBBCCDAABBB') --> A B C D
    # unique_everseen('ABBCcAD', str.lower) --> A B C D
    seen: Set[Union[_T, _U]] = set()
    seen_add = seen.add
    if key is None:
        for element in filterfalse(seen.__contains__, iterable):
            seen_add(element)
            yield element
    else:
        for element in iterable:
            k = key(element)
            if k not in seen:
                seen_add(k)
                yield element

Directory Contents

Dirs: 1 × Files: 10

Name Size Perms Modified Actions
- drwxr-xr-x 2026-02-10 08:06:45
Edit Download
5.02 KB lrw-r--r-- 2026-01-08 18:42:35
Edit Download
0 B lrw-r--r-- 2026-01-08 18:42:35
Edit Download
3.50 KB lrw-r--r-- 2026-01-08 18:42:35
Edit Download
2.52 KB lrw-r--r-- 2026-01-08 18:42:35
Edit Download
4.40 KB lrw-r--r-- 2026-01-08 18:42:35
Edit Download
5.33 KB lrw-r--r-- 2026-01-08 18:42:35
Edit Download
2.86 KB lrw-r--r-- 2026-01-08 18:42:35
Edit Download
884 B lrw-r--r-- 2026-01-08 18:42:35
Edit Download
3.40 KB lrw-r--r-- 2026-01-08 18:42:35
Edit Download
506 B lrw-r--r-- 2026-01-08 18:42:35
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).