Skip to content

Commit 9abfb50

Browse files
iscai-msftiscai-msft
andauthored
[python] fix pipeline client typing (#7119)
cc @kristapratico --------- Co-authored-by: iscai-msft <[email protected]>
1 parent 4f9a259 commit 9abfb50

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
changeKind: fix
3+
packages:
4+
- "@typespec/http-client-python"
5+
---
6+
7+
Fix typing for generic `PipelineClient`

packages/http-client-python/generator/pygen/codegen/models/operation_group.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ def has_non_abstract_operations(self) -> bool:
6464
)
6565

6666
def base_class(self, async_mode: bool) -> str:
67-
pipeline_client = f"{'Async' if async_mode else ''}PipelineClient"
67+
pipeline_client = (
68+
f"{'Async' if async_mode else ''}PipelineClient[HttpRequest, {'Async' if async_mode else ''}HttpResponse]"
69+
)
6870
base_classes: List[str] = []
6971
if self.is_mixin:
7072
base_classes.append(f"ClientMixinABC[{pipeline_client}, {self.client.name}Configuration]")
@@ -166,6 +168,16 @@ def imports(self, async_mode: bool, **kwargs: Any) -> FileImport:
166168
"ClientMixinABC",
167169
ImportType.LOCAL,
168170
)
171+
file_import.add_submodule_import(
172+
"rest",
173+
"HttpRequest",
174+
ImportType.SDKCORE,
175+
)
176+
file_import.add_submodule_import(
177+
"rest",
178+
f"{'Async' if async_mode else ''}HttpResponse",
179+
ImportType.SDKCORE,
180+
)
169181
else:
170182
file_import.add_msrest_import(
171183
serialize_namespace=kwargs.get("serialize_namespace", self.code_model.namespace),

0 commit comments

Comments
 (0)