Utilities for Python
Project description
py-utls
Utilities for Python
py-utls
is a small Python repository where I put all the useful stuff I regularly need in my projects.
Feel free to use at your discretion with the appropriate license mentions.
NB: I've developed the same kind of libraries for both Go and TypeScript.
Usage
pip install py-utls
This repository contains the following modules:
hex
:from_hex
: builds the byte array from a string;to_hex
: creates the hexadecimal representation of a byte array;
list
:chunk
: split a list into chunks of a maximum size;flatten
: transforms a list of list of items to a list of items.
from pyutls.hex import from_hex, to_hex
from pyutls.list import chunk, flatten
# Hex utilities
barray = from_hex('1234abcd')
hex_string = to_hex(barray)
assertEqual(hex_string == '1234abcd')
# Flatten a list of list
chunks = chunk(some_list, size)
flat_list = flatten(chunks)
assertListEqual(flat_list == some_list)
Tests
$ python3 -m unittest discover
License
These modules are distributed under a MIT license.
See the LICENSE file.
© 2022-2024 Cyril Dever. All rights reserved.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
py-utls-0.2.0.tar.gz
(3.8 kB
view details)
Built Distribution
File details
Details for the file py-utls-0.2.0.tar.gz
.
File metadata
- Download URL: py-utls-0.2.0.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.31.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.3 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b510154d3886d2fea756beee3d34a50d6ce905439dccf7e9e0209aeb273f4f5d |
|
MD5 | 860d90e31fc90476e0538398d8a22035 |
|
BLAKE2b-256 | e7a8ceac406e43c549add647c378989a494cc109d594aed93b5451cd65f41089 |
File details
Details for the file py_utls-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: py_utls-0.2.0-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.31.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.3 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d775534c6fa79537f2eabc78959d5a11dbe41c7581310b7f80f17da5ee4a3e1e |
|
MD5 | 6b7aabcc3f1792b7947a53a841491dff |
|
BLAKE2b-256 | 4a163f50868a222cc10ffb160f1c98654e459043ce9e50d473b848987fb41490 |