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])
| 18 | |
| 19 | |
| 20 | def 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 | |
| 48 | def chop(seq: Sequence[T], size: int) -> list[Sequence[T]]: |