This commit is contained in:
David Halter
2012-07-30 01:00:48 +02:00
parent 0a3a167561
commit eb7e877fd9
4 changed files with 13 additions and 12 deletions

View File

@@ -1,9 +1,10 @@
import re
import sys
import os
import types
if sys.hexversion >= 0x03000000:
import io
else:
import types
import inspect
import debug
@@ -31,7 +32,7 @@ class CachedModule(object):
if not self.path or timestamp == os.path.getmtime(self.path):
self._parser = parser
else:
raise KeyError
raise KeyError()
except KeyError:
self._load_module()
return self._parser
@@ -243,7 +244,8 @@ class Parser(CachedModule):
# class members (functions) properties?
for name, func in members.items():
# recursion problem in properties TODO remove
if name in ['fget', 'fset', 'fdel']: continue
if name in ['fget', 'fset', 'fdel']:
continue
ret = 'pass'
code += '@property\ndef %s(self):\n' % (name)
code += parsing.indent_block(get_doc(func) + '%s\n\n' % ret)

View File

@@ -896,7 +896,7 @@ def get_scopes_for_name(scope, name_str, position=None, search_global=False):
except DecoratorNotFound:
continue
res_new.append(r)
debug.dbg(a+'sfn remove, new: %s, old: %s' % (res_new, result))
debug.dbg('sfn remove, new: %s, old: %s' % (res_new, result))
return res_new
def filter_name(scope_generator):
@@ -961,7 +961,7 @@ def get_scopes_for_name(scope, name_str, position=None, search_global=False):
# if there are results, ignore the other scopes
if result:
break
debug.dbg(a+'sfn filter "%s" in %s: %s' % (name_str, scope, result))
debug.dbg('sfn filter "%s" in %s: %s' % (name_str, scope, result))
return result
def descriptor_check(result):
@@ -979,7 +979,6 @@ def get_scopes_for_name(scope, name_str, position=None, search_global=False):
res_new.append(r)
return res_new
import random; a = str(random.randint(0,99))
if search_global:
scope_generator = get_names_for_scope(scope, position=position)
else:
@@ -1200,5 +1199,3 @@ def follow_path(path, scope, position=None):
result = imports.strip_imports(get_scopes_for_name(scope, current,
position=position))
return follow_paths(path, result, position=position)

View File

@@ -985,7 +985,6 @@ class PyFuzzyParser(object):
else:
self.user_stmt = simple
def _parsedotname(self, pre_used_token=None):
"""
The dot name parser parses a name, variable or function and returns

View File

@@ -27,6 +27,9 @@ def run_completion_test(correct, source, line_nr, line, path):
# difference for testing)
try:
completions = functions.complete(source, line_nr, len(line), path)
#import cProfile as profile
#profile.run('functions.complete("""%s""", %i, %i, "%s")'
# % (source, line_nr, len(line), path))
except Exception:
print('test @%s: %s' % (line_nr - 1, line))
print(traceback.format_exc())