Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a couple of bugs when importing modules from interpreter #78

Merged
merged 2 commits into from
May 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions easyaccess/easyaccess.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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:
--------
Expand Down
15 changes: 6 additions & 9 deletions easyaccess/eautils/fun_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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-nargs_p]))
temp = easy_function
temp.__doc1__ = head
temp.__doc1__ = '('+', '.join(head)+')'
temp.in_easyaccess = True
temp.__doc__ = custom.__doc__

Expand Down