Skip to content

Commit 135c688

Browse files
committed
comments
Signed-off-by: laurentsimon <laurentsimon@google.com>
1 parent 4c61591 commit 135c688

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

sigstore/_utils.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,15 @@ def key_id(key: PublicKey) -> KeyID:
141141

142142
return KeyID(hashlib.sha256(public_bytes).digest())
143143

144+
144145
def get_digest(input_: IO[bytes] | sigstore_hashes.Hashed) -> sigstore_hashes.Hashed:
145146
if isinstance(input_, sigstore_hashes.Hashed):
146147
return input_
147148

148-
# NOTE: Not able to check for the type `TypeError: Subscripted generics cannot be used with class and instance checks`
149-
# when calling isinstance(_input, IO[bytes])
150-
return sigstore_hashes.Hashed(digest=sha256_streaming(input_), algorithm=HashAlgorithm.SHA2_256)
149+
return sigstore_hashes.Hashed(
150+
digest=sha256_streaming(input_), algorithm=HashAlgorithm.SHA2_256
151+
)
152+
151153

152154
def sha256_streaming(io: IO[bytes]) -> bytes:
153155
"""

sigstore/hashes.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# Copyright 2023 The Sigstore Authors
32
#
43
# Licensed under the Apache License, Version 2.0 (the "License");

0 commit comments

Comments
 (0)