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.
"""
f = self.base_func
print 'dec', f
# only enter it, if has not already been processed
if not self.is_decorated:
@@ -346,11 +347,12 @@ class Function(object):
debug.dbg('decorator end', f)
if f != self.base_func and isinstance(f, parsing.Function):
f = Function(f)
print 'enddec', f
return f
def __getattr__(self, name):
if self.decorated_func == None:
raise DecoratorNotFound()
raise DecoratorNotFound('Accessed name %s in function' % name)
return getattr(self.decorated_func, name)
def __repr__(self):
@@ -453,6 +455,7 @@ class Execution(Executable):
result.append(self_name)
param_dict = {}
print 'base', self.base, self.base.params
for param in self.base.params:
param_dict[str(param.get_name())] = param
# 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
the necessary functions). Add also the params.
"""
a = self.get_params()
print 'params', a
return self.get_params() + parsing.Scope._get_set_vars(self)
@property

View File

@@ -8,6 +8,7 @@ functions.debug.ignored_modules = ['parsing', 'builtin']
functions.modules.builtin.module_find_path.insert(0, '.')
f_name = 'functions.py'
f_name = 'parsetest.py'
#f_name = 'test/completion/classes.py'
import os
path = os.path.join(os.getcwd(), f_name)
@@ -15,7 +16,8 @@ path = os.path.join(os.getcwd(), f_name)
f = open(path)
code = f.read()
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.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.
:type source_path: int
:return: list of completion objects
:return: list of Completion objects.
:rtype: list
"""
try:

View File

@@ -93,3 +93,22 @@ 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]
# has problems with that (sometimes) very deep nesting.
#? ['description']
el.description
#? str()
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.