unicodedata-reader 1.3.3__tar.gz → 1.3.4__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.
- {unicodedata_reader-1.3.3 → unicodedata_reader-1.3.4}/PKG-INFO +1 -1
- {unicodedata_reader-1.3.3 → unicodedata_reader-1.3.4}/pyproject.toml +1 -1
- {unicodedata_reader-1.3.3 → unicodedata_reader-1.3.4}/unicodedata_reader/entry.py +14 -10
- {unicodedata_reader-1.3.3 → unicodedata_reader-1.3.4}/LICENSE +0 -0
- {unicodedata_reader-1.3.3 → unicodedata_reader-1.3.4}/README.md +0 -0
- {unicodedata_reader-1.3.3 → unicodedata_reader-1.3.4}/unicodedata_reader/__init__.py +0 -0
- {unicodedata_reader-1.3.3 → unicodedata_reader-1.3.4}/unicodedata_reader/__main__.py +0 -0
- {unicodedata_reader-1.3.3 → unicodedata_reader-1.3.4}/unicodedata_reader/bidi_brackets.py +0 -0
- {unicodedata_reader-1.3.3 → unicodedata_reader-1.3.4}/unicodedata_reader/cli.py +0 -0
- {unicodedata_reader-1.3.3 → unicodedata_reader-1.3.4}/unicodedata_reader/compressor.py +0 -0
- {unicodedata_reader-1.3.3 → unicodedata_reader-1.3.4}/unicodedata_reader/east_asian_width.py +0 -0
- {unicodedata_reader-1.3.3 → unicodedata_reader-1.3.4}/unicodedata_reader/emoji.py +0 -0
- {unicodedata_reader-1.3.3 → unicodedata_reader-1.3.4}/unicodedata_reader/general_category.py +0 -0
- {unicodedata_reader-1.3.3 → unicodedata_reader-1.3.4}/unicodedata_reader/line_break.py +0 -0
- {unicodedata_reader-1.3.3 → unicodedata_reader-1.3.4}/unicodedata_reader/reader.py +0 -0
- {unicodedata_reader-1.3.3 → unicodedata_reader-1.3.4}/unicodedata_reader/set.py +0 -0
- {unicodedata_reader-1.3.3 → unicodedata_reader-1.3.4}/unicodedata_reader/vertical_orientation.py +0 -0
|
@@ -16,7 +16,7 @@ from typing import Tuple
|
|
|
16
16
|
_logger = logging.getLogger('UnicodeDataEntry')
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
def u_hex(value):
|
|
19
|
+
def u_hex(value: int) -> str:
|
|
20
20
|
return f'{value:04X}'
|
|
21
21
|
|
|
22
22
|
|
|
@@ -79,16 +79,24 @@ class UnicodeDataEntry(object):
|
|
|
79
79
|
def is_in_range(self, code: int) -> bool:
|
|
80
80
|
return code >= self.min and code <= self.max
|
|
81
81
|
|
|
82
|
+
@staticmethod
|
|
83
|
+
def to_codes(entries: Iterable['UnicodeDataEntry']):
|
|
84
|
+
return itertools.chain(*(e.range() for e in entries))
|
|
85
|
+
|
|
82
86
|
@property
|
|
83
87
|
def count(self):
|
|
84
88
|
self.assert_range()
|
|
85
89
|
return self.max - self.min + 1
|
|
86
90
|
|
|
87
|
-
def range_as_str(self):
|
|
91
|
+
def range_as_str(self, converter: Callable[[int], str] = u_hex):
|
|
88
92
|
self.assert_range()
|
|
93
|
+
min = converter(self.min)
|
|
89
94
|
if self.min == self.max:
|
|
90
|
-
return
|
|
91
|
-
|
|
95
|
+
return min
|
|
96
|
+
max = converter(self.max)
|
|
97
|
+
if min == max:
|
|
98
|
+
return min
|
|
99
|
+
return f'{min}..{max}'
|
|
92
100
|
|
|
93
101
|
def to_str(self, separator: str = ';'):
|
|
94
102
|
return separator.join((self.range_as_str(), str(self.value)))
|
|
@@ -268,18 +276,14 @@ class UnicodeDataEntries(object):
|
|
|
268
276
|
"""Returns an `Iterable` of `UnicodeDataEntry` for the given `pred`."""
|
|
269
277
|
return (entry for entry in self if pred(entry.value))
|
|
270
278
|
|
|
271
|
-
def codes_for(self, pred: Callable[[Any], bool]) -> Iterable[int]:
|
|
272
|
-
"""Returns an `Iterable` of Unicode code points for the given `pred`."""
|
|
273
|
-
return itertools.chain(*(e.range() for e in self.filter(pred)))
|
|
274
|
-
|
|
275
279
|
def add_to_set(self, pred: Callable[[Any], bool], set: set) -> None:
|
|
276
280
|
"""Add values `pred` returns `True` to `set[int]`."""
|
|
277
|
-
for code in self.
|
|
281
|
+
for code in UnicodeDataEntry.to_codes(self.filter(pred)):
|
|
278
282
|
set.add(code)
|
|
279
283
|
|
|
280
284
|
def remove_from_set(self, pred: Callable[[Any], bool], set: set) -> None:
|
|
281
285
|
"""Remove values `pred` returns `True` from `set[int]`."""
|
|
282
|
-
for code in self.
|
|
286
|
+
for code in UnicodeDataEntry.to_codes(self.filter(pred)):
|
|
283
287
|
set.discard(code)
|
|
284
288
|
|
|
285
289
|
def to_set(self, pred: Callable[[Any], bool]) -> set:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{unicodedata_reader-1.3.3 → unicodedata_reader-1.3.4}/unicodedata_reader/east_asian_width.py
RENAMED
|
File without changes
|
|
File without changes
|
{unicodedata_reader-1.3.3 → unicodedata_reader-1.3.4}/unicodedata_reader/general_category.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{unicodedata_reader-1.3.3 → unicodedata_reader-1.3.4}/unicodedata_reader/vertical_orientation.py
RENAMED
|
File without changes
|