12
12
import re
13
13
import shutil
14
14
import tempfile
15
- from collections . abc import Sequence
15
+ from contextlib import suppress
16
16
from datetime import datetime , timedelta
17
17
from importlib .metadata import PackageNotFoundError , version
18
18
from pathlib import Path
19
- from typing import Any
19
+ from typing import TYPE_CHECKING , Any
20
20
21
21
from pytz import timezone
22
22
29
29
from .path import rmtree as junction_rmtree
30
30
from .utils import _create_utc_datetime , is_date , is_namespace , is_rev
31
31
32
+ if TYPE_CHECKING :
33
+ from collections .abc import Sequence
34
+
32
35
try :
33
36
__version__ = version ("fuzzfetch" )
34
37
except PackageNotFoundError :
@@ -402,7 +405,7 @@ def resolve_targets(self, targets: Sequence[str]) -> None:
402
405
for target in targets_remaining :
403
406
try :
404
407
resolve_url (self .artifact_url (f"{ target } .tests.tar.gz" ))
405
- except FetcherException :
408
+ except FetcherException : # noqa: PERF203
406
409
resolve_url (self .artifact_url (f"{ target } .tests.zip" ))
407
410
408
411
def extract_build (self , path : PathArg ) -> None :
@@ -500,16 +503,14 @@ def extract_build(self, path: PathArg) -> None:
500
503
else :
501
504
sym_path = path / "symbols"
502
505
sym_path .mkdir ()
503
- try :
506
+ # fuzzing debug builds no longer have crashreporter-symbols.zip
507
+ # (bug 1649062)
508
+ # we want to maintain support for older builds for now
509
+ with suppress (FetcherException ):
504
510
self .extract_zip (
505
511
self .artifact_url ("crashreporter-symbols.zip" ),
506
512
path = sym_path ,
507
513
)
508
- except FetcherException :
509
- # fuzzing debug builds no longer have crashreporter-symbols.zip
510
- # (bug 1649062)
511
- # we want to maintain support for older builds for now
512
- pass
513
514
514
515
if "searchfox" in targets_remaining :
515
516
targets_remaining .remove ("searchfox" )
@@ -524,7 +525,7 @@ def extract_build(self, path: PathArg) -> None:
524
525
for target in targets_remaining :
525
526
try :
526
527
self .extract_tar (self .artifact_url (f"{ target } .tests.tar.gz" ), path = path )
527
- except FetcherException :
528
+ except FetcherException : # noqa: PERF203
528
529
self .extract_zip (self .artifact_url (f"{ target } .tests.zip" ), path = path )
529
530
530
531
# used by Pernosco to locate source ('\n' is expected)
@@ -769,7 +770,7 @@ def main(cls) -> int:
769
770
(out / "download" ).mkdir (parents = True )
770
771
with (out / "download" / "firefox-temp.txt" ).open ("a" ) as dl_fd :
771
772
dl_fd .write (f"buildID={ obj .id } { os .linesep } " )
772
- except : # noqa
773
+ except :
773
774
if out .is_dir ():
774
775
junction_rmtree (out )
775
776
raise
0 commit comments