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

Function Optional

Lib/typing.py:744–747  ·  view source on GitHub ↗

Optional[X] is equivalent to Union[X, None].

(self, parameters)

Source from the content-addressed store, hash-verified

742
743@_SpecialForm
744def Optional(self, parameters):
745 """Optional[X] is equivalent to Union[X, None]."""
746 arg = _type_check(parameters, f"{self} requires a single type.")
747 return Union[arg, type(None)]
748
749@_TypedCacheSpecialForm
750@_tp_cache(typed=True)

Callers 1

pyast.rsFile · 0.85

Calls 1

_type_checkFunction · 0.85

Tested by

no test coverage detected