Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > c3732731228538f6126cae930c10ad71 > files > 182

python-pyro4-4.21-3.mga4.noarch.rpm



<!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>Pyro4.util — Utilities &mdash; Pyro 4.21 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:     '4.21',
        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="Pyro 4.21 documentation" href="../index.html" />
    <link rel="up" title="Pyro4 library API" href="../api.html" />
    <link rel="next" title="Pyro4.constants — Constant value definitions" href="constants.html" />
    <link rel="prev" title="Pyro4.naming — Pyro name server" href="naming.html" /> 
  </head>
  <body>
    <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="constants.html" title="Pyro4.constants — Constant value definitions"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="naming.html" title="Pyro4.naming — Pyro name server"
             accesskey="P">previous</a> |</li>
        <li><a href="../index.html">Pyro 4.21 documentation</a> &raquo;</li>
          <li><a href="../api.html" accesskey="U">Pyro4 library API</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="module-Pyro4.util">
<span id="pyro4-util-utilities"></span><h1><a class="reference internal" href="#module-Pyro4.util" title="Pyro4.util"><tt class="xref py py-mod docutils literal"><span class="pre">Pyro4.util</span></tt></a> &#8212; Utilities<a class="headerlink" href="#module-Pyro4.util" title="Permalink to this headline">¶</a></h1>
<p>Miscellaneous utilities.</p>
<dl class="class">
<dt id="Pyro4.util.JsonSerializer">
<em class="property">class </em><tt class="descclassname">Pyro4.util.</tt><tt class="descname">JsonSerializer</tt><a class="headerlink" href="#Pyro4.util.JsonSerializer" title="Permalink to this definition">¶</a></dt>
<dd><p>(de)serializer that wraps the json serialization protocol.</p>
</dd></dl>

<dl class="class">
<dt id="Pyro4.util.MarshalSerializer">
<em class="property">class </em><tt class="descclassname">Pyro4.util.</tt><tt class="descname">MarshalSerializer</tt><a class="headerlink" href="#Pyro4.util.MarshalSerializer" title="Permalink to this definition">¶</a></dt>
<dd><p>(de)serializer that wraps the marshal serialization protocol.</p>
</dd></dl>

<dl class="class">
<dt id="Pyro4.util.PickleSerializer">
<em class="property">class </em><tt class="descclassname">Pyro4.util.</tt><tt class="descname">PickleSerializer</tt><a class="headerlink" href="#Pyro4.util.PickleSerializer" title="Permalink to this definition">¶</a></dt>
<dd><p>A (de)serializer that wraps the Pickle serialization protocol.
It can optionally compress the serialized data, and is thread safe.</p>
</dd></dl>

<dl class="class">
<dt id="Pyro4.util.SerializerBase">
<em class="property">class </em><tt class="descclassname">Pyro4.util.</tt><tt class="descname">SerializerBase</tt><a class="headerlink" href="#Pyro4.util.SerializerBase" title="Permalink to this definition">¶</a></dt>
<dd><p>Base class for (de)serializer implementations (which must be thread safe)</p>
<dl class="classmethod">
<dt id="Pyro4.util.SerializerBase.class_to_dict">
<em class="property">classmethod </em><tt class="descname">class_to_dict</tt><big>(</big><em>obj</em><big>)</big><a class="headerlink" href="#Pyro4.util.SerializerBase.class_to_dict" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert a non-serializable object to a dict. Mostly borrowed from serpent.</p>
</dd></dl>

<dl class="method">
<dt id="Pyro4.util.SerializerBase.deserializeCall">
<tt class="descname">deserializeCall</tt><big>(</big><em>data</em>, <em>compressed=False</em><big>)</big><a class="headerlink" href="#Pyro4.util.SerializerBase.deserializeCall" title="Permalink to this definition">¶</a></dt>
<dd><p>Deserializes the given call data back to (object, method, vargs, kwargs) tuple.
Set compressed to True to decompress the data first.</p>
</dd></dl>

<dl class="method">
<dt id="Pyro4.util.SerializerBase.deserializeData">
<tt class="descname">deserializeData</tt><big>(</big><em>data</em>, <em>compressed=False</em><big>)</big><a class="headerlink" href="#Pyro4.util.SerializerBase.deserializeData" title="Permalink to this definition">¶</a></dt>
<dd><p>Deserializes the given data (bytes). Set compressed to True to decompress the data first.</p>
</dd></dl>

