flexablelib 2.0.4__tar.gz → 2.0.6__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.0.4/flexablelib.egg-info → flexablelib-2.0.6}/PKG-INFO +13 -1
- {flexablelib-2.0.4 → flexablelib-2.0.6}/README.md +12 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/flexablelib/merges.py +10 -3
- {flexablelib-2.0.4 → flexablelib-2.0.6/flexablelib.egg-info}/PKG-INFO +13 -1
- {flexablelib-2.0.4 → flexablelib-2.0.6}/package.json +1 -1
- {flexablelib-2.0.4 → flexablelib-2.0.6}/tests/test_merges.py +50 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/CHANGELOG.md +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/LICENSE +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/MANIFEST.in +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/flexablelib/__init__.py +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/flexablelib/_speedups.c +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/flexablelib/_width_tables.h +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/flexablelib/cells.py +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/flexablelib/colors.py +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/flexablelib/columns.py +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/flexablelib/fast.py +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/flexablelib/options.py +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/flexablelib/readers.py +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/flexablelib/style_compositions.py +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/flexablelib/table.py +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/flexablelib/table_strings.py +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/flexablelib/text_width.py +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/flexablelib/utils.py +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/flexablelib/writers.py +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/flexablelib.egg-info/SOURCES.txt +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/flexablelib.egg-info/dependency_links.txt +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/flexablelib.egg-info/requires.txt +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/flexablelib.egg-info/top_level.txt +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/setup.cfg +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/setup.py +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/tests/test_cells.py +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/tests/test_columns.py +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/tests/test_excel.py +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/tests/test_features.py +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/tests/test_issues.py +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/tests/test_readme_examples.py +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/tests/test_styles.py +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/tests/test_text_width.py +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/tests/test_two_pass_measurement.py +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/tests/test_upstream_issues.py +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/tools/benchmark.py +0 -0
- {flexablelib-2.0.4 → flexablelib-2.0.6}/tools/generate_width_tables.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: flexablelib
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.6
|
|
4
4
|
Summary: Flexible console and HTML tables for Python
|
|
5
5
|
Home-page: https://github.com/Opus-Perpetuus/flexablelib
|
|
6
6
|
Download-URL:
|
|
@@ -76,6 +76,18 @@ Python package for formatting tabular data as console and HTML tables: border st
|
|
|
76
76
|
|
|
77
77
|
``pip3 install flexablelib`` on Linux
|
|
78
78
|
|
|
79
|
+
Prebuilt wheels (with the C speedups) are published for Linux (manylinux/musllinux), Windows (x64) and macOS (arm64); other platforms build from the sdist or fall back to pure Python.
|
|
80
|
+
|
|
81
|
+
### Windows console encoding
|
|
82
|
+
Box-drawing styles (`┌─┐`, `╔═╗`, ...) need a UTF-8 console. Legacy `cp1252` consoles raise `UnicodeEncodeError` for them, while ASCII styles work everywhere. Enable UTF-8 with either:
|
|
83
|
+
|
|
84
|
+
```bat
|
|
85
|
+
chcp 65001
|
|
86
|
+
set PYTHONUTF8=1
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
(PowerShell: `$env:PYTHONUTF8=1`.) Windows Terminal with Python 3.8+ is usually UTF-8 already.
|
|
90
|
+
|
|
79
91
|
# Usage
|
|
80
92
|
Creating a table is simple.
|
|
81
93
|
### Code Example
|
|
@@ -27,6 +27,18 @@ Python package for formatting tabular data as console and HTML tables: border st
|
|
|
27
27
|
|
|
28
28
|
``pip3 install flexablelib`` on Linux
|
|
29
29
|
|
|
30
|
+
Prebuilt wheels (with the C speedups) are published for Linux (manylinux/musllinux), Windows (x64) and macOS (arm64); other platforms build from the sdist or fall back to pure Python.
|
|
31
|
+
|
|
32
|
+
### Windows console encoding
|
|
33
|
+
Box-drawing styles (`┌─┐`, `╔═╗`, ...) need a UTF-8 console. Legacy `cp1252` consoles raise `UnicodeEncodeError` for them, while ASCII styles work everywhere. Enable UTF-8 with either:
|
|
34
|
+
|
|
35
|
+
```bat
|
|
36
|
+
chcp 65001
|
|
37
|
+
set PYTHONUTF8=1
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
(PowerShell: `$env:PYTHONUTF8=1`.) Windows Terminal with Python 3.8+ is usually UTF-8 already.
|
|
41
|
+
|
|
30
42
|
# Usage
|
|
31
43
|
Creating a table is simple.
|
|
32
44
|
### Code Example
|
|
@@ -368,12 +368,16 @@ def _looks_like_rule(line: str, h_glyph: str) -> bool:
|
|
|
368
368
|
return any(ch in plain for ch in _H_CHARS)
|
|
369
369
|
|
|
370
370
|
|
|
371
|
-
def _repair_rule_junctions(line, layout, composition, h_glyph, missing_south=None, missing_north=None
|
|
371
|
+
def _repair_rule_junctions(line, layout, composition, h_glyph, missing_south=None, missing_north=None,
|
|
372
|
+
no_south=False, no_north=False):
|
|
372
373
|
"""
|
|
373
374
|
Rebuild every junction on a horizontal rule from the arms that remain.
|
|
374
375
|
|
|
375
376
|
``missing_south`` / ``missing_north`` are sets of visible x positions where
|
|
376
377
|
a vertical arm was removed by a horizontal (or 2D) merge on that side.
|
|
378
|
+
|
|
379
|
+
``no_south`` / ``no_north`` force every junction to drop that arm — used for
|
|
380
|
+
the table's outer end/start rules, which never continue past the border.
|
|
377
381
|
"""
|
|
378
382
|
missing_south = missing_south or set()
|
|
379
383
|
missing_north = missing_north or set()
|
|
@@ -393,8 +397,8 @@ def _repair_rule_junctions(line, layout, composition, h_glyph, missing_south=Non
|
|
|
393
397
|
right = _char_at(rewritten, x + 1)
|
|
394
398
|
west = _is_h(left)
|
|
395
399
|
east = _is_h(right)
|
|
396
|
-
north = x not in missing_north
|
|
397
|
-
south = x not in missing_south
|
|
400
|
+
north = (not no_north) and (x not in missing_north)
|
|
401
|
+
south = (not no_south) and (x not in missing_south)
|
|
398
402
|
# A junction with no arms at all becomes the bare vertical.
|
|
399
403
|
glyph = _pick_junction(v_glyph, h_glyph, north, south, east, west)
|
|
400
404
|
rewritten = _repaint(rewritten, x, x + 1, glyph)
|
|
@@ -560,10 +564,13 @@ def apply(lines, row_line_map, regions, column_widths, composition,
|
|
|
560
564
|
continue
|
|
561
565
|
# Guess h glyph from the line itself.
|
|
562
566
|
line_h = next((ch for ch in line if _is_h(ch)), h_glyph or '─')
|
|
567
|
+
# Outer borders never grow an arm past the table.
|
|
563
568
|
lines[line_index] = _repair_rule_junctions(
|
|
564
569
|
line, layout, composition, line_h,
|
|
565
570
|
missing_south=missing_south_by_line.get(line_index),
|
|
566
571
|
missing_north=missing_north_by_line.get(line_index),
|
|
572
|
+
no_south=(line_index >= len(lines) - 1),
|
|
573
|
+
no_north=(line_index == 0),
|
|
567
574
|
)
|
|
568
575
|
|
|
569
576
|
# --- Pass 4: insert synthetic row rules for column-only styles ----------
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: flexablelib
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.6
|
|
4
4
|
Summary: Flexible console and HTML tables for Python
|
|
5
5
|
Home-page: https://github.com/Opus-Perpetuus/flexablelib
|
|
6
6
|
Download-URL:
|
|
@@ -76,6 +76,18 @@ Python package for formatting tabular data as console and HTML tables: border st
|
|
|
76
76
|
|
|
77
77
|
``pip3 install flexablelib`` on Linux
|
|
78
78
|
|
|
79
|
+
Prebuilt wheels (with the C speedups) are published for Linux (manylinux/musllinux), Windows (x64) and macOS (arm64); other platforms build from the sdist or fall back to pure Python.
|
|
80
|
+
|
|
81
|
+
### Windows console encoding
|
|
82
|
+
Box-drawing styles (`┌─┐`, `╔═╗`, ...) need a UTF-8 console. Legacy `cp1252` consoles raise `UnicodeEncodeError` for them, while ASCII styles work everywhere. Enable UTF-8 with either:
|
|
83
|
+
|
|
84
|
+
```bat
|
|
85
|
+
chcp 65001
|
|
86
|
+
set PYTHONUTF8=1
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
(PowerShell: `$env:PYTHONUTF8=1`.) Windows Terminal with Python 3.8+ is usually UTF-8 already.
|
|
90
|
+
|
|
79
91
|
# Usage
|
|
80
92
|
Creating a table is simple.
|
|
81
93
|
### Code Example
|
|
@@ -588,3 +588,53 @@ def test_block_merge_header_and_footer_caps():
|
|
|
588
588
|
rendered = str(table)
|
|
589
589
|
assert '╧' in rendered # header intersection loses south into the block
|
|
590
590
|
assert '┬' in rendered # body rule below gains north-less tee
|
|
591
|
+
|
|
592
|
+
|
|
593
|
+
def test_last_row_horizontal_merge_uses_table_end_corners_not_header_tees():
|
|
594
|
+
"""A multi-column merge on the final data row must not rewrite the
|
|
595
|
+
table_end_line as if it had south arms (that yields ╞/╪/╤/╡)."""
|
|
596
|
+
table = Table(style_name='pretty_grid')
|
|
597
|
+
table.add_column('A', ['a1', 'a2', 'a3'])
|
|
598
|
+
table.add_column('B', ['b1', 'b2', 'b3'])
|
|
599
|
+
table.add_column('C', ['c1', 'c2', 'c3'])
|
|
600
|
+
table.add_column('D', ['d1', 'd2', 'd3'])
|
|
601
|
+
table.merge_cells(2, 1, last_column=2, value='BC')
|
|
602
|
+
|
|
603
|
+
lines = str(table).splitlines()
|
|
604
|
+
bottom = lines[-1]
|
|
605
|
+
assert bottom.startswith('╘'), bottom
|
|
606
|
+
assert bottom.endswith('╛'), bottom
|
|
607
|
+
assert '╞' not in bottom and '╡' not in bottom, bottom
|
|
608
|
+
assert '╪' not in bottom and '╤' not in bottom, bottom
|
|
609
|
+
# Inner sep under BC becomes a plain double horizontal (no south/north).
|
|
610
|
+
assert bottom == '╘════╧═════════╧════╛', bottom
|
|
611
|
+
|
|
612
|
+
|
|
613
|
+
def test_stress_last_row_merge_bottom_border_is_end_line():
|
|
614
|
+
"""Stress table from demos: H14 on the last row must keep ╘/╧/╛."""
|
|
615
|
+
table = Table(style_name='pretty_grid')
|
|
616
|
+
headers = [f'C{c}' for c in range(8)]
|
|
617
|
+
for c, h in enumerate(headers):
|
|
618
|
+
table.add_column(h, [f'S{r}c{c}' for r in range(15)])
|
|
619
|
+
for r in range(0, 15, 3):
|
|
620
|
+
table.merge_cells(r, 0, last_row=min(r + 2, 14), value=f'R{r}')
|
|
621
|
+
for r, c0, c1, label in [
|
|
622
|
+
(0, 2, 4, 'H0'),
|
|
623
|
+
(1, 5, 7, 'H1'),
|
|
624
|
+
(4, 2, 3, 'H4'),
|
|
625
|
+
(7, 3, 6, 'H7'),
|
|
626
|
+
(10, 1, 2, 'H10'),
|
|
627
|
+
(12, 4, 7, 'H12'),
|
|
628
|
+
(14, 2, 5, 'H14'),
|
|
629
|
+
]:
|
|
630
|
+
table.merge_cells(r, c0, last_column=c1, value=label)
|
|
631
|
+
table.merge_cells(2, 5, 3, 7, value='BOX')
|
|
632
|
+
table.merge_cells(8, 1, 9, 2, value='SQ')
|
|
633
|
+
|
|
634
|
+
bottom = str(table).splitlines()[-1]
|
|
635
|
+
assert bottom.startswith('╘'), bottom
|
|
636
|
+
assert bottom.endswith('╛'), bottom
|
|
637
|
+
assert '╞' not in bottom and '╡' not in bottom, bottom
|
|
638
|
+
assert '╤' not in bottom and '╪' not in bottom, bottom
|
|
639
|
+
# Continuous run under H14 (C2–C5): three inner junctions → ═.
|
|
640
|
+
assert '╧═══════════════════════════════╧' in bottom, bottom # C2–C5: 7+1+7+1+7+1+7
|
|
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
|