forked from VimPlug/jedi
Rename Simple -> BaseNode.
This commit is contained in:
@@ -77,7 +77,7 @@ def deep_ast_copy(obj, new_elements_default=None, check_first=False):
|
|||||||
setattr(new_obj, key, d)
|
setattr(new_obj, key, d)
|
||||||
elif isinstance(value, (list, tuple)):
|
elif isinstance(value, (list, tuple)):
|
||||||
setattr(new_obj, key, sequence_recursion(value))
|
setattr(new_obj, key, sequence_recursion(value))
|
||||||
elif isinstance(value, (pr.Simple, pr.Name)):
|
elif isinstance(value, (pr.BaseNode, pr.Name)):
|
||||||
setattr(new_obj, key, recursion(value))
|
setattr(new_obj, key, recursion(value))
|
||||||
|
|
||||||
return new_obj
|
return new_obj
|
||||||
|
|||||||
@@ -311,7 +311,7 @@ class InstanceElement(use_metaclass(CachedMetaClass, pr.Base)):
|
|||||||
return par
|
return par
|
||||||
|
|
||||||
def get_parent_until(self, *args, **kwargs):
|
def get_parent_until(self, *args, **kwargs):
|
||||||
return pr.Simple.get_parent_until(self, *args, **kwargs)
|
return pr.BaseNode.get_parent_until(self, *args, **kwargs)
|
||||||
|
|
||||||
def get_definition(self):
|
def get_definition(self):
|
||||||
return self.get_parent_until((pr.ExprStmt, pr.IsScope, pr.Import))
|
return self.get_parent_until((pr.ExprStmt, pr.IsScope, pr.Import))
|
||||||
|
|||||||
@@ -396,7 +396,7 @@ class Keyword(Leaf):
|
|||||||
return hash(self.value)
|
return hash(self.value)
|
||||||
|
|
||||||
|
|
||||||
class Simple(Base):
|
class BaseNode(Base):
|
||||||
"""
|
"""
|
||||||
The super class for Scope, Import, Name and Statement. Every object in
|
The super class for Scope, Import, Name and Statement. Every object in
|
||||||
the parser tree inherits from this class.
|
the parser tree inherits from this class.
|
||||||
@@ -405,7 +405,7 @@ class Simple(Base):
|
|||||||
|
|
||||||
def __init__(self, children):
|
def __init__(self, children):
|
||||||
"""
|
"""
|
||||||
Initialize :class:`Simple`.
|
Initialize :class:`BaseNode`.
|
||||||
|
|
||||||
:param children: The module in which this Python object locates.
|
:param children: The module in which this Python object locates.
|
||||||
"""
|
"""
|
||||||
@@ -475,7 +475,7 @@ class Simple(Base):
|
|||||||
(type(self).__name__, code, self.start_pos[0], self.start_pos[1])
|
(type(self).__name__, code, self.start_pos[0], self.start_pos[1])
|
||||||
|
|
||||||
|
|
||||||
class Node(Simple):
|
class Node(BaseNode):
|
||||||
"""Concrete implementation for interior nodes."""
|
"""Concrete implementation for interior nodes."""
|
||||||
__slots__ = ('type',)
|
__slots__ = ('type',)
|
||||||
|
|
||||||
@@ -504,7 +504,7 @@ class IsScope(use_metaclass(IsScopeMeta)):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Scope(Simple, DocstringMixin):
|
class Scope(BaseNode, DocstringMixin):
|
||||||
"""
|
"""
|
||||||
Super class for the parser tree, which represents the state of a python
|
Super class for the parser tree, which represents the state of a python
|
||||||
text file.
|
text file.
|
||||||
@@ -646,7 +646,7 @@ class Module(Scope):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class Decorator(Simple):
|
class Decorator(BaseNode):
|
||||||
type = 'decorator'
|
type = 'decorator'
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
|
|
||||||
@@ -815,7 +815,7 @@ class Lambda(Function):
|
|||||||
return "<%s@%s>" % (self.__class__.__name__, self.start_pos)
|
return "<%s@%s>" % (self.__class__.__name__, self.start_pos)
|
||||||
|
|
||||||
|
|
||||||
class Flow(Simple):
|
class Flow(BaseNode):
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
|
|
||||||
|
|
||||||
@@ -899,7 +899,7 @@ class WithStmt(Flow):
|
|||||||
return node.children[0]
|
return node.children[0]
|
||||||
|
|
||||||
|
|
||||||
class Import(Simple):
|
class Import(BaseNode):
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
|
|
||||||
def path_for_name(self, name):
|
def path_for_name(self, name):
|
||||||
@@ -1038,7 +1038,7 @@ class ImportName(Import):
|
|||||||
if alias is not None)
|
if alias is not None)
|
||||||
|
|
||||||
|
|
||||||
class KeywordStatement(Simple):
|
class KeywordStatement(BaseNode):
|
||||||
"""
|
"""
|
||||||
For the following statements: `assert`, `del`, `global`, `nonlocal`,
|
For the following statements: `assert`, `del`, `global`, `nonlocal`,
|
||||||
`raise`, `return`, `yield`, `pass`, `continue`, `break`, `return`, `yield`.
|
`raise`, `return`, `yield`, `pass`, `continue`, `break`, `return`, `yield`.
|
||||||
@@ -1074,7 +1074,7 @@ class ReturnStmt(KeywordStatement):
|
|||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
|
|
||||||
|
|
||||||
class YieldExpr(Simple):
|
class YieldExpr(BaseNode):
|
||||||
type = 'yield_expr'
|
type = 'yield_expr'
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
|
|
||||||
@@ -1100,7 +1100,7 @@ def _defined_names(current):
|
|||||||
return names
|
return names
|
||||||
|
|
||||||
|
|
||||||
class ExprStmt(Simple, DocstringMixin):
|
class ExprStmt(BaseNode, DocstringMixin):
|
||||||
type = 'expr_stmt'
|
type = 'expr_stmt'
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
|
|
||||||
@@ -1183,7 +1183,7 @@ class Param(Base):
|
|||||||
return '<%s: %s>' % (type(self).__name__, str(self.tfpdef) + default)
|
return '<%s: %s>' % (type(self).__name__, str(self.tfpdef) + default)
|
||||||
|
|
||||||
|
|
||||||
class CompFor(Simple):
|
class CompFor(BaseNode):
|
||||||
type = 'comp_for'
|
type = 'comp_for'
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user