6
6
import logging
7
7
import os
8
8
import urllib .parse
9
+ < << << << HEAD
9
10
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 )
10
14
from collections .abc import Iterator , Mapping , Generator
11
15
from pathlib import Path
12
16
import requests
@@ -49,7 +53,11 @@ def exists(self, key: str) -> bool:
49
53
response = self .client .get (f"/images/{ key } /exists" )
50
54
return response .ok
51
55
56
+ < << << << HEAD
52
57
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 )
53
61
"""Report on images.
54
62
55
63
Keyword Args:
@@ -203,8 +211,13 @@ def prune(
203
211
response = self .client .post ("/images/prune" , params = params )
204
212
response .raise_for_status ()
205
213
214
+ < << << << HEAD
206
215
deleted : builtins .list [dict [str , str ]] = []
207
216
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 )
208
221
reclaimed : int = 0
209
222
# If the prune doesn't remove images, the API returns "null"
210
223
# and it's interpreted as None (NoneType)
@@ -302,7 +315,11 @@ def push(
302
315
303
316
@staticmethod
304
317
def _push_helper (
318
+ << << << < HEAD
305
319
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 )
306
323
) -> Iterator [Union [str , dict [str , Any ]]]:
307
324
"""Helper needed to allow push() to return either a generator or a str."""
308
325
for entry in body :
@@ -318,7 +335,11 @@ def pull(
318
335
tag : Optional [str ] = None ,
319
336
all_tags : bool = False ,
320
337
** kwargs ,
338
+ << << << < HEAD
321
339
) -> 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 )
322
343
"""Request Podman service to pull image(s) from repository.
323
344
324
345
Args:
@@ -423,7 +444,11 @@ def pull(
423
444
for item in reversed (list (response .iter_lines ())):
424
445
obj = json .loads (item )
425
446
if all_tags and "images" in obj :
447
+ < << << << HEAD
426
448
images : builtins .list [Image ] = []
449
+ == == == =
450
+ images : list [Image ] = []
451
+ >> >> >> > fa8eb3e (Fix Code based on ruff 0.3 -> 0.8 .1 )
427
452
for name in obj ["images" ]:
428
453
images .append (self .get (name ))
429
454
return images
@@ -468,7 +493,11 @@ def remove(
468
493
image : Union [Image , str ],
469
494
force : Optional [bool ] = None ,
470
495
noprune : bool = False , # pylint: disable=unused-argument
496
+ << << << < HEAD
471
497
) -> 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 )
472
501
"""Delete image from Podman service.
473
502
474
503
Args:
@@ -487,15 +516,23 @@ def remove(
487
516
response .raise_for_status (not_found = ImageNotFound )
488
517
489
518
body = response .json ()
519
+ < << << << HEAD
490
520
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 )
491
524
for key in ("Deleted" , "Untagged" , "Errors" ):
492
525
if key in body :
493
526
for element in body [key ]:
494
527
results .append ({key : element })
495
528
results .append ({"ExitCode" : body ["ExitCode" ]})
496
529
return results
497
530
531
+ < << << << HEAD
498
532
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 )
499
536
"""Search Images on registries.
500
537
501
538
Args:
0 commit comments