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

Update contrib.sessions.backends #2351

Merged
merged 3 commits into from
Aug 29, 2024

Conversation

Viicos
Copy link
Contributor

@Viicos Viicos commented Aug 24, 2024

I have made things!

Related issues

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Thank you! A lot of useful fixes 👍

@overload
async def aget(self, key: str, default: Any) -> Any: ...
@overload
async def aget(self, key: str, default: _T) -> Any | _T: ... # type: ignore[misc]
Copy link
Member

Choose a reason for hiding this comment

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

I would suggest to remove this case, Any | _T is still Any

Copy link
Contributor Author

@Viicos Viicos Aug 25, 2024

Choose a reason for hiding this comment

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

I copied the signatures over from typeshed, but indeed because _VT is Any we can simplify this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

However, pyright may retain the type information:

image

For a better user experience, maybe this can be useful?

Copy link
Member

Choose a reason for hiding this comment

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

I would still prefer not to complicate the signature, cause it does not provide anything extra, but is still visible in the autosuggestions / docs / etc.

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Thanks, great work!

@sobolevn sobolevn merged commit 7906c01 into typeddjango:master Aug 29, 2024
36 checks passed
@Viicos Viicos deleted the contrib-sessions-backends branch August 29, 2024 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants