semvec/pypi-packages huggingface dataset:
redis-gt 1.2.0
Global throttling with Redis.
License: MIT
Keywords: throttle redis async

[![PyPI pyversions](https://img.shields.io/pypi/pyversions/redis-gt.svg)](https://pypi.python.org/pypi/redis-gt/)
[![CircleCI](https://circleci.com/gh/sukobuto/python-redis-gt.svg?style=svg)](https://circleci.com/gh/sukobuto/python-redis-gt)

# Redis GT
Global throttling with Redis.

## installation

```
pip install redis-gt
```

## usage

ex) request with throttle

```python
import redis_gt
import requests

redis_gt.Defaults.redis_url = 'redis://127.0.0.1:6379'

def get_members(**kwargs):
    throttle = redis_gt.Throttle('backend_api_call', 20)
    return throttle.run(requests.get, '/api/members/', **kwargs)
```

ex) same with asyncio

```python
import asyncio
import redis_gt
import requests

redis_gt.Defaults.redis_url = 'redis://127.0.0.1:6379'

async def get_members(**kwargs):
    def _get():
        return requests.get('/api/members/', **kwargs)
    loop = asyncio.get_event_loop()
    throttle = redis_gt.AsyncThrottle('backend_api_call', 20)
    return await throttle.run(loop.run_in_executer(_get))
```

### throttling

```python
import redis_gt
import time
from threading import Thread

redis_gt.Defaults.redis_url = 'redis://127.0.0.1:6379'

def do_something():
    time.sleep(1.0)

def do_something_with_throttle():
    # max 10 parallels
    throttle = Throttle(r, 'something', 10)
    throttle.run(do_something)

# 100 tasks of each 1sec.
threads = [Thread(target=do_something_with_throttle) for _ in range(100)]
for t in threads:
    t.start()

# takes about 10secs (100tasks/10para).
for t in threads:
    t.join()
```

### throttling with asyncio

```python
import asyncio
from redis_gt import AsyncThrottle
import redis

async def do_something():
     await asyncio.sleep(1.0)

r = redis.StrictRedis.from_url('redis://127.0.0.1:6379')

# max 10 parallels
throttle = AsyncThrottle(r, 'something', 10)

# 100 tasks of each 1sec.
tasks = [throttle.run(do_something()) for _ in range(100)]
loop = asyncio.get_event_loop()

# takes about 10secs (100tasks/10para).
loop.run_until_complete(asyncio.wait(tasks))
```

### decorator

```python
from redis_gt import Throttle
from redis_gt.decorators import throttle
import redis

r = redis.StrictRedis.from_url('redis://127.0.0.1:6379')

# for sync function

@throttle('something', 10, redis=r)
def do_something():
    time.sleep(1.0)

# 100 tasks of each 1sec.
threads = [Thread(target=do_something) for _ in range(100)]
for t in threads:
    t.start()

# takes about 10secs (100tasks/10para).
for t in threads:
    t.join()

# for async function
@throttle('something', 10, redis=r)
async def do_something_async():
     await asyncio.sleep(1.0)

# 100 tasks of each 1sec.
tasks = [do_something_async() for _ in range(100)]
loop = asyncio.get_event_loop()

# takes about 10secs (100tasks/10para).
loop.run_until_complete(asyncio.wait(tasks))
```
strpipe 0.5.0
Reversible String Process Pipeline
License: MIT
Requires Python: >=3.6

strpipe
=======

|Build Status| |PyPI version|

Reversible string processing pipe. Featuring reproducibility,
serializability and performance.

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

::

    pip install strpipe

Usage
-----

.. code:: python

    import strpipe as sp

    p = sp.Pipe()
    p.add_step_by_op_name('ZhCharTokenizer')
    p.add_step_by_op_name('AddSosEos')
    p.add_checkpoint()
    p.add_step_by_op_name('Pad')
    p.add_step_by_op_name('TokenToIndex')

    data = [
        '你好啊',
        '早安',
        '你早上好',
    ]

    p.fit(data)
    result, tx_info, intermediates = p.transform(data)  # convention: tx => tranform
    back_data = p.inverse_transform(result, tx_info)

Serialization
~~~~~~~~~~~~~

.. code:: python

    # Save it
    p.save_json('/path/of/pipe')

    # Load it
    p = sp.Pipe.restore_from_json('/path/of/pipe')
    result, meta = p.transform(['你好'])

Test
----

::

    $ make test

Docs
----

::

    $ make docs

    Docs will be built in the `docs/build/html` folder. (Note: this also reinstalls the package because we
    need Cython code to be rebuilt.)

Extend Ops
----------

1. Extend the new ops with ``BaseOp``
2. Define ``input_type``, ``output_type``
3. Implement op creation
4. Implement fit, transform, inverse\_transform. If the op is stateless,
   the ``fit`` method should return None.

    Note: It is expected that an ops's functionality will often be able
    to be decomposed into several functions. These functions should be
    written into (or imported from) the toolkit package for easy reuse.
    Ops in the ops package will, for the most part, be wrappers for
    functions in toolkit.

5. Write tests
6. Register to ``op_factory``

.. |Build Status| image:: https://travis-ci.org/Yoctol/strpipe.svg?branch=master
   :target: https://travis-ci.org/Yoctol/strpipe
.. |PyPI version| image:: https://badge.fury.io/py/strpipe.svg
   :target: https://badge.fury.io/py/strpipe
graphic 1.0.0a6
More phthonic, humanize way to play with graphdb
License: MIT
Requires Python: >=3.4
Keywords: graph,neo4j,graph algorithms,client

=========================
Graphic
=========================

|Pypi Release| |Python Version| |Build Status| |Coverage Status|
=========================================================================


The target of this project is:
**More pythonic, humanize way to play with graph model**

------------

Install
"""""""""""""""""""""""""

.. code-block:: bash

    pip install graphic



Basic Example
"""""""""""""""""""""""""

.. code-block:: python

    >>>from graphic import use_neo4j
    >>>neo4j = use_neo4j()
    >>>boss = graphic.node('Boss', uid=1234)._as('b')
    >>>geek = graphic.node('Geek', uid=2345)._as('g')
    >>>neo4j.push(graphic.relationship(boss, geek, 'WORKTAT', startat=3432432)
    >>>q = graphic.node().filter(id__gt=123).select('id')
    >>>graph = neo4j.fetch(q)
    >>>from graphic.query.func import avg
    >>>q = graphic.node().select(avg('uid')).order_by('-id').limit(10)



.. |Pypi Release| image:: https://img.shields.io/pypi/v/graphic.svg
.. |Python Version| image:: https://img.shields.io/pypi/pyversions/graphic.svg
.. |Build Status| image:: https://travis-ci.org/chuter/graphic.svg?branch=master
.. |Coverage Status| image:: https://codecov.io/gh/chuter/graphic/branch/master/graph/badge.svg
  :target: https://codecov.io/gh/chuter/graphic
cpen 0.1.2
Hacky Downloader for Codepens
License: MIT

# CodePen Downloader

A hacky downloader for [codepen.io](https://codepen.io). Uses requests and bs4 to extract relevant data and jinja2 to construct local copies.

Really basic, currently doesn't handle any compiling, preprocessing, etc.

## Usage

`pip install cpen`

`cpen <url> <target folder>`