• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(34)  |  Call(0)  |  Derive(0)  |  Import(34)
int(x[, base]) -> integer

Convert a string or number to an integer, if possible.  A floating point
argument will be truncated towards zero (this does not include a string
representation of a floating point number!)  When converting a string, use
the optional base.  It is an error to supply a base when converting a
non-string.  If base is zero, the proper base is guessed based on the
string content.  If the argument is outside the integer range a
long object will be returned instead.

src/n/e/Nevow-0.10.0/examples/pastebin/pastebin/service.py   Nevow(Download)
    def _savePastingData(self, oid, data):
        f = file(self._makeFilename(str(oid)), 'wb')
        pickle.dump(data, f, pickle.HIGHEST_PROTOCOL)
 
    def getPasting(self, oid):
        data = self._loadPastingData(oid)
        return Pasting(data)
    def stopService(self):
        log.msg('Storing index')
        d = {'index':self._index, 'nextOid':self._nextOid}
        f = file(self._makeFilename('index'), 'wb')
        pickle.dump(d, f, pickle.HIGHEST_PROTOCOL)
 
class Pasting(object):

src/n/o/notmm-0.4.1/examples/lib/keyedcache/__init__.py   notmm(Download)
def md5_hash(obj):
    pickled = pickle.dumps(obj, protocol=pickle.HIGHEST_PROTOCOL)
    return md5_constructor(pickled).hexdigest()
 
 
def is_memcached_backend():
    try:

src/w/e/webnest-HEAD/env/lib/python2.6/site-packages/werkzeug/contrib/cache.py   webnest(Download)
    from md5 import new as md5
from itertools import izip
from time import time
from cPickle import loads, dumps, load, dump, HIGHEST_PROTOCOL
 
 
class BaseCache(object):
    def set(self, key, value, timeout=None):
        if timeout is None:
            timeout = self.default_timeout
        self._prune()
        self._cache[key] = (time() + timeout, dumps(value, HIGHEST_PROTOCOL))
 
    def add(self, key, value, timeout=None):
        if timeout is None:
            timeout = self.default_timeout
        if len(self._cache) > self._threshold:
            self._prune()
        item = (time() + timeout, dumps(value, HIGHEST_PROTOCOL))
                except:
                    pass
            else:
                client = memcache.Client(servers, False, HIGHEST_PROTOCOL)
        else:
            client = servers
 
            f = file(filename, 'wb')
            try:
                dump(int(time() + timeout), f, 1)
                dump(value, f, HIGHEST_PROTOCOL)
            finally:
                f.close()
        except (IOError, OSError):

src/z/a/zamboni-lib-HEAD/lib/python/werkzeug/contrib/cache.py   zamboni-lib(Download)
    from md5 import new as md5
from itertools import izip
from time import time
from cPickle import loads, dumps, load, dump, HIGHEST_PROTOCOL
 
 
class BaseCache(object):
    def set(self, key, value, timeout=None):
        if timeout is None:
            timeout = self.default_timeout
        self._prune()
        self._cache[key] = (time() + timeout, dumps(value, HIGHEST_PROTOCOL))
 
    def add(self, key, value, timeout=None):
        if timeout is None:
            timeout = self.default_timeout
        if len(self._cache) > self._threshold:
            self._prune()
        item = (time() + timeout, dumps(value, HIGHEST_PROTOCOL))
                except:
                    pass
            else:
                client = memcache.Client(servers, False, HIGHEST_PROTOCOL)
        else:
            client = servers
 
            f = file(filename, 'wb')
            try:
                dump(int(time() + timeout), f, 1)
                dump(value, f, HIGHEST_PROTOCOL)
            finally:
                f.close()
        except (IOError, OSError):

src/u/l/uliweb-HEAD/uliweb/lib/werkzeug/contrib/cache.py   uliweb(Download)
    from md5 import new as md5
