Skip to main content

spliterator

Split line streams into managable chunks

Usage

Take things.txt as follows.

Thing Name Thing 1
Thing Color Red
Thing Hair Big
Thing Motto I am Number 1!
Thing Name Thing 2
Thing Color Red
Thing Hair Big
Thing Motto Seconds Please!

And lets iterate through each line while adding in start and end events around each individual thing.

>>> import spliterator
>>> for event, line in spliterator.chunk(open('things.txt'), 'Thing Name'):
...   print(event, line)
...
START None
LINE Thing Name Thing 1
LINE Thing Color Red
LINE Thing Hair Big
LINE Thing Motto I am Number 1!
END None
START None
LINE Thing Name Thing 2
LINE Thing Color Red
LINE Thing Hair Big
LINE Thing Motto Seconds Please!
END None

Now we can process specific things properly based on the event variable.

Metadata

Release files for spliterator 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spliterator 0.0.1
File Size Uploaded Provenance
spliterator-0.0.1.tar.gz 2.1 kB Without provenance Details

Release files / spliterator-0.0.1.tar.gz

Download URL spliterator-0.0.1.tar.gz
Size 2.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7a0ea862866fd04e9602118e0c6f2582f4cf403c575a09c0fd279ea86ae95b2b
BLAKE2b-256 checksum
How to use checksums
b529c6d3a97ad2f9b2a45d12a324c67ef915b99651b8bf79a92b1bccdd13066f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for spliterator 0.0.1

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.

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page