diff --git a/jedi/api/refactoring.py b/jedi/api/refactoring.py index d9c838e8..f89008b9 100644 --- a/jedi/api/refactoring.py +++ b/jedi/api/refactoring.py @@ -6,7 +6,7 @@ import difflib from parso import split_lines from jedi.api.exceptions import RefactoringError -from jedi.inference.utils import indent_block +from jedi.utils import indent_block _INLINE_NEEDS_BRACKET = ( 'xor_expr and_expr shift_expr arith_expr term factor power atom_expr ' diff --git a/jedi/inference/docstrings.py b/jedi/inference/docstrings.py index 6ff12cf3..5d6c448d 100644 --- a/jedi/inference/docstrings.py +++ b/jedi/inference/docstrings.py @@ -23,7 +23,7 @@ from parso import parse, ParserSyntaxError from jedi._compatibility import u from jedi import debug -from jedi.inference.utils import indent_block +from jedi.utils import indent_block from jedi.inference.cache import inference_state_method_cache from jedi.inference.base_value import iterator_to_value_set, ValueSet, \ NO_VALUES diff --git a/jedi/inference/utils.py b/jedi/inference/utils.py index a1efc047..0d81e5f4 100644 --- a/jedi/inference/utils.py +++ b/jedi/inference/utils.py @@ -113,13 +113,3 @@ def ignored(*exceptions): yield except exceptions: pass - - -def indent_block(text, indention=' '): - """This function indents a text block with a default of four spaces.""" - temp = '' - while text and text[-1] == '\n': - temp += text[-1] - text = text[:-1] - lines = text.split('\n') - return '\n'.join(map(lambda s: indention + s, lines)) + temp diff --git a/jedi/utils.py b/jedi/utils.py index 85fe4314..dfcc51ff 100644 --- a/jedi/utils.py +++ b/jedi/utils.py @@ -132,3 +132,13 @@ def version_info(): from jedi import __version__ tupl = re.findall(r'[a-z]+|\d+', __version__) return Version(*[x if i == 3 else int(x) for i, x in enumerate(tupl)]) + + +def indent_block(text, indention=' '): + """This function indents a text block with a default of four spaces.""" + temp = '' + while text and text[-1] == '\n': + temp += text[-1] + text = text[:-1] + lines = text.split('\n') + return '\n'.join(map(lambda s: indention + s, lines)) + temp diff --git a/test/refactor/extract_variable.py b/test/refactor/extract_variable.py index 76594783..da38e135 100644 --- a/test/refactor/extract_variable.py +++ b/test/refactor/extract_variable.py @@ -84,7 +84,7 @@ class Foo(foo.Bar): x = foo.Bar class Foo(x): pass -# -------------------------------------------------- class-inheritance-1 +# -------------------------------------------------- class-inheritance-2 #? 16 text {'new_name': 'x'} class Foo(foo.Bar): pass diff --git a/test/test_integration.py b/test/test_integration.py index 25fe213c..206299e7 100644 --- a/test/test_integration.py +++ b/test/test_integration.py @@ -3,7 +3,7 @@ import os import pytest from . import helpers -from jedi.inference.utils import indent_block +from jedi.utils import indent_block from jedi import RefactoringError