Include AsyncIterator import for both clients and servers (#264)

Co-authored-by: Robin Lambertz <github@roblab.la>
This commit is contained in:
lazytype
2021-11-05 14:22:15 +00:00
committed by GitHub
co-authored by Robin Lambertz
parent 421fdba309
commit c424b6f8db
2 changed files with 4 additions and 2 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
from abc import ABC
from collections import AsyncIterable
from collections.abc import AsyncIterable
from typing import Callable, Any, Dict
import grpclib
+3 -1
View File
@@ -653,7 +653,9 @@ class ServiceMethodCompiler(ProtoContentBase):
self.output_file.typing_imports.add("AsyncIterable")
self.output_file.typing_imports.add("Iterable")
self.output_file.typing_imports.add("Union")
if self.server_streaming:
# Required by both client and server
if self.client_streaming or self.server_streaming:
self.output_file.typing_imports.add("AsyncIterator")
super().__post_init__() # check for unset fields