---
source: crates/ruff_linter/src/rules/flake8_async/mod.rs
---
ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
  --> ASYNC116.py:11:11
   |
10 |     # These examples are probably not meant to ever wake up:
11 |     await trio.sleep(100000)  # error: 116, "async"
   |           ^^^^^^^^^^^^^^^^^^
12 |
13 |     # 'inf literal' overflow trick
   |
help: Replace with `trio.sleep_forever()`
   |
10 |     # These examples are probably not meant to ever wake up:
   -     await trio.sleep(100000)  # error: 116, "async"
11 +     await trio.sleep_forever()  # error: 116, "async"
12 |
   |
note: This is an unsafe fix and may change runtime behavior

ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
  --> ASYNC116.py:14:11
   |
13 |     # 'inf literal' overflow trick
14 |     await trio.sleep(1e999)  # error: 116, "async"
   |           ^^^^^^^^^^^^^^^^^
15 |
16 |     await trio.sleep(86399)
   |
help: Replace with `trio.sleep_forever()`
   |
13 |     # 'inf literal' overflow trick
   -     await trio.sleep(1e999)  # error: 116, "async"
14 +     await trio.sleep_forever()  # error: 116, "async"
15 |
   |
note: This is an unsafe fix and may change runtime behavior

ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
  --> ASYNC116.py:18:11
   |
16 |     await trio.sleep(86399)
17 |     await trio.sleep(86400)
18 |     await trio.sleep(86400.01)  # error: 116, "async"
   |           ^^^^^^^^^^^^^^^^^^^^
19 |     await trio.sleep(86401)  # error: 116, "async"
   |
help: Replace with `trio.sleep_forever()`
   |
17 |     await trio.sleep(86400)
   -     await trio.sleep(86400.01)  # error: 116, "async"
18 +     await trio.sleep_forever()  # error: 116, "async"
19 |     await trio.sleep(86401)  # error: 116, "async"
   |
note: This is an unsafe fix and may change runtime behavior

ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
  --> ASYNC116.py:19:11
   |
17 |     await trio.sleep(86400)
18 |     await trio.sleep(86400.01)  # error: 116, "async"
19 |     await trio.sleep(86401)  # error: 116, "async"
   |           ^^^^^^^^^^^^^^^^^
20 |
21 |     await trio.sleep(-1)  # will raise a runtime error
   |
help: Replace with `trio.sleep_forever()`
   |
18 |     await trio.sleep(86400.01)  # error: 116, "async"
   -     await trio.sleep(86401)  # error: 116, "async"
19 +     await trio.sleep_forever()  # error: 116, "async"
20 |
   |
note: This is an unsafe fix and may change runtime behavior

ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
  --> ASYNC116.py:48:5
   |
47 |     # does not require the call to be awaited, nor in an async fun
48 |     trio.sleep(86401)  # error: 116, "async"
   |     ^^^^^^^^^^^^^^^^^
49 |     # also checks that we don't break visit_Call
50 |     trio.run(trio.sleep(86401))  # error: 116, "async"
   |
help: Replace with `trio.sleep_forever()`
   |
47 |     # does not require the call to be awaited, nor in an async fun
   -     trio.sleep(86401)  # error: 116, "async"
48 +     trio.sleep_forever()  # error: 116, "async"
49 |     # also checks that we don't break visit_Call
   |
note: This is an unsafe fix and may change runtime behavior

ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
  --> ASYNC116.py:50:14
   |
48 |     trio.sleep(86401)  # error: 116, "async"
49 |     # also checks that we don't break visit_Call
50 |     trio.run(trio.sleep(86401))  # error: 116, "async"
   |              ^^^^^^^^^^^^^^^^^
   |
help: Replace with `trio.sleep_forever()`
   |
49 |     # also checks that we don't break visit_Call
   -     trio.run(trio.sleep(86401))  # error: 116, "async"
50 +     trio.run(trio.sleep_forever())  # error: 116, "async"
51 |
   |
note: This is an unsafe fix and may change runtime behavior

ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
  --> ASYNC116.py:57:11
   |