<dl class="staticmethod">
<dt id="Pyro4.util.SerializerBase.dict_to_class">
<em class="property">static </em><tt class="descname">dict_to_class</tt><big>(</big><em>data</em><big>)</big><a class="headerlink" href="#Pyro4.util.SerializerBase.dict_to_class" title="Permalink to this definition">¶</a></dt>
<dd><p>Recreate an object out of a dict containing the class name and the attributes.
Only a fixed set of classes are recognized.</p>
</dd></dl>

<dl class="method">
<dt id="Pyro4.util.SerializerBase.serializeCall">
<tt class="descname">serializeCall</tt><big>(</big><em>obj</em>, <em>method</em>, <em>vargs</em>, <em>kwargs</em>, <em>compress=False</em><big>)</big><a class="headerlink" href="#Pyro4.util.SerializerBase.serializeCall" title="Permalink to this definition">¶</a></dt>
<dd><p>Serialize the given method call parameters, try to compress if told so.
Returns a tuple of the serialized data and a bool indicating if it is compressed or not.</p>
</dd></dl>

<dl class="method">
<dt id="Pyro4.util.SerializerBase.serializeData">
<tt class="descname">serializeData</tt><big>(</big><em>data</em>, <em>compress=False</em><big>)</big><a class="headerlink" href="#Pyro4.util.SerializerBase.serializeData" title="Permalink to this definition">¶</a></dt>
<dd><p>Serialize the given data object, try to compress if told so.
Returns a tuple of the serialized data (bytes) and a bool indicating if it is compressed or not.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="Pyro4.util.SerpentSerializer">
<em class="property">class </em><tt class="descclassname">Pyro4.util.</tt><tt class="descname">SerpentSerializer</tt><a class="headerlink" href="#Pyro4.util.SerpentSerializer" title="Permalink to this definition">¶</a></dt>
<dd><p>(de)serializer that wraps the serpent serialization protocol.</p>
</dd></dl>

<dl class="function">
<dt id="Pyro4.util.excepthook">
<tt class="descclassname">Pyro4.util.</tt><tt class="descname">excepthook</tt><big>(</big><em>ex_type</em>, <em>ex_value</em>, <em>ex_tb</em><big>)</big><a class="headerlink" href="#Pyro4.util.excepthook" title="Permalink to this definition">¶</a></dt>
<dd><p>An exception hook you can use for <tt class="docutils literal"><span class="pre">sys.excepthook</span></tt>, to automatically print remote Pyro tracebacks</p>
</dd></dl>

<dl class="function">
<dt id="Pyro4.util.fixIronPythonExceptionForPickle">
<tt class="descclassname">Pyro4.util.</tt><tt class="descname">fixIronPythonExceptionForPickle</tt><big>(</big><em>exceptionObject</em>, <em>addAttributes</em><big>)</big><a class="headerlink" href="#Pyro4.util.fixIronPythonExceptionForPickle" title="Permalink to this definition">¶</a></dt>
<dd><p>function to hack around a bug in IronPython where it doesn&#8217;t pickle
exception attributes. We piggyback them into the exception&#8217;s args.</p>
</dd></dl>

<dl class="function">
<dt id="Pyro4.util.formatTraceback">
<tt class="descclassname">Pyro4.util.</tt><tt class="descname">formatTraceback</tt><big>(</big><em>ex_type=None</em>, <em>ex_value=None</em>, <em>ex_tb=None</em>, <em>detailed=False</em><big>)</big><a class="headerlink" href="#Pyro4.util.formatTraceback" title="Permalink to this definition">¶</a></dt>
<dd><p>Formats an exception traceback. If you ask for detailed formatting,
the result will contain info on the variables in each stack frame.
You don&#8217;t have to provide the exception info objects, if you omit them,
this function will obtain them itself using <tt class="docutils literal"><span class="pre">sys.exc_info()</span></tt>.</p>
</dd></dl>

<dl class="function">
<dt id="Pyro4.util.getPyroTraceback">
<tt class="descclassname">Pyro4.util.</tt><tt class="descname">getPyroTraceback</tt><big>(</big><em>ex_type=None</em>, <em>ex_value=None</em>, <em>ex_tb=None</em><big>)</big><a class="headerlink" href="#Pyro4.util.getPyroTraceback" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a list of strings that form the traceback information of a
Pyro exception. Any remote Pyro exception information is included.
Traceback information is automatically obtained via <tt class="docutils literal"><span class="pre">sys.exc_info()</span></tt> if
you do not supply the objects yourself.</p>
</dd></dl>

