MCPcopy Index your code
hub / github.com/RustPython/RustPython / _deduplicate

Function _deduplicate

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

Source from the content-addressed store, hash-verified

349 return newargs
350
351def _deduplicate(params, *, unhashable_fallback=False):
352 # Weed out strict duplicates, preserving the first of each occurrence.
353 try:
354 return dict.fromkeys(params)
355 except TypeError:
356 if not unhashable_fallback:
357 raise
358 # Happens for cases like `Annotated[dict, {'x': IntValidator()}]`
359 new_unhashable = []
360 for t in params:
361 if t not in new_unhashable:
362 new_unhashable.append(t)
363 return new_unhashable
364
365def _flatten_literal_params(parameters):
366 """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