Stream Tap
Capture data from an iterator as it gets pulled down stream.
Example
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from stream_tap import Bucket
from stream_tap import stream_tap
def get_fruit(item):
"""Get things that are fruit.
:returns: thing of item if it's a fruit"""
if len(item) == 2 and item[1] == u"fruit":
return item[0]
def get_metal(item):
"""Get things that are metal.
:returns: thing of item if it's metal"""
if len(item) == 2 and item[1] == u"metal":
return item[0]
def certain_kind_tap(data_items):
"""
:param data_items: A sequence of unicode strings
"""
fruit_spigot = Bucket(get_fruit)
metal_spigot = Bucket(get_metal)
items = stream_tap((fruit_spigot, metal_spigot), data_items)
# consume iterator.
for item in items:
print item
return fruit_spigot.contents(), metal_spigot.contents()
def run():
"""
Run the composition of csv_file_consumer and information tap
with the csv files in the input directory, and collect
the results from each file and merge them together,
printing both kinds of results.
"""
data_items = [
[u"mushroom", u"fungus"],
[u"tomato", u"fruit"],
[u"topaz", u"mineral"],
[u"iron", u"metal"],
[u"dróżką", u"utf-8 sample"],
[u"apple", u"fruit"],
[u"cheese", u"dairy"],
[u"peach", u"fruit"],
[u"celery", u"vegetable"],
[u"pear", u"fruit"],
[u"ruby", u"mineral"],
[u"titanium", u"metal"],
[u"cat", u"animal"],
[u"orange", u"fruit"],
[u"WĄŻ", u"utf-8 sample"],
]
results = certain_kind_tap(data_items)
fruits, metals = results
print("=== fruits ===")
for fruit in fruits:
print(fruit)
print("=== metals ===")
for metal in metals:
print(metal)
if __name__ == "__main__":
run()
Documentation
Read the docs: http://stream_tap.readthedocs.org/en/latest/
Contributing:
Submit any issues or questions here: https://github.com/johnwlockwood/stream_tap/issues.
- Make pull requests to development branch of
- Documentation is written in reStructuredText and currently uses the
Sphinx style for field lists http://sphinx-doc.org/domains.html#info-field-lists
Check out closed pull requests to see the flow of development, as almost every change to master is done via a pull request on GitHub. Code Reviews are welcome, even on merged Pull Requests. Feel free to ask questions about the code.
Metadata
Release files for stream_tap 0.9.4
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 |
|---|---|---|---|---|
| stream_tap-0.9.4.tar.gz | 19.4 kB | Without provenance | Details for stream_tap-0.9.4.tar.gz |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| stream_tap-0.9.4.macosx-10.12-x86_64.exe | Details for stream_tap-0.9.4.macosx-10.12-x86_64.exe | |||
| stream_tap-0.9.4-py3.5.egg | Legacy Egg format | - | - | Details for stream_tap-0.9.4-py3.5.egg |
| stream_tap-0.9.4-py2.7.egg | Legacy Egg format | - | - | Details for stream_tap-0.9.4-py2.7.egg |
Total release size: 116.5 kB
Release files / stream_tap-0.9.4.tar.gz
| Download URL | stream_tap-0.9.4.tar.gz |
|---|---|
| Size | 19.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a39082c56f1b26e40a76aaf71d4ec135a9773d46782df921dbc3b5afff3f29e5
|
|
BLAKE2b-256 checksum How to use checksums |
df3309309246b8252e9bc8eb3aec6c652fd1ad274716254c04c85ad0957a1838
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / stream_tap-0.9.4.macosx-10.12-x86_64.exe
| Download URL | stream_tap-0.9.4.macosx-10.12-x86_64.exe |
|---|---|
| Size | 73.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8aee262686f66bddb48c8bd6b52f54e5202d6c9b815a929e2882e418d9e57e05
|
|
BLAKE2b-256 checksum How to use checksums |
d0c99877d5e97df606fa028088daf8b94bf97de084773ff44a4975c85570e9ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / stream_tap-0.9.4-py3.5.egg
| Download URL | stream_tap-0.9.4-py3.5.egg |
|---|---|
| Size | 12.0 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
771d1e85645fc6e09b1c4d428eb2f0472c17a79e82f9d573b8d0138d64c32105
|
|
BLAKE2b-256 checksum How to use checksums |
a0dbf287fd2b9c377a305a7e03ce9a76ba7e54dce7d23011e1e6f06f316406c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / stream_tap-0.9.4-py2.7.egg
| Download URL | stream_tap-0.9.4-py2.7.egg |
|---|---|
| Size | 11.7 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
8ed73c026fd6ba18af5bb60e05ebeec5f5203b852ac47e211470f323d713ee07
|
|
BLAKE2b-256 checksum How to use checksums |
42720f25b407f4a5e34acce0e0ce61df6484e40dc6af6a7c431f67a6b6f11328
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for stream_tap 0.9.4
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.