Skip to content

Commit

Permalink
move docstring indent to after class dedent
Browse files Browse the repository at this point in the history
  • Loading branch information
jcapriot committed Aug 16, 2024
1 parent c4bff97 commit 18eb1ab
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mypy/stubgenc.py
Original file line number Diff line number Diff line change
Expand Up @@ -811,8 +811,6 @@ def generate_class_stub(self, class_name: str, cls: type, output: list[str]) ->

class_info = ClassInfo(class_name, "", getattr(cls, "__doc__", None), cls)
docstring = class_info.docstring if self._include_docstrings else None
if docstring:
docstring = self._indent_docstring(docstring)

for attr, value in items:
# use unevaluated descriptors when dealing with property inspection
Expand Down Expand Up @@ -861,6 +859,9 @@ def generate_class_stub(self, class_name: str, cls: type, output: list[str]) ->

self.dedent()

if docstring:
docstring = self._indent_docstring(docstring)

bases = self.get_base_types(cls)
if bases:
bases_str = "(%s)" % ", ".join(bases)
Expand Down

0 comments on commit 18eb1ab

Please sign in to comment.