Skip to main content

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bit_common-0.1.15.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bit_common-0.1.15-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file bit_common-0.1.15.tar.gz.

File metadata

  • Download URL: bit_common-0.1.15.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.1 Darwin/23.3.0

File hashes

Hashes for bit_common-0.1.15.tar.gz
Algorithm Hash digest
SHA256 4cecdaabe01e542f7a1dd0bbf85a839ed8a1b77f481135fef76d2fe863b6679e
MD5 e138e507125b8cd98f4350951a9e20c7
BLAKE2b-256 b24348a05fb28933934ac87febad438b12e5d042533e49d8aec0d20c2026e553

See more details on using hashes here.

File details

Details for the file bit_common-0.1.15-py3-none-any.whl.

File metadata

  • Download URL: bit_common-0.1.15-py3-none-any.whl
  • Upload date:
  • Size: 13.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.1 Darwin/23.3.0

File hashes

Hashes for bit_common-0.1.15-py3-none-any.whl
Algorithm Hash digest
SHA256 0b1631f20a24fc2dc5449f64e6b4bacca46a6d512e90db10aab4dc928f8b99ca
MD5 3302156f78bffbf6a91d274a81553c03
BLAKE2b-256 baa6f96181c0f4a3a86b2e9310403a2fbc23c8821978ab3ea73e92857c2b7f02

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.15 This release

2 files

0.1.14

2 files

0.1.13

2 files

0.1.12

2 files

0.1.11

2 files

0.1.10

2 files

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page