Commit b41d9c7
committed
use _HAVE_ARGCOMPLETE flag for import argcomplete
Setting autocomplete to None if it can not be imported from argcomplete
now causes mypy to fail with
> src/packagename/cli.py:17: error: Incompatible types in assignment (expression has type "None", variable has type "CompletionFinder") [assignment]
I'm not aware of a way to add an Optional type hint to autocomplete, so
instead of assigning None to it, add a flag named _HAVE_AUTOCOMPLETE to
track whether it has been imported.
Signed-off-by: Kevin Locke <[email protected]>1 parent 2468b69 commit b41d9c7
1 file changed
+5
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | | - | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| |||
105 | 107 | | |
106 | 108 | | |
107 | 109 | | |
108 | | - | |
| 110 | + | |
109 | 111 | | |
110 | 112 | | |
111 | 113 | | |
| |||
0 commit comments