Skip to main content

A bit flag class for python

Project description

BitFlag

PyPi release

A simple bit flag class for Python 🐍.

Installation

$ pip install bitflag

Usage

# 1. import the "BitFlag" class.
from bitflag import BitFlag

# 2. initialize a BitFlag instance with any number of string, flag arguments.
bf = BitFlag("flagA", "flagB", "flagC")

# 3. run operations on those bit flags!

# set – Set one or more bit flags.
bf.set("flagB", "flagC")

# unset – Unset one or more bit flags.
bf.unset("flagB")

# has – Check if one or more bit flags have been set.
bf.has("flagC")

# toggle – Toggle one or more bit flags.
bf.toggle("flagA", "flagB", "flagC")

# reset – Reset (unset) all bit flags.
bf.reset()

# flip – Flip all bit flags.
bf.flip()

License

MIT © Travis Clarke

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

bitflag-0.0.1.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

bitflag-0.0.1-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file bitflag-0.0.1.tar.gz.

File metadata

  • Download URL: bitflag-0.0.1.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for bitflag-0.0.1.tar.gz
Algorithm Hash digest
SHA256 ddd777b6f867ed19d63c528acd589571f0919f27eaeb25100ec0398f283e78ac
MD5 3461778d92ea5a3384bed73564453b77
BLAKE2b-256 6439fb7c42fdf850b636f1e722f4997b4b1ddb86eb4568d09f9958c99ecbbbb5

See more details on using hashes here.

File details

Details for the file bitflag-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for bitflag-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 35ed2ae987579b3badefb6b9d7bfb1e2ab248dec0c58193b876547dc69e2b3a5
MD5 7c0054793d6c922c6dadd50788582fca
BLAKE2b-256 303c5464402302ed6b2b9e2751f7837d8fb8c52d0664386f2f2723a52fa9269e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page