MCPcopy Create free account
hub / github.com/bslatkin/effectivepython / fill

Function fill

example_code/item_059.py:68–73  ·  view source on GitHub ↗
(bucket, amount)

Source from the content-addressed store, hash-verified

66
67print("Example 2")
68def fill(bucket, amount):
69 now = datetime.now()
70 if (now - bucket.reset_time) > bucket.period_delta:
71 bucket.quota = 0
72 bucket.reset_time = now
73 bucket.quota += amount
74
75
76print("Example 3")

Callers 1

item_059.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected