jupyter/qtconsole

misspelled keyword arg in qtconsole.util.compute_item_matrix

martsenecal opened this issue · 2 comments

expected args & kwargs the compute_item_matrix are:

def compute_item_matrix(items, empty=None, *, separator_size=2, displaywith=80)

Consumers of this function (eg. completion_html.CompletionHtml.show_items, line 315) call on it with the correctly spelled keyword, 'displaywidth'.

As well, within the compute_item_matrix function itself, line 195, it tries to pass on displaywith to another function using the correctly spelled keyword, displaywidth, which it doesn't have.

I fixed the misspelled keyword in my local copy of util.py, and as expected, it resolved the issue and no longer raises a TypeError exception crashing the instance.

*** quick test (after fixing spelling) ***

Python 3.11.7 (main, Dec 15 2023, 12:09:56) [Clang 14.0.6 ]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.20.0 -- An enhanced Interactive Python. Type '?' for help.

from qtconsole.util import compute_item_matrix

compute_item_matrix(['a', 'b', 'c'], displaywidth=100)
Out[3]: 
([['a', 'b', 'c']],
 {'columns_numbers': 3, 'rows_numbers': 1, 'columns_width': [1, 1, 1]})

Hey @martsenecal, thanks for reporting. This is a duplicate of issue #591 and fixed in our latest version (5.5.1), so please update to that version.

Most awesome!

Thank you,
-mart