README.md
bit-common
bit-common is a Python library that provides types and utilities for working with bits. It allows you to easily convert data to and from bits, making it a handy tool for low-level programming, data analysis, and more.
Installation
You can install bit-common using pip or poetry.
Using pip
pip install bit-common
Using poetry
poetry add bit-common
Usage
Here are some examples of how you can use bit-common.
Converting data to bits
from bit.type import int8, UTF8StringWithPrefix
# Converting data to bits
data = int8(3)
bits = data.to_bits()
print(bits) # Output: [1, 1, 0, 0, 0, 0, 0, 0]
# Converting bits to data
bits = [1, 1, 0, 0, 0, 0, 0, 0]
data = int8.from_bits(bits)
print(data) # Output: 3
# Converting string to bits
string = UTF8StringWithPrefix("Hello")
bits = string.to_bits()
print(bits) # Output: [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0]
# Converting bits to string
bits = [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0]
string = UTF8StringWithPrefix.from_bits(bits)
print(string) # Output: "Hello"
License
bit-common is licensed under the MIT License.
Metadata
Release files for bit-common 0.1.15
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bit_common-0.1.15.tar.gz | 9.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bit_common-0.1.15-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.2 kB
Release files / bit_common-0.1.15.tar.gz
| Download URL | bit_common-0.1.15.tar.gz |
|---|---|
| Size | 9.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4cecdaabe01e542f7a1dd0bbf85a839ed8a1b77f481135fef76d2fe863b6679e
|
|
BLAKE2b-256 checksum How to use checksums |
b24348a05fb28933934ac87febad438b12e5d042533e49d8aec0d20c2026e553
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.11.1 Darwin/23.3.0
|
Release files / bit_common-0.1.15-py3-none-any.whl
| Download URL | bit_common-0.1.15-py3-none-any.whl |
|---|---|
| Size | 13.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0b1631f20a24fc2dc5449f64e6b4bacca46a6d512e90db10aab4dc928f8b99ca
|
|
BLAKE2b-256 checksum How to use checksums |
baa6f96181c0f4a3a86b2e9310403a2fbc23c8821978ab3ea73e92857c2b7f02
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.11.1 Darwin/23.3.0
|