Skip to content

Commit aaaef27

Browse files
committed
leaner syntax
1 parent 6cef0bc commit aaaef27

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

rich/cells.py

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,14 @@
1515
(0x02800, 0x028FF), # Braille
1616
]
1717

18-
19-
def _make_single_cell_set() -> frozenset[str]:
20-
"""Combine ranges of ordinals in to a frozen set of strings.
21-
22-
Returns:
23-
A frozenset of single cell characters.
24-
25-
"""
26-
character_range_lists = [
27-
list(map(chr, range(_start, _end + 1)))
18+
# A set of characters that are a single cell wide
19+
_SINGLE_CELLS = frozenset(
20+
[
21+
character
2822
for _start, _end in _SINGLE_CELL_UNICODE_RANGES
23+
for character in map(chr, range(_start, _end + 1))
2924
]
30-
return frozenset(sum(character_range_lists, start=[]))
31-
32-
33-
# A set of characters that are a single cell wide
34-
_SINGLE_CELLS = _make_single_cell_set()
25+
)
3526

3627
# When called with a string this will return True if all
3728
# characters are single-cell, otherwise False

0 commit comments

Comments
 (0)