Did I find the right examples for you? yes no

All Samples(1)  |  Call(0)  |  Derive(0)  |  Import(1)

src/c/y/cyn.in-HEAD/products/ATRatings/ZODBStorage.py   cyn.in(Download)
RATINGS_SUMMARY_ID = '_ratings'
 
from config import HIT_RATE_TIME_INTERVAL
 
class ZODBHitsSummary(Persistent):
    def addHit(self):
        self.hits += 1
        self.hit_rate = 1.0 + math.exp((time.time() - self.last_hit_time)/float(HIT_RATE_TIME_INTERVAL))*self.hit_rate
        self.last_hit_time = time.time()
 
        # Basically H will be a rough estimate of the current hit rate, since
        # more weight is given to recent events.
        return math.exp((time.time() - self.last_hit_time)/float(HIT_RATE_TIME_INTERVAL))*self.hit_rate