Skip to content

Commit 1a1312e

Browse files
committed
dsse: Improve type checking
mypy rightly complains our types do not match (this only happen if you enable type checks for securesystemslib): * I think the annotation is actually wrong: Envelope does not know the contained type at this point. * Likely SimpleEnvelope should not be generic: it does not relly know what it contains I decided not to break the API here and just made the type cast explicit (even though we don't really know that the cast is correct): this silences mypy but has no other consequences. Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
1 parent bb62dde commit 1a1312e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tuf/api/dsse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def from_bytes(cls, data: bytes) -> SimpleEnvelope[T]:
8181
except Exception as e:
8282
raise DeserializationError from e
8383

84-
return envelope
84+
return cast(SimpleEnvelope[T], envelope)
8585

8686
def to_bytes(self) -> bytes:
8787
"""Return envelope as JSON bytes.

0 commit comments

Comments
 (0)