Trio's documentations explicitly states that the "clock" argument of trio.run can be None:
clock – None to use the default system-specific monotonic clock; otherwise, an object implementing the trio.abc.Clock interface, like (for example) a trio.testing.MockClock instance.
however the stub for it is showing only trio.abc.Clock:
This is making it problematic to wrap run with a similar calling interface:
from trio import run
from trio.abc import Clock
def my_run(clock: Clock|None = None) -> None:
run(my_async_fn, clock=clock)
async def my_async_fn() -> None:
...
$ mypy sample.py
sample.py:5: error: Argument "clock" to "run" has incompatible type "Optional[Clock]"; expected "Clock"
Found 1 error in 1 file (checked 1 source file)
Trio's documentations explicitly states that the "clock" argument of
trio.run
can beNone
:however the stub for it is showing only
trio.abc.Clock
:https://github.com/python-trio/trio-typing/blob/9d57cb1d3f1fa7c9f915e7c884e9a2930645b8b7/trio-stubs/__init__.pyi#L166-L173
This is making it problematic to wrap
run
with a similar calling interface: