Include AsyncIterator import for both clients and servers (#264)
Co-authored-by: Robin Lambertz <github@roblab.la>
This commit is contained in:
		| @@ -1,5 +1,5 @@ | |||||||
| from abc import ABC | from abc import ABC | ||||||
| from collections import AsyncIterable | from collections.abc import AsyncIterable | ||||||
| from typing import Callable, Any, Dict | from typing import Callable, Any, Dict | ||||||
|  |  | ||||||
| import grpclib | import grpclib | ||||||
|   | |||||||
| @@ -653,7 +653,9 @@ class ServiceMethodCompiler(ProtoContentBase): | |||||||
|             self.output_file.typing_imports.add("AsyncIterable") |             self.output_file.typing_imports.add("AsyncIterable") | ||||||
|             self.output_file.typing_imports.add("Iterable") |             self.output_file.typing_imports.add("Iterable") | ||||||
|             self.output_file.typing_imports.add("Union") |             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") |             self.output_file.typing_imports.add("AsyncIterator") | ||||||
|  |  | ||||||
|         super().__post_init__()  # check for unset fields |         super().__post_init__()  # check for unset fields | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user