from itertools import izip
from time import time
from cPickle import loads, dumps, load, dump, HIGHEST_PROTOCOL
 
have_memcache = True
try:
    def set(self, key, value, timeout=None):
        if timeout is None:
            timeout = self.default_timeout
        self._prune()
        self._cache[key] = (time() + timeout, dumps(value, HIGHEST_PROTOCOL))
 
    def add(self, key, value, timeout=None):
        if timeout is None:
            timeout = self.default_timeout
        if len(self._cache) > self._threshold:
            self._prune()
        item = (time() + timeout, dumps(value, HIGHEST_PROTOCOL))
            except:
                pass
        else:
            self._client = memcache.Client(servers, False, HIGHEST_PROTOCOL)
 
    def get(self, key):
        if isinstance(key, unicode):
            f = file(filename, 'wb')
            try:
                dump(int(time() + timeout), f, 1)
                dump(value, f, HIGHEST_PROTOCOL)
            finally:
                f.close()
        except (IOError, OSError):

src/p/y/pythonedinburgh-HEAD/werkzeug/contrib/cache.py   pythonedinburgh(Download)
    from md5 import new as md5
from itertools import izip
from time import time
from cPickle import loads, dumps, load, dump, HIGHEST_PROTOCOL
 
 
class BaseCache(object):
    def set(self, key, value, timeout=None):
        if timeout is None:
            timeout = self.default_timeout
        self._prune()
        self._cache[key] = (time() + timeout, dumps(value, HIGHEST_PROTOCOL))
 
    def add(self, key, value, timeout=None):
        if timeout is None:
            timeout = self.default_timeout
        if len(self._cache) > self._threshold:
            self._prune()
        item = (time() + timeout, dumps(value, HIGHEST_PROTOCOL))
                except:
                    pass
            else:
                client = memcache.Client(servers, False, HIGHEST_PROTOCOL)
        else:
            client = servers
 
            f = file(filename, 'wb')
            try:
                dump(int(time() + timeout), f, 1)
                dump(value, f, HIGHEST_PROTOCOL)
            finally:
                f.close()
        except (IOError, OSError):

src/u/l/Uliweb-0.0.1a2/uliweb/lib/werkzeug/contrib/cache.py   Uliweb(Download)
    from md5 import new as md5
from itertools import izip
from time import time
from cPickle import loads, dumps, load, dump, HIGHEST_PROTOCOL
 
 
class BaseCache(object):
    def set(self, key, value, timeout=None):
        if timeout is None:
            timeout = self.default_timeout
        self._prune()
        self._cache[key] = (time() + timeout, dumps(value, HIGHEST_PROTOCOL))
 
    def add(self, key, value, timeout=None):
        if timeout is None:
            timeout = self.default_timeout
        if len(self._cache) > self._threshold:
            self._prune()
        item = (time() + timeout, dumps(value, HIGHEST_PROTOCOL))
                except:
                    pass
            else:
                client = memcache.Client(servers, False, HIGHEST_PROTOCOL)
        else:
            client = servers
 
            f = file(filename, 'wb')
            try:
                dump(int(time() + timeout), f, 1)
                dump(value, f, HIGHEST_PROTOCOL)
            finally:
                f.close()
        except (IOError, OSError):

