Skip to main content

.

Project description

BitMap for python

This package provides a BitMap class which is an array of bits stored in compact format.

Installation

bitmap can be installed from pip:

$ sudo pip install bitmap

Functions

  • BitMap(maxnum): construct a BitMap object with maxnum bits
  • set(pos): set the bit at position pos to 1
  • reset(pos): reset the bit at position pos to 0
  • flip(pos): flip the bit at position pos
  • count(): return the number of 1s
  • size(): return the size of the BitMap
  • test(pos): check if bit at position pos has been set to 1
  • any(): check if any bit in the BitMap has been set to 1
  • none(): check if none of the bits in the BitMap has been set to 1
  • all(): check if all bits in the BitMap has been set to 1
  • nonzero(): return indexes of all non-zero bits
  • tostring(): convert a BitMap object to 0 and 1 string
  • fromstring(bitstring): create a BitMap object from 0 and 1 string

Examples

from bitmap import BitMap
bm = BitMap(32)
print bm.tostring()
bm.set(1)
print bm.tostring()

bm = BitMap.fromstring("00011101")
print bm.tostring()
bm.flip(1)
print bm.tostring()

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

bitmap-0.0.7.tar.gz (3.4 kB view details)

Uploaded Source

Built Distributions

bitmap-0.0.7-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

bitmap-0.0.7-py2-none-any.whl (3.9 kB view details)

Uploaded Python 2

File details

Details for the file bitmap-0.0.7.tar.gz.

File metadata

  • Download URL: bitmap-0.0.7.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/2.7.16

File hashes

Hashes for bitmap-0.0.7.tar.gz
Algorithm Hash digest
SHA256 e7fb8fcdade2223348132c108619f93178b563f584ed552aa5d3c6f946958a2d
MD5 12d443f62dbb6a54d8aa48e32ddba62a
BLAKE2b-256 5c4216842f4fdaabd710fbe7b2577a016f4ac9b5b3076e29611f96716c5a672b

See more details on using hashes here.

File details

Details for the file bitmap-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: bitmap-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.4

File hashes

Hashes for bitmap-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 7e768adb29a7429729e79c0bd59d6351b47b65b6fc7478c239e07fefdc4dfc49
MD5 85aec86f94dfc2788f02b4400878587d
BLAKE2b-256 3a180cf0116c3faf5023a6e971549055d42907020bca37320b3ada380e07f3ff

See more details on using hashes here.

File details

Details for the file bitmap-0.0.7-py2-none-any.whl.

File metadata

  • Download URL: bitmap-0.0.7-py2-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/2.7.16

File hashes

Hashes for bitmap-0.0.7-py2-none-any.whl
Algorithm Hash digest
SHA256 ee994535356cf18f82793823a873ae4feb6074e3cd7b443176ca4e208d59f9f7
MD5 1193bba266786999dc01b17151ac500e
BLAKE2b-256 0f0caaf4bce788435605e40d0f5f4f3c7077337254fbce6c308386a8f18f350f

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