56 |     # catch from import
57 |     await sleep(86401)  # error: 116, "async"
   |           ^^^^^^^^^^^^
   |
help: Replace with `trio.sleep_forever()`
   |
4  | from math import inf
5  + from trio import sleep_forever
6  |
--------------------------------------------------------------------------------
57 |     # catch from import
   -     await sleep(86401)  # error: 116, "async"
58 +     await sleep_forever()  # error: 116, "async"
59 |
   |
note: This is an unsafe fix and may change runtime behavior

ASYNC116 [*] `anyio.sleep()` with >24 hour interval should usually be `anyio.sleep_forever()`
  --> ASYNC116.py:64:11
   |
63 |     # These examples are probably not meant to ever wake up:
64 |     await anyio.sleep(100000)  # error: 116, "async"
   |           ^^^^^^^^^^^^^^^^^^^
65 |
66 |     # 'inf literal' overflow trick
   |
help: Replace with `anyio.sleep_forever()`
   |
63 |     # These examples are probably not meant to ever wake up:
   -     await anyio.sleep(100000)  # error: 116, "async"
64 +     await anyio.sleep_forever()  # error: 116, "async"
65 |
   |
note: This is an unsafe fix and may change runtime behavior

ASYNC116 [*] `anyio.sleep()` with >24 hour interval should usually be `anyio.sleep_forever()`
  --> ASYNC116.py:67:11
   |
66 |     # 'inf literal' overflow trick
67 |     await anyio.sleep(1e999)  # error: 116, "async"
   |           ^^^^^^^^^^^^^^^^^^
68 |
69 |     await anyio.sleep(86399)
   |
help: Replace with `anyio.sleep_forever()`
   |
66 |     # 'inf literal' overflow trick
   -     await anyio.sleep(1e999)  # error: 116, "async"
67 +     await anyio.sleep_forever()  # error: 116, "async"
68 |
   |
note: This is an unsafe fix and may change runtime behavior

ASYNC116 [*] `anyio.sleep()` with >24 hour interval should usually be `anyio.sleep_forever()`
  --> ASYNC116.py:71:11
   |
69 |     await anyio.sleep(86399)
70 |     await anyio.sleep(86400)
71 |     await anyio.sleep(86400.01)  # error: 116, "async"
   |           ^^^^^^^^^^^^^^^^^^^^^
72 |     await anyio.sleep(86401)  # error: 116, "async"
   |
help: Replace with `anyio.sleep_forever()`
   |
70 |     await anyio.sleep(86400)
   -     await anyio.sleep(86400.01)  # error: 116, "async"
71 +     await anyio.sleep_forever()  # error: 116, "async"
72 |     await anyio.sleep(86401)  # error: 116, "async"
   |
note: This is an unsafe fix and may change runtime behavior

ASYNC116 [*] `anyio.sleep()` with >24 hour interval should usually be `anyio.sleep_forever()`
  --> ASYNC116.py:72:11
   |
70 |     await anyio.sleep(86400)
71 |     await anyio.sleep(86400.01)  # error: 116, "async"
72 |     await anyio.sleep(86401)  # error: 116, "async"
   |           ^^^^^^^^^^^^^^^^^^
73 |
74 |     await anyio.sleep(-1)  # will raise a runtime error
   |
help: Replace with `anyio.sleep_forever()`
   |
71 |     await anyio.sleep(86400.01)  # error: 116, "async"
   -     await anyio.sleep(86401)  # error: 116, "async"
72 +     await anyio.sleep_forever()  # error: 116, "async"
73 |
   |
note: This is an unsafe fix and may change runtime behavior

ASYNC116 [*] `anyio.sleep()` with >24 hour interval should usually be `anyio.sleep_forever()`
   --> ASYNC116.py:101:5
    |
100 |     # does not require the call to be awaited, nor in an async fun
101 |     anyio.sleep(86401)  # error: 116, "async"
    |     ^^^^^^^^^^^^^^^^^^
102 |     # also checks that we don't break visit_Call
103 |     anyio.run(anyio.sleep(86401))  # error: 116, "async"
    |