<dl class="function">
<dt id="Pyro4.util.resolveDottedAttribute">
<tt class="descclassname">Pyro4.util.</tt><tt class="descname">resolveDottedAttribute</tt><big>(</big><em>obj</em>, <em>attr</em>, <em>allowDotted</em><big>)</big><a class="headerlink" href="#Pyro4.util.resolveDottedAttribute" title="Permalink to this definition">¶</a></dt>
<dd><p>Resolves a dotted attribute name to an object.  Raises
an AttributeError if any attribute in the chain starts with a &#8216;<tt class="docutils literal"><span class="pre">_</span></tt>&#8216;.
If the optional allowDotted argument is false, dots are not
supported and this function operates similar to <tt class="docutils literal"><span class="pre">getattr(obj,</span> <span class="pre">attr)</span></tt>.</p>
</dd></dl>

</div>
<div class="section" id="module-Pyro4.socketutil">
<span id="pyro4-socketutil-socket-related-utilities"></span><h1><a class="reference internal" href="#module-Pyro4.socketutil" title="Pyro4.socketutil"><tt class="xref py py-mod docutils literal"><span class="pre">Pyro4.socketutil</span></tt></a> &#8212; Socket related utilities<a class="headerlink" href="#module-Pyro4.socketutil" title="Permalink to this headline">¶</a></h1>
<p>Low level socket utilities.</p>
<dl class="class">
<dt id="Pyro4.socketutil.SocketConnection">
<em class="property">class </em><tt class="descclassname">Pyro4.socketutil.</tt><tt class="descname">SocketConnection</tt><big>(</big><em>sock</em>, <em>objectId=None</em><big>)</big><a class="headerlink" href="#Pyro4.socketutil.SocketConnection" title="Permalink to this definition">¶</a></dt>
<dd><p>A wrapper class for plain sockets, containing various methods such as <tt class="xref py py-meth docutils literal"><span class="pre">send()</span></tt> and <tt class="xref py py-meth docutils literal"><span class="pre">recv()</span></tt></p>
</dd></dl>

<dl class="function">
<dt id="Pyro4.socketutil.bindOnUnusedPort">
<tt class="descclassname">Pyro4.socketutil.</tt><tt class="descname">bindOnUnusedPort</tt><big>(</big><em>sock</em>, <em>host='localhost'</em><big>)</big><a class="headerlink" href="#Pyro4.socketutil.bindOnUnusedPort" title="Permalink to this definition">¶</a></dt>
<dd><p>Bind the socket to a free port and return the port number.
This code is based on the code in the stdlib&#8217;s test.test_support module.</p>
</dd></dl>

<dl class="function">
<dt id="Pyro4.socketutil.createBroadcastSocket">
<tt class="descclassname">Pyro4.socketutil.</tt><tt class="descname">createBroadcastSocket</tt><big>(</big><em>bind=None</em>, <em>reuseaddr=False</em>, <em>timeout=&lt;object object at 0xf730e508&gt;</em>, <em>ipv6=False</em><big>)</big><a class="headerlink" href="#Pyro4.socketutil.createBroadcastSocket" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a udp broadcast socket.
Set ipv6=True to create an IPv6 socket rather than IPv4.
Set ipv6=None to use the PREFER_IP_VERSION config setting.</p>
</dd></dl>

<dl class="function">
<dt id="Pyro4.socketutil.createSocket">
<tt class="descclassname">Pyro4.socketutil.</tt><tt class="descname">createSocket</tt><big>(</big><em>bind=None</em>, <em>connect=None</em>, <em>reuseaddr=False</em>, <em>keepalive=True</em>, <em>timeout=&lt;object object at 0xf730e508&gt;</em>, <em>noinherit=False</em>, <em>ipv6=False</em><big>)</big><a class="headerlink" href="#Pyro4.socketutil.createSocket" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a socket. Default socket options are keepalive and IPv4 family.
If &#8216;bind&#8217; or &#8216;connect&#8217; is a string, it is assumed a Unix domain socket is requested.
Otherwise, a normal tcp/ip socket is used.
Set ipv6=True to create an IPv6 socket rather than IPv4.
Set ipv6=None to use the PREFER_IP_VERSION config setting.</p>
</dd></dl>

