No project description provided
Project description
py-unicode-linebreak
Python bindings for the Rust crate unicode-linebreak.
Installation
pip install unicode-linebreak
Usage
from unicode_linebreak import linebreaks, Allowed, Mandatory
s = 'a b\nc\r\nd e\rf end'
expected_result = [
(2, Allowed), (4, Mandatory), (7, Mandatory), (9, Allowed),
(11, Mandatory), (13, Allowed), (16, Mandatory)
]
assert list(linebreaks(s)) == expected_result
Returns an iterator which iterates over tuples with the binary character position of the linebreak and a boolean indicating whether the linebreak is a mandatory break.
# the end of the string is always a mandatory break
assert list(linebreaks(s))[-1] == (0, Mandatory)
# Mandatory and Allowed are just boolean values
assert expected_result[0][1] is Allowed is False
assert expected_result[-1][1] is Mandatory is True
Note that the binary character position is not the same as the readable character index, but the binary position. See the Rust method on strings
char_indices()
.
Contribute
python -m virtualenv venv
source venv/bin/activate
pip install -r dev-requirements.txt
maturin develop && python -m unittest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Close
Hashes for unicode_linebreak-0.0.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2f853b926178ac62a4054c141f075a91ec547ed92e80f559106185dceb1d57a |
|
MD5 | 65f072aa03592dfd82411907100e9355 |
|
BLAKE2b-256 | 335600bb5eb1673fb3cee03db4e0b88baf24acab72e6784eba5400e048789dce |
Close
Hashes for unicode_linebreak-0.0.2-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc3a5941e63f062513b621a7deefefed075153e59e1ccdcec28046c0814c06ce |
|
MD5 | c9110097043ff0f0612fb00956d1d4ba |
|
BLAKE2b-256 | 81b619f80e355c8c502b6abc17378f4db02d8d4a3fdfdb9a0da3bf7aab5a7ca2 |
Close
Hashes for unicode_linebreak-0.0.2-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 616a9cff9321ceb48c9026fcc739ad3123e05efb325a8674ea13228c706cdec4 |
|
MD5 | fe5406c779cf9d72a68ca6e13bdb2bc1 |
|
BLAKE2b-256 | 68b91c999d111af3bf853d34228f953dde48890900a298c9389904b866bab8d1 |
Close
Hashes for unicode_linebreak-0.0.2-cp311-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5d006226e50eb677b0a3c5704dca5f1fd131ee5cc8fdacb7319e31a9d592b59 |
|
MD5 | ebbdd336584e13711bc302e3ac27c718 |
|
BLAKE2b-256 | 58cfdf86015139a91c00f03db0baabd53eef57583791edb08141d7e8b0deef56 |
Close
Hashes for unicode_linebreak-0.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1a65268071070e9f40d2cae0f74948a7c6a653532b491c1a3b316dd255d4c5d |
|
MD5 | 3db4fa728c3abea1b5742c06992b7c3f |
|
BLAKE2b-256 | 925ef2b70795f73a49608de4b8aabb8271a1982170d1d57c2967e3c94d7bb38a |
Close
Hashes for unicode_linebreak-0.0.2-cp311-cp311-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17bb8b1d09c55df3ed3bb0207d208ec8347e9b4ad50bc5bcfe51bc442c2c2262 |
|
MD5 | 97670690e8fa876aeee97a67a3c53234 |
|
BLAKE2b-256 | 5cc1bd517f24a416f0f810a454e74b24aaf7ebfe122c3376320b0c8c00c25134 |
Close
Hashes for unicode_linebreak-0.0.2-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 900d5e9e3f38ddca2b47d17a1cd0655ac9da61d16e4e5a5381a1f9e2371688b3 |
|
MD5 | a54112e1780440eab09f23b7dddba3be |
|
BLAKE2b-256 | 66614450b45c9c9a8ff86567f3be6f753c3e82dc33808f80623a25c017a215d7 |
Close
Hashes for unicode_linebreak-0.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf1e3298956b9619f015a041da7c979065b8fbbedb81a2e1984de19c4af78fd6 |
|
MD5 | 036e262823ec4bc10618a49bc6cc0f11 |
|
BLAKE2b-256 | d50ef422c01c956160993e958848272d3c92f27514cecd4710a6dee2dc137b30 |
Close
Hashes for unicode_linebreak-0.0.2-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90746755abfb3c9bfd832b6a4913303bf7dc5c57db5a538485b4fc39447e00c2 |
|
MD5 | c040778ecd2b760d64e436f326a5a0ee |
|
BLAKE2b-256 | ebfbd14d743aa2d62d68fa4bf93408e5ee7cbbfa21b44f75d3104a10e746f107 |
Close
Hashes for unicode_linebreak-0.0.2-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ae3adf8590d48bb7c760fe4fd66501fe651f1a31fa9e3e24639ff6d21b82dd8 |
|
MD5 | f89c618f11a261a2a6a938edbf03408a |
|
BLAKE2b-256 | 428b00d855e4a9b771a52ecd0c978e66a74e367abdc85a369427e2b8a1d1bb49 |
Close
Hashes for unicode_linebreak-0.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e105ca3f9fd42ae9bb29fb00525cb904735dca416f6cb54d9c1806fc4b0b80c |
|
MD5 | e49cd1aee68b489d66c49de40aec4b1d |
|
BLAKE2b-256 | f888ce4dd9a30a4eb797b75d82190ed12aa6310848b911dbce3c140e86386332 |
Close
Hashes for unicode_linebreak-0.0.2-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d141ca19638a64c3d4bbe81c051e903de126d13779956822e170f0f2e8ac3bac |
|
MD5 | a2210e6f3ed0c65330096ebc4f007752 |
|
BLAKE2b-256 | 5986a6bc7c48d205efa99c8fbd5fe7f2d21cc83d926bf6579ffdba3ece18762e |
Close
Hashes for unicode_linebreak-0.0.2-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca597bd2f1a5a14220165d09c23969e476351f52dfb9111f27e4977666d1118a |
|
MD5 | 7737d7d0b0f416034a9b2c310554d2dc |
|
BLAKE2b-256 | 748f1c8b81057684900e8eff065f899d7c751f5ec4628b21b0ab9ee1b1bb329a |
Close
Hashes for unicode_linebreak-0.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53c3fa80d228447395ca733871dc278d87087a406d073e90ff46756f91c460a3 |
|
MD5 | 358daec4e87435b0252bcbdaeaa522cb |
|
BLAKE2b-256 | b4629660a4199356480be867ffc6fadf6277ff3f8513d5e11fce445b00e61c6c |
Close
Hashes for unicode_linebreak-0.0.2-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b1823979fb6932e67f48b24b32540e08ad072b83ee9e46c80748183a1bca4e6 |
|
MD5 | d62fc1fe8733e5e58f1c519310c31280 |
|
BLAKE2b-256 | 071e6d78310defaa38d84c25bbff72c0ba1c3bd14a88d368a04795e6ec573829 |
Close
Hashes for unicode_linebreak-0.0.2-cp37-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1175998ef7d2133c36bd7e3ff1665fa97a2a0fedc1f2fec23d58f07e89d8fa3d |
|
MD5 | f1097014f75c46faa661f4162063ae95 |
|
BLAKE2b-256 | eec7db86a59152942dbd9351d7bc392e552e30b1c9751cab64c2a91574e9480c |
Close
Hashes for unicode_linebreak-0.0.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 504adb4ec709fcfd2c93ea40bd08a4bcf35a243c7e882edc8754a25b7e437483 |
|
MD5 | 9335af03bc6673595136aad9dd811ebe |
|
BLAKE2b-256 | 3399344ab56bfb1a47b7c93f88cc2d70c8148a8de93bb7b2ad5ee4dfb08482de |
Close
Hashes for unicode_linebreak-0.0.2-cp37-cp37m-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19f454d82a085d4ef884dcfabdb60e3fb0ecf6418dd5601d91d6f0efa3348bcd |
|
MD5 | f2ef99d91181c8293d8188e38f4a293f |
|
BLAKE2b-256 | 5cdb0021a0a0c71ecfe2085b978f3dc385ca4346ce6dd22f1d54384f200080d9 |