8000 Fixed mypy errors · IBMZ-Linux-OSS-Python/anyio@22a38ad · GitHub
[go: up one dir, main page]

Skip to content

Commit 22a38ad

Browse files
committed
Fixed mypy errors
1 parent a925074 commit 22a38ad

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/anyio/_backends/_trio.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import array
44
import math
55
import socket
6+
import sys
67
from collections.abc import AsyncIterator, Iterable
78
from concurrent.futures import Future
89
from dataclasses import dataclass
@@ -61,6 +62,9 @@
6162
from ..abc import IPSockAddrType, UDPPacketType, UNIXDatagramPacketType
6263
from ..abc._eventloop import AsyncBackend
6364

65+
if sys.version_info < (3, 11):
66+
from exceptiongroup import BaseExceptionGroup
67+
6468
if TYPE_CHECKING:
6569
from trio_typing import TaskStatus
6670

@@ -134,7 +138,9 @@ def shield(self, value: bool) -> None:
134138
class TaskGroup(abc.TaskGroup):
135139
def __init__(self) -> None:
136140
self._active = False
137-
self._nursery_manager = trio.open_nursery(strict_exception_groups=True)
141+
self._nursery_manager = trio.open_nursery(
142+
strict_exception_groups=True # type: ignore[call-arg]
143+
)
138144
self.cancel_scope = None # type: ignore[assignment]
139145

140146
async def __aenter__(self) -> TaskGroup:
@@ -154,7 +160,7 @@ async def __aexit__(
154160
except BaseExceptionGroup as excgrp:
155161
matched, unmatched = excgrp.split(trio.Cancelled)
156162
if not unmatched:
157-
raise trio.Cancelled._create() from None
163+
raise trio.Cancelled._create() from None # type: ignore[attr-defined]
158164
elif unmatched:
159165
raise unmatched from None
160166
else:
@@ -727,7 +733,9 @@ def __init__(self, **options: Any) -> None:
727733

728734
async def _trio_main(self) -> None:
729735
self._stop_event = trio.Event()
730-
async with trio.open_nursery(strict_exception_groups=True) as self._nursery:
736+
async with trio.open_nursery(
737+
strict_exception_groups=True # type: ignore[call-arg]
738+
) as self._nursery:
731739
await self._stop_event.wait()
732740

733741
async def _call_func(

0 commit comments

Comments
 (0)
0