Show More
@@ -400,7 +400,7 b' def run_iptest():' | |||
|
400 | 400 | SubprocessStreamCapturePlugin() ] |
|
401 | 401 | |
|
402 | 402 | # we still have some vestigial doctests in core |
|
403 | if (section.name.startswith(('core', 'IPython.core'))): | |
|
403 | if (section.name.startswith(('core', 'IPython.core', 'IPython.utils'))): | |
|
404 | 404 | plugins.append(IPythonDoctest()) |
|
405 | 405 | argv.extend([ |
|
406 | 406 | '--with-ipdoctest', |
@@ -635,7 +635,7 b' def _find_optimal(rlist, row_first=False, separator_size=2, displaywidth=80):' | |||
|
635 | 635 | if sumlength + separator_size * (ncols - 1) <= displaywidth: |
|
636 | 636 | break |
|
637 | 637 | return {'num_columns': ncols, |
|
638 | 'optimal_separator_width': (displaywidth - sumlength) / (ncols - 1) if (ncols - 1) else 0, | |
|
638 | 'optimal_separator_width': (displaywidth - sumlength) // (ncols - 1) if (ncols - 1) else 0, | |
|
639 | 639 | 'max_rows': max_rows, |
|
640 | 640 | 'column_widths': col_widths |
|
641 | 641 | } |
@@ -694,17 +694,12 b' def compute_item_matrix(items, row_first=False, empty=None, *args, **kwargs) :' | |||
|
694 | 694 | :: |
|
695 | 695 | |
|
696 | 696 | In [1]: l = ['aaa','b','cc','d','eeeee','f','g','h','i','j','k','l'] |
|
697 |
|
|
|
698 |
|
|
|
699 | ([['aaa', 'f', 'k'], | |
|
700 | ['b', 'g', 'l'], | |
|
701 | ['cc', 'h', None], | |
|
702 | ['d', 'i', None], | |
|
703 | ['eeeee', 'j', None]], | |
|
704 | {'num_columns': 3, | |
|
705 | 'column_widths': [5, 1, 1], | |
|
706 | 'optimal_separator_width': 2, | |
|
707 | 'max_rows': 5}) | |
|
697 | In [2]: list, info = compute_item_matrix(l, displaywidth=12) | |
|
698 | In [3]: list | |
|
699 | Out[3]: [['aaa', 'f', 'k'], ['b', 'g', 'l'], ['cc', 'h', None], ['d', 'i', None], ['eeeee', 'j', None]] | |
|
700 | In [4]: ideal = {'num_columns': 3, 'column_widths': [5, 1, 1], 'optimal_separator_width': 2, 'max_rows': 5} | |
|
701 | In [5]: all((info[k] == ideal[k] for k in ideal.keys())) | |
|
702 | Out[5]: True | |
|
708 | 703 | """ |
|
709 | 704 | info = _find_optimal(list(map(len, items)), row_first, *args, **kwargs) |
|
710 | 705 | nrow, ncol = info['max_rows'], info['num_columns'] |
General Comments 0
You need to be logged in to leave comments.
Login now