MCPcopy Index your code
hub / github.com/ipython/ipython / uniq_stable

Function uniq_stable

IPython/utils/data.py:20–45  ·  view source on GitHub ↗

uniq_stable(elems) -> list .. deprecated:: 9.8 This function is deprecated and will be removed in a future version. It is not used within IPython and was never part of the public API. Return from an iterable, a list of all the unique elements in the input, but maintaini

(elems: Iterable[T])

Source from the content-addressed store, hash-verified

18
19
20def uniq_stable(elems: Iterable[T]) -> list[T]:
21 """uniq_stable(elems) -> list
22
23 .. deprecated:: 9.8
24 This function is deprecated and will be removed in a future version.
25 It is not used within IPython and was never part of the public API.
26
27 Return from an iterable, a list of all the unique elements in the input,
28 but maintaining the order in which they first appear.
29
30 Note: All elements in the input must be hashable for this routine
31 to work, as it internally uses a set for efficiency reasons.
32 """
33 warnings.warn(
34 "uniq_stable is deprecated since IPython 9.8 and will be removed in a future version. "
35 "It was never part of the public API.",
36 DeprecationWarning,
37 stacklevel=2,
38 )
39 seen: set[T] = set()
40 result: list[T] = []
41 for x in elems:
42 if x not in seen:
43 seen.add(x)
44 result.append(x)
45 return result
46
47
48def chop(seq: Sequence[T], size: int) -> list[Sequence[T]]:

Callers

nothing calls this directly

Calls 2

warnMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…