66import logging
77import os
88import urllib .parse
9+ < << << << HEAD
910from 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 )
1014from collections .abc import Iterator , Mapping , Generator
1115from pathlib import Path
1216import requests
@@ -49,7 +53,11 @@ def exists(self, key: str) -> bool:
4953 response = self .client .get (f"/images/{ key } /exists" )
5054 return response .ok
5155
56+ < << << << HEAD
5257 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 )
5361 """Report on images.
5462
5563 Keyword Args:
@@ -203,8 +211,13 @@ def prune(
203211 response = self .client .post ("/images/prune" , params = params )
204212 response .raise_for_status ()
205213
214+ < << << << HEAD
206215 deleted : builtins .list [dict [str , str ]] = []
207216 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 )
208221 reclaimed : int = 0
209222 # If the prune doesn't remove images, the API returns "null"
210223 # and it's interpreted as None (NoneType)
@@ -302,7 +315,11 @@ def push(
302315
303316 @staticmethod
304317 def _push_helper (
318+ << << << < HEAD
305319 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 )
306323 ) -> Iterator [Union [str , dict [str , Any ]]]:
307324 """Helper needed to allow push() to return either a generator or a str."""
308325 for entry in body :
@@ -318,7 +335,11 @@ def pull(
318335 tag : Optional [str ] = None ,
319336 all_tags : bool = False ,
320337 ** kwargs ,
338+ << << << < HEAD
321339 ) -> 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 )
322343 """Request Podman service to pull image(s) from repository.
323344
324345 Args:
@@ -423,7 +444,11 @@ def pull(
423444 for item in reversed (list (response .iter_lines ())):
424445 obj = json .loads (item )
425446 if all_tags and "images" in obj :
447+ < << << << HEAD
426448 images : builtins .list [Image ] = []
449+ == == == =
450+ images : list [Image ] = []
451+ >> >> >> > fa8eb3e (Fix Code based on ruff 0.3 -> 0.8 .1 )
427452 for name in obj ["images" ]:
428453 images .append (self .get (name ))
429454 return images
@@ -468,7 +493,11 @@ def remove(
468493 image : Union [Image , str ],
469494 force : Optional [bool ] = None ,
470495 noprune : bool = False , # pylint: disable=unused-argument
496+ << << << < HEAD
471497 ) -> 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 )
472501 """Delete image from Podman service.
473502
474503 Args:
@@ -487,15 +516,23 @@ def remove(
487516 response .raise_for_status (not_found = ImageNotFound )
488517
489518 body = response .json ()
519+ < << << << HEAD
490520 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 )
491524 for key in ("Deleted" , "Untagged" , "Errors" ):
492525 if key in body :
493526 for element in body [key ]:
494527 results .append ({key : element })
495528 results .append ({"ExitCode" : body ["ExitCode" ]})
496529 return results
497530
531+ < << << << HEAD
498532 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 )
499536 """Search Images on registries.
500537
501538 Args:
0 commit comments