66import logging
77import os
88import urllib .parse
9- < << << << HEAD
109from 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 )
1410from collections .abc import Iterator , Mapping , Generator
1511from pathlib import Path
1612import requests
@@ -53,11 +49,7 @@ def exists(self, key: str) -> bool:
5349 response = self .client .get (f"/images/{ key } /exists" )
5450 return response .ok
5551
56- < << << << HEAD
5752 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 )
6153 """Report on images.
6254
6355 Keyword Args:
@@ -211,13 +203,8 @@ def prune(
211203 response = self .client .post ("/images/prune" , params = params )
212204 response .raise_for_status ()
213205
214- < << << << HEAD
215206 deleted : builtins .list [dict [str , str ]] = []
216207 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 )
221208 reclaimed : int = 0
222209 # If the prune doesn't remove images, the API returns "null"
223210 # and it's interpreted as None (NoneType)
@@ -315,11 +302,7 @@ def push(
315302
316303 @staticmethod
317304 def _push_helper (
318- << << << < HEAD
319305 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 )
323306 ) -> Iterator [Union [str , dict [str , Any ]]]:
324307 """Helper needed to allow push() to return either a generator or a str."""
325308 for entry in body :
@@ -335,11 +318,7 @@ def pull(
335318 tag : Optional [str ] = None ,
336319 all_tags : bool = False ,
337320 ** kwargs ,
338- << << << < HEAD
339321 ) -> 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 )
343322 """Request Podman service to pull image(s) from repository.
344323
345324 Args:
@@ -351,11 +330,8 @@ def pull(
351330 auth_config (Mapping[str, str]) – Override the credentials that are found in the
352331 config for this request. auth_config should contain the username and password
353332 keys to be valid.
354- <<<<<<< HEAD
355333 compatMode (bool) – Return the same JSON payload as the Docker-compat endpoint.
356334 Default: True.
357- =======
358- >>>>>>> b8f28e2 (Implement "decode" parameter in pull())
359335 decode (bool) – Decode the JSON data from the server into dicts.
360336 Only applies with ``stream=True``
361337 platform (str) – Platform in the format os[/arch[/variant]]
@@ -444,11 +420,7 @@ def pull(
444420 for item in reversed (list (response .iter_lines ())):
445421 obj = json .loads (item )
446422 if all_tags and "images" in obj :
447- < << << << HEAD
448423 images : builtins .list [Image ] = []
449- == == == =
450- images : list [Image ] = []
451- >> >> >> > fa8eb3e (Fix Code based on ruff 0.3 -> 0.8 .1 )
452424 for name in obj ["images" ]:
453425 images .append (self .get (name ))
454426 return images
@@ -493,11 +465,7 @@ def remove(
493465 image : Union [Image , str ],
494466 force : Optional [bool ] = None ,
495467 noprune : bool = False , # pylint: disable=unused-argument
496- << << << < HEAD
497468 ) -> 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 )
501469 """Delete image from Podman service.
502470
503471 Args:
@@ -516,23 +484,15 @@ def remove(
516484 response .raise_for_status (not_found = ImageNotFound )
517485
518486 body = response .json ()
519- < << << << HEAD
520487 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 )
524488 for key in ("Deleted" , "Untagged" , "Errors" ):
525489 if key in body :
526490 for element in body [key ]:
527491 results .append ({key : element })
528492 results .append ({"ExitCode" : body ["ExitCode" ]})
529493 return results
530494
531- < << << << HEAD
532495 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 )
536496 """Search Images on registries.
537497
538498 Args:
@@ -612,4 +572,4 @@ def _stream_helper(self, response, decode=False):
612572 else :
613573 # Response isn't chunked, meaning we probably
614574 # encountered an error immediately
615- yield self ._result (response , json = decode )
575+ yield self ._result (response , json = decode )
0 commit comments