Repository navigation
Annotate jwt.algorithms - #2532
Merged
Merged
Conversation
JelleZijlstra
requested changes
Oct 23, 2018
| @staticmethod | ||
| def to_jwk(key_obj: _K) -> str: ... | ||
| @staticmethod | ||
| def from_jwk(jwk: str) -> _K: ... |
Member
There was a problem hiding this comment.
I don't think this works correctly:
$ cat bin/genstat.py
from typing import *
T = TypeVar('T')
class A(Generic[T]):
@staticmethod
def foo() -> T:
pass
class B(A[int]):
pass
reveal_type(B.foo())
$ python3.7 -m mypy bin/genstat.py
bin/genstat.py:13: error: Revealed type is 'T`1'
This is python/mypy#1337.
There doesn't appear to be a good workaround, so we may have to use Any for now.
| SHA256: ClassVar[_HashAlg] | ||
| SHA384: ClassVar[_HashAlg] | ||
| SHA512: ClassVar[_HashAlg] | ||
| has_alg: _HashAlg |
| def __init__(self, _HashAlg) -> None: ... | ||
| def prepare_key(self, key: Union[str, bytes]) -> bytes: ... | ||
| @staticmethod | ||
| def to_jwk(key_obj: Union[str, bytes]) -> Any: ... |
Member
There was a problem hiding this comment.
Seems to actually return str.
| @staticmethod | ||
| def from_jwk(jwk: _LoadsString) -> bytes: ... | ||
|
|
||
| # If cryptography is installed, also has classes RSAAlgorithm and ECAlgorithm. |
Member
There was a problem hiding this comment.
We should also have stubs for these classes then. False negatives are better than false positives.
Collaborator
Author
There was a problem hiding this comment.
Agreed. I left them out for now, since we don't have stubs for cryptography, yet, but we could of course use Any.
JelleZijlstra
approved these changes
Oct 23, 2018
yedpodtrzitko
pushed a commit
to yedpodtrzitko/typeshed
that referenced
this pull request
Jan 23, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cf. #1446