trio-async-function-with-timeout (TRIO109)#
Derived from the flake8-trio linter.
This rule is unstable and in preview. The --preview
flag is required for use.
What it does#
Checks for async
functions with a timeout
argument.
Why is this bad?#
Rather than implementing asynchronous timeout behavior manually, prefer
trio's built-in timeout functionality, available as trio.fail_after
,
trio.move_on_after
, trio.fail_at
, and trio.move_on_at
.
Known problems#
To avoid false positives, this rule is only enabled if trio
is imported
in the module.
Example#
Use instead: