MCPcopy Index your code
hub / github.com/python/mypy / _first

Function _first

mypy/plugins/enums.py:63–70  ·  view source on GitHub ↗

Return the first value from any iterable. Returns ``None`` if the iterable is empty.

(it: Iterable[_T])

Source from the content-addressed store, hash-verified

61
62
63def _first(it: Iterable[_T]) -> _T | None:
64 """Return the first value from any iterable.
65
66 Returns ``None`` if the iterable is empty.
67 """
68 for val in it:
69 return val
70 return None
71
72
73def _infer_value_type_with_auto_fallback(

Callers 3

_implements_newFunction · 0.85
enum_value_callbackFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…