mirror of
https://github.com/davidhalter/parso.git
synced 2026-01-01 09:03:39 +08:00
A better repr for the endmarker
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user