<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Module: kernel.zmq.serialize — IPython 2.3.0 documentation</title> <link rel="stylesheet" href="../../_static/default.css" type="text/css" /> <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../../', VERSION: '2.3.0', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="../../_static/jquery.js"></script> <script type="text/javascript" src="../../_static/underscore.js"></script> <script type="text/javascript" src="../../_static/doctools.js"></script> <link rel="top" title="IPython 2.3.0 documentation" href="../../index.html" /> <link rel="up" title="The IPython API" href="../index.html" /> <link rel="next" title="Module: kernel.zmq.session" href="IPython.kernel.zmq.session.html" /> <link rel="prev" title="Module: kernel.zmq.pylab.config" href="IPython.kernel.zmq.pylab.config.html" /> </head> <body> <div style="background-color: white; text-align: left; padding: 10px 10px 15px 15px"> <a href="http://ipython.org/"><img src="../../_static/logo.png" border="0" alt="IPython Documentation"/></a> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../../genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="../../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="IPython.kernel.zmq.session.html" title="Module: kernel.zmq.session" accesskey="N">next</a> |</li> <li class="right" > <a href="IPython.kernel.zmq.pylab.config.html" title="Module: kernel.zmq.pylab.config" accesskey="P">previous</a> |</li> <li><a href="http://ipython.org">home</a>| </li> <li><a href="../../search.html">search</a>| </li> <li><a href="../../index.html">documentation </a> »</li> <li><a href="../index.html" accesskey="U">The IPython API</a> »</li> </ul> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h3><a href="../../index.html">Table Of Contents</a></h3> <ul> <li><a class="reference internal" href="#">Module: <tt class="docutils literal"><span class="pre">kernel.zmq.serialize</span></tt></a><ul> <li><a class="reference internal" href="#functions">4 Functions</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="IPython.kernel.zmq.pylab.config.html" title="previous chapter">Module: <tt class="docutils literal"><span class="pre">kernel.zmq.pylab.config</span></tt></a></p> <h4>Next topic</h4> <p class="topless"><a href="IPython.kernel.zmq.session.html" title="next chapter">Module: <tt class="docutils literal"><span class="pre">kernel.zmq.session</span></tt></a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../../_sources/api/generated/IPython.kernel.zmq.serialize.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="../../search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="module-IPython.kernel.zmq.serialize"> <span id="module-kernel-zmq-serialize"></span><h1>Module: <tt class="xref py py-mod docutils literal"><span class="pre">kernel.zmq.serialize</span></tt><a class="headerlink" href="#module-IPython.kernel.zmq.serialize" title="Permalink to this headline">¶</a></h1> <p>serialization utilities for apply messages</p> <div class="section" id="functions"> <h2>4 Functions<a class="headerlink" href="#functions" title="Permalink to this headline">¶</a></h2> <dl class="function"> <dt id="IPython.kernel.zmq.serialize.serialize_object"> <tt class="descclassname">IPython.kernel.zmq.serialize.</tt><tt class="descname">serialize_object</tt><big>(</big><em>obj</em>, <em>buffer_threshold=1024</em>, <em>item_threshold=64</em><big>)</big><a class="headerlink" href="#IPython.kernel.zmq.serialize.serialize_object" title="Permalink to this definition">¶</a></dt> <dd><p>Serialize an object into a list of sendable buffers.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>obj</strong> : object</p> <blockquote> <div><p>The object to be serialized</p> </div></blockquote> <p><strong>buffer_threshold</strong> : int</p> <blockquote> <div><p>The threshold (in bytes) for pulling out data buffers to avoid pickling them.</p> </div></blockquote> <p><strong>item_threshold</strong> : int</p> <blockquote> <div><p>The maximum number of items over which canning will iterate. Containers (lists, dicts) larger than this will be pickled without introspection.</p> </div></blockquote> </td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><strong>[bufs]</strong> : list of buffers representing the serialized object.</p> </td> </tr> </tbody> </table> </dd></dl> <dl class="function"> <dt id="IPython.kernel.zmq.serialize.unserialize_object"> <tt class="descclassname">IPython.kernel.zmq.serialize.</tt><tt class="descname">unserialize_object</tt><big>(</big><em>buffers</em>, <em>g=None</em><big>)</big><a class="headerlink" href="#IPython.kernel.zmq.serialize.unserialize_object" title="Permalink to this definition">¶</a></dt> <dd><p>reconstruct an object serialized by serialize_object from data buffers.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>bufs</strong> : list of buffers/bytes</p> <p><strong>g</strong> : globals to be used when uncanning</p> </td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><strong>(newobj, bufs)</strong> : unpacked object, and the list of remaining unused buffers.</p> </td> </tr> </tbody> </table> </dd></dl> <dl class="function"> <dt id="IPython.kernel.zmq.serialize.pack_apply_message"> <tt class="descclassname">IPython.kernel.zmq.serialize.</tt><tt class="descname">pack_apply_message</tt><big>(</big><em>f</em>, <em>args</em>, <em>kwargs</em>, <em>buffer_threshold=1024</em>, <em>item_threshold=64</em><big>)</big><a class="headerlink" href="#IPython.kernel.zmq.serialize.pack_apply_message" title="Permalink to this definition">¶</a></dt> <dd><p>pack up a function, args, and kwargs to be sent over the wire</p> <p>Each element of args/kwargs will be canned for special treatment, but inspection will not go any deeper than that.</p> <p>Any object whose data is larger than <cite>threshold</cite> will not have their data copied (only numpy arrays and bytes/buffers support zero-copy)</p> <p>Message will be a list of bytes/buffers of the format:</p> <p>[ cf, pinfo, <arg_bufs>, <kwarg_bufs> ]</p> <p>With length at least two + len(args) + len(kwargs)</p> </dd></dl> <dl class="function"> <dt id="IPython.kernel.zmq.serialize.unpack_apply_message"> <tt class="descclassname">IPython.kernel.zmq.serialize.</tt><tt class="descname">unpack_apply_message</tt><big>(</big><em>bufs</em>, <em>g=None</em>, <em>copy=True</em><big>)</big><a class="headerlink" href="#IPython.kernel.zmq.serialize.unpack_apply_message" title="Permalink to this definition">¶</a></dt> <dd><p>unpack f,args,kwargs from buffers packed by pack_apply_message() Returns: original f,args,kwargs</p> </dd></dl> </div> </div> </div> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../../genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="../../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="IPython.kernel.zmq.session.html" title="Module: kernel.zmq.session" >next</a> |</li> <li class="right" > <a href="IPython.kernel.zmq.pylab.config.html" title="Module: kernel.zmq.pylab.config" >previous</a> |</li> <li><a href="http://ipython.org">home</a>| </li> <li><a href="../../search.html">search</a>| </li> <li><a href="../../index.html">documentation </a> »</li> <li><a href="../index.html" >The IPython API</a> »</li> </ul> </div> <div class="footer"> © Copyright The IPython Development Team. Last updated on Jul 14, 2015. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3. </div> </body> </html>