class documentation

`class Bucket: (source)`

Implementation of a Token bucket.

A bucket can hold a certain number of tokens and it drains over time.

Method | `__init__` |
Create a `Bucket` that may have a parent `Bucket` . |

Method | `add` |
Adds tokens to the `Bucket` and its parentBucket. |

Method | `drip` |
Let some of the bucket drain. |

Class Variable | `maxburst` |
The maximum number of tokens that the bucket can hold at any given time. If this is `None` , the bucket has an infinite size. |

Class Variable | `rate` |
The rate at which the bucket drains, in number of tokens per second. If the rate is `None` , the bucket drains instantaneously. |

Instance Variable | `content` |
Undocumented |

Instance Variable | `lastDrip` |
Undocumented |

Instance Variable | `parentBucket` |
Undocumented |

Class Variable | `_refcount` |
Undocumented |

Let some of the bucket drain.

The `Bucket`

drains at the rate specified by the class variable `rate`.

Returns | |

bool | True if the bucket is empty after this drip. |

The maximum number of tokens that the bucket can hold at any given time. If this is

`None`

, the bucket has an infinite size.The rate at which the bucket drains, in number of tokens per second. If the rate is

`None`

, the bucket drains instantaneously.