Skip to content

Commit 2e2825b

Browse files
authored
Make public exports of aiotools.taskgroup static-checker friendly (#72)
1 parent eef3cd8 commit 2e2825b

File tree

3 files changed

+17
-21
lines changed

3 files changed

+17
-21
lines changed

.github/workflows/timeline-check.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ jobs:
88
if: |
99
!contains(github.event.pull_request.labels.*.name, 'skip:changelog')
1010
steps:
11-
- uses: actions/checkout@v2
11+
- uses: actions/checkout@v4
1212
with:
1313
fetch-depth: 0
1414
- name: Set up Python
15-
uses: actions/setup-python@v3
15+
uses: actions/setup-python@v5
1616
with:
1717
python-version: "3.10"
1818
cache: "pip"

changes/72.fix

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix static type checker's recognition of `aiotools.taskgroup` public exports, such as `aiotools.PersistentTaskGroup`

src/aiotools/taskgroup/__init__.py

+14-19
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,29 @@
22

33
from .types import MultiError, TaskGroupError
44

5+
__all__ = [
6+
"MultiError",
7+
"TaskGroup",
8+
"TaskGroupError",
9+
"PersistentTaskGroup",
10+
"as_completed_safe",
11+
"persistent",
12+
"persistent_compat",
13+
"current_taskgroup",
14+
"current_ptaskgroup",
15+
"has_contextvars",
16+
]
17+
518
if hasattr(asyncio, "TaskGroup"):
619
from . import persistent
720
from .base import * # noqa
821
from .persistent import * # noqa
922

10-
__all__ = [
11-
"MultiError",
12-
"TaskGroup",
13-
"TaskGroupError",
14-
"current_taskgroup",
15-
*persistent.__all__,
16-
]
23+
has_contextvars = True
1724
else:
1825
from . import persistent_compat
1926
from .base_compat import * # type: ignore # noqa
2027
from .base_compat import has_contextvars
2128
from .persistent_compat import * # type: ignore # noqa
2229

23-
__all__ = [ # type: ignore # noqa
24-
"MultiError",
25-
"TaskGroup",
26-
"TaskGroupError",
27-
*persistent_compat.__all__,
28-
]
29-
if has_contextvars:
30-
__all__.append("current_taskgroup")
31-
32-
3330
from .utils import as_completed_safe # noqa
34-
35-
__all__.append("as_completed_safe")

0 commit comments

Comments
 (0)