This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Use Literal from typing_extensions (compatible with Python 3.7)#15605
Closed
MadLittleMods wants to merge 2 commits intodevelopfrom
Closed
Use Literal from typing_extensions (compatible with Python 3.7)#15605MadLittleMods wants to merge 2 commits intodevelopfrom
Literal from typing_extensions (compatible with Python 3.7)#15605MadLittleMods wants to merge 2 commits intodevelopfrom
Conversation
Fix ``` synapse/config/_base.pyi:2: error: Module "typing" has no attribute "Literal" [attr-defined] ``` `typing.Literal` is only available in Python 3.8 or later, https://docs.python.org/3/library/typing.html#typing.Literal
24 tasks
MadLittleMods
commented
May 15, 2023
| ) | ||
|
|
||
| import jinja2 | ||
| from typing_extensions import Literal |
Contributor
Author
There was a problem hiding this comment.
This PR is no longer necessary because we're now targeting Python 3.8 as the minimum version which is where typing.Literal was introduced.
But perhaps we want to do this solely to align our single typing.Literal usage to typing_extensions.Literal which we do everywhere else.
Or maybe we want to instead move everything to typing.Literal ⏩
Pokes in whatever direction welcome
Member
There was a problem hiding this comment.
I think move to typing.Literal ASAP when we drop 3.7 is the way to go
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Use
Literalfromtyping_extensions(compatible with Python 3.7)Fix the following
mypyerrors when runningmypywith Python 3.7:Part of #15603
typing.Literalis only available in Python 3.8 or later, https://docs.python.org/3/library/typing.html#typing.LiteralPull Request Checklist
EventStoretoEventWorkerStore.".code blocks.Pull request includes a sign off(run the linters)