Skip to content

Commit 52a2bdf

Browse files
authored
Merge pull request #288 from rixx/missing-docstring-newlines
Fix missing newlines
2 parents e23c119 + ae68f12 commit 52a2bdf

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

cbv/importer/importers.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import importlib
22
import inspect
33
import sys
4+
import textwrap
45
from collections.abc import Iterator
56
from typing import Protocol
67

@@ -185,12 +186,10 @@ def _full_path(klass: type) -> str:
185186
def get_code(member):
186187
# Strip unneeded whitespace from beginning of code lines
187188
lines, start_line = inspect.getsourcelines(member)
188-
whitespace = len(lines[0]) - len(lines[0].lstrip())
189-
for i, line in enumerate(lines):
190-
lines[i] = line[whitespace:]
191189

192190
# Join code lines into one string
193191
code = "".join(lines)
192+
code = textwrap.dedent(code)
194193

195194
# Get the method arguments
196195
arguments = inspect.formatargspec(*inspect.getfullargspec(member))

0 commit comments

Comments
 (0)