src/v/o/votv-HEAD/trunk/portable/storedatabase.py   votv(Download)
    f = open(pathname, 'wb')
    f.write(FILEMAGIC)
    try:
        cPickle.dump(toPickle, f, cPickle.HIGHEST_PROTOCOL)
    finally:
        f.close()
 
                savables_set.add(o)
            for o in changed:
                if o in savables_set:
                    data = cPickle.dumps(o,cPickle.HIGHEST_PROTOCOL)
                    self.db.put (str(o.savedData['id']), data, txn=txn)
                else:
                    try:
            cursor.delete()
        cursor.close()
        for o in savables:
            data = cPickle.dumps(o,cPickle.HIGHEST_PROTOCOL)
            self.db.put (str(o.savedData['id']), data, txn=txn)
 
    def loadDatabase(self):
            savable = objectToSavable (object)
            if savable:
                key = str(object.id)
                data = cPickle.dumps(savable,cPickle.HIGHEST_PROTOCOL)
                self.db.put (key, data, txn=self.txn)
 
    def remove (self, object):
                    savables_set.add(o)
                for o in changed:
                    if o in savables_set:
                        data = cPickle.dumps(o,cPickle.HIGHEST_PROTOCOL)
                        self.cursor.execute("REPLACE INTO dtv_objects (id, serialized_object) VALUES (?,?)",(int(o.savedData['id']), buffer(data)))
                    else:
                        self.cursor.execute("DELETE FROM dtv_objects WHERE id=?", (int(o.savedData['id']),))
            self.version = schema_mod.VERSION
            self.cursor.execute("REPLACE INTO dtv_variables (name, serialized_value) VALUES (?,?)",(VERSION_KEY, buffer(cPickle.dumps(self.version,cPickle.HIGHEST_PROTOCOL))))
        try:
            self.cursor.execute("DELETE FROM dtv_objects")
            for o in savables:
                data = cPickle.dumps(o,cPickle.HIGHEST_PROTOCOL)
                self.cursor.execute("REPLACE INTO dtv_objects (id, serialized_object) VALUES (?,?)",(int(o.savedData['id']), buffer(data)))
        finally:
            if not self.updating:
            for o in db.objects:
                self.update(o[0])
            self.version = schema_mod.VERSION
            self.cursor.execute("REPLACE INTO dtv_variables (name, serialized_value) VALUES (?,?)",(VERSION_KEY, buffer(cPickle.dumps(self.version,cPickle.HIGHEST_PROTOCOL))))
        finally:
            self.updating = False
            self.cursor.execute("COMMIT")
            savable = objectToSavable (object)
            if savable:
                key = int(object.id)
                data = cPickle.dumps(savable,cPickle.HIGHEST_PROTOCOL)
                self.cursor.execute("REPLACE INTO dtv_objects (id, serialized_object) VALUES (?,?)",(int(key), buffer(data)))
 
    def remove (self, object):

src/a/r/artifex-HEAD/artifex/__init__.py   artifex(Download)
    def save(self, to):
        if self.changed:
            f = open(to, 'w')
            cPickle.dump(self.depends, f, cPickle.HIGHEST_PROTOCOL)
            cPickle.dump(self.rdepends, f, cPickle.HIGHEST_PROTOCOL)
            cPickle.dump(self.filecache, f, cPickle.HIGHEST_PROTOCOL)
            cPickle.dump(self.objcache, f, cPickle.HIGHEST_PROTOCOL)
            '_pkgconfig_proc' : self._pkgconfig_proc
            }
        f = open(self._cachefile, 'w')
        cPickle.dump(cachedata, f, cPickle.HIGHEST_PROTOCOL)
        f.close()
 
    def load_cache(self):

src/i/p/ipedia-palm-HEAD/ipedia/scripts/downloadStats.py   ipedia-palm(Download)
def saveData():
    global g_tableUsersData, g_tableRequestLogData, g_tableGetCookieLogData, g_tableVerifyRegCodeLogData, g_tableRegCodesData
    fo = open(DATA_FILE_NAME, "wb")
    cPickle.dump(g_tableUsersData, fo, protocol = cPickle.HIGHEST_PROTOCOL)
    cPickle.dump(g_tableRequestLogData, fo, protocol = cPickle.HIGHEST_PROTOCOL)
    cPickle.dump(g_tableGetCookieLogData, fo, protocol = cPickle.HIGHEST_PROTOCOL)
    cPickle.dump(g_tableVerifyRegCodeLogData, fo, protocol = cPickle.HIGHEST_PROTOCOL)

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next