Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(336)  |  Call(138)  |  Derive(3)  |  Import(195)
Function cache decorator 

        def Cache(fn):
   """ Function cache decorator """
   def fnCache(*args, **kwargs):
      """ Cache function """
      key = (args and tuple(args) or None,
             kwargs and frozenset(kwargs.items()) or None)
      if key not in fn.__cached__:
         fn.__cached__[key] = cache = fn(*args, **kwargs)
      else:
         cache = fn.__cached__[key]
      return cache

   def ResetCache():
      """ Reset cache """
      fn.__cached__ = {}

   setattr(fn, "__cached__", {})
   setattr(fn, "__resetcache__", ResetCache)
   fnCache.__name__ = fn.__name__
   fnCache.__doc__ = fn.__doc__
   fnCache.__dict__.update(fn.__dict__)
   return fnCache
        


src/u/l/UlDunAd-HEAD/src/Texture.py   UlDunAd(Download)
from math import *
 
from Cache import Cache
 
textureCache = Cache(256)

src/f/e/FetionWether-HEAD/hello/weather/PyWapFetion/Fetion.py   FetionWether(Download)
from Errors import *
from re import compile
from Cache import Cache
from gzip import GzipFile
try:from cStringIO import StringIO
        '''
        if cachefile is not None: 
            self.cache = Cache(cachefile)        
 
        self.opener = build_opener(HTTPCookieProcessor(CookieJar()), HTTPHandler)

src/p/y/pynode-HEAD/ChainDb.py   pynode(Download)
import time
from decimal import Decimal
from Cache import Cache
from bitcoin.serialize import *
from bitcoin.core import *
		self.netmagic = netmagic
		self.fast_dbm = fast_dbm
		self.blk_cache = Cache(500)
		self.orphans = {}
		self.orphan_deps = {}

src/e/m/emesene-HEAD/mesinyer/e3/cache/EmoticonCache.py   emesene(Download)
class EmoticonCache(Cache.Cache):
    '''a class to maintain a cache of an user emoticons
    '''
 
    def __init__(self, config_path, user):

src/e/m/emesene-HEAD/mesinyer/e3/cache/AvatarCache.py   emesene(Download)
class AvatarCache(Cache.Cache):
    '''a class to maintain a cache of an user avatars
    '''
 
    def __init__(self, config_path, user):

src/p/y/pyvmomi-5.5.0/pyVmomi/DynamicTypeManagerHelper.py   pyvmomi(Download)
 
from pyVmomi import VmomiSupport, vmodl
from Cache import Cache
 
## Dynamic type importer

src/p/y/pyvmomi-HEAD/pyVmomi/DynamicTypeManagerHelper.py   pyvmomi(Download)
 
from pyVmomi import VmomiSupport, vmodl
from Cache import Cache
 
## Dynamic type importer

src/s/t/stratum-mining-HEAD/mining/DBInterface.py   stratum-mining(Download)
        self.queueclock = None
 
        self.cache = Cache.Cache()
 
        self.nextStatsUpdate = 0