We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents e23c119 + ae68f12 commit 52a2bdfCopy full SHA for 52a2bdf
cbv/importer/importers.py
@@ -1,6 +1,7 @@
1
import importlib
2
import inspect
3
import sys
4
+import textwrap
5
from collections.abc import Iterator
6
from typing import Protocol
7
@@ -185,12 +186,10 @@ def _full_path(klass: type) -> str:
185
186
def get_code(member):
187
# Strip unneeded whitespace from beginning of code lines
188
lines, start_line = inspect.getsourcelines(member)
- whitespace = len(lines[0]) - len(lines[0].lstrip())
189
- for i, line in enumerate(lines):
190
- lines[i] = line[whitespace:]
191
192
# Join code lines into one string
193
code = "".join(lines)
+ code = textwrap.dedent(code)
194
195
# Get the method arguments
196
arguments = inspect.formatargspec(*inspect.getfullargspec(member))
0 commit comments