summaryrefslogtreecommitdiff
path: root/pylint/utils/utils.py
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2019-03-09 18:59:44 +0100
committerClaudiu Popa <pcmanticore@gmail.com>2019-03-29 09:37:05 +0100
commitd8116eac7c03d6889ba3b5eef8cbf53a8ba5b44b (patch)
tree18ccc847a44188e1812cd5afe52d9db68c6c47d6 /pylint/utils/utils.py
parentd84578f84ef8e4a7c73b7126e9321b2c4a4c7e37 (diff)
downloadpylint-git-d8116eac7c03d6889ba3b5eef8cbf53a8ba5b44b.tar.gz
Refactor - Merge normalize text in utils.py
Now that there is no more circular import we can do that.
Diffstat (limited to 'pylint/utils/utils.py')
-rw-r--r--pylint/utils/utils.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/pylint/utils/utils.py b/pylint/utils/utils.py
index d265e2c20..e78cd98a4 100644
--- a/pylint/utils/utils.py
+++ b/pylint/utils/utils.py
@@ -8,6 +8,7 @@ from __future__ import print_function
import codecs
import re
import sys
+import textwrap
import tokenize
from os import linesep, listdir
from os.path import basename, dirname, exists, isdir, join, normpath, splitext
@@ -15,7 +16,15 @@ from os.path import basename, dirname, exists, isdir, join, normpath, splitext
from astroid import Module, modutils
from pylint.constants import MSG_TYPES, MSG_TYPES_LONG, PY_EXTS
-from pylint.utils.normalize_text import normalize_text
+
+
+def normalize_text(text, line_len=80, indent=""):
+ """Wrap the text on the given line length."""
+ return "\n".join(
+ textwrap.wrap(
+ text, width=line_len, initial_indent=indent, subsequent_indent=indent
+ )
+ )
def get_module_and_frameid(node):