How to use the aioftp.Throttle function in aioftp

To help you get started, we’ve selected a few aioftp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aio-libs / aioftp / tests / test_simple_functions.py View on Github external
def test_throttle_reset():
    t = aioftp.Throttle(limit=1, reset_rate=1)
    t.append(b"-" * 3, 0)
    assert t._start == 0
    assert t._sum == 3
    t.append(b"-" * 3, 2)
    assert t._start == 2
    assert t._sum == 4
github aio-libs / aioftp / tests / test_simple_functions.py View on Github external
def test_reprs_works():
    repr(aioftp.Throttle())
    repr(aioftp.Permission())
    repr(aioftp.User())
github aio-libs / aioftp / tests / test-repr.py View on Github external
def test_throttle_repr():

    t = aioftp.Throttle(loop="loop")
    nose.tools.eq_(repr(t), "Throttle(loop='loop', limit=None, reset_rate=10)")