本文整理汇总了Python中rope.base.ast.get_child_nodes函数的典型用法代码示例。如果您正苦于以下问题:Python get_child_nodes函数的具体用法?Python get_child_nodes怎么用?Python get_child_nodes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_child_nodes函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _handle_conditional_node
def _handle_conditional_node(self, node):
self.conditional = True
try:
for child in ast.get_child_nodes(node):
ast.walk(child, self)
finally:
self.conditional = False
开发者ID:Ferada,项目名称:rope,代码行数:7,代码来源:extract.py
示例2: _FunctionDef
def _FunctionDef(self, node):
_ScopeVisitor._FunctionDef(self, node)
if len(node.args.args) > 0:
first = node.args.args[0]
if isinstance(first, ast.arg):
new_visitor = _ClassInitVisitor(self, first.arg)
for child in ast.get_child_nodes(node):
ast.walk(child, new_visitor)
开发者ID:Ampersandy,项目名称:python-mode,代码行数:8,代码来源:pyobjectsdef.py
示例3: _create_structural_attributes
def _create_structural_attributes(self):
if self.visitor_class is None:
return {}
new_visitor = self.visitor_class(self.pycore, self)
for child in ast.get_child_nodes(self.ast_node):
ast.walk(child, new_visitor)
self.defineds = new_visitor.defineds
return new_visitor.names
开发者ID:0Chuzz,项目名称:python-mode,代码行数:8,代码来源:pyobjects.py
示例4: _get_nearest_roots
def _get_nearest_roots(self, node):
if node not in self._nearest_roots:
result = []
for child in ast.get_child_nodes(node):
if child in self.matched_asts:
result.append(child)
else:
result.extend(self._get_nearest_roots(child))
self._nearest_roots[node] = result
return self._nearest_roots[node]
开发者ID:mattvonrocketstein,项目名称:kinbaku,代码行数:10,代码来源:restructure.py
示例5: _visit_function
def _visit_function(self):
if self.names is None:
new_visitor = self.visitor(self.pycore, self.pyobject)
for n in ast.get_child_nodes(self.pyobject.get_ast()):
ast.walk(n, new_visitor)
self.names = new_visitor.names
self.names.update(self.pyobject.get_parameters())
self.returned_asts = new_visitor.returned_asts
self.is_generator = new_visitor.generator
self.defineds = new_visitor.defineds
开发者ID:ArthurChiao,项目名称:vim_awesome,代码行数:10,代码来源:pyscopes.py
示例6: _FunctionDef
def _FunctionDef(self, node):
_ScopeVisitor._FunctionDef(self, node)
if len(node.args.args) > 0:
first = node.args.args[0]
new_visitor = None
if isinstance(first, pycompat.ast_arg_type):
new_visitor = _ClassInitVisitor(self, pycompat.get_ast_arg_arg(first))
if new_visitor is not None:
for child in ast.get_child_nodes(node):
ast.walk(child, new_visitor)
开发者ID:mcepl,项目名称:rope,代码行数:10,代码来源:pyobjectsdef.py
示例7: _Tuple
def _Tuple(self, node):
new_levels = []
if self.levels is not None:
new_levels = list(self.levels)
new_levels.append(self.index)
self.index += 1
visitor = _NodeNameCollector(new_levels)
for child in ast.get_child_nodes(node):
ast.walk(child, visitor)
self.names.extend(visitor.names)
开发者ID:0Chuzz,项目名称:python-mode,代码行数:10,代码来源:astutils.py
示例8: _FunctionDef
def _FunctionDef(self, node):
_ScopeVisitor._FunctionDef(self, node)
if len(node.args.args) > 0:
first = node.args.args[0]
new_visitor = None
if hasattr(ast, 'arg'): # Py3
if isinstance(first, ast.arg):
new_visitor = _ClassInitVisitor(self, first.arg)
else: # Py2
if isinstance(first, ast.Name):
new_visitor = _ClassInitVisitor(self, first.id)
if new_visitor is not None:
for child in ast.get_child_nodes(node):
ast.walk(child, new_visitor)
开发者ID:emacsway-qarea,项目名称:rope,代码行数:14,代码来源:pyobjectsdef.py
示例9: _FunctionDef
def _FunctionDef(self, node):
self.written.add(node.name)
visitor = _VariableReadsAndWritesFinder()
for child in ast.get_child_nodes(node):
ast.walk(child, visitor)
self.read.update(visitor.read - visitor.written)
开发者ID:Ferada,项目名称:rope,代码行数:6,代码来源:extract.py
示例10: _visit_child_scope
def _visit_child_scope(self, node):
pyobject = self.pyobject.get_module().get_scope().\
get_inner_scope_for_line(node.lineno).pyobject
visitor = _LocalUnboundNameFinder(pyobject, self)
for child in ast.get_child_nodes(node):
ast.walk(child, visitor)
开发者ID:Marslo,项目名称:VimConfig,代码行数:6,代码来源:module_imports.py
示例11: _Tuple
def _Tuple(self, node):
if not isinstance(node.ctx, ast.Store):
return
for child in ast.get_child_nodes(node):
ast.walk(child, self)
开发者ID:Ampersandy,项目名称:python-mode,代码行数:5,代码来源:pyobjectsdef.py
示例12: _new_scope
def _new_scope(self, node):
visitor = _WarningsVisitor()
for child in ast.get_child_nodes(node):
ast.walk(child, visitor)
self.warnings.extend(visitor.warnings)
开发者ID:brucexin,项目名称:bruce-s-profiles,代码行数:5,代码来源:notes.py
示例13: start_walking
def start_walking(self, node):
nodes = [node]
if isinstance(node, ast.FunctionDef):
nodes = ast.get_child_nodes(node)
for child in nodes:
ast.walk(child, self)
开发者ID:0Chuzz,项目名称:python-mode,代码行数:6,代码来源:usefunction.py
示例14: _get_ast_children
def _get_ast_children(node):
visitor = _ASTDefinedVisitor()
for child in ast.get_child_nodes(node):
ast.walk(child, visitor)
return visitor.result
开发者ID:brucexin,项目名称:bruce-s-profiles,代码行数:5,代码来源:outline.py
注:本文中的rope.base.ast.get_child_nodes函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论