debugging stuff

This commit is contained in:
David Halter
2012-07-05 01:03:28 +02:00
parent 70530c0767
commit 70b3895e42
5 changed files with 39 additions and 5 deletions

View File

@@ -314,6 +314,7 @@ class Function(object):
This is also the places where the decorators are processed. This is also the places where the decorators are processed.
""" """
f = self.base_func f = self.base_func
print 'dec', f
# only enter it, if has not already been processed # only enter it, if has not already been processed
if not self.is_decorated: if not self.is_decorated:
@@ -346,11 +347,12 @@ class Function(object):
debug.dbg('decorator end', f) debug.dbg('decorator end', f)
if f != self.base_func and isinstance(f, parsing.Function): if f != self.base_func and isinstance(f, parsing.Function):
f = Function(f) f = Function(f)
print 'enddec', f
return f return f
def __getattr__(self, name): def __getattr__(self, name):
if self.decorated_func == None: if self.decorated_func == None:
raise DecoratorNotFound() raise DecoratorNotFound('Accessed name %s in function' % name)
return getattr(self.decorated_func, name) return getattr(self.decorated_func, name)
def __repr__(self): def __repr__(self):
@@ -453,6 +455,7 @@ class Execution(Executable):
result.append(self_name) result.append(self_name)
param_dict = {} param_dict = {}
print 'base', self.base, self.base.params
for param in self.base.params: for param in self.base.params:
param_dict[str(param.get_name())] = param param_dict[str(param.get_name())] = param
# There may be calls, which don't fit all the params, this just ignores # There may be calls, which don't fit all the params, this just ignores
@@ -579,6 +582,8 @@ class Execution(Executable):
Call the default method with the own instance (self implements all Call the default method with the own instance (self implements all
the necessary functions). Add also the params. the necessary functions). Add also the params.
""" """
a = self.get_params()
print 'params', a
return self.get_params() + parsing.Scope._get_set_vars(self) return self.get_params() + parsing.Scope._get_set_vars(self)
@property @property

View File

@@ -8,6 +8,7 @@ functions.debug.ignored_modules = ['parsing', 'builtin']
functions.modules.builtin.module_find_path.insert(0, '.') functions.modules.builtin.module_find_path.insert(0, '.')
f_name = 'functions.py' f_name = 'functions.py'
f_name = 'parsetest.py'
#f_name = 'test/completion/classes.py' #f_name = 'test/completion/classes.py'
import os import os
path = os.path.join(os.getcwd(), f_name) path = os.path.join(os.getcwd(), f_name)
@@ -15,7 +16,8 @@ path = os.path.join(os.getcwd(), f_name)
f = open(path) f = open(path)
code = f.read() code = f.read()
for i in range(1): for i in range(1):
completions = functions.complete(code, 163, 200, path) completions = functions.complete(code, 15, 200, path)
#completions = functions.complete(code, 163, 200, path)
#completions = functions.get_definitions(code, 181, 2, path) #completions = functions.get_definitions(code, 181, 2, path)
#completions = functions.complete(code, 42, 200, path) #completions = functions.complete(code, 42, 200, path)

View File

@@ -133,7 +133,7 @@ def complete(source, row, column, source_path):
:param source_path: The path in the os, the current module is in. :param source_path: The path in the os, the current module is in.
:type source_path: int :type source_path: int
:return: list of completion objects :return: list of Completion objects.
:rtype: list :rtype: list
""" """
try: try:

View File

@@ -93,3 +93,22 @@ JustAClass().a()
JustAClass.a. JustAClass.a.
#? [] #? []
JustAClass().a() JustAClass().a()
# -----------------
# others
# -----------------
def memoize(function):
def wrapper(*args):
if 1:
pass
else:
rv = function(*args)
return rv
return wrapper
@memoize
def follow_statement(stmt):
return stmt
#? int()
follow_statement(1)

View File

@@ -1,10 +1,18 @@
import functions from jedi import functions
el = functions.complete()[0] el = functions.complete()[0]
# has problems with that (sometimes) very deep nesting.
#? ['description'] #? ['description']
el.description el.description
#? str() #? str()
el.description el.description
scopes, path, dot, like = \
functions.prepare_goto(source, row, column,
source_path, True)
# has problems with that (sometimes) very deep nesting.
#? str()
el = scopes.