How to use the rope.base.ast.walk function in rope

To help you get started, we’ve selected a few rope examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github marslo / myvim / Configurations / Offline_Packages / bundle / python-mode / pymode / libs3 / rope / refactor / suites.py View on Github external
def get_children(self):
        if self._children is None:
            walker = _SuiteWalker(self)
            for child in self.child_nodes:
                ast.walk(child, walker)
            self._children = walker.suites
        return self._children
github python-rope / rope / rope / refactor / extract.py View on Github external
def _create_info_collector(self):
        zero = self.info.scope.get_start() - 1
        start_line = self.info.region_lines[0] - zero
        end_line = self.info.region_lines[1] - zero
        info_collector = _FunctionInformationCollector(start_line, end_line,
                                                       self.info.global_)
        body = self.info.source[self.info.scope_region[0]:
                                self.info.scope_region[1]]
        node = _parse_text(body)
        ast.walk(node, info_collector)
        return info_collector
github marslo / myvim / Configurations / Offline_Packages / bundle / python-mode / pymode / libs / rope / refactor / importutils / module_imports.py View on Github external
def _get_unbound_names(self, defined_pyobject):
        visitor = _GlobalUnboundNameFinder(self.pymodule, defined_pyobject)
        ast.walk(self.pymodule.get_ast(), visitor)
        return visitor.unbound
github spyder-ide / spyder / external-py2 / rope / base / pyobjectsdef.py View on Github external
def _excepthandler(self, node):
        if node.name is not None and isinstance(node.name, ast.Name):
            type_node = node.type
            if isinstance(node.type, ast.Tuple) and type_node.elts:
                type_node = type_node.elts[0]
            self._update_evaluated(node.name, type_node, eval_type=True)
        for child in node.body:
            ast.walk(child, self)
github python-rope / rope / rope / base / pyscopes.py View on Github external
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
github DonJayamanne / pythonVSCode / pythonFiles / rope / refactor / extract.py View on Github external
def _For(self, node):
        self.conditional = True
        try:
            # iter has to be checked before the target variables
            ast.walk(node.iter, self)
            ast.walk(node.target, self)

            for child in node.body:
                ast.walk(child, self)
            for child in node.orelse:
                ast.walk(child, self)
        finally:
            self.conditional = False
github JulianEberius / SublimePythonIDE / server / lib / python3 / rope / base / pyobjectsdef.py View on Github external
def _Tuple(self, node):
        if not isinstance(node.ctx, ast.Store):
            return
        for child in ast.get_child_nodes(node):
            ast.walk(child, self)
github marslo / myvim / Configurations / Offline_Packages / bundle / python-mode / pymode / libs2 / rope / refactor / extract.py View on Github external
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
github python-rope / rope / rope / refactor / extract.py View on Github external
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
github marslo / myvim / Configurations / Offline_Packages / bundle / python-mode / pymode / libs2 / rope / refactor / extract.py View on Github external
def loop_encountered(self, node):
        self.loop_count += 1
        for child in node.body:
            ast.walk(child, self)
        self.loop_count -= 1
        if node.orelse:
            ast.walk(node.orelse, self)