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

stubgen: add support for PEPs 695 and 696 syntax #18054

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hamdanal
Copy link
Collaborator

closes #17997

@hamdanal hamdanal added topic-stubgen topic-pep-696 TypeVar defaults topic-pep-695 Issues related to PEP 695 syntax labels Oct 26, 2024
Comment on lines +145 to 152
sig = "{indent}{prefix}def {name}{type_args}({args}){ret}:".format(
indent=indent,
prefix=prefix,
name=self.name,
args=", ".join(args),
ret=retfield,
type_args=self.type_args,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: while we're touching this, we could take the opportunity to switch to an f-string:

Suggested change
sig = "{indent}{prefix}def {name}{type_args}({args}){ret}:".format(
indent=indent,
prefix=prefix,
name=self.name,
args=", ".join(args),
ret=retfield,
type_args=self.type_args,
)
sig = f"{indent}{prefix}def {self.name}{self.type_args}({', '.join(args)}){retfield}:"

Copy link
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-pep-695 Issues related to PEP 695 syntax topic-pep-696 TypeVar defaults topic-stubgen
Projects
None yet
Development

Successfully merging this pull request may close these issues.

stubgen doesn't support new PEP 695 type aliases
2 participants