summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCeridwen <ceridwenv@gmail.com>2016-03-31 14:56:20 -0400
committerCeridwen <ceridwenv@gmail.com>2016-03-31 14:56:20 -0400
commit4b5593450c8018a5bfe33f82009e6127382a1b91 (patch)
tree7d44cb8d5b53e1ff51473f6985bd0dba55b8eb34
parent3aa99786327dbb366b02123468fece10e44ceb9c (diff)
downloadastroid-git-4b5593450c8018a5bfe33f82009e6127382a1b91.tar.gz
Make the field character limit for __str__ a global constant
-rw-r--r--astroid/__init__.py2
-rw-r--r--astroid/tree/base.py6
2 files changed, 7 insertions, 1 deletions
diff --git a/astroid/__init__.py b/astroid/__init__.py
index 7d84335e..6b2b0049 100644
--- a/astroid/__init__.py
+++ b/astroid/__init__.py
@@ -83,8 +83,10 @@ from astroid.builder import parse
from astroid.util import Uninferable, YES
# TODO
+# from astroid.tree import zipper
from astroid.tree.base import NodeNG
+
# transform utilities (filters and decorator)
class AsStringRegexpPredicate(object):
diff --git a/astroid/tree/base.py b/astroid/tree/base.py
index 098ca194..59fc2872 100644
--- a/astroid/tree/base.py
+++ b/astroid/tree/base.py
@@ -34,6 +34,10 @@ from astroid import util
inference = util.lazy_import('inference')
+# The maximum number of characters to print for a field in a string
+# representation of a node.
+FIELD_CHARACTERS_LIMIT = 160
+
@util.register_implementation(treeabc.NodeNG)
class NodeNG(object):
"""Base Class for all Astroid node classes.
@@ -129,7 +133,7 @@ class NodeNG(object):
# Some fields, notably source_code for Module nodes, are
# too long to display comfortably, so this limits them.
- if len(lines[0]) > 160:
+ if len(lines[0]) > FIELD_CHARACTERS_LIMIT:
lines[0] = lines[0][:160] + '...'
inner = [lines[0]]
for line in lines[1:]: