A better repr for the endmarker

This commit is contained in:
Dave Halter
2018-05-17 09:56:16 +02:00
parent 948f9ccecc
commit ac0bf4fcdd

View File

@@ -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.