88from typing import Any , Optional , Union
99from collections .abc import Iterator
1010
11- from requests import Response
11+ from podman . api . client import APIResponse
1212from .output_utils import demux_output
1313
1414
@@ -59,15 +59,15 @@ def prepare_timestamp(value: Union[datetime, int, None]) -> Optional[int]:
5959 raise ValueError (f"Type '{ type (value )} ' is not supported by prepare_timestamp()" )
6060
6161
62- def prepare_cidr (value : Union [ipaddress .IPv4Network , ipaddress .IPv6Network ]) -> ( str , str ) :
62+ def prepare_cidr (value : Union [ipaddress .IPv4Network , ipaddress .IPv6Network ]) -> tuple [ str , str ] :
6363 """Returns network address and Base64 encoded netmask from CIDR.
6464
6565 The return values are dictated by the Go JSON decoder.
6666 """
6767 return str (value .network_address ), base64 .b64encode (value .netmask .packed ).decode ("utf-8" )
6868
6969
70- def frames (response : Response ) -> Iterator [bytes ]:
70+ def frames (response : APIResponse ) -> Iterator [bytes ]:
7171 """Returns each frame from multiplexed payload, all results are expected in the payload.
7272
7373 The stdout and stderr frames are undifferentiated as they are returned.
@@ -84,7 +84,7 @@ def frames(response: Response) -> Iterator[bytes]:
8484
8585
8686def stream_frames (
87- response : Response , demux : bool = False
87+ response : APIResponse , demux : bool = False
8888) -> Iterator [Union [bytes , tuple [bytes , bytes ]]]:
8989 """Returns each frame from multiplexed streamed payload.
9090
@@ -111,7 +111,7 @@ def stream_frames(
111111
112112
113113def stream_helper (
114- response : Response , decode_to_json : bool = False
114+ response : APIResponse , decode_to_json : bool = False
115115) -> Union [Iterator [bytes ], Iterator [dict [str , Any ]]]:
116116 """Helper to stream results and optionally decode to json"""
117117 for value in response .iter_lines ():
0 commit comments