forked from python-trio/flake8-async
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathasync103_both_imported.py
52 lines (46 loc) · 953 Bytes
/
async103_both_imported.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# NOANYIO - don't run it with substitutions
import anyio
import trio
try:
...
except trio.Cancelled: # ASYNC103: 7, "trio.Cancelled"
...
except (
anyio.get_cancelled_exc_class() # ASYNC103: 4, "anyio.get_cancelled_exc_class()"
):
...
except: # safe
...
try:
...
except (
anyio.get_cancelled_exc_class() # ASYNC103: 4, "anyio.get_cancelled_exc_class()"
):
...
except trio.Cancelled: # ASYNC103: 7, "trio.Cancelled"
...
except: # safe
...
try:
...
except (
anyio.get_cancelled_exc_class() # ASYNC103: 4, "anyio.get_cancelled_exc_class()"
):
...
except: # safe ?
...
try:
...
except trio.Cancelled: # ASYNC103: 7, "trio.Cancelled"
...
except: # safe ?
...
# Check we get the proper suggestion when both are imported
try:
...
except BaseException: # ASYNC103_anyio_trio: 7, "BaseException"
...
try:
...
except: # ASYNC103_anyio_trio: 0, "bare except"
...