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

Method foo

Lib/test/test_typing.py:8056–8060  ·  view source on GitHub ↗
(a: A)

Source from the content-addressed store, hash-verified

8054 A = Optional[Type[BaseException]]
8055
8056 def foo(a: A) -> Optional[BaseException]:
8057 if a is None:
8058 return None
8059 else:
8060 return a()
8061
8062 self.assertIsInstance(foo(KeyboardInterrupt), KeyboardInterrupt)
8063 self.assertIsNone(foo(None))

Callers

nothing calls this directly

Calls 1

aClass · 0.70

Tested by

no test coverage detected