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

Formatter: TypeAlias #5929

Closed
konstin opened this issue Jul 20, 2023 · 5 comments · Fixed by #6162
Closed

Formatter: TypeAlias #5929

konstin opened this issue Jul 20, 2023 · 5 comments · Fixed by #6162
Assignees
Labels
formatter Related to the formatter python312 Related to Python 3.12

Comments

@konstin
Copy link
Member

konstin commented Jul 20, 2023

See PEP 695 for details on this python 3.12 feature. Not to be confused with typing.TypeAlias of python 3.10. The goal is to format statements in the form:

# TypeAlias
type ListOrSet[T] = list[T] | set[T]
@konstin konstin added the formatter Related to the formatter label Jul 20, 2023
@zanieb
Copy link
Member

zanieb commented Jul 20, 2023

Technically probably best to implement formatting for type parameters on functions and classes first as the implementation for that will need to be reused here.

@MichaReiser MichaReiser changed the title Formatter: TypeAlias Formatter: TypeAlias and TypeParameters Jul 20, 2023
@MichaReiser
Copy link
Member

MichaReiser commented Jul 20, 2023

Technically probably best to implement formatting for type parameters on functions and classes first as the implementation for that will need to be reused here.

I included type parameters in the issue and its description

@konstin
Copy link
Member Author

konstin commented Jul 20, 2023

i meanwhile had made a new issue: #5931

@MichaReiser
Copy link
Member

i meanwhile had made a new issue: #5931

Oh I'm sorry. I defer the decision on whether to revert my changes or close this issue to you.

@konstin konstin changed the title Formatter: TypeAlias and TypeParameters Formatter: TypeAlias Jul 21, 2023
@konstin
Copy link
Member Author

konstin commented Jul 21, 2023

i've reverted, i think they'll require two separate PRs

@MichaReiser MichaReiser added this to the Formatter: Alpha milestone Jul 31, 2023
@MichaReiser MichaReiser linked a pull request Jul 31, 2023 that will close this issue
zanieb added a commit that referenced this issue Aug 2, 2023
…6161)

Part of #5062 
Closes #5931

Implements formatting of a sequence of type parameters in a dedicated
struct for reuse by classes, functions, and type aliases (preparing for
#5929). Adds formatting of type parameters in class and function
definitions — previously, they were just elided.
zanieb added a commit that referenced this issue Aug 2, 2023
@zanieb zanieb added the python312 Related to Python 3.12 label Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
formatter Related to the formatter python312 Related to Python 3.12
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants