Repository URL to install this package:
|
Version:
4.1.2 ▾
|
<!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>zope.interface — zope.interface 4.0.1 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.0.1',
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="zope.interface 4.0.1 documentation" href="../../index.html" />
<link rel="up" title="Module code" href="../index.html" />
</head>
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li><a href="../../index.html">zope.interface 4.0.1 documentation</a> »</li>
<li><a href="../index.html" accesskey="U">Module code</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<h1>Source code for zope.interface</h1><div class="highlight"><pre>
<span class="c">##############################################################################</span>
<span class="c">#</span>
<span class="c"># Copyright (c) 2001, 2002 Zope Foundation and Contributors.</span>
<span class="c"># All Rights Reserved.</span>
<span class="c">#</span>
<span class="c"># This software is subject to the provisions of the Zope Public License,</span>
<span class="c"># Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.</span>
<span class="c"># THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED</span>
<span class="c"># WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED</span>
<span class="c"># WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS</span>
<span class="c"># FOR A PARTICULAR PURPOSE.</span>
<span class="c">#</span>
<span class="c">##############################################################################</span>
<span class="sd">"""Interfaces</span>
<span class="sd">This package implements the Python "scarecrow" proposal.</span>
<span class="sd">The package exports two objects, `Interface` and `Attribute` directly. It also</span>
<span class="sd">exports several helper methods. Interface is used to create an interface with</span>
<span class="sd">a class statement, as in:</span>
<span class="sd"> class IMyInterface(Interface):</span>
<span class="sd"> '''Interface documentation</span>
<span class="sd"> '''</span>
<span class="sd"> def meth(arg1, arg2):</span>
<span class="sd"> '''Documentation for meth</span>
<span class="sd"> '''</span>
<span class="sd"> # Note that there is no self argument</span>
<span class="sd">To find out what you can do with interfaces, see the interface</span>
<span class="sd">interface, `IInterface` in the `interfaces` module.</span>
<span class="sd">The package has several public modules:</span>
<span class="sd"> o `declarations` provides utilities to declare interfaces on objects. It</span>
<span class="sd"> also provides a wide range of helpful utilities that aid in managing</span>
<span class="sd"> declared interfaces. Most of its public names are however imported here.</span>
<span class="sd"> o `document` has a utility for documenting an interface as structured text.</span>
<span class="sd"> o `exceptions` has the interface-defined exceptions</span>
<span class="sd"> o `interfaces` contains a list of all public interfaces for this package.</span>
<span class="sd"> o `verify` has utilities for verifying implementations of interfaces.</span>
<span class="sd">See the module doc strings for more information.</span>
<span class="sd">"""</span>
<span class="n">__docformat__</span> <span class="o">=</span> <span class="s">'restructuredtext'</span>
<span class="kn">from</span> <span class="nn">zope.interface.interface</span> <span class="kn">import</span> <span class="n">Interface</span>
<span class="kn">from</span> <span class="nn">zope.interface.interface</span> <span class="kn">import</span> <span class="n">_wire</span>
<span class="c"># Need to actually get the interface elements to implement the right interfaces</span>
<span class="n">_wire</span><span class="p">()</span>
<span class="k">del</span> <span class="n">_wire</span>
<span class="kn">from</span> <span class="nn">zope.interface.declarations</span> <span class="kn">import</span> <span class="n">Declaration</span>
<span class="kn">from</span> <span class="nn">zope.interface.declarations</span> <span class="kn">import</span> <span class="n">alsoProvides</span>
<span class="kn">from</span> <span class="nn">zope.interface.declarations</span> <span class="kn">import</span> <span class="n">classImplements</span>
<span class="kn">from</span> <span class="nn">zope.interface.declarations</span> <span class="kn">import</span> <span class="n">classImplementsOnly</span>
<span class="kn">from</span> <span class="nn">zope.interface.declarations</span> <span class="kn">import</span> <span class="n">classProvides</span>
<span class="kn">from</span> <span class="nn">zope.interface.declarations</span> <span class="kn">import</span> <span class="n">directlyProvidedBy</span>
<span class="kn">from</span> <span class="nn">zope.interface.declarations</span> <span class="kn">import</span> <span class="n">directlyProvides</span>
<span class="kn">from</span> <span class="nn">zope.interface.declarations</span> <span class="kn">import</span> <span class="n">implementedBy</span>
<span class="kn">from</span> <span class="nn">zope.interface.declarations</span> <span class="kn">import</span> <span class="n">implementer</span>
<span class="kn">from</span> <span class="nn">zope.interface.declarations</span> <span class="kn">import</span> <span class="n">implementer_only</span>
<span class="kn">from</span> <span class="nn">zope.interface.declarations</span> <span class="kn">import</span> <span class="n">implements</span>
<span class="kn">from</span> <span class="nn">zope.interface.declarations</span> <span class="kn">import</span> <span class="n">implementsOnly</span>
<span class="kn">from</span> <span class="nn">zope.interface.declarations</span> <span class="kn">import</span> <span class="n">moduleProvides</span>
<span class="kn">from</span> <span class="nn">zope.interface.declarations</span> <span class="kn">import</span> <span class="n">named</span>
<span class="kn">from</span> <span class="nn">zope.interface.declarations</span> <span class="kn">import</span> <span class="n">noLongerProvides</span>
<span class="kn">from</span> <span class="nn">zope.interface.declarations</span> <span class="kn">import</span> <span class="n">providedBy</span>
<span class="kn">from</span> <span class="nn">zope.interface.declarations</span> <span class="kn">import</span> <span class="n">provider</span>
<span class="kn">from</span> <span class="nn">zope.interface.exceptions</span> <span class="kn">import</span> <span class="n">Invalid</span>
<span class="kn">from</span> <span class="nn">zope.interface.interface</span> <span class="kn">import</span> <span class="n">Attribute</span>
<span class="kn">from</span> <span class="nn">zope.interface.interface</span> <span class="kn">import</span> <span class="n">invariant</span>
<span class="kn">from</span> <span class="nn">zope.interface.interface</span> <span class="kn">import</span> <span class="n">taggedValue</span>
<span class="c"># The following are to make spec pickles cleaner</span>
<span class="kn">from</span> <span class="nn">zope.interface.declarations</span> <span class="kn">import</span> <span class="n">Provides</span>
<span class="kn">from</span> <span class="nn">zope.interface.interfaces</span> <span class="kn">import</span> <span class="n">IInterfaceDeclaration</span>
<span class="n">moduleProvides</span><span class="p">(</span><span class="n">IInterfaceDeclaration</span><span class="p">)</span>
<span class="n">__all__</span> <span class="o">=</span> <span class="p">(</span><span class="s">'Interface'</span><span class="p">,</span> <span class="s">'Attribute'</span><span class="p">)</span> <span class="o">+</span> <span class="nb">tuple</span><span class="p">(</span><span class="n">IInterfaceDeclaration</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<div id="searchbox" style="display: none" role="search">
<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" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../genindex.html" title="General Index"
>index</a></li>
<li><a href="../../index.html">zope.interface 4.0.1 documentation</a> »</li>
<li><a href="../index.html" >Module code</a> »</li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2012, Zope Foundation contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3b2.
</div>
</body>
</html>