Skip to content

Commit eacbb79

Browse files
D3vil0p3rMr-Sunglasses
authored andcommitted
Implement "decode" parameter in pull()
Implement `decode (bool)` parameter in `pull()`. Decode the JSON data from the server into dicts. Only applies with `stream=True`. Signed-off-by: Antonio <vozaanthony@gmail.com>
1 parent 788579a commit eacbb79

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

podman/domain/images_manager.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,7 @@ def prune(
172172
all: Optional[bool] = False, # pylint: disable=redefined-builtin
173173
external: Optional[bool] = False,
174174
filters: Optional[Mapping[str, Any]] = None,
175-
<<<<<<< HEAD
176175
) -> dict[Literal["ImagesDeleted", "SpaceReclaimed"], Any]:
177-
=======
178-
) -> Dict[Literal["ImagesDeleted", "SpaceReclaimed"], Any]:
179-
>>>>>>> cec6b18 (Add all, external, and label to Image.prune())
180176
"""Delete unused images.
181177
182178
The Untagged keys will always be "".
@@ -334,8 +330,11 @@ def pull(
334330
auth_config (Mapping[str, str]) – Override the credentials that are found in the
335331
config for this request. auth_config should contain the username and password
336332
keys to be valid.
333+
<<<<<<< HEAD
337334
compatMode (bool) – Return the same JSON payload as the Docker-compat endpoint.
338335
Default: True.
336+
=======
337+
>>>>>>> b8f28e2 (Implement "decode" parameter in pull())
339338
decode (bool) – Decode the JSON data from the server into dicts.
340339
Only applies with ``stream=True``
341340
platform (str) – Platform in the format os[/arch[/variant]]

podman/domain/json_stream.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@ def stream_as_text(stream):
1414
instead of byte streams.
1515
"""
1616
for data in stream:
17-
_data = data
1817
if not isinstance(data, str):
19-
_data = data.decode('utf-8', 'replace')
20-
yield _data
18+
data = data.decode('utf-8', 'replace')
19+
yield data
2120

2221

2322
def json_splitter(buffer):

podman/errors/exceptions.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def __init__(
143143

144144
class InvalidArgument(PodmanError):
145145
"""Parameter to method/function was not valid."""
146-
146+
147147

148148
class PodmanConnectionError(PodmanError):
149149
"""Exception raised when connection to Podman service fails using environment configuration."""
@@ -201,6 +201,7 @@ def __str__(self) -> str:
201201

202202

203203
class StreamParseError(RuntimeError):
204+
<<<<<<< HEAD
204205
"""Exception raised when parsing a stream fails."""
205206

206207
def __init__(self, reason: str):
@@ -210,4 +211,7 @@ def __init__(self, reason: str):
210211
reason: Description of the parsing error.
211212
"""
212213
super().__init__(reason)
214+
=======
215+
def __init__(self, reason):
216+
>>>>>>> b8f28e2 (Implement "decode" parameter in pull())
213217
self.msg = reason

0 commit comments

Comments
 (0)