Facilities to do with buffers, particularly CornuCopyBuffer, an automatically refilling buffer to support parsing of data streams.
Function chunky(bfr_func)
Decorator for a function accepting a leading CornuCopyBuffer
parameter.
Returns a function accepting a leading data chunks parameter
(bytes instances) and optional offset and 'copy_offsets`
keywords parameters.
Example::
@chunky
def func(bfr, ...):
Class CopyingIterator
Wrapper for an iterator that copies every item retrieved to a callable.
Class CornuCopyBuffer
An automatically refilling buffer intended to support parsing of data streams.
Attributes:
buf: a buffer of unparsed data from the input, available for direct inspection by parsersoffset: the logical offset of the buffer; this excludes unconsumed input data and.buf
The primary methods supporting parsing of data streams are
extend() and take(). Calling .extend(min_size) arranges
that .buf contains at least min_size bytes. Calling .take(size)
fetches exactly size bytes from .buf and the input source if
necessary and returns them, adjusting .buf.
len(CornuCopyBuffer) returns the length of .buf.
bool(CornuCopyBuffer) tests whether len() > 0.
Indexing a CornuCopyBuffer accesses .buf.
A CornuCopyBuffer is also iterable, yielding data in whatever
sizes come from its input_data source, preceeded by the
current .buf if not empty.
A CornuCopyBuffer also supports the file methods .read,
.tell and .seek supporting drop in use of the buffer in
many file contexts. Backward seeks are not supported. .seek
will take advantage of the input_data's .seek method if it
has one, otherwise it will use reads.
Class FDIterator
MRO: _Iterator
An iterator over the data of a file descriptor.
Note: the iterator works with an os.dup() of the file descriptor so that it can close it with impunity; this requires the caller to close their descriptor.
Class FileIterator
MRO: _Iterator, SeekableIteratorMixin
An iterator over the data of a file object.
Note: the iterator closes the file on del or if its .close method is called.
Class SeekableFDIterator
MRO: FDIterator, _Iterator, SeekableIteratorMixin
An iterator over the data of a seekable file descriptor.
Note: the iterator works with an os.dup() of the file descriptor so that it can close it with impunity; this requires the caller to close their descriptor.
Class SeekableFileIterator
MRO: FileIterator, _Iterator, SeekableIteratorMixin
An iterator over the data of a seekable file object.
Note: the iterator closes the file on del or if its .close method is called.
Class SeekableIteratorMixin
Mixin supplying a logical with a seek method.
Class SeekableMMapIterator
MRO: _Iterator, SeekableIteratorMixin
An iterator over the data of a mappable file descriptor.
Note: the iterator works with an mmap of an os.dup() of the file descriptor so that it can close it with impunity; this requires the caller to close their descriptor.
Metadata
Release files for cs-buffer 20181231
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cs.buffer-20181231.tar.gz | 11.1 kB | Without provenance | Details for cs.buffer-20181231.tar.gz |
Release files / cs.buffer-20181231.tar.gz
| Download URL | cs.buffer-20181231.tar.gz |
|---|---|
| Size | 11.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2eda809e7bc22f8efe8b7385a276ed0fb5c524c4111141626eba491ed70ab123
|
|
BLAKE2b-256 checksum How to use checksums |
ae835fd1a62471838cdc401bd9bc6c88e00009b8e49cbb640eba94197c6ebd35
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.23.0 CPython/3.6.6
|
Security for cs-buffer 20181231
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.