<dl class="function">
<dt id="Pyro4.socketutil.findProbablyUnusedPort">
<tt class="descclassname">Pyro4.socketutil.</tt><tt class="descname">findProbablyUnusedPort</tt><big>(</big><em>family=2</em>, <em>socktype=1</em><big>)</big><a class="headerlink" href="#Pyro4.socketutil.findProbablyUnusedPort" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns an unused port that should be suitable for binding (likely, but not guaranteed).
This code is copied from the stdlib&#8217;s test.test_support module.</p>
</dd></dl>

<dl class="function">
<dt id="Pyro4.socketutil.getInterfaceAddress">
<tt class="descclassname">Pyro4.socketutil.</tt><tt class="descname">getInterfaceAddress</tt><big>(</big><em>ip_address</em><big>)</big><a class="headerlink" href="#Pyro4.socketutil.getInterfaceAddress" title="Permalink to this definition">¶</a></dt>
<dd><p>tries to find the ip address of the interface that connects to the given host&#8217;s address</p>
</dd></dl>

<dl class="function">
<dt id="Pyro4.socketutil.getIpAddress">
<tt class="descclassname">Pyro4.socketutil.</tt><tt class="descname">getIpAddress</tt><big>(</big><em>hostname</em>, <em>workaround127=False</em>, <em>ipVersion=None</em><big>)</big><a class="headerlink" href="#Pyro4.socketutil.getIpAddress" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the IP address for the given host. If you enable the workaround,
it will use a little hack if the ip address is found to be the loopback address.
The hack tries to discover an externally visible ip address instead (this only works for ipv4 addresses).
Set ipVersion=6 to return ipv6 addresses, 4 to return ipv4, 0 to let OS choose the best one or None to use Pyro4.config.PREFER_IP_VERSION.</p>
</dd></dl>

<dl class="function">
<dt id="Pyro4.socketutil.getIpVersion">
<tt class="descclassname">Pyro4.socketutil.</tt><tt class="descname">getIpVersion</tt><big>(</big><em>hostnameOrAddress</em><big>)</big><a class="headerlink" href="#Pyro4.socketutil.getIpVersion" title="Permalink to this definition">¶</a></dt>
<dd><p>Determine what the IP version is of the given hostname or ip address (4 or 6).
First, it resolves the hostname or address to get an IP address.
Then, if the resolved IP contains a &#8216;:&#8217; it is considered to be an ipv6 address,
and if it contains a &#8216;.&#8217;, it is ipv4.</p>
</dd></dl>

<dl class="data">
<dt id="Pyro4.socketutil.hasSelect">
<tt class="descclassname">Pyro4.socketutil.</tt><tt class="descname">hasSelect</tt><em class="property"> = True</em><a class="headerlink" href="#Pyro4.socketutil.hasSelect" title="Permalink to this definition">¶</a></dt>
<dd><p>is poll() available?</p>
</dd></dl>

<dl class="function">
<dt id="Pyro4.socketutil.receiveData">
<tt class="descclassname">Pyro4.socketutil.</tt><tt class="descname">receiveData</tt><big>(</big><em>sock</em>, <em>size</em><big>)</big><a class="headerlink" href="#Pyro4.socketutil.receiveData" title="Permalink to this definition">¶</a></dt>
<dd><p>Retrieve a given number of bytes from a socket.
It is expected the socket is able to supply that number of bytes.
If it isn&#8217;t, an exception is raised (you will not get a zero length result
or a result that is smaller than what you asked for). The partial data that
has been received however is stored in the &#8216;partialData&#8217; attribute of
the exception object.</p>
</dd></dl>

<dl class="function">
<dt id="Pyro4.socketutil.sendData">
<tt class="descclassname">Pyro4.socketutil.</tt><tt class="descname">sendData</tt><big>(</big><em>sock</em>, <em>data</em><big>)</big><a class="headerlink" href="#Pyro4.socketutil.sendData" title="Permalink to this definition">¶</a></dt>
<dd><p>Send some data over a socket.
Some systems have problems with <tt class="docutils literal"><span class="pre">sendall()</span></tt> when the socket is in non-blocking mode.
For instance, Mac OS X seems to be happy to throw EAGAIN errors too often.
This function falls back to using a regular send loop if needed.</p>
</dd></dl>

