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

Modernize stubgen #14982

Merged
merged 2 commits into from
Mar 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions mypy/stubgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
import sys
import traceback
from collections import defaultdict
from typing import Iterable, List, Mapping
from typing import Iterable, Mapping
from typing_extensions import Final

import mypy.build
Expand Down Expand Up @@ -888,8 +888,8 @@ def process_member_expr_decorator(
):
if expr.name == "abstractproperty":
self.import_tracker.require_name(expr.expr.name)
self.add_decorator("%s" % ("property"))
self.add_decorator("{}.{}".format(expr.expr.name, "abstractmethod"))
self.add_decorator("property")
self.add_decorator(f"{expr.expr.name}.abstractmethod")
else:
self.import_tracker.require_name(expr.expr.name)
self.add_decorator(f"{expr.expr.name}.{expr.name}")
Expand Down Expand Up @@ -1656,8 +1656,8 @@ def generate_stub_from_ast(
file.write("".join(gen.output()))


def get_sig_generators(options: Options) -> List[SignatureGenerator]:
sig_generators: List[SignatureGenerator] = [
def get_sig_generators(options: Options) -> list[SignatureGenerator]:
sig_generators: list[SignatureGenerator] = [
DocstringSignatureGenerator(),
FallbackSignatureGenerator(),
]
Expand Down