Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type/annotation fixes #2778

Merged
merged 2 commits into from
Jan 31, 2025
Merged

Type/annotation fixes #2778

merged 2 commits into from
Jan 31, 2025

Conversation

jku
Copy link
Member

@jku jku commented Jan 31, 2025

These annotation issues come up if the type checking is enabled for securesystemslib.

  • The json serialization issue is a result of weird securesystemslib API design
  • The SimpleEnvelope issue seems to point to the API being a bit wrong: I did not change API, just silenced the warning

Fixes #2775, makes it possible to potentially enable type checks in next securesystemslib release

jku added 2 commits January 30, 2025 18:20
mypy warns about this but we know that encode_canonical() cannot return
None if we don't set output_function argument.

ruff does not like assert so I added a "noqa" and a comment

Signed-off-by: Jussi Kukkonen <[email protected]>
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 <[email protected]>
@jku jku requested a review from a team as a code owner January 31, 2025 11:52
@jku jku merged commit 5249e6a into theupdateframework:develop Jan 31, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

annotation issues
2 participants