コード例 #1
0
ファイル: __init__.py プロジェクト: aroba12/jedi
    def _analysis(self):
        def check_types(types):
            for typ in types:
                try:
                    f = typ.iter_content
                except AttributeError:
                    pass
                else:
                    check_types(f())

        #statements = set(chain(*self._parser.module().used_names.values()))
        nodes, imp_names, decorated_funcs = \
            analysis.get_module_statements(self._parser.module())
        # Sort the statements so that the results are reproducible.
        for n in imp_names:
            imports.ImportWrapper(self._evaluator, n).follow()
        for node in sorted(nodes, key=lambda obj: obj.start_pos):
            #if not (isinstance(stmt.parent, pr.ForFlow) and stmt.parent.set_stmt == stmt):
            if node.type == 'expr_stmt':
                check_types(self._evaluator.eval_statement(node))
            else:
                check_types(self._evaluator.eval_element(node))

        for dec_func in decorated_funcs:
            er.Function(self._evaluator, dec_func).get_decorated_func()

        ana = [a for a in self._evaluator.analysis if self.path == a.path]
        return sorted(set(ana), key=lambda x: x.line)
コード例 #2
0
ファイル: __init__.py プロジェクト: beyang/jedi
    def _analysis(self):
        #statements = set(chain(*self._parser.module().used_names.values()))
        stmts, imps = analysis.get_module_statements(self._parser.module())
        # Sort the statements so that the results are reproducible.
        for i in imps:
            iw = imports.ImportWrapper(self._evaluator, i,
                                       nested_resolve=True).follow()
            if i.is_nested() and any(not isinstance(i, pr.Module) for i in iw):
                analysis.add(self._evaluator, 'import-error', i.namespace.names[-1])
        for stmt in sorted(stmts, key=lambda obj: obj.start_pos):
            if not (isinstance(stmt.parent, pr.ForFlow)
                    and stmt.parent.set_stmt == stmt):
                self._evaluator.eval_statement(stmt)

        ana = [a for a in self._evaluator.analysis if self.path == a.path]
        return sorted(set(ana), key=lambda x: x.line)
コード例 #3
0
ファイル: __init__.py プロジェクト: ppalaciosa/emacs.d
    def _analysis(self):
        #statements = set(chain(*self._parser.module().used_names.values()))
        stmts, imps = analysis.get_module_statements(self._parser.module())
        # Sort the statements so that the results are reproducible.
        for i in imps:
            iw = imports.ImportWrapper(self._evaluator, i,
                                       nested_resolve=True).follow()
            if i.is_nested() and any(not isinstance(i, pr.Module) for i in iw):
                analysis.add(self._evaluator, 'import-error',
                             i.namespace.names[-1])
        for stmt in sorted(stmts, key=lambda obj: obj.start_pos):
            if not (isinstance(stmt.parent, pr.ForFlow)
                    and stmt.parent.set_stmt == stmt):
                self._evaluator.eval_statement(stmt)

        ana = [a for a in self._evaluator.analysis if self.path == a.path]
        return sorted(set(ana), key=lambda x: x.line)
コード例 #4
0
ファイル: __init__.py プロジェクト: ABob/vim
    def _analysis(self):
        def check_types(types):
            for typ in types:
                try:
                    f = typ.iter_content
                except AttributeError:
                    pass
                else:
                    check_types(f())

        #statements = set(chain(*self._parser.module().used_names.values()))
        nodes, imp_names, decorated_funcs = \
            analysis.get_module_statements(self._parser.module())
        # Sort the statements so that the results are reproducible.
        for n in imp_names:
            imports.ImportWrapper(self._evaluator, n).follow()
        for node in sorted(nodes, key=lambda obj: obj.start_pos):
            check_types(self._evaluator.eval_element(node))

        for dec_func in decorated_funcs:
            er.Function(self._evaluator, dec_func).get_decorated_func()

        ana = [a for a in self._evaluator.analysis if self.path == a.path]
        return sorted(set(ana), key=lambda x: x.line)