PY-LEXIMITED
by LCF NERD 218
LEX-ENCODING IN PYTHON
Lexicographically Delimited Encoding for python, why not ay...
See: https://github.com/elenasa/ULAM/wiki/Appendix-D:-Leximited-Format
Following on from: https://github.com/walpolea/leximitedjs
WHY? : https://twitter.com/walpolea/status/1260954256292458497
LIKE THIS? CHECK OUT => https://www.livingcomputation.org/
INSTALL
https://pypi.org/project/leximited/1.1.1/
pip install leximited
IMPORT
import leximited
USE
Call leximited.to_leximited() with numbers (int or str) or arbitrary strings to get their leximited version.
Call leximited.from_leximited() with lex-encoded numbers (int or str) or arbitrary lex-encoded strings to get their "normal" version.
Also supports lists and tuples and allows for mixed lists with lex-encoding on numbers only, see examples below.
print(f'INTEGERS: {leximited.to_leximited(1)}')
INTEGERS: 11
print(f"NUMBERS WITH LEADING 0s: {leximited.to_leximited('002')}")
NUMBERS WITH LEADING 0s: '12'
print(f'BIG NUMBERS: {leximited.to_leximited(2000000000)}')
BIG NUMBERS: 92102000000000
print(f"SHORT STRINGS: {leximited.to_leximited('Bh3!!!')}")
SHORT STRINGS: 6Bh3!!!
print(f'LONG STRINGS: {leximited.to_leximited("a man, a plan, a guy: eleets")}')
LONG STRINGS: 9228a man, a plan, a guy: eleets
print(f"EMPTY STRINGS: {leximited.to_leximited('')}")
EMPTY STRINGS: 0
Also takes lists or tuples, and optionally preserve non-number strings as their original form (convert_text defaults to True to lex-encode everything).
in_list = [1, '002', 2000000000, 'Bh3!!!', 'a man, a plan, a guy: eleets', '']
print(f'INPUT: {in_list}')
leximited_list = leximited.list_to_leximited(in_list, convert_text=True)
print(f'LEXIMITED: {leximited_list}')
back_again = leximited.list_from_leximited(leximited_list)
print(f'AND BACK AGAIN: {back_again}')
INPUT: [1, '002', 2000000000, 'Bh3!!!', 'a man, a plan, a guy: eleets', '']
LEXIMITED: [11, '12', 92102000000000, '6Bh3!!!', '9228a man, a plan, a guy: eleets', '0']
AND BACK AGAIN: [1, '2', 2000000000, 'Bh3!!!', 'a man, a plan, a guy: eleets', '']
Note that the leading zeros are lost when converting back again.
Metadata
Release files for leximited 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| leximited-1.1.1.tar.gz | 3.1 kB | Without provenance | Details for leximited-1.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| leximited-1.1.1-py3-none-any.whl | Python 3 | none | any | Details for leximited-1.1.1-py3-none-any.whl |
Total release size: 18.9 kB
Release files / leximited-1.1.1.tar.gz
| Download URL | leximited-1.1.1.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5332491604473b899576b4fbd05a41a2b9d72f40bbcc3076fb4d04b413d42f74
|
|
BLAKE2b-256 checksum How to use checksums |
0634a85760ef2d0d8aac2b72cd041157b13cce94a140fcad2ee4735a6c47d466
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.3.1 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.4
|
Release files / leximited-1.1.1-py3-none-any.whl
| Download URL | leximited-1.1.1-py3-none-any.whl |
|---|---|
| Size | 15.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0012d14a11967620bf8f51d84a1ca77ca99405823f4945fa6cc808155b26e6df
|
|
BLAKE2b-256 checksum How to use checksums |
2b00ad571d75fd873f86eddfade0994f9837350f891b4dc2a5fb10f9eab40dc1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.3.1 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.4
|
Security for leximited 1.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.