semvec/pypi-packages huggingface dataset:
redis-namespace 2.10.3.1
redis namespace
License: MIT
Keywords: redis namespace,redis prefix

## redis-namespace

[![Build Status][travis-image]][travis-url] [![PyPi Version][pypi-image]][pypi-url]

[redis-namespace](https://github.com/resque/redis-namespace) for python

Redis::Namespace provides an interface to a namespaced subset of your [redis](https://redis.io) keyspace (e.g., keys with a common beginning), and requires the [redis-py](https://github.com/andymccurdy/redis-py).

```python
import redis
from redis_namespace import StrictRedis

redis_connection = redis.StrictRedis()
namespaced_redis = StrictRedis(namespace='ns:')
namespaced_redis.set('foo', 'bar')  # redis_connection.set('ns:foo', 'bar')

namespaced_redis.get('foo')
redis_connection.get('ns:foo')

namespaced_redis.delete('foo')
namespaced_redis.get('foo')
redis_connection.get('ns:foo')
```


### Installation

`pip install redis-namespace`


[travis-url]: https://travis-ci.org/guokr/redis-namespace
[travis-image]: https://travis-ci.org/guokr/redis-namespace.svg

[pypi-url]: https://pypi.python.org/pypi/redis-namespace/
[pypi-image]: https://img.shields.io/pypi/v/redis-namespace.svg?style=flat-square
json-lines 0.5.0
Reading JSON lines (jl) files, recover broken files
License: MIT

json-lines
==========

.. image:: https://img.shields.io/pypi/v/json-lines.svg
   :target: https://pypi.python.org/pypi/json-lines
   :alt: PyPI Version

.. image:: https://travis-ci.org/TeamHG-Memex/json-lines.svg?branch=master
   :target: http://travis-ci.org/TeamHG-Memex/json-lines
   :alt: Build Status

.. image:: http://codecov.io/github/TeamHG-Memex/json-lines/coverage.svg?branch=master
   :target: http://codecov.io/github/TeamHG-Memex/json-lines?branch=master
   :alt: Code Coverage

This is a tiny library for reading JSON lines (.jl) files,
including gzipped and broken files.

`JSON lines <http://jsonlines.org/>`_ is a text file format
where each line is a single json encoded item.


Why?
----

Reading a well-formed JSON lines file is a one-liner in Python.
But the file can be broken: cut at some point
(this happens when the process writing it is killed),
or concatenated from several cut pieces
(this happend when the process started appending to the same file again).
Handling all this cases is not easy, especially if the file is compressed.

json-lines handles all this cases for you!


Installation
------------

::

    pip install json-lines

If `ujson <https://pypi.python.org/pypi/ujson>`_ is installed, it is used
to speed up json decoding (which is the main performance bottleneck
even for gzipped files).


Usage
-----

In order to read a well-formed json lined file,
pass an open file as the first argument to ``json_lines.reader``.
The file can be opened
in text or binary mode, but if it's opened in text mode, the encoding
must be set correctly::

    import json_lines

    with open('file.jl', 'rb') as f:
        for item in json_lines.reader(f):
            print(item['x'])

There is also a helper function ``json_lines.open`` that recognizes
".gz" and ".gzip" extensions and opens them with ``gzip``::

    with json_lines.open('file.jl.gz') as f:
        for item in f:
            print(item['x'])

Handling broken (cut at some point) files is enabled by passing ``broken=True``
to ``json_lines.reader`` or ``json_lines.open``.
Broken lines are skipped (only logging a warning), and reading continues
from the next valid position.
This works both for compressed and uncompressed files::

    with json_lines.open('file.jl.gz', broken=True) as f:
        for item in f:
            print(item['x'])


License
-------

License is MIT.