• 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/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()

src/p/r/Products.CMFEditions-2.0.2/Products/CMFEditions/ZVCStorageTool.py   Products.CMFEditions(Download)
import time
import types
from StringIO import StringIO
from cPickle import Pickler, Unpickler, dumps, loads, HIGHEST_PROTOCOL
from zope.interface import implements
 
from App.class_init import InitializeClass
def deepCopy(obj):
    stream = StringIO()
    p = Pickler(stream, 1)
    p.dump(obj)
    stream.seek(0)
    u = Unpickler(stream)
    return u.load()
    try:
        # fallback: pickling the object
        stream = StringIO()
        p = Pickler(stream, 1)
        p.dump(obj)
        size = stream.tell()
    except:

src/s/a/sage-HEAD/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()

src/s/a/sage-HEAD/trunk/local/lib/python2.4/site-packages/ZODB/ConflictResolution.py   sage(Download)
 
import logging
from cStringIO import StringIO
from cPickle import Unpickler, Pickler
from pickle import PicklingError
 
from ZODB.POSException import ConflictError
        resolved = resolve(old, committed, newstate)
 
        file = StringIO()
        pickler = Pickler(file,1)
        pickler.persistent_id = persistent_id
        pickler.dump(meta)
        pickler.dump(resolved)

src/z/o/ZODB3-3.10.0b8/src/ZODB/ExportImport.py   ZODB3(Download)
import os
 
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.inst_persistent_id = persistent_id
 
            pickler.dump(unpickler.load())

src/s/a/sage-HEAD/local/lib/python2.4/site-packages/ZODB/ConflictResolution.py   sage(Download)
 
import logging
from cStringIO import StringIO
from cPickle import Unpickler, Pickler
from pickle import PicklingError
 
from ZODB.POSException import ConflictError
        resolved = resolve(old, committed, newstate)
 
        file = StringIO()
        pickler = Pickler(file,1)
        pickler.persistent_id = persistent_id
        pickler.dump(meta)
        pickler.dump(resolved)

src/p/r/Products.CMFEditions-2.0.2/Products/CMFEditions/ArchivistTool.py   Products.CMFEditions(Download)
 
import time
from StringIO import StringIO
from cPickle import Pickler, Unpickler
from zope.interface import implements, alsoProvides
 
from App.class_init import InitializeClass
def deepcopy(obj):
    """Makes a deep copy of the object using the pickle mechanism.
    """
    stream = StringIO()
    p = Pickler(stream, 1)
    p.dump(aq_base(obj))
    stream.seek(0)
            inside_orefs, outside_orefs = (), ()
 
        stream = StringIO()
        p = Pickler(stream, 1)
        if callbacks is not None:
            p.persistent_id = pers_id
        p.dump(aq_base(obj))

src/z/o/ZODB3-3.10.0b8/src/ZODB/FileStorage/FileStorage.py   ZODB3(Download)
 
from __future__ import with_statement
 
from cPickle import Pickler, loads
from persistent.TimeStamp import TimeStamp
from struct import pack, unpack
from zc.lockfile import LockFile
            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