<dl class="function">
<dt id="Pyro4.socketutil.setKeepalive">
<tt class="descclassname">Pyro4.socketutil.</tt><tt class="descname">setKeepalive</tt><big>(</big><em>sock</em><big>)</big><a class="headerlink" href="#Pyro4.socketutil.setKeepalive" title="Permalink to this definition">¶</a></dt>
<dd><p>sets the SO_KEEPALIVE option on the socket, if possible.</p>
</dd></dl>

<dl class="function">
<dt id="Pyro4.socketutil.setNoInherit">
<tt class="descclassname">Pyro4.socketutil.</tt><tt class="descname">setNoInherit</tt><big>(</big><em>sock</em><big>)</big><a class="headerlink" href="#Pyro4.socketutil.setNoInherit" title="Permalink to this definition">¶</a></dt>
<dd><p>Mark the given socket fd as non-inheritable to child processes</p>
</dd></dl>

<dl class="function">
<dt id="Pyro4.socketutil.setReuseAddr">
<tt class="descclassname">Pyro4.socketutil.</tt><tt class="descname">setReuseAddr</tt><big>(</big><em>sock</em><big>)</big><a class="headerlink" href="#Pyro4.socketutil.setReuseAddr" title="Permalink to this definition">¶</a></dt>
<dd><p>sets the SO_REUSEADDR option on the socket, if possible.</p>
</dd></dl>

<dl class="function">
<dt id="Pyro4.socketutil.triggerSocket">
<tt class="descclassname">Pyro4.socketutil.</tt><tt class="descname">triggerSocket</tt><big>(</big><em>sock</em><big>)</big><a class="headerlink" href="#Pyro4.socketutil.triggerSocket" title="Permalink to this definition">¶</a></dt>
<dd><p>send a small data packet over the socket, to trigger it</p>
</dd></dl>

</div>
<div class="section" id="module-Pyro4.threadutil">
<span id="pyro4-threadutil-wrapper-module-for-threading"></span><h1><a class="reference internal" href="#module-Pyro4.threadutil" title="Pyro4.threadutil"><tt class="xref py py-mod docutils literal"><span class="pre">Pyro4.threadutil</span></tt></a> &#8212; wrapper module for <tt class="xref py py-mod docutils literal"><span class="pre">threading</span></tt><a class="headerlink" href="#module-Pyro4.threadutil" title="Permalink to this headline">¶</a></h1>
<p>Threading abstraction which allows for <tt class="xref py py-mod docutils literal"><span class="pre">threading2</span></tt> use with a
transparent fallback to <tt class="xref py py-mod docutils literal"><span class="pre">threading</span></tt> when it is not available.
Pyro doesn&#8217;t use <tt class="xref py py-mod docutils literal"><span class="pre">threading</span></tt> directly: it imports all
thread related items via this module instead. Code using Pyro can do
the same (but it is not required).</p>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="../index.html">
              <img class="logo" src="../_static/pyro.png" alt="Logo"/>
            </a></p>
  <h3><a href="../index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#"><tt class="docutils literal"><span class="pre">Pyro4.util</span></tt> &#8212; Utilities</a></li>
<li><a class="reference internal" href="#module-Pyro4.socketutil"><tt class="docutils literal"><span class="pre">Pyro4.socketutil</span></tt> &#8212; Socket related utilities</a></li>
<li><a class="reference internal" href="#module-Pyro4.threadutil"><tt class="docutils literal"><span class="pre">Pyro4.threadutil</span></tt> &#8212; wrapper module for <tt class="docutils literal"><span class="pre">threading</span></tt></a></li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="naming.html"
                        title="previous chapter"><tt class="docutils literal"><span class="pre">Pyro4.naming</span></tt> &#8212; Pyro name server</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="constants.html"
                        title="next chapter"><tt class="docutils literal"><span class="pre">Pyro4.constants</span></tt> &#8212; Constant value definitions</a></p>
<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="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="constants.html" title="Pyro4.constants — Constant value definitions"
             >next</a> |</li>
        <li class="right" >
          <a href="naming.html" title="Pyro4.naming — Pyro name server"
             >previous</a> |</li>
        <li><a href="../index.html">Pyro 4.21 documentation</a> &raquo;</li>
          <li><a href="../api.html" >Pyro4 library API</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright Irmen de Jong.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
    </div>
  </body>
</html>