forked from VimPlug/jedi
Remove some fixer related stuff (lib2to3 stuff).
This commit is contained in:
@@ -29,7 +29,8 @@ __author__ = 'Ka-Ping Yee <ping@lfw.org>'
|
|||||||
__credits__ = \
|
__credits__ = \
|
||||||
'GvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, Skip Montanaro'
|
'GvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, Skip Montanaro'
|
||||||
|
|
||||||
import string, re
|
import string
|
||||||
|
import re
|
||||||
from codecs import BOM_UTF8, lookup
|
from codecs import BOM_UTF8, lookup
|
||||||
|
|
||||||
from .token import *
|
from .token import *
|
||||||
|
|||||||
@@ -72,8 +72,6 @@ class Base(object):
|
|||||||
type = None # int: token number (< 256) or symbol number (>= 256)
|
type = None # int: token number (< 256) or symbol number (>= 256)
|
||||||
parent = None # Parent node pointer, or None
|
parent = None # Parent node pointer, or None
|
||||||
children = () # Tuple of subnodes
|
children = () # Tuple of subnodes
|
||||||
was_changed = False
|
|
||||||
was_checked = False
|
|
||||||
|
|
||||||
def __new__(cls, *args, **kwds):
|
def __new__(cls, *args, **kwds):
|
||||||
"""Constructor that prevents Base from being instantiated."""
|
"""Constructor that prevents Base from being instantiated."""
|
||||||
@@ -169,11 +167,6 @@ class Base(object):
|
|||||||
node = node.children[0]
|
node = node.children[0]
|
||||||
return node.lineno
|
return node.lineno
|
||||||
|
|
||||||
def changed(self):
|
|
||||||
if self.parent:
|
|
||||||
self.parent.changed()
|
|
||||||
self.was_changed = True
|
|
||||||
|
|
||||||
def remove(self):
|
def remove(self):
|
||||||
"""
|
"""
|
||||||
Remove the node from the tree. Returns the position of the node in its
|
Remove the node from the tree. Returns the position of the node in its
|
||||||
@@ -250,8 +243,7 @@ class Node(Base):
|
|||||||
|
|
||||||
def __init__(self, type, children,
|
def __init__(self, type, children,
|
||||||
context=None,
|
context=None,
|
||||||
prefix=None,
|
prefix=None):
|
||||||
fixers_applied=None):
|
|
||||||
"""
|
"""
|
||||||
Initializer.
|
Initializer.
|
||||||
|
|
||||||
@@ -268,10 +260,6 @@ class Node(Base):
|
|||||||
ch.parent = self
|
ch.parent = self
|
||||||
if prefix is not None:
|
if prefix is not None:
|
||||||
self.prefix = prefix
|
self.prefix = prefix
|
||||||
if fixers_applied:
|
|
||||||
self.fixers_applied = fixers_applied[:]
|
|
||||||
else:
|
|
||||||
self.fixers_applied = None
|
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
"""Return a canonical string representation."""
|
"""Return a canonical string representation."""
|
||||||
@@ -296,8 +284,7 @@ class Node(Base):
|
|||||||
|
|
||||||
def clone(self):
|
def clone(self):
|
||||||
"""Return a cloned (deep) copy of self."""
|
"""Return a cloned (deep) copy of self."""
|
||||||
return Node(self.type, [ch.clone() for ch in self.children],
|
return Node(self.type, [ch.clone() for ch in self.children])
|
||||||
fixers_applied=self.fixers_applied)
|
|
||||||
|
|
||||||
def post_order(self):
|
def post_order(self):
|
||||||
"""Return a post-order iterator for the tree."""
|
"""Return a post-order iterator for the tree."""
|
||||||
@@ -365,10 +352,7 @@ class Leaf(Base):
|
|||||||
lineno = 0 # Line where this token starts in the input
|
lineno = 0 # Line where this token starts in the input
|
||||||
column = 0 # Column where this token tarts in the input
|
column = 0 # Column where this token tarts in the input
|
||||||
|
|
||||||
def __init__(self, type, value,
|
def __init__(self, type, value, context=None, prefix=None):
|
||||||
context=None,
|
|
||||||
prefix=None,
|
|
||||||
fixers_applied=[]):
|
|
||||||
"""
|
"""
|
||||||
Initializer.
|
Initializer.
|
||||||
|
|
||||||
@@ -382,7 +366,6 @@ class Leaf(Base):
|
|||||||
self.value = value
|
self.value = value
|
||||||
if prefix is not None:
|
if prefix is not None:
|
||||||
self._prefix = prefix
|
self._prefix = prefix
|
||||||
self.fixers_applied = fixers_applied[:]
|
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
"""Return a canonical string representation."""
|
"""Return a canonical string representation."""
|
||||||
@@ -407,9 +390,7 @@ class Leaf(Base):
|
|||||||
|
|
||||||
def clone(self):
|
def clone(self):
|
||||||
"""Return a cloned (deep) copy of self."""
|
"""Return a cloned (deep) copy of self."""
|
||||||
return Leaf(self.type, self.value,
|
return Leaf(self.type, self.value, (self.prefix, (self.lineno, self.column)))
|
||||||
(self.prefix, (self.lineno, self.column)),
|
|
||||||
fixers_applied=self.fixers_applied)
|
|
||||||
|
|
||||||
def leaves(self):
|
def leaves(self):
|
||||||
yield self
|
yield self
|
||||||
|
|||||||
Reference in New Issue
Block a user