jwcrypto: type most of the rest of JWT and JWKSet.generate function#13807
jwcrypto: type most of the rest of JWT and JWKSet.generate function#13807srittau merged 4 commits intopython:mainfrom
JWT and JWKSet.generate function#13807Conversation
This comment has been minimized.
This comment has been minimized.
stubs/jwcrypto/jwcrypto/jwk.pyi
Outdated
| def generate(cls, **kwargs: Any) -> Self: ... | ||
| def generate_key(self, **params) -> None: ... |
There was a problem hiding this comment.
Please note that we generally need documentation for each use of Any. Also in this case, at least the required kty argument should be added to the signature. And in theory it's possible to have overloads for the various kty types to includes the extra arguments that some generator functions accept. Something like this:
| def generate(cls, **kwargs: Any) -> Self: ... | |
| def generate_key(self, **params) -> None: ... | |
| # `kty` and the other keyword arguments are passed as `params` to the called generator | |
| # function. The possible arguments depend on the value of `kty`. | |
| # TODO: Add overloads for the individual `kty` values. | |
| def generate(cls, *, kty: Literal["oct", "RSA", "EC", "OKP"], **kwargs) -> Self: ... | |
| def generate_key(cls, *, kty: Literal["oct", "RSA", "EC", "OKP"], **kwargs) -> None: ... |
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
5544378 to
d4df742
Compare
This comment has been minimized.
This comment has been minimized.
srittau
left a comment
There was a problem hiding this comment.
Thanks, nearly good to go, except that JWKKeyTypeSupported, JWKOperationSupported, and JWKUseSupported need to be prefixed with an underscore, to mark that they are not available at runtime. This should also fix the CI failure.
d4df742 to
544f489
Compare
Oop, ya my bad, fixed up |
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
No description provided.