diff --git a/builtin.py b/builtin.py index fd84934e..1fb1c3ec 100644 --- a/builtin.py +++ b/builtin.py @@ -2,7 +2,6 @@ import re import debug import parsing -import __builtin__ class Parser(object): @@ -80,8 +79,8 @@ class Parser(object): pass code += '"""\n%s\n"""\n' % scope.__doc__ - names = set(dir(scope)) - {'__file__', '__name__', '__doc__', - '__path__', '__package__'} + names = set(dir(scope)) - set(['__file__', '__name__', '__doc__', + '__path__', '__package__']) classes, funcs, stmts, members = get_types(names) # classes @@ -140,7 +139,6 @@ def parse_function_doc(func): This is nothing more than a docstring parser. """ # TODO: things like utime(path, (atime, mtime)) and a(b [, b]) -> None - params = [] doc = func.__doc__ # get full string, parse round parentheses: def func(a, (b,c)) diff --git a/evaluate.py b/evaluate.py index 2a63ee4d..effee528 100644 --- a/evaluate.py +++ b/evaluate.py @@ -6,6 +6,13 @@ follow_statement -> follow_call -> follow_paths -> follow_path TODO include super classes """ +# python2.5 compatibility +try: + next +except NameError: + def next(obj): + return obj.next() + import itertools import parsing diff --git a/ftest.py b/ftest.py index 7207d053..ac390dd7 100755 --- a/ftest.py +++ b/ftest.py @@ -11,8 +11,8 @@ f_name = 'test.py' import os path = os.getcwd() + '/' + f_name -with open(path) as f: - code = f.read() +f = open(path) +code = f.read() for i in range(1): completions = functions.complete(code, 150, 200, path) diff --git a/functions.py b/functions.py index 4dcd45e2..28559fbe 100644 --- a/functions.py +++ b/functions.py @@ -8,7 +8,6 @@ import debug __all__ = ['complete', 'get_completion_parts', 'complete_test', 'set_debug_function'] - class FileWithCursor(modules.File): """ Manages all files, that are parsed and caches them. diff --git a/modules.py b/modules.py index 5e5e46a2..beafc8e0 100644 --- a/modules.py +++ b/modules.py @@ -86,6 +86,7 @@ def find_module(current_module, point_path): raise return i + # TODO handle relative paths - they are included int the import object current_namespace = None sys.path.insert(0, os.path.dirname(current_module.module_path)) # now execute those paths @@ -108,8 +109,10 @@ def find_module(current_module, point_path): # is a directory module if is_package_directory: path += '/__init__.py' - with open(path) as f: - source = f.read() + # python2.5 cannot cope with the `with` statement + #with open(path) as f: + # source = f.read() + source = open(path).read() else: source = current_namespace[0].read() f = File(path, source) diff --git a/test.py b/test.py index 9516d4e8..911332d4 100644 --- a/test.py +++ b/test.py @@ -147,4 +147,4 @@ b= asdf2 #import parsing as test c = b().c3() 1.0.fromhex(); import flask ; flsk = flask.Flask + flask.Request; -c2(flask(). +c2(flask.