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

All Samples(1990)  |  Call(1868)  |  Derive(0)  |  Import(122)
dump(obj, file, protocol=0) -- Write an object in pickle format to the given file.

See the Pickler docstring for the meaning of optional argument proto.

src/p/r/procimap-HEAD/examples/notify.py   procimap(Download)
 
    # pickle data to disk
    output = open(picklefile, 'wb')
    cPickle.dump(unread_mails, output, protocol=2)
    output.close()
 
 

src/p/y/pymol-HEAD/trunk/pymol/examples/devel/syncmol.py   pymol(Download)
                self.sock=None
                print "retrying..."
                time.sleep(1)
        cPickle.dump(meth,self.send,1) # binary by default
        cPickle.dump(args,self.send,1)
        cPickle.dump(kwds,self.send,1)
        self.send.flush()
             meth_obj = getattr(self.server.cmd,method)
 
             # call method and return result
             cPickle.dump(apply(meth_obj,args,kw),self.wfile,1) # binary by default
             self.wfile.flush()
 
if __name__=='pymol':

src/p/y/pymol-HEAD/pymol/examples/devel/syncmol.py   pymol(Download)
                self.sock=None
                print "retrying..."
                time.sleep(1)
        cPickle.dump(meth,self.send,1) # binary by default
        cPickle.dump(args,self.send,1)
        cPickle.dump(kwds,self.send,1)
        self.send.flush()
             meth_obj = getattr(self.server.cmd,method)
 
             # call method and return result
             cPickle.dump(apply(meth_obj,args,kw),self.wfile,1) # binary by default
             self.wfile.flush()
 
if __name__=='pymol':

src/m/a/matplotlib-HEAD/toolkits/basemap-0.9.6.1/examples/ireland.py   matplotlib(Download)
            resolution='i',projection='tmerc',lon_0=-8.,lat_0=0.)
print time.clock()-t1,'seconds to create class instance with intermediate res coastlines'
# cPickle the class instance.
cPickle.dump(m,open('map.pickle','wb'),-1)
# draw coastlines and fill continents.
m.drawcoastlines()
m.fillcontinents()
            resolution='h',projection='tmerc',lon_0=-8.,lat_0=0.)
print time.clock()-t1,'seconds to create class instance with high res coastlines'
# cPickle the class instance.
cPickle.dump(m,open('map.pickle','wb'),-1)
# draw coastlines and fill continents.
m.drawcoastlines()
m.fillcontinents()

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/c/u/CUV-HEAD/examples/rbm/caller.py   CUV(Download)
        descr = x[cfg.dataset]
        f=open(os.path.join(cfg.workdir,"%s.pickle"%descr),'w')
        if cfg.dbm==1:
            pickle.dump(rbmstack.getHiddenRepDBM(mbp),f,-1)
        else :
            mbp2 = mbp
            hid_rep_list=pyrbm.repList(len(rbmstack.layers),mbp2.teacher)
            for i in xrange(len(rbmstack.layers)-1):
                print str(i), "...",
                mbp2 = rbmstack.getHiddenRep(i, mbp2)
                hid_rep_list.appendRep(i,np.hstack(mbp2.dataset))
            pickle.dump(hid_rep_list,f,-1)
            descr = descr+"_test"
            f=open(os.path.join(cfg.workdir,"%s.pickle"%descr),'w')
            if cfg.dbm==1:
                pickle.dump(rbmstack.getHiddenRepDBM(mbp_test),f,-1)
            else :
                mbp2=mbp_test
                hid_rep_list=pyrbm.repList(len(rbmstack.layers),mbp2.teacher)
                for i in xrange(len(rbmstack.layers)-1):
                    print str(i), "...",
                    mbp2 = rbmstack.getHiddenRep(i, mbp2)
                    hid_rep_list.appendRep(i,np.hstack(mbp2.dataset))
                pickle.dump(hid_rep_list,f,-1)

src/m/a/matplotlib-HEAD/toolkits/basemap/examples/hires.py   matplotlib(Download)
print time.clock()-t1,' secs to create original Basemap instance'
 
# cPickle the class instance.
cPickle.dump(m,open('map.pickle','wb'),-1)
 
# clear the figure
plt.clf()

src/m/u/muscorian-HEAD/muscorian/archive/pubmed_dump_example.py   muscorian(Download)
while (ID_start < ID_stop):
    try:
        c = medline_dict[str(ID_start)]
        cPickle.dump(c, open(str(c.pubmed_id) + '.txt', 'w'), -1)
        ID_start = ID_start + 1
        time.sleep(downtime)
        print 'ID count: ', str(ID_start)

src/g/m/gmes-HEAD/trunk/examples/passband_parallel.py   gmes(Download)
 
    if space.my_id == ez1_id:
        ez_sums1_file = open(FILENAME_EZ_SUMS_1, 'w')
        cPickle.dump(ez_sums1, ez_sums1_file)
        ez_sums1_file.close()
 
    if space.my_id == hx1_id:
        hx_sums1_file = open(FILENAME_HX_SUMS_1, 'w')
        cPickle.dump(hx_sums1, hx_sums1_file)
        hx_sums1_file.close()
 
    if space.my_id == hy1_id:
        hy_sums1_file = open(FILENAME_HY_SUMS_1, 'w')
        cPickle.dump(hy_sums1, hy_sums1_file)
 
    if space.my_id == ez2_id:
        ez_sums2_file = open(FILENAME_EZ_SUMS_2, 'w')
        cPickle.dump(ez_sums2, ez_sums2_file)
        ez_sums2_file.close()
 
    if space.my_id == hx2_id:
        hx_sums2_file = open(FILENAME_HX_SUMS_2, 'w')
        cPickle.dump(hx_sums2, hx_sums2_file)
        hx_sums2_file.close()
 
    if space.my_id == hy2_id:
        hy_sums2_file = open(FILENAME_HY_SUMS_2, 'w')
        cPickle.dump(hy_sums2, hy_sums2_file)

src/g/o/google-app-engine-HEAD/lib/webob/docs/comment-example-code/example.py   google-app-engine(Download)
import os
import urllib
import time
import re
from cPickle import load, dump
from webob import Request, Response, html_escape
from webob import exc
    def save_data(self, url, data):
        filename = self.url_filename(url)
        f = open(filename, 'wb')
        dump(data, f)
        f.close()
 
    def url_filename(self, url):

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