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

All Samples(348)  |  Call(236)  |  Derive(0)  |  Import(112)
Pickler(file, protocol=0) -- Create a pickler.

This takes a file-like object for writing a pickle data stream.
The optional proto argument tells the pickler to use the given
protocol; supported protocols are 0, 1, 2.  The default
protocol is 0, to be backwards compatible.  (Protocol 0 is the
only protocol that can be written to a file opened in text
mode and read back successfully.  When using a protocol higher
than 0, make sure the file is opened in binary mode, both when
pickling and unpickling.)

Protocol 1 is more efficient than protocol 0; protocol 2 is
more efficient than protocol 1.

Specifying a negative protocol version selects the highest
protocol version supported.  The higher the protocol used, the
more recent the version of Python needed to read the pickle
produced.

The file parameter must have a write() method that accepts a single
string argument.  It can thus be an open file object, a StringIO
object, or any other custom object that meets this interface.

src/g/o/google_appengine-HEAD/google/appengine/api/datastore_file_stub.py   google_appengine(Download)
 
    tmpfile = openfile(os.tempnam(os.path.dirname(filename)), 'wb')
 
    pickler = pickle.Pickler(tmpfile, protocol=1)
    pickler.fast = True
    pickler.dump(obj)
 

src/g/o/google-app-engine-HEAD/google/appengine/api/datastore_file_stub.py   google-app-engine(Download)
 
    descriptor, tmp_filename = tempfile.mkstemp(dir=os.path.dirname(filename))
    tmpfile = openfile(tmp_filename, 'wb')
    pickler = pickle.Pickler(tmpfile, protocol=1)
    pickler.fast = True
    pickler.dump(obj)
 

src/n/l/nltk-HEAD/trunk/nltk/nltk_contrib/tiger/indexer/graph_serializer.py   nltk(Download)
                               self._convert_edges(node.secedges, self._secedge_label_map)))
 
        d = cStringIO.StringIO()
        p = cPickle.Pickler(d, protocol = 2)
        p.dump(graph.root_id)
        for l in (nts, ts, se_nts, se_ts):
            p.dump(tuple(l))

src/g/a/gaesdk-python-HEAD/google/appengine/api/datastore_file_stub.py   gaesdk-python(Download)
 
    descriptor, tmp_filename = tempfile.mkstemp(dir=os.path.dirname(filename))
    tmpfile = openfile(tmp_filename, 'wb')
    pickler = pickle.Pickler(tmpfile, protocol=1)
    pickler.fast = True
    pickler.dump(obj)
 

src/n/l/nltk-HEAD/nltk/nltk_contrib/tiger/indexer/graph_serializer.py   nltk(Download)
                               self._convert_edges(node.secedges, self._secedge_label_map)))
 
        d = cStringIO.StringIO()
        p = cPickle.Pickler(d, protocol = 2)
        p.dump(graph.root_id)
        for l in (nts, ts, se_nts, se_ts):
            p.dump(tuple(l))

src/w/3/w3af-HEAD/extlib/nltk_contrib/tiger/indexer/graph_serializer.py   w3af(Download)
                               self._convert_edges(node.secedges, self._secedge_label_map)))
 
        d = cStringIO.StringIO()
        p = cPickle.Pickler(d, protocol = 2)
        p.dump(graph.root_id)
        for l in (nts, ts, se_nts, se_ts):
            p.dump(tuple(l))

src/a/p/AppEngine-mlk-1.3.6/google/appengine/api/datastore_file_stub.py   AppEngine-mlk(Download)
 
        tmpfile = openfile(os.tempnam(os.path.dirname(filename)), 'wb')
 
        pickler = pickle.Pickler(tmpfile, protocol=1)
        pickler.fast = True
        pickler.dump(obj)
 

src/s/a/sage-HEAD/trunk/local/lib/python2.4/site-packages/ZODB/ExportImport.py   sage(Download)
"""Support for database export and import."""
 
from cStringIO import StringIO
from cPickle import Pickler, Unpickler
from tempfile import TemporaryFile
import logging
 
            unpickler.persistent_load = persistent_load
 
            newp = StringIO()
            pickler = Pickler(newp, 1)
            pickler.persistent_id = persistent_id
 
            pickler.dump(unpickler.load())

src/s/a/sage-HEAD/local/lib/python2.4/site-packages/ZODB/ExportImport.py   sage(Download)
"""Support for database export and import."""
 
from cStringIO import StringIO
from cPickle import Pickler, Unpickler
from tempfile import TemporaryFile
import logging
 
            unpickler.persistent_load = persistent_load
 
            newp = StringIO()
            pickler = Pickler(newp, 1)
            pickler.persistent_id = persistent_id
 
            pickler.dump(unpickler.load())

src/s/a/sage-HEAD/trunk/local/lib/python2.4/site-packages/ZODB/FileStorage/FileStorage.py   sage(Download)
"""
 
import base64
from cPickle import Pickler, Unpickler, loads
import errno
import os
import sys
        tmp_name = index_name + '.index_tmp'
 
        f=open(tmp_name,'wb')
        p=Pickler(f,1)
 
        # Note:  starting with ZODB 3.2.6, the 'oid' value stored is ignored
        # by the code that reads the index.  We still write it, so that
            if not self._is_read_only:
                # Save the converted index.
                f = open(index_name, 'wb')
                p = Pickler(f, 1)
                info['index'] = index
                p.dump(info)
                f.close()

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