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

Mark key types as SupportsBytes #21

Merged
merged 2 commits into from
Mar 29, 2022
Merged

Mark key types as SupportsBytes #21

merged 2 commits into from
Mar 29, 2022

Conversation

DMRobertson
Copy link
Contributor

pynacl's SigningKey and VerifyKey both expose a __bytes__ method, so
this is correct. It's just that the information gets lost when we
replace these with our Protocol types.

While I'm at it, add a drive-by-comment.

Blocks matrix-org/synapse#12326.

David Robertson added 2 commits March 29, 2022 16:16
pynacl's SigningKey and VerifyKey both expose a `__bytes__` method, so
this is correct. It's just that the information gets lost when we
replace these with our Protocol types.
@DMRobertson DMRobertson requested a review from a team as a code owner March 29, 2022 15:22
@DMRobertson
Copy link
Contributor Author

We don't have CI set up for this repo. I ran mypy manually and it didn't find anything alarming:

 $ mypy 
signedjson/__init__.py:18: error: Incompatible import of "PackageNotFoundError" (imported name has type "Type[importlib_metadata.PackageNotFoundError]", local name has type "Type[importlib.metadata.PackageNotFoundError]")  [misc]
signedjson/__init__.py:18: note: Error code "misc" not covered by "type: ignore" comment
signedjson/key.py:21: error: Cannot find implementation or library stub for module named "unpaddedbase64"  [import]
signedjson/key.py:21: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
signedjson/sign.py:23: error: Cannot find implementation or library stub for module named "unpaddedbase64"  [import]
tests/test_sign.py:19: error: Cannot find implementation or library stub for module named "unpaddedbase64"  [import]
tests/test_known_key.py:20: error: Cannot find implementation or library stub for module named "unpaddedbase64"  [import]
Found 5 errors in 5 files (checked 8 source files)

@DMRobertson DMRobertson merged commit 5a7d7b7 into main Mar 29, 2022
@DMRobertson DMRobertson deleted the dmr/typing2 branch March 29, 2022 15:41
DMRobertson pushed a commit that referenced this pull request Mar 29, 2022
DMRobertson pushed a commit that referenced this pull request Mar 29, 2022
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.

2 participants