Color Guard
Color Guard provides simple bit manipulation and bit flags in Python. Everything is built on the int type so no number functionality is lost, while making it possible to index and slice binary numbers like strings.
Basic usage:
>>> num = Bits(20)
>>> num
Bits(0b10100)
>>> num * 3
Bits(0b111100)
>>> num[:4]
Bits(0b1010)
>>> num.bit_length()
5
>>> num.join(0b101)
Bits(0b10100101)
Color Guard also supports conversion to and from other Python data types.
>>> Bits.from_binary("111101001101")
Bits(0b111101001101)
>>> Bits.from_hex("abc123")
Bits(0b101010111100000100100011)
>>> Bits.from_bytes(b"abc")
Bits(0b11000010110001001100011)
>>> bytes(Bits(367))
b'\x01o'
>>> int(Bits(0b1011010))
90
>>> list(Bits(367))
[1, 0, 1, 1, 0, 1, 1, 1, 1]
Features
Indexing and slicing of binary numbers like strings
Conversion between several Python data types
All builtin math operations including bit manipulation and comparison
Padded binary numbers that maintain bit length
- Custom, easy-to-use bit flags
Bit field loading from bytes or stream
Custom data descriptors for fields
Field editing & conversion to bytes
For further documentation, visit http://paric.xyz/python/
Metadata
Release files for colorguard 0.4
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 |
|---|---|---|---|---|
| colorguard-0.4.tar.gz | 7.5 kB | Without provenance | Details for colorguard-0.4.tar.gz |
Release files / colorguard-0.4.tar.gz
| Download URL | colorguard-0.4.tar.gz |
|---|---|
| Size | 7.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
74e3137858416b82178937ed395b4f14b7675eef0df8555bc1f07c061873d39d
|
|
BLAKE2b-256 checksum How to use checksums |
955c6730b295680ad68739041c9574d9210f3f9c309532baafc83af40cc373c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.3
|
Security for colorguard 0.4
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.