semvec/pypi-packages huggingface dataset:
dtoolutils 0.2.0
Utilities for working with dtoolcore
License: MIT

README
======

.. image:: https://badge.fury.io/py/dtoolutils.svg
   :target: http://badge.fury.io/py/dtoolutils
   :alt: PyPi package

.. image:: https://travis-ci.org/JIC-CSB/dtoolutils.svg?branch=master
    :target: https://travis-ci.org/JIC-CSB/dtoolutils

.. image:: https://codecov.io/github/JIC-CSB/dtoolutils/coverage.svg?branch=master
   :target: https://codecov.io/github/JIC-CSB/dtoolutils?branch=master
   :alt: Code Coverage

.. image:: https://readthedocs.org/projects/dtoolutils/badge/?version=latest
   :target: https://readthedocs.org/projects/dtoolutils?badge=latest
   :alt: Documentation Status

- Documentation: http://dtoolutils.readthedocs.io
- GitHub: https://github.com/JIC-CSB/dtoolutils
- PyPI: https://pypi.python.org/pypi/dtoolutils
- Free software: MIT License

Utility functions for making it easier to work with ``dtoolcore``.

Related packages
----------------

- `dtoolcore <https://github.com/JIC-CSB/dtoolcore>`_
- `dtool <https://github.com/JIC-CSB/dtool>`_
streamcat 0.2.1
Encode and decode concatenated objects as streams
License: MIT
Keywords: stream,file,json

streamcat
=========

Examples
--------

Encoding a JSON iterator into a stream:

.. code-block:: python

    def gen_records():
        yield b'{"foo": "bar"}'
        yield b'{"baz": [1, 2, 3]}'

    stream = streamcat.iterator_to_stream(gen_records())

    # `stream` can then be used just like any other `io.RawIOBase`
    with open('/tmp/jsoncat', 'wb') as destination:
        shutil.copyfileobj(stream, destination)

Decoding a stream into a generator:

.. code-block:: python

    decoder = json.JSONDecoder()
    with open('/tmp/jsoncat', 'rb') as source:
        records = streamcat.stream_to_iterator(source, decoder)
        for record in records:
            print(record)