From ac0bf4fcdd0477bef500c0c614119535d0719ac3 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Thu, 17 May 2018 09:56:16 +0200 Subject: [PATCH] A better repr for the endmarker --- parso/python/tree.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/parso/python/tree.py b/parso/python/tree.py index e2bf010..f6b4dd3 100644 --- a/parso/python/tree.py +++ b/parso/python/tree.py @@ -60,7 +60,6 @@ _GET_DEFINITION_TYPES = set([ _IMPORTS = set(['import_name', 'import_from']) - class DocstringMixin(object): __slots__ = () @@ -133,7 +132,6 @@ class PythonLeaf(PythonMixin, Leaf): return previous_leaf.end_pos - class _LeafWithoutNewlines(PythonLeaf): """ Simply here to optimize performance. @@ -166,6 +164,10 @@ class EndMarker(_LeafWithoutNewlines): __slots__ = () type = 'endmarker' + @utf8_repr + def __repr__(self): + return "<%s: prefix=%s>" % (type(self).__name__, repr(self.prefix)) + class Newline(PythonLeaf): """Contains NEWLINE and ENDMARKER tokens.""" @@ -235,7 +237,6 @@ class Name(_LeafWithoutNewlines): return None - class Literal(PythonLeaf): __slots__ = () @@ -653,6 +654,7 @@ class Function(ClassOrFunc): except IndexError: return None + class Lambda(Function): """ Lambdas are basically trimmed functions, so give it the same interface.