Skip to content

Commit c424b6f

Browse files
lazytyperoblabla
andauthored
Include AsyncIterator import for both clients and servers (#264)
Co-authored-by: Robin Lambertz <[email protected]>
1 parent 421fdba commit c424b6f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/betterproto/grpc/grpclib_server.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from abc import ABC
2-
from collections import AsyncIterable
2+
from collections.abc import AsyncIterable
33
from typing import Callable, Any, Dict
44

55
import grpclib

src/betterproto/plugin/models.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,9 @@ def __post_init__(self) -> None:
653653
self.output_file.typing_imports.add("AsyncIterable")
654654
self.output_file.typing_imports.add("Iterable")
655655
self.output_file.typing_imports.add("Union")
656-
if self.server_streaming:
656+
657+
# Required by both client and server
658+
if self.client_streaming or self.server_streaming:
657659
self.output_file.typing_imports.add("AsyncIterator")
658660

659661
super().__post_init__() # check for unset fields

0 commit comments

Comments
 (0)