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

Method relevant_items

mypy/types.py:3381–3386  ·  view source on GitHub ↗

Removes NoneTypes from Unions when strict Optional checking is off.

(self)

Source from the content-addressed store, hash-verified

3379 return visitor.visit_union_type(self)
3380
3381 def relevant_items(self) -> list[Type]:
3382 """Removes NoneTypes from Unions when strict Optional checking is off."""
3383 if state.strict_optional:
3384 return self.items
3385 else:
3386 return [i for i in self.items if not isinstance(get_proper_type(i), NoneType)]
3387
3388 def serialize(self) -> JsonDict:
3389 return {

Calls 2

isinstanceFunction · 0.85
get_proper_typeFunction · 0.85

Tested by

no test coverage detected