Giter Club home page Giter Club logo

speedlimit's Introduction

Speed limit

https://travis-ci.org/harlowja/speedlimit.png?branch=master

Speed limit utilities that use the token bucket algorithm internally.

An example:

>>> import string
>>> import time
>>>
>>> import speedlimit
>>>
>>> police = speedlimit.SpeedLimit(1)
>>>
>>> it = iter(string.ascii_lowercase)
>>> t_zero = time.time()
>>>
>>> for alpha in police.speed_limit_iter(it):
...     print("Got %s at %0.2f" % (alpha,  time.time() - t_zero))
...
Got a at 1.00
Got b at 2.00
Got c at 3.00
Got d at 4.00
Got e at 5.00
Got f at 6.00
Got g at 7.00
Got h at 8.00
Got i at 9.00
Got j at 10.00
Got k at 11.00
Got l at 12.00
Got m at 13.00
Got n at 14.00
Got o at 15.00
Got p at 16.00
Got q at 17.00
Got r at 18.00
Got s at 19.00
Got t at 20.00
Got u at 21.00
Got v at 22.00
Got w at 23.00
Got x at 24.00
Got y at 25.00
Got z at 26.00

speedlimit's People

Contributors

harlowja avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.