6
6
import logging
7
7
import os
8
8
import urllib .parse
9
- < << << << HEAD
10
9
from typing import Any , Literal , Optional , Union
11
- == == == =
12
- from typing import Any , Optional , Union
13
- > >> >> >> fa8eb3e (Fix Code based on ruff 0.3 -> 0.8 .1 )
14
10
from collections .abc import Iterator , Mapping , Generator
15
11
from pathlib import Path
16
12
import requests
@@ -53,11 +49,7 @@ def exists(self, key: str) -> bool:
53
49
response = self .client .get (f"/images/{ key } /exists" )
54
50
return response .ok
55
51
56
- < << << << HEAD
57
52
def list (self , ** kwargs ) -> builtins .list [Image ]:
58
- == == == =
59
- def list (self , ** kwargs ) -> list [Image ]:
60
- >> >> >> > fa8eb3e (Fix Code based on ruff 0.3 -> 0.8 .1 )
61
53
"""Report on images.
62
54
63
55
Keyword Args:
@@ -211,13 +203,8 @@ def prune(
211
203
response = self .client .post ("/images/prune" , params = params )
212
204
response .raise_for_status ()
213
205
214
- < << << << HEAD
215
206
deleted : builtins .list [dict [str , str ]] = []
216
207
error : builtins .list [str ] = []
217
- == == == =
218
- deleted : list [dict [str , str ]] = []
219
- error : list [str ] = []
220
- >> >> >> > fa8eb3e (Fix Code based on ruff 0.3 -> 0.8 .1 )
221
208
reclaimed : int = 0
222
209
# If the prune doesn't remove images, the API returns "null"
223
210
# and it's interpreted as None (NoneType)
@@ -315,11 +302,7 @@ def push(
315
302
316
303
@staticmethod
317
304
def _push_helper (
318
- << << << < HEAD
319
305
decode : bool , body : builtins .list [dict [str , Any ]]
320
- == == == =
321
- decode : bool , body : list [dict [str , Any ]]
322
- >> >> >> > fa8eb3e (Fix Code based on ruff 0.3 -> 0.8 .1 )
323
306
) -> Iterator [Union [str , dict [str , Any ]]]:
324
307
"""Helper needed to allow push() to return either a generator or a str."""
325
308
for entry in body :
@@ -335,11 +318,7 @@ def pull(
335
318
tag : Optional [str ] = None ,
336
319
all_tags : bool = False ,
337
320
** kwargs ,
338
- << << << < HEAD
339
321
) -> Union [Image , builtins .list [Image ], Iterator [str ]]:
340
- == == == =
341
- ) -> Union [Image , list [Image ], Iterator [str ]]:
342
- >> >> >> > fa8eb3e (Fix Code based on ruff 0.3 -> 0.8 .1 )
343
322
"""Request Podman service to pull image(s) from repository.
344
323
345
324
Args:
@@ -351,11 +330,8 @@ def pull(
351
330
auth_config (Mapping[str, str]) – Override the credentials that are found in the
352
331
config for this request. auth_config should contain the username and password
353
332
keys to be valid.
354
- <<<<<<< HEAD
355
333
compatMode (bool) – Return the same JSON payload as the Docker-compat endpoint.
356
334
Default: True.
357
- =======
358
- >>>>>>> b8f28e2 (Implement "decode" parameter in pull())
359
335
decode (bool) – Decode the JSON data from the server into dicts.
360
336
Only applies with ``stream=True``
361
337
platform (str) – Platform in the format os[/arch[/variant]]
@@ -444,11 +420,7 @@ def pull(
444
420
for item in reversed (list (response .iter_lines ())):
445
421
obj = json .loads (item )
446
422
if all_tags and "images" in obj :
447
- < << << << HEAD
448
423
images : builtins .list [Image ] = []
449
- == == == =
450
- images : list [Image ] = []
451
- >> >> >> > fa8eb3e (Fix Code based on ruff 0.3 -> 0.8 .1 )
452
424
for name in obj ["images" ]:
453
425
images .append (self .get (name ))
454
426
return images
@@ -493,11 +465,7 @@ def remove(
493
465
image : Union [Image , str ],
494
466
force : Optional [bool ] = None ,
495
467
noprune : bool = False , # pylint: disable=unused-argument
496
- << << << < HEAD
497
468
) -> builtins .list [dict [Literal ["Deleted" , "Untagged" , "Errors" , "ExitCode" ], Union [str , int ]]]:
498
- == == == =
499
- ) -> list [dict [Literal ["Deleted" , "Untagged" , "Errors" , "ExitCode" ], Union [str , int ]]]:
500
- >> >> >> > fa8eb3e (Fix Code based on ruff 0.3 -> 0.8 .1 )
501
469
"""Delete image from Podman service.
502
470
503
471
Args:
@@ -516,23 +484,15 @@ def remove(
516
484
response .raise_for_status (not_found = ImageNotFound )
517
485
518
486
body = response .json ()
519
- < << << << HEAD
520
487
results : builtins .list [dict [str , Union [int , str ]]] = []
521
- == == == =
522
- results : list [dict [str , Union [int , str ]]] = []
523
- >> >> >> > fa8eb3e (Fix Code based on ruff 0.3 -> 0.8 .1 )
524
488
for key in ("Deleted" , "Untagged" , "Errors" ):
525
489
if key in body :
526
490
for element in body [key ]:
527
491
results .append ({key : element })
528
492
results .append ({"ExitCode" : body ["ExitCode" ]})
529
493
return results
530
494
531
- < << << << HEAD
532
495
def search (self , term : str , ** kwargs ) -> builtins .list [dict [str , Any ]]:
533
- == == == =
534
- def search (self , term : str , ** kwargs ) -> list [dict [str , Any ]]:
535
- >> >> >> > fa8eb3e (Fix Code based on ruff 0.3 -> 0.8 .1 )
536
496
"""Search Images on registries.
537
497
538
498
Args:
@@ -612,4 +572,4 @@ def _stream_helper(self, response, decode=False):
612
572
else :
613
573
# Response isn't chunked, meaning we probably
614
574
# encountered an error immediately
615
- yield self ._result (response , json = decode )
575
+ yield self ._result (response , json = decode )
0 commit comments