Bitwise support for configuration
Project description
BitAware
Bitwise Toolbox
Usage
Define
from bitaware import BitFlag, BitAware
class PermissionTypes(BitFlag):
ADMIN = 1
USER = 2
GUEST = 4
MODERATOR = 8
class UserPermission(BitAware[PermissionTypes]):
def __init__(self, value: int):
super().__init__(value, PermissionTypes)
pass
Use
Standalone:
permission = UserPermission(PermissionTypes.ADMIN | PermissionTypes.USER)
print(permission.has(PermissionTypes.ADMIN)) # True
print(permission.has(PermissionTypes.GUEST)) # False
As Pydantic field:
class User(BaseModel):
permissions: UserPermission
Test
uv run pytest
Security
If you discover any security-related issues, please email email instead of using the issue tracker.
Copyright (c) 2025 Wojciech Nowicki
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bitaware-0.1.1.tar.gz.
File metadata
- Download URL: bitaware-0.1.1.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a1c2ea396a568c45a7e15d255b7a87bddc94781e6d8ca2ae5e4db73e9abda7e
|
|
| MD5 |
af5f23b287937a6a60bb0ccab0c214c3
|
|
| BLAKE2b-256 |
736527440ccef778905ee82848c22082a3da725d0d6d17ac983d654b754e7e0f
|
Provenance
The following attestation bundles were made for bitaware-0.1.1.tar.gz:
Publisher:
publish.yml on wnowicki/bitaware
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bitaware-0.1.1.tar.gz -
Subject digest:
1a1c2ea396a568c45a7e15d255b7a87bddc94781e6d8ca2ae5e4db73e9abda7e - Sigstore transparency entry: 214159552
- Sigstore integration time:
-
Permalink:
wnowicki/bitaware@602f9a06b27af21d9aec7b1d8f8085c21c1ded26 -
Branch / Tag:
refs/tags/0.1.1 - Owner: https://github.com/wnowicki
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@602f9a06b27af21d9aec7b1d8f8085c21c1ded26 -
Trigger Event:
push
-
Statement type:
File details
Details for the file bitaware-0.1.1-py3-none-any.whl.
File metadata
- Download URL: bitaware-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ad474c9b1178ee17f86ed899bc0966bae5f184b5419db11529150b4863a4171
|
|
| MD5 |
b6eb20b7518596fe9570e37e209ff949
|
|
| BLAKE2b-256 |
bfc0637927d3c5024fd0a83dd5c8a2812042ca36b1f65eb86fa4c01282be5704
|
Provenance
The following attestation bundles were made for bitaware-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on wnowicki/bitaware
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bitaware-0.1.1-py3-none-any.whl -
Subject digest:
0ad474c9b1178ee17f86ed899bc0966bae5f184b5419db11529150b4863a4171 - Sigstore transparency entry: 214159555
- Sigstore integration time:
-
Permalink:
wnowicki/bitaware@602f9a06b27af21d9aec7b1d8f8085c21c1ded26 -
Branch / Tag:
refs/tags/0.1.1 - Owner: https://github.com/wnowicki
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@602f9a06b27af21d9aec7b1d8f8085c21c1ded26 -
Trigger Event:
push
-
Statement type: