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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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