X Tutup
Skip to content

Commit 0ace2c4

Browse files
committed
Replaced argspec list with namedtuple FuncProps for better readability
1 parent 86a9cce commit 0ace2c4

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

bpython/cli.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -699,16 +699,17 @@ def mkargspec(self, topline, down):
699699
sturdy."""
700700

701701
r = 3
702-
fn = topline[0]
703-
args = topline[1][0]
704-
kwargs = topline[1][3]
705-
_args = topline[1][1]
706-
_kwargs = topline[1][2]
707-
is_bound_method = topline[2]
708-
in_arg = topline[3]
702+
fn = topline.func
703+
args = topline.arginfo.args
704+
kwargs = topline.arginfo.defaults
705+
_args = topline.arginfo.varargs
706+
_kwargs = topline.arginfo.varkwargs
707+
is_bound_method = topline.is_bound_method
708+
in_arg = topline.in_arg
709+
print "\n\nprinting topline",topline
709710
if py3:
710-
kwonly = topline[1][4]
711-
kwonly_defaults = topline[1][5] or dict()
711+
kwonly = topline.arginfo.kwonly
712+
kwonly_defaults = topline.kwonly_defaults or dict()
712713
max_w = int(self.scr.getmaxyx()[1] * 0.6)
713714
self.list_win.erase()
714715
self.list_win.resize(3, max_w)
@@ -1454,7 +1455,7 @@ def tab(self, back=False):
14541455
current_match = back and self.matches_iter.previous() \
14551456
or next(self.matches_iter)
14561457
try:
1457-
self.show_list(self.matches_iter.matches, topline=self.argspec,
1458+
self.show_list(self.matches_iter.matches, topline=self.funcprops,
14581459
formatter=self.matches_iter.completer.format,
14591460
current_item=current_match)
14601461
except curses.error:

0 commit comments

Comments
 (0)
X Tutup