From 542116299f2dbfe8d539d965c66e9badc941f488 Mon Sep 17 00:00:00 2001 From: Matias Carrasco Kind Date: Fri, 13 May 2016 09:31:19 -0700 Subject: [PATCH 1/2] fixes on import --- easyaccess/easyaccess.py | 5 +++-- easyaccess/eautils/fun_utils.py | 15 ++++++--------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/easyaccess/easyaccess.py b/easyaccess/easyaccess.py index ac7de43..0569803 100755 --- a/easyaccess/easyaccess.py +++ b/easyaccess/easyaccess.py @@ -61,6 +61,7 @@ def colored(line, color): return line import argparse import webbrowser import signal +sys.path.insert(0, os.getcwd()) fun_utils.init_func() @@ -2418,8 +2419,8 @@ def ea_import(self, import_line='', help=False): Use: ---- - import('module as name') - import('my_module') + ea_import('module as name') + ea_import('my_module') Returns: -------- diff --git a/easyaccess/eautils/fun_utils.py b/easyaccess/eautils/fun_utils.py index 31fbc00..bf5cc6f 100644 --- a/easyaccess/eautils/fun_utils.py +++ b/easyaccess/eautils/fun_utils.py @@ -35,18 +35,15 @@ def easy_function(*args, **kwargs): n_def = len(check.defaults) except: n_def = 0 - head = '(' + nargs_p = len(check.args) - n_def + head = [] for j, ag in enumerate(check.args): - if j < len(check.args) - n_def: - head += ag + ', ' + if j < nargs_p: + head.append(ag) else: - head += ag + '=' + str(check.defaults[j - n_def]) + ', ' - head = head[:-1] - if head[-1] == ',': head = head[:-1] - head += ')' - + head.append(ag + '=' + str(check.defaults[j-narg_p])) temp = easy_function - temp.__doc1__ = head + temp.__doc1__ = '('+', '.join(head)+')' temp.in_easyaccess = True temp.__doc__ = custom.__doc__ From e84b0eef576057e93ae60e055e5980f47cdef61b Mon Sep 17 00:00:00 2001 From: Matias Carrasco Kind Date: Fri, 13 May 2016 09:33:16 -0700 Subject: [PATCH 2/2] fixes on import and bug --- easyaccess/eautils/fun_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easyaccess/eautils/fun_utils.py b/easyaccess/eautils/fun_utils.py index bf5cc6f..617e504 100644 --- a/easyaccess/eautils/fun_utils.py +++ b/easyaccess/eautils/fun_utils.py @@ -41,7 +41,7 @@ def easy_function(*args, **kwargs): if j < nargs_p: head.append(ag) else: - head.append(ag + '=' + str(check.defaults[j-narg_p])) + head.append(ag + '=' + str(check.defaults[j-nargs_p])) temp = easy_function temp.__doc1__ = '('+', '.join(head)+')' temp.in_easyaccess = True