Skip to content

Add __hash__ method to jwcrypto.jwk.JWK such that it satisfies Hashable interface to be used as dictionary key#15782

Open
jonathandung wants to merge 4 commits into
python:mainfrom
jonathandung:patch-4
Open

Add __hash__ method to jwcrypto.jwk.JWK such that it satisfies Hashable interface to be used as dictionary key#15782
jonathandung wants to merge 4 commits into
python:mainfrom
jonathandung:patch-4

Conversation

@jonathandung
Copy link
Copy Markdown
Contributor

Parent: #15754

@github-actions

This comment has been minimized.

@srittau
Copy link
Copy Markdown
Collaborator

srittau commented May 12, 2026

For reference, I've just filed python/typing#2284 and left a comment on python/mypy#4266 for the mypy errors. For now # type: ignore is the best we can do.

@github-actions
Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

Copy link
Copy Markdown
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks mostly good, one nit.

@jonathandung jonathandung requested a review from srittau May 12, 2026 14:38
@jonathandung
Copy link
Copy Markdown
Contributor Author

I'm sorry, but I can't see what changes you've requested.

def from_password(cls, password: str) -> Self: ...
def setdefault(self, key: str, default: _T | None = None) -> _T: ...
def __hash__(self) -> int: ... # type: ignore[override]
def __eq__(self, other: object, /) -> bool: ...
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: This is inherited from dict and doesn't need repeating here.

@srittau
Copy link
Copy Markdown
Collaborator

srittau commented May 12, 2026

It seems I forgot to click a button. The comment is now visible.

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