Skip to main content

Simple implementation of circular buffer.

Project description

  • License : MIT

Summary

Simple circular buffer written in python extension.

CircularBuffer will allocate requested size + 2 bytes for two sections of null terminated strings.

WARNING: current implementation doesn’t expect data with char 0, or char ‘0’.

Installation

Simply pip install pycircularbuffer, compilation from downloaded source is probably needed.

Using

from circularbuffer import CircularBuffer

buf = CircularBuffer(1024)

buf.write(b’some text’)
while len(buf) > 0:
buf.read(1)

API

Regular methods:

  • clear()
  • read()
  • resize()
  • write()
  • write_available()

String methods:

  • count()
  • startswith()

Sequence methods:

  • __contains__()
  • __getitem__()
  • __len__()
  • __setitem__()

Magic methods:

  • __repr__()

  • __str__()

    Note: while string representation makes thing easier it always creates memory copy.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pycircularbuffer, version 0.0.4
Filename, size File type Python version Upload date Hashes
Filename, size pycircularbuffer-0.0.4.tar.gz (8.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page