Skip to content

Commit ed02ead

Browse files
committed
print all lines if maxlines=-1
1 parent 10150a0 commit ed02ead

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

doc/source/changes/version_0_30.rst.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ Miscellaneous improvements
259259

260260
Closes :issue:`274`.
261261

262+
262263
Fixes
263264
-----
264265

larray/core/array.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2296,14 +2296,13 @@ def as_table(self, maxlines=-1, edgeitems=5, light=False, wide=True, value_name=
22962296
Parameters
22972297
----------
22982298
maxlines : int, optional
2299-
Maximum number of lines to show. If negative all lines are shown.
2300-
Defaults to -1.
2299+
Maximum number of lines to show. Defaults to -1 (all lines are shown).
23012300
edgeitems : int, optional
23022301
If number of lines to display is greater than `maxlines`,
23032302
only the first and last `edgeitems` lines are displayed.
2304-
Only active if `maxlines` is not 0.
2303+
Only active if `maxlines` is not -1.
23052304
Defaults to 5.
2306-
light: bool, optional
2305+
light : bool, optional
23072306
Whether or not printing the array in the same way as a pandas DataFrame with a MultiIndex
23082307
(see example below). Defaults to False.
23092308
wide : boolean, optional
@@ -2385,7 +2384,7 @@ def as_table(self, maxlines=-1, edgeitems=5, light=False, wide=True, value_name=
23852384
other_colnames = self.axes[-1].labels.tolist() if wide else [value_name]
23862385
yield axes_names + other_colnames
23872386
# summary if needed
2388-
if maxlines > 0 and height > maxlines:
2387+
if maxlines >= 0 and height > maxlines:
23892388
# replace middle lines of the table by '...'.
23902389
# We show only the first and last edgeitems lines.
23912390
startticks = islice(ticks, edgeitems)

larray/util/options.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@
2020
}
2121

2222

23-
def _integer(value):
24-
if not isinstance(value, int):
25-
raise ValueError("Expected integer")
26-
27-
2823
def _positive_integer(value):
2924
if not (isinstance(value, int) and value > 0):
3025
raise ValueError("Expected positive integer")
3126

3227

28+
def _integer_maxlines(value):
29+
if not isinstance(value, int) and value >= -1:
30+
raise ValueError("Expected integer")
31+
32+
3333
def _positive_integer_or_none(value):
3434
if value is None:
3535
return
@@ -40,7 +40,7 @@ def _positive_integer_or_none(value):
4040
_VALIDATORS = {
4141
DISPLAY_PRECISION: _positive_integer_or_none,
4242
DISPLAY_WIDTH: _positive_integer,
43-
DISPLAY_MAXLINES: _integer,
43+
DISPLAY_MAXLINES: _integer_maxlines,
4444
DISPLAY_EDGEITEMS: _positive_integer,
4545
}
4646

@@ -53,11 +53,11 @@ class set_options(object):
5353
5454
- ``display_precision``: number of digits of precision for floating point output.
5555
- ``display_width``: maximum display width for ``repr`` on larray objects. Defaults to 80.
56-
- ``display_maxlines``: Maximum number of lines to show. If 0 all lines are shown.
56+
- ``display_maxlines``: Maximum number of lines to show. All lines are shown if -1.
5757
Defaults to 200.
5858
- ``display_edgeitems`` : if number of lines to display is greater than ``display_maxlines``,
5959
only the first and last ``display_edgeitems`` lines are displayed.
60-
Only active if ``display_maxlines`` is not 0. Defaults to 5.
60+
Only active if ``display_maxlines`` is not -1. Defaults to 5.
6161
6262
Examples
6363
--------

0 commit comments

Comments
 (0)