44import os
55from hashlib import sha256
66from pathlib import Path
7+ from typing import Any
78
89import pretend
910import pypi_attestations ._impl as impl
@@ -75,7 +76,7 @@ def test_roundtrip(self, id_token: IdentityToken) -> None:
7576 def test_wrong_predicate_raises_exception (self , monkeypatch : pytest .MonkeyPatch ) -> None :
7677 def dummy_predicate (self_ : StatementBuilder , _ : str ) -> StatementBuilder :
7778 # wrong type here to have a validation error
78- self_ ._predicate_type = False
79+ self_ ._predicate_type = False # type: ignore[assignment]
7980 return self_
8081
8182 monkeypatch .setattr (sigstore .dsse .StatementBuilder , "predicate_type" , dummy_predicate )
@@ -100,7 +101,7 @@ def in_validity_period(_: IdentityToken) -> bool:
100101 def test_multiple_signatures (
101102 self , id_token : IdentityToken , monkeypatch : pytest .MonkeyPatch
102103 ) -> None :
103- def get_bundle (* _ ) -> Bundle : # noqa: ANN002
104+ def get_bundle (* _ : Any ) -> Bundle :
104105 # Duplicate the signature to trigger a Conversion error
105106 bundle = Bundle .from_json (gh_signed_dist_bundle_path .read_bytes ())
106107 bundle ._inner .dsse_envelope .signatures .append (bundle ._inner .dsse_envelope .signatures [0 ])
@@ -468,15 +469,15 @@ def test_ultranormalize_dist_filename_invalid(input: str) -> None:
468469class TestPublisher :
469470 def test_discriminator (self ) -> None :
470471 gh_raw = {"kind" : "GitHub" , "repository" : "foo/bar" , "workflow" : "publish.yml" }
471- gh = TypeAdapter (impl .Publisher ).validate_python (gh_raw )
472+ gh : impl . Publisher = TypeAdapter (impl .Publisher ).validate_python (gh_raw )
472473
473474 assert isinstance (gh , impl .GitHubPublisher )
474475 assert gh .repository == "foo/bar"
475476 assert gh .workflow == "publish.yml"
476477 assert TypeAdapter (impl .Publisher ).validate_json (json .dumps (gh_raw )) == gh
477478
478479 gl_raw = {"kind" : "GitLab" , "repository" : "foo/bar/baz" , "environment" : "publish" }
479- gl = TypeAdapter (impl .Publisher ).validate_python (gl_raw )
480+ gl : impl . Publisher = TypeAdapter (impl .Publisher ).validate_python (gl_raw )
480481 assert isinstance (gl , impl .GitLabPublisher )
481482 assert gl .repository == "foo/bar/baz"
482483 assert gl .environment == "publish"
@@ -499,7 +500,7 @@ def test_claims(self) -> None:
499500 "this-too" : 123 ,
500501 },
501502 }
502- pub = TypeAdapter (impl .Publisher ).validate_python (raw )
503+ pub : impl . Publisher = TypeAdapter (impl .Publisher ).validate_python (raw )
503504
504505 assert pub .claims == {
505506 "this" : "is-preserved" ,
0 commit comments