Open
Conversation
Contributor
|
Thank you for your contribution! I see that a lot of tests are failing, python 3.9 which we still support doesn't have some of the typing attributes available (e.g. Can you please make this PR compatible with python versions 3.9 - 3.13? |
vgrozdanic
reviewed
Apr 3, 2025
|
|
||
|
|
||
| class TokenUser: | ||
| class TokenUser(TokenUserBase): |
Contributor
There was a problem hiding this comment.
why is this being introduced?
Is there a reason why TokenUser should be a subclass of AbstractBaseUser?
Member
There was a problem hiding this comment.
I have a feeling it's because, unlike Typescript, there isn't interface overlapping in Python, so the author was trying to resolve what happens when you receive a "user" type.
They made a change here that explains it a little:
Suggested change
| class TokenUser(TokenUserBase): | |
| - AuthUser = TypeVar("AuthUser", AbstractBaseUser, TokenUser) | |
| + TokenTypeVar = TypeVar("TokenTypeVar", bound=Token) |
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.
TypeVarfor theAuthToken/AbstractBaseUsercovariant type as it doesn't seem to play nice with Mypy.Genericusage seems plain wrong.if TYPE_CHECKING: assert self.userassertions toTokenObtainSerializerimplementations to make Mypy understand the serializer lifecycle.lifetimeinToken.set_exp.