1414import urllib .request
1515from collections import OrderedDict
1616from collections .abc import Iterator
17+ from contextlib import suppress
1718from typing import Any , TextIO
1819
1920try :
@@ -342,10 +343,8 @@ def fprint(string: str) -> None:
342343 print ("Ignore the error by passing --ignore-errors" )
343344 raise
344345
345- try :
346+ with suppress ( FileNotFoundError ) :
346347 os .remove (requirements_file_output )
347- except FileNotFoundError :
348- pass
349348
350349 fprint ("Downloading arch independent packages" )
351350 for filename in os .listdir (tempdir ):
@@ -361,10 +360,8 @@ def fprint(string: str) -> None:
361360 # available like for wasmtime-27.0.2
362361 unresolved_dependencies_errors .append (err )
363362 print ("Deleting" , filename )
364- try :
363+ with suppress ( FileNotFoundError ) :
365364 os .remove (os .path .join (tempdir , filename ))
366- except FileNotFoundError :
367- pass
368365
369366 files : dict [str , list [str ]] = {get_package_name (f ): [] for f in os .listdir (tempdir )}
370367
@@ -382,10 +379,8 @@ def fprint(string: str) -> None:
382379 if zip_source :
383380 for f in files [name ]:
384381 if not f .endswith (".zip" ):
385- try :
382+ with suppress ( FileNotFoundError ) :
386383 os .remove (os .path .join (tempdir , f ))
387- except FileNotFoundError :
388- pass
389384
390385 vcs_packages : dict [str , dict [str , str | None ]] = {
391386 str (x .name ): {"vcs" : x .vcs , "revision" : x .revision , "uri" : x .uri }
0 commit comments