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 10:22:15 -04:00 committed by GitHub
parent 421fdba309
commit c424b6f8db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

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

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