MCPcopy Index your code
hub / github.com/python/cpython / _deduplicate

Function _deduplicate

Lib/typing.py:373–385  ·  view source on GitHub ↗
(params, *, unhashable_fallback=False)

Source from the content-addressed store, hash-verified

371 return newargs
372
373def _deduplicate(params, *, unhashable_fallback=False):
374 # Weed out strict duplicates, preserving the first of each occurrence.
375 try:
376 return dict.fromkeys(params)
377 except TypeError:
378 if not unhashable_fallback:
379 raise
380 # Happens for cases like `Annotated[dict, {'x': IntValidator()}]`
381 new_unhashable = []
382 for t in params:
383 if t not in new_unhashable:
384 new_unhashable.append(t)
385 return new_unhashable
386
387def _flatten_literal_params(parameters):
388 """Internal helper for Literal creation: flatten Literals among parameters."""

Callers 1

LiteralFunction · 0.85

Calls 2

fromkeysMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…