flexablelib 2.2.2__tar.gz → 2.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {flexablelib-2.2.2 → flexablelib-2.2.3}/CHANGELOG.md +14 -0
- {flexablelib-2.2.2/flexablelib.egg-info → flexablelib-2.2.3}/PKG-INFO +1 -1
- {flexablelib-2.2.2 → flexablelib-2.2.3}/flexablelib/table.py +43 -11
- {flexablelib-2.2.2 → flexablelib-2.2.3/flexablelib.egg-info}/PKG-INFO +1 -1
- {flexablelib-2.2.2 → flexablelib-2.2.3}/flexablelib.egg-info/SOURCES.txt +1 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/package.json +1 -1
- flexablelib-2.2.3/tests/test_v223_fixes.py +66 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/LICENSE +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/MANIFEST.in +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/README.md +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/flexablelib/__init__.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/flexablelib/_speedups.c +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/flexablelib/_width_tables.h +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/flexablelib/cells.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/flexablelib/colors.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/flexablelib/columns.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/flexablelib/fast.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/flexablelib/merges.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/flexablelib/options.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/flexablelib/py.typed +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/flexablelib/readers.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/flexablelib/style_compositions.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/flexablelib/table_strings.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/flexablelib/text_width.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/flexablelib/utils.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/flexablelib/writers.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/flexablelib.egg-info/dependency_links.txt +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/flexablelib.egg-info/requires.txt +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/flexablelib.egg-info/top_level.txt +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/pytest.ini +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/setup.cfg +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/setup.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/style_examples.md +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tests/conftest.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tests/helpers.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tests/test_cells.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tests/test_columns.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tests/test_excel.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tests/test_features.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tests/test_issues.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tests/test_merge_edge_matrix.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tests/test_merges.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tests/test_readme_examples.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tests/test_style_line_widths.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tests/test_styles.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tests/test_text_width.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tests/test_two_pass_measurement.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tests/test_upstream_issues.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tests/test_v2021_fixes.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tests/test_v210_rows_copy.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tests/test_v2110_fixes.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tests/test_v211_fixes.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tests/test_v213_features.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tests/test_v214_features.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tests/test_v215_features.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tests/test_v216_features.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tests/test_v217_features.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tests/test_v218_features.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tests/test_v219_coverage.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tests/test_v219_fixes.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tests/test_v220_exports.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tests/test_v221_fixes.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tests/test_v222_fixes.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tools/benchmark.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tools/generate_width_tables.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tools/readme_gallery.py +0 -0
- {flexablelib-2.2.2 → flexablelib-2.2.3}/tools/text_to_png.py +0 -0
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [2.2.3] - 2026-11-06
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- ``Table(headers=..., rows=...)`` with a short first row and a wider later
|
|
9
|
+
row no longer invents a ghost ``column N``. Padding now uses the live
|
|
10
|
+
column count after every row is loaded, so later cells that already fill
|
|
11
|
+
the remaining headers are enough.
|
|
12
|
+
- ``add_row`` / ``add_column`` reject bare ``str`` / ``bytes`` data with
|
|
13
|
+
``TypeError`` instead of expanding them into one cell per character.
|
|
14
|
+
``Table(rows=...)`` does the same for a string ``rows`` value or string
|
|
15
|
+
row entries. Wrap a single string cell in a list.
|
|
16
|
+
- ``show_empty_columns`` coerces with ``bool(...)``, matching
|
|
17
|
+
``show_empty_rows``.
|
|
18
|
+
|
|
5
19
|
## [2.2.2] - 2026-11-05
|
|
6
20
|
|
|
7
21
|
### Fixed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: flexablelib
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.3
|
|
4
4
|
Summary: Fast, dependency-free terminal tables for Python: 56 border styles, ANSI colors, cell merges, decimal alignment, width fitting, and CSV/Markdown/HTML/Excel/LaTeX I/O.
|
|
5
5
|
Home-page: https://github.com/Opus-Perpetuus/flexablelib
|
|
6
6
|
Author: Benjamin Ramirez
|
|
@@ -952,19 +952,39 @@ class Table(object):
|
|
|
952
952
|
self.__check_add_header_on_init(header)
|
|
953
953
|
except TypeError:
|
|
954
954
|
pass
|
|
955
|
+
if isinstance(rows, (str, bytes)):
|
|
956
|
+
raise TypeError(
|
|
957
|
+
'Table() rows must be a sequence of rows, not '
|
|
958
|
+
f'{type(rows).__name__}'
|
|
959
|
+
)
|
|
955
960
|
try:
|
|
956
|
-
|
|
961
|
+
rows_iter = iter(rows)
|
|
962
|
+
except TypeError:
|
|
963
|
+
rows_iter = None
|
|
964
|
+
if rows_iter is not None:
|
|
965
|
+
for row in rows_iter:
|
|
966
|
+
if isinstance(row, (str, bytes)):
|
|
967
|
+
raise TypeError(
|
|
968
|
+
'Table() row entries must be sequences of cells, not '
|
|
969
|
+
f'{type(row).__name__}; wrap a single value in a list'
|
|
970
|
+
)
|
|
957
971
|
try:
|
|
958
972
|
row.__iter__
|
|
959
|
-
self.add_row(data=list(row))
|
|
960
973
|
except AttributeError:
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
974
|
+
continue
|
|
975
|
+
self.add_row(data=list(row))
|
|
976
|
+
# Activate any headers the rows did not already fill. Use the
|
|
977
|
+
# live column count, not len(rows[0]): a short first row followed
|
|
978
|
+
# by a wider one used to spawn a ghost "column N" because the
|
|
979
|
+
# padding arithmetic ignored later rows that had already claimed
|
|
980
|
+
# the remaining headers.
|
|
981
|
+
try:
|
|
982
|
+
n_headers = len(headers)
|
|
983
|
+
except TypeError:
|
|
984
|
+
n_headers = 0
|
|
985
|
+
for _ in range(max(0, n_headers - self.__real_column_count)):
|
|
964
986
|
self.add_column()
|
|
965
987
|
return None
|
|
966
|
-
except (TypeError, IndexError):
|
|
967
|
-
pass
|
|
968
988
|
try:
|
|
969
989
|
for column in columns:
|
|
970
990
|
try:
|
|
@@ -2292,7 +2312,7 @@ class Table(object):
|
|
|
2292
2312
|
|
|
2293
2313
|
@show_empty_columns.setter
|
|
2294
2314
|
def show_empty_columns(self, value: bool):
|
|
2295
|
-
self.__show_empty_columns = value
|
|
2315
|
+
self.__show_empty_columns = bool(value)
|
|
2296
2316
|
|
|
2297
2317
|
@property
|
|
2298
2318
|
def hide_columns(self):
|
|
@@ -2640,8 +2660,20 @@ class Table(object):
|
|
|
2640
2660
|
return value
|
|
2641
2661
|
|
|
2642
2662
|
def __coerce_incoming_sequence(self, data):
|
|
2643
|
-
"""Copy ``data`` with ``__coerce_incoming_value`` applied to each cell.
|
|
2644
|
-
|
|
2663
|
+
"""Copy ``data`` with ``__coerce_incoming_value`` applied to each cell.
|
|
2664
|
+
|
|
2665
|
+
``str`` and ``bytes`` are rejected: both are iterable, so a bare
|
|
2666
|
+
``add_row('abc')`` or ``add_column('h', 'abc')`` used to expand into
|
|
2667
|
+
one cell per character. Pass a list/tuple of cells instead.
|
|
2668
|
+
"""
|
|
2669
|
+
if data is None:
|
|
2670
|
+
return data
|
|
2671
|
+
if isinstance(data, (str, bytes)):
|
|
2672
|
+
raise TypeError(
|
|
2673
|
+
'row/column data must be a sequence of cells, not '
|
|
2674
|
+
f'{type(data).__name__}; wrap a single value in a list'
|
|
2675
|
+
)
|
|
2676
|
+
if not self.__parse_str_numbers:
|
|
2645
2677
|
return data
|
|
2646
2678
|
return [self.__coerce_incoming_value(cell) for cell in data]
|
|
2647
2679
|
|
|
@@ -3359,7 +3391,7 @@ class Table(object):
|
|
|
3359
3391
|
Add a row to the table. Can be left empty to add
|
|
3360
3392
|
an empty row.
|
|
3361
3393
|
|
|
3362
|
-
``data``:
|
|
3394
|
+
``data``: Sequence of cell values (list or tuple). Bare ``str``/``bytes`` are rejected.
|
|
3363
3395
|
|
|
3364
3396
|
Example::
|
|
3365
3397
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: flexablelib
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.3
|
|
4
4
|
Summary: Fast, dependency-free terminal tables for Python: 56 border styles, ANSI colors, cell merges, decimal alignment, width fitting, and CSV/Markdown/HTML/Excel/LaTeX I/O.
|
|
5
5
|
Home-page: https://github.com/Opus-Perpetuus/flexablelib
|
|
6
6
|
Author: Benjamin Ramirez
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"""2.2.3 regressions: constructor jagged rows, str data rejection, bool coerce."""
|
|
2
|
+
import pytest
|
|
3
|
+
|
|
4
|
+
from flexablelib import Table
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def test_constructor_jagged_rows_do_not_spawn_ghost_column():
|
|
8
|
+
"""A short first row must not invent a column after a wider later row."""
|
|
9
|
+
table = Table(headers=['a', 'b'], rows=[[1], [2, 3]])
|
|
10
|
+
assert table.headers == ['a', 'b']
|
|
11
|
+
assert table.column_count == 2
|
|
12
|
+
assert table.rows == [[1, None], [2, 3]]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def test_constructor_jagged_rows_with_three_headers():
|
|
16
|
+
table = Table(headers=['a', 'b', 'c'], rows=[[1, 2], [3, 4, 5]])
|
|
17
|
+
assert table.headers == ['a', 'b', 'c']
|
|
18
|
+
assert table.column_count == 3
|
|
19
|
+
assert table.rows == [[1, 2, None], [3, 4, 5]]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def test_constructor_more_headers_than_first_row_still_keeps_them():
|
|
23
|
+
table = Table(headers=['a', 'b', 'c', 'd'], rows=[[1, 2]])
|
|
24
|
+
assert table.headers == ['a', 'b', 'c', 'd']
|
|
25
|
+
assert table.column_count == 4
|
|
26
|
+
assert table.rows == [[1, 2, None, None]]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def test_add_row_rejects_bare_string():
|
|
30
|
+
table = Table()
|
|
31
|
+
with pytest.raises(TypeError, match='sequence of cells'):
|
|
32
|
+
table.add_row('not-cells')
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def test_add_column_rejects_bare_string_data():
|
|
36
|
+
table = Table()
|
|
37
|
+
with pytest.raises(TypeError, match='sequence of cells'):
|
|
38
|
+
table.add_column('name', 'abc')
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def test_add_row_accepts_single_string_cell_in_a_list():
|
|
42
|
+
table = Table()
|
|
43
|
+
table.add_row(['hello'])
|
|
44
|
+
assert table.rows == [['hello']]
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def test_constructor_rejects_string_row_entries():
|
|
48
|
+
with pytest.raises(TypeError, match='sequences of cells'):
|
|
49
|
+
Table(rows=['ab', 'cd'])
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def test_constructor_rejects_rows_as_string():
|
|
53
|
+
with pytest.raises(TypeError, match='sequence of rows'):
|
|
54
|
+
Table(rows='ab')
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def test_show_empty_columns_coerces_to_bool():
|
|
58
|
+
table = Table()
|
|
59
|
+
table.add_column('a', [1, 2])
|
|
60
|
+
table.add_column('b', ['', ''])
|
|
61
|
+
table.show_empty_columns = 0
|
|
62
|
+
assert table.show_empty_columns is False
|
|
63
|
+
assert 'b' not in table.compose()
|
|
64
|
+
table.show_empty_columns = 1
|
|
65
|
+
assert table.show_empty_columns is True
|
|
66
|
+
assert 'b' in table.compose()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|