help: Replace with `anyio.sleep_forever()`
    |
100 |     # does not require the call to be awaited, nor in an async fun
    -     anyio.sleep(86401)  # error: 116, "async"
101 +     anyio.sleep_forever()  # error: 116, "async"
102 |     # also checks that we don't break visit_Call
    |
note: This is an unsafe fix and may change runtime behavior

ASYNC116 [*] `anyio.sleep()` with >24 hour interval should usually be `anyio.sleep_forever()`
   --> ASYNC116.py:103:15
    |
101 |     anyio.sleep(86401)  # error: 116, "async"
102 |     # also checks that we don't break visit_Call
103 |     anyio.run(anyio.sleep(86401))  # error: 116, "async"
    |               ^^^^^^^^^^^^^^^^^^
    |
help: Replace with `anyio.sleep_forever()`
    |
102 |     # also checks that we don't break visit_Call
    -     anyio.run(anyio.sleep(86401))  # error: 116, "async"
103 +     anyio.run(anyio.sleep_forever())  # error: 116, "async"
104 |
    |
note: This is an unsafe fix and may change runtime behavior

ASYNC116 [*] `anyio.sleep()` with >24 hour interval should usually be `anyio.sleep_forever()`
   --> ASYNC116.py:110:11
    |
109 |     # catch from import
110 |     await sleep(86401)  # error: 116, "async"
    |           ^^^^^^^^^^^^
    |
help: Replace with `anyio.sleep_forever()`
    |
4   | from math import inf
5   + from anyio import sleep_forever
6   |
--------------------------------------------------------------------------------
110 |     # catch from import
    -     await sleep(86401)  # error: 116, "async"
111 +     await sleep_forever()  # error: 116, "async"
112 |
    |
note: This is an unsafe fix and may change runtime behavior

ASYNC116 [*] `anyio.sleep()` with >24 hour interval should usually be `anyio.sleep_forever()`
   --> ASYNC116.py:119:11
    |
117 |     await anyio.sleep(seconds=1)  # OK
118 |
119 |     await anyio.sleep(delay=86401)  # ASYNC116
    |           ^^^^^^^^^^^^^^^^^^^^^^^^
120 |     await anyio.sleep(seconds=86401)  # OK
    |
help: Replace with `anyio.sleep_forever()`
    |
118 |
    -     await anyio.sleep(delay=86401)  # ASYNC116
119 +     await anyio.sleep_forever()  # ASYNC116
120 |     await anyio.sleep(seconds=86401)  # OK
    |
note: This is an unsafe fix and may change runtime behavior

ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
   --> ASYNC116.py:129:11
    |
127 |     await trio.sleep(delay=1)  # OK
128 |
129 |     await trio.sleep(seconds=86401)  # ASYNC116
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^
130 |     await trio.sleep(delay=86401)  # OK
    |
help: Replace with `trio.sleep_forever()`
    |
128 |
    -     await trio.sleep(seconds=86401)  # ASYNC116
129 +     await trio.sleep_forever()  # ASYNC116
130 |     await trio.sleep(delay=86401)  # OK
    |
note: This is an unsafe fix and may change runtime behavior

ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
   --> ASYNC116.py:137:11
    |
135 |     from trio import sleep
136 |
137 |     await sleep(18446744073709551616)
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
138 |     await trio.sleep(99999999999999999999)
    |
help: Replace with `trio.sleep_forever()`
    |
136 |
    -     await sleep(18446744073709551616)
137 +     await trio.sleep_forever()
138 |     await trio.sleep(99999999999999999999)
    |
note: This is an unsafe fix and may change runtime behavior

ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
   --> ASYNC116.py:138:11
    |
137 |     await sleep(18446744073709551616)
138 |     await trio.sleep(99999999999999999999)
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
help: Replace with `trio.sleep_forever()`
    |
137 |     await sleep(18446744073709551616)
    -     await trio.sleep(99999999999999999999)
138 +     await trio.sleep_forever()
    |
note: This is an unsafe fix and may change runtime behavior
