[Zodb-checkins] CVS: Zope3/src/zope/interface - __init__.py:1.9.2.1 _flatten.py:1.6.30.1 adapter.py:1.6.24.1 declarations.py:1.17.10.2 document.py:1.4.46.1 interface.py:1.13.4.2 interfaces.py:1.15.8.1

Jim Fulton jim at zope.com
Sat Oct 11 10:19:35 EDT 2003


Update of /cvs-repository/Zope3/src/zope/interface
In directory cvs.zope.org:/tmp/cvs-serv7088/src/zope/interface

Modified Files:
      Tag: adaptergeddon-branch
	__init__.py _flatten.py adapter.py declarations.py document.py 
	interface.py interfaces.py 
Log Message:
Refactored declaration framework to unify declarations and interfaces.


=== Zope3/src/zope/interface/__init__.py 1.9 => 1.9.2.1 ===
--- Zope3/src/zope/interface/__init__.py:1.9	Tue Oct  7 13:27:03 2003
+++ Zope3/src/zope/interface/__init__.py	Sat Oct 11 10:19:03 2003
@@ -83,10 +83,10 @@
 from zope.interface.declarations import directlyProvidedBy, directlyProvides
 from zope.interface.declarations import implements, implementsOnly
 from zope.interface.declarations import classProvides, moduleProvides
-from zope.interface.declarations import InterfaceSpecification, Spec
+from zope.interface.declarations import Declaration
 
 # The following are to make spec pickles cleaner
-from zope.interface.declarations import Implements, Only, Provides
+from zope.interface.declarations import Provides
 
 
 from zope.interface.interfaces import IInterfaceDeclaration


=== Zope3/src/zope/interface/_flatten.py 1.6 => 1.6.30.1 ===
--- Zope3/src/zope/interface/_flatten.py:1.6	Tue Jun  3 18:46:25 2003
+++ Zope3/src/zope/interface/_flatten.py	Sat Oct 11 10:19:03 2003
@@ -19,7 +19,7 @@
 """
 __metaclass__ = type # All classes are new style when run with Python 2.2+
 
-from zope.interface import InterfaceSpecification
+from zope.interface import Declaration
 
 def _flatten(implements, include_None=0):
 
@@ -29,7 +29,7 @@
         if implements is None:
             r=()
         else:
-            r = InterfaceSpecification(implements).flattened()
+            r = Declaration(implements).flattened()
 
     if not include_None:
         return r


=== Zope3/src/zope/interface/adapter.py 1.6 => 1.6.24.1 ===
--- Zope3/src/zope/interface/adapter.py:1.6	Mon Jun 23 18:44:01 2003
+++ Zope3/src/zope/interface/adapter.py	Sat Oct 11 10:19:03 2003
@@ -20,7 +20,7 @@
 __metaclass__ = type # All classes are new style when run with Python 2.2+
 
 from zope.interface import Interface, implements, providedBy
-from zope.interface import InterfaceSpecification
+from zope.interface import Declaration
 from zope.interface.interfaces import IInterface
 from zope.interface.interfaces import IAdapterRegistry
 from _flatten import _flatten
@@ -77,9 +77,6 @@
             raise TypeError(
                 "The provide argument must be an interface")
 
-        # Invalidate our cache
-        self._v_cache = {}
-
         self._registerAllProvided(require, provide, object, provide)
 
     def get(self, ob_interface_provide, default=None, filter=None):
@@ -88,29 +85,6 @@
         Returns None if not found.
         """
 
-        if filter is None:
-            cache = getattr(self, '_v_cache', self)
-            if cache is self:
-                cache = self._v_cache = {}
-
-            # get the cache key
-            interfaces, provide = ob_interface_provide
-            try:
-                key = interfaces.__signature__
-            except AttributeError:
-                if interfaces is None:
-                    key = None
-                else:
-                    key = InterfaceSpecification(interfaces).__signature__
-            key = key, provide.__identifier__
-
-            cached = cache.get(key, self)
-            if cached is self:
-                cached = self._uncached_get(ob_interface_provide,
-                                            default, filter)
-                cache[key] = cached
-            return cached
-
         return self._uncached_get(ob_interface_provide,
                                   default, filter)
 
@@ -121,7 +95,7 @@
         except AttributeError:
             # Somebodey (probably a test) passed us a bare interface
             if ob_interface is not None:
-                flattened = InterfaceSpecification(ob_interface).flattened()
+                flattened = Declaration(ob_interface).flattened()
             else:
                 flattened = None,
         else:


=== Zope3/src/zope/interface/declarations.py 1.17.10.1 => 1.17.10.2 === (1598/1998 lines abridged)
--- Zope3/src/zope/interface/declarations.py:1.17.10.1	Fri Oct 10 07:16:38 2003
+++ Zope3/src/zope/interface/declarations.py	Sat Oct 11 10:19:03 2003
@@ -11,468 +11,39 @@
 ##############################################################################
 """Implementation of interface declarations
 
+There are three flavors of declarations:
+
+  - Declarations are used to simply name declared interfaces.
+
+  - ImplementsDeclarations are used to express the interfaces that a
+    class implements (that instances of the class provides).
+
+    Implements specifications support inheriting interfaces.
+
+  - ProvidesDeclarations are used to express interfaces directly
+    provided by objects.
+    
+
 $Id$
 """
 
 import sys
-from zope.interface.interface import InterfaceClass
-from ro import mergeOrderings
+import weakref
+from zope.interface.interface import InterfaceClass, Specification
+from ro import mergeOrderings, ro
 import exceptions
 from types import ClassType
 from zope.interface.advice import addClassAdvisor
 
-# There are imports from _zope_interface_ospec later in the file
-# because _zope_interface_ospec depends on some functions defined
-# here.
-
-
-DescriptorAwareMetaClasses = ClassType, type
-
 __metaclass__ = type
 
-heap = 1 << 9
-
-# Notes:
-#
-# We have 3 implementations of interface specifications:
-#
-# ImplementsSpecification
-#   Holds specifications of interfaces of instances of classes.
-#
-# ProvidesSpecification
-#   These are specifications for interfaces directly provided by
-#   objects.   This is a descriptor that assures
-#   that if we get it from a class for an instance, we get an attribute
-#   error.
-#
-# ObjectSpecification
-#   Holds the specification for all of the interfaces of an object.
-#   These are computed on the floy based on provides and implements
-#   specs.
-#
-# We also have a descriptor to support providedBy
-
-
-# implementation info for immutable classes (heap flag clear)
-# This is overridden by _zope_interface_ospec.
-_implements_reg = {}
-
-# This is overridden by _zope_interface_ospec.
-class InterfaceSpecificationBase:
-    __slots__ = ['__signature__']
-
-
-# This function is needed by _zope_interface_ospec and, so, must be
-# defined before _zope_interface_ospec is imported.
-def classImplements(cls, *interfaces):
-    """Declare additional interfaces implemented for instances of a class
-
-    The arguments after the class are one or more interfaces or
-    interface specifications (IInterfaceSpecification objects).
-
-    The interfaces given (including the interfaces in the
-    specifications) are added to any interfaces previously
-    declared.
-
-    Consider the following example::
-
-
-    for example:
-
-    >>> from zope.interface import Interface
-    >>> class I1(Interface): pass
-    ...
-    >>> class I2(Interface): pass
-    ...
-    >>> class I3(Interface): pass
-    ...
-    >>> class I4(Interface): pass
-    ...
-    >>> class I5(Interface): pass
-    ...
-    >>> class A:
-    ...   implements(I3)
-    >>> class B:
-    ...   implements(I4)
-    >>> class C(A, B):
-    ...   pass
-    >>> classImplements(C, I1, I2)
-    >>> [i.getName() for i in implementedBy(C)]
-    ['I1', 'I2', 'I3', 'I4']
-    >>> classImplements(C, I5)
-    >>> [i.getName() for i in implementedBy(C)]
-    ['I1', 'I2', 'I5', 'I3', 'I4']
-
-    Instances of ``C`` provide ``I1``, ``I2``, ``I5``, and whatever interfaces
-    instances of ``A`` and ``B`` provide.
-
-    """
-
-    _setImplements(cls,
-                   _getImplements(cls) + ImplementsSpecification(*interfaces)
-                   )
-
-# This function is needed by _zope_interface_ospec and, so, must be
-# defined before _zope_interface_ospec is imported.
-def proxySig(cls):
-    # Get an implementation signature from a proxied class
-
-    # XXX If we got here, we must have a
-    # security-proxied class. This introduces an
-    # indirect dependency on security proxies,
-    # which we don't want. This is necessary to
-    # support old-style __implements__ interface
-    # declarations.
-
-    # If we got here, we must have an old-style
-    # declaration, so we'll just look for an
-    # __implements__.  We can't fix it because the class
-    # is probably security proxied.
-
-    implements = getattr(cls, '__implements__', None)
-    if implements is not None:
-        assert ((implements.__class__ == tuple)
-                or
-                (InterfaceClass in
-                 implements.__class__.__mro__)
-                )
-        sig = `implements`
-
-        return sig
-
-# This function is needed by _zope_interface_ospec and, so, must be
-# defined before _zope_interface_ospec is imported.
-def oldSpecSig(cls, implements):
-    implements = ImplementsOnlySpecification(implements)
-    _setImplements(cls, implements)
-    return implements.__signature__
-
-# This is overridden by _zope_interface_ospec.
-
-def combinedSpec(provides, cls):
-    if provides is not None:
-        result = [provides]
-    else:
-        result = []
-
-    _gatherSpecs(cls, result)
-
-    return InterfaceSpecification(*result)
-
-class ObjectSpecification_py:
-    """Provide object specifications
-
-    These combine information for the object and for it's classes.
-
-    For example::
-
-        >>> from zope.interface import Interface
-        >>> class I1(Interface): pass
-        ...
-        >>> class I2(Interface): pass
-        ...
-        >>> class I3(Interface): pass
-        ...
-        >>> class I31(I3): pass
-        ...
-        >>> class I4(Interface): pass
-        ...
-        >>> class I5(Interface): pass
-        ...
-        >>> class A: implements(I1)
-        ...
-        >>> class B: __implements__ = I2
-        ...
-        >>> class C(A, B): implements(I31)
-        ...
-        >>> c = C()
-        >>> directlyProvides(c, I4)
-        >>> [i.getName() for i in providedBy(c)]
-        ['I4', 'I31', 'I1', 'I2']

[-=- -=- -=- 1598 lines omitted -=- -=- -=-]

 
-            # XXX If we got here, we must have a
-            # security-proxied class. This introduces an
-            # indirect dependency on security proxies,
-            # which we don't want. This is necessary to
-            # support old-style __implements__ interface
-            # declarations.
+    return ObjectSpecification(provides, cls)
 
-            # If we got here, we must have an old-style
-            # declaration, so we'll just look for an
-            # __implements__.
+def providedBy(ob):
 
-            implements = getattr(cls, '__implements__', None)
-            if implements is not None:
-                implements = ImplementsOnlySpecification(implements)
+    # Here we have either a special object, an old-style declaration
+    # or a descriptor
 
-            return implements
+    try:
+        r = ob.__providedBy__
 
-        k = '__implements__'
-    else:
-        d = _implements_reg
-        k = cls
+        # We might have gotten a descriptor from an instance of a
+        # class (like an ExtensionClass) that doesn't support
+        # descriptors.  We'll make sure we got one by trying to get
+        # the only attribute, which all specs have.
+        r.extends
 
-    return d.get(k)
+    except AttributeError:
+        # No descriptor, so fall back to a plain object spec
+        r = getObjectSpecification(ob)
 
-def _finddescr(cls):
-    # Try to find the __providedBy__ descriptor. If we can't find it,
-    # just return the class. 
-
-    d = cls.__dict__.get("__providedBy__", cls)
-    if d is not cls:
-        return d
-    for b in cls.__bases__:
-        d = _finddescr(b)
-        if d is not b:
-            return d
+    return r
 
-    return cls
+class ObjectSpecificationDescriptor(object):
+    """Implement the __providedBy__ attribute
 
-def _setImplements(cls, v):
-    flags = getattr(cls, '__flags__', heap)
+    The __providedBy__ attribute computes the interfaces peovided by
+    an object.
+    """
 
-    if flags & heap:
-        cls.__implements__ = v
+    def __get__(self, inst, cls):
+        """Get an object specification for an object
+
+        For example::
 
-        # Add a __providedBy__ descriptor if there isn't already one.
-        # If there is one and it's not in the dict, then make a copy
-        # here.
-
-        try:
-            cls.__providedBy__
-        except AttributeError:
-            # No existing descriptor, add one
-            cls.__providedBy__ = _objectSpecificationDescriptor
+          >>> from zope.interface import Interface
+          >>> class IFoo(Interface): pass
+          ...
+          >>> class IFooFactory(Interface): pass
+          ...
+          >>> class C:
+          ...   implements(IFoo)
+          ...   classProvides(IFooFactory)
+          >>> [i.getName() for i in C.__providedBy__]
+          ['IFooFactory']
+          >>> [i.getName() for i in C().__providedBy__]
+          ['IFoo']
+
+        """
+
+        # Get an ObjectSpecification bound to either an instance or a class,
+        # depending on how we were accessed.
+        
+        if inst is None:
+            return getObjectSpecification(cls)
         else:
-            # Hm, the class already has a descriptor, let's get it and
-            # see if it's the right kind.
-            try:
-                mro = cls.__mro__
-            except AttributeError:
-                pb = _finddescr(cls)
-                if pb is cls:
-                    pb = None
-            else:
-                for c in mro:
-                    pb = c.__dict__.get("__providedBy__", c)
-                    if pb is not c:
-                        break
-                else: # no break
-                    pb = None
-
-            if not isinstance(pb, ObjectSpecificationDescriptor):
-                raise TypeError(
-                    cls,
-                    "has a __providedBy__ descriptor of the wrong type",
-                    pb)
+            return getObjectSpecification(inst)
 
-            if "__providedBy__" not in cls.__dict__:
-                cls.__providedBy__ = pb
+objectSpecificationDescriptor = ObjectSpecificationDescriptor()
 
-    else:
-        _implements_reg[cls] = v
+##############################################################################
+
+
+def _normalizeargs(sequence, output = None,
+                   noexpand=(InterfaceClass, Implements)):
+    """Normalize declaration arguments
 
-    v.setClass(cls)
+    Normalization arguments might contain Declarions, tuples, or single
+    interfaces.
+
+    Anything but individial interfaces or implements specs will be expanded.
+    """
+    if output is None:
+        output = []
+    for v in sequence:
+        if isinstance(v, noexpand):
+            output.append(v)
+        else:
+            _normalizeargs(v, output)
+    return output
 
-def _getmro(C, r):
-  if C not in r: r.append(C)
-  for b in C.__bases__:
-    _getmro(b, r)
-  return r
-
-def _gatherSpecs(cls, result):
-    implements = _getImplements(cls)
-    if implements is not None:
-        try:
-            stop = implements.only
-        except AttributeError:
-            # Must be an old-style interface spec
-            implements = ImplementsOnlySpecification(
-                _flattenSpecs([implements], []))
-            stop = 1
-            _setImplements(cls, implements)
-
-        if stop:
-            result.append(implements)
-            return result
-
-        cspec = implements._cspec
-        if cspec is not None:
-            # We have a cached spec.
-            # This makes out job much easier
-            result.append(cspec)
-            return result
-
-        # No cached cspec. Compute one if we're being called recursively.
-        # We know we're being called recursively is result is not empty!
-        if result:
-            implements.setClass(cls)
-            cspec = implements._cspec
-            # Now we have one
-            result.append(cspec)
-            return result
-
-        result.append(implements)
-
-    for b in cls.__bases__:
-        _gatherSpecs(b, result)
-
-    return result
-
-# DocTest:
-if __name__ == "__main__":
-    import doctest, __main__
-    doctest.testmod(__main__, isprivate=lambda *a: False)
+_empty = Declaration()


=== Zope3/src/zope/interface/document.py 1.4 => 1.4.46.1 ===
--- Zope3/src/zope/interface/document.py:1.4	Mon Apr 14 04:31:00 2003
+++ Zope3/src/zope/interface/document.py	Sat Oct 11 10:19:03 2003
@@ -36,7 +36,7 @@
         outp(_justify_and_indent(_trim_doc_string(I.getDoc()), level)+ "\n\n")
 
     bases = [base
-             for base in I.getBases()
+             for base in I.__bases__
              if base is not zope.interface.Interface
              ]
     if bases:


=== Zope3/src/zope/interface/interface.py 1.13.4.1 => 1.13.4.2 ===
--- Zope3/src/zope/interface/interface.py:1.13.4.1	Fri Oct 10 07:16:38 2003
+++ Zope3/src/zope/interface/interface.py	Sat Oct 11 10:19:03 2003
@@ -64,7 +64,181 @@
         self.__tagged_values[tag] = value
 
 
-class InterfaceClass(Element):
+class Specification(object):
+    """Specifications
+
+    An interface specification is used to track interface declarations
+    and component registrations.
+
+    This class is a base class for both interfaces themselves and for
+    interface specifications (declarations).
+
+    Specifications are mutable.  If you reassign their cases, their
+    relations with other specifications are adjusted accordingly.
+
+    For example:
+
+    >>> from zope.interface import Interface
+    >>> class I1(Interface):
+    ...     pass
+    >>> class I1(I1):
+    ...     pass
+    >>> class I2(I1):
+    ...     pass
+    >>> class I3(I2):
+    ...     pass
+
+    >>> [i.__name__ for i in I1.__bases__]
+    ['Interface']
+
+    >>> [i.__name__ for i in I2.__bases__]
+    ['I1']
+
+    >>> i3.extends(I1)
+    1
+
+    >>> i2.__bases__ = (Interface, )
+
+    >>> [i.__name__ for i in I2.__bases__]
+    ['Interface']
+
+    >>> i3.extends(I1)
+    0
+    
+    
+    """
+
+    def __init__(self, bases=()):
+
+        # Mapping from provided or (provided, name) or (provided,
+        # name, interfaces) -> factories This contains the transitive
+        # closure
+
+        self._implied = {}                
+        self.dependents = weakref.WeakKeyDictionary()
+        self.__bases__ = tuple(bases)
+
+    def addDependent(self, ob):
+        self.dependents[ob] = 1
+
+    def __setBases(self, bases):
+        # Register ourselves as a dependent of our old bases
+        for b in self.__bases__:
+            del b.dependents[self]
+        
+        # Register ourselves as a dependent of our bases
+        self.__dict__['__bases__'] = bases
+        for b in bases:
+            b.dependents[self] = 1
+        
+        self.changed()
+
+    __bases__ = property(
+        
+        lambda self: self.__dict__.get('__bases__', ()),
+        __setBases,
+        )
+
+    def changed(self):
+        """We, or something we depend on, have changed
+        """
+        
+        implied = self._implied
+        implied.clear()
+
+        ancestors = ro(self)
+        self.__iro__ = tuple([ancestor for ancestor in ancestors
+                              if isinstance(ancestor, InterfaceClass)
+                             ])
+
+        for ancestor in ancestors:
+            # We directly imply our ancestors:
+            implied[ancestor] = ()
+
+        # Now, advize our dependents of change:
+        for dependent in self.dependents:
+            dependent.changed()
+
+
+    def isImplementedBy(self, ob):
+        spec = providedBy(ob)
+        return self in spec._implied
+
+    def isImplementedByInstancesOf(self, cls):
+        """Do instances of the given class implement the interface?"""
+        spec = implementedBy(cls)
+        return self in spec._implied
+
+    def interfaces(self):
+        """Return an iterator for the interfaces in the specification
+
+        for example::
+
+          >>> from zope.interface import Interface
+          >>> class I1(Interface): pass
+          ...
+          >>> class I2(I1): pass
+          ...
+          >>> class I3(Interface): pass
+          ...
+          >>> class I4(I3): pass
+          ...
+          >>> spec = Specification(I2, I3)
+          >>> spec = Specification(I4, spec)
+          >>> i = spec.interfaces()
+          >>> i.next().getName()
+          'I4'
+          >>> i.next().getName()
+          'I2'
+          >>> i.next().getName()
+          'I3'
+          >>> list(i)
+          []
+        """
+        for base in self.__bases__:
+            for interface in base.interfaces():
+                yield interface
+        
+
+    def extends(self, interface, strict=True):
+        """Does the specification extend the given interface?
+
+        Test whether an interface in the specification extends the
+        given interface
+
+        Examples::
+
+          >>> from zope.interface import Interface
+          >>> class I1(Interface): pass
+          ...
+          >>> class I2(I1): pass
+          ...
+          >>> class I3(Interface): pass
+          ...
+          >>> class I4(I3): pass
+          ...
+          >>> spec = Declaration()
+          >>> int(spec.extends(Interface))
+          0
+          >>> spec = Declaration(I2)
+          >>> int(spec.extends(Interface))
+          1
+          >>> int(spec.extends(I1))
+          1
+          >>> int(spec.extends(I2))
+          1
+          >>> int(spec.extends(I3))
+          0
+          >>> int(spec.extends(I4))
+          0
+
+        """
+        return ((interface in self._implied)
+                and
+                ((not strict) or (self != interface))
+                )
+
+class InterfaceClass(Element, Specification):
     """Prototype (scarecrow) Interfaces Implementation."""
 
     # We can't say this yet because we don't have enough
@@ -97,8 +271,8 @@
         for b in bases:
             if not isinstance(b, InterfaceClass):
                 raise TypeError, 'Expected base interfaces'
-        # Python expects __bases__ to be a tuple.
-        self.__bases__ = tuple(bases)
+
+        Specification.__init__(self, bases)
 
         if attrs is None:
             attrs = {}
@@ -115,8 +289,6 @@
 
         Element.__init__(self, name, __doc__)
 
-        self.__iro__ = ro(self)
-
         for k, v in attrs.items():
             if isinstance(v, Attribute):
                 v.interface = name
@@ -131,53 +303,33 @@
 
         self.__identifier__ = "%s.%s" % (self.__module__, self.__name__)
 
-        self._dependents = weakref.WeakKeyDictionary()
+    def interfaces(self):
+        """Return an iterator for the interfaces in the specification
 
-    def addDependent(self, ob):
-        self._dependents[ob] = 1
+        for example::
 
-    def getBases(self):
-        return self.__bases__
+          >>> from zope.interface import Interface
+          >>> class I1(Interface): pass
+          ...
+          >>> 
+          >>> i = I1.interfaces()
+          >>> i.next().getName()
+          'I1'
+          >>> list(i)
+          []
+        """
+        yield self
 
-    def extends(self, other, strict=True):
-        """Does an interface extend another?"""
-        if not strict and self == other:
-            return True
 
-        for b in self.__bases__:
-            if b == other: return True
-            if b.extends(other): return True
-        return False
+
+    def getBases(self):
+        return self.__bases__
 
     def isEqualOrExtendedBy(self, other):
         """Same interface or extends?"""
         if self == other:
             return True
         return other.extends(self)
-
-    def isImplementedBy(self, object):
-        """Does the given object implement the interface?"""
-
-        # OPT Cache implements lookups
-        implements = providedBy(object)
-        cache = getattr(self, '_v_cache', self)
-        if cache is self:
-            cache = self._v_cache = {}
-
-
-        key = implements.__signature__
-
-        r = cache.get(key)
-        if r is None:
-            r = bool(implements.extends(self))
-            cache[key] = r
-
-        return r
-
-    def isImplementedByInstancesOf(self, klass):
-        """Do instances of the given class implement the interface?"""
-        i = implementedBy(klass)
-        return bool(i.extends(self))
 
     def names(self, all=False):
         """Return the attribute names defined by the interface."""


=== Zope3/src/zope/interface/interfaces.py 1.15 => 1.15.8.1 ===
--- Zope3/src/zope/interface/interfaces.py:1.15	Mon Sep  8 05:15:54 2003
+++ Zope3/src/zope/interface/interfaces.py	Sat Oct 11 10:19:03 2003
@@ -149,9 +149,6 @@
     """
 
 
-    def getBases():
-        """Return a sequence of the base interfaces."""
-
     def extends(other, strict=True):
         """Test whether the interface extends another interface
 
@@ -238,22 +235,6 @@
     __module__ = Attribute("""The name of the module defining the interface""")
 
     __bases__ = Attribute("""A tuple of base interfaces""")
-    __iro__ = Attribute(
-        """A tuple of all interfaces extended by the interface
-
-        The first item in the tuple is the interface itself.  The
-        interfaces are listed in order from most specific to most
-        general, preserving the original order of base interfaces
-        where possible.
-
-        """)
-
-    __identifier__ = Attribute("""A unique identifier for the interface
-
-    This identifier should be different for different interfaces.
-
-    The identifier is not allowed to contain tab characters.
-    """)
                                
     
 
@@ -450,7 +431,13 @@
 
         """
 
-class IInterfaceSpecification(Interface):
+class IDeclaration(Interface):
+    """Interface declaration
+
+    Declarations are used to express the interfaces implemented by
+    classes or provided by objects.
+    
+    """
 
     def __contains__(interface):
         """Test whether an interface is in the specification
@@ -512,21 +499,6 @@
         """Return a true value of the interface specification is non-empty
         """
 
-    __signature__ = Attribute("""A specification signature
-
-    The signature should change if any of the interfaces in the
-    specification change.
-
-    """)
-
-    only = Attribute("""\
-    A flag (boolean) indicating whether a specification extends others
-
-    If only is true, then a class implementing the specification
-    doesn't implement base-class specifications.
-    
-    """)
-
 class IInterfaceDeclaration(Interface):
     """Declare and check the interfaces of objects
 
@@ -557,20 +529,20 @@
         This is the union of the interfaces directly provided by an
         object and interfaces implemented by it's class.
 
-        The value returned is an IInterfaceSpecification.
+        The value returned is an IDeclaration.
         """
 
     def implementedBy(class_):
         """Return the interfaces implemented for a class' instances
 
-        The value returned is an IInterfaceSpecification.
+        The value returned is an IDeclaration.
         """
 
     def classImplements(class_, *interfaces):
         """Declare additional interfaces implemented for instances of a class
 
         The arguments after the class are one or more interfaces or
-        interface specifications (IInterfaceSpecification objects).
+        interface specifications (IDeclaration objects).
 
         The interfaces given (including the interfaces in the
         specifications) are added to any interfaces previously
@@ -592,7 +564,7 @@
         """Declare the only interfaces implemented by instances of a class
 
         The arguments after the class are one or more interfaces or
-        interface specifications (IInterfaceSpecification objects).
+        interface specifications (IDeclaration objects).
 
         The interfaces given (including the interfaces in the
         specifications) replace any previous declarations.
@@ -612,14 +584,14 @@
     def directlyProvidedBy(object):
         """Return the interfaces directly provided by the given object
 
-        The value returned is an IInterfaceSpecification.
+        The value returned is an IDeclaration.
         """
 
     def directlyProvides(object, *interfaces):
         """Declare interfaces declared directly for an object
 
         The arguments after the object are one or more interfaces or
-        interface specifications (IInterfaceSpecification objects).
+        interface specifications (IDeclaration objects).
 
         The interfaces given (including the interfaces in the
         specifications) replace interfaces previously
@@ -660,7 +632,7 @@
         This function is called in a class definition.
 
         The arguments are one or more interfaces or interface
-        specifications (IInterfaceSpecification objects).
+        specifications (IDeclaration objects).
 
         The interfaces given (including the interfaces in the
         specifications) are added to any interfaces previously
@@ -696,7 +668,7 @@
         This function is called in a class definition.
 
         The arguments are one or more interfaces or interface
-        specifications (IInterfaceSpecification objects).
+        specifications (IDeclaration objects).
 
         Previous declarations including declarations for base classes
         are overridden.
@@ -728,7 +700,7 @@
         This function is called in a class definition.
 
         The arguments are one or more interfaces or interface
-        specifications (IInterfaceSpecification objects).
+        specifications (IDeclaration objects).
 
         The given interfaces (including the interfaces in the
         specifications) are used to create the class's direct-object
@@ -758,7 +730,7 @@
         This function is used in a module definition.
 
         The arguments are one or more interfaces or interface
-        specifications (IInterfaceSpecification objects).
+        specifications (IDeclaration objects).
 
         The given interfaces (including the interfaces in the
         specifications) are used to create the module's direct-object
@@ -777,13 +749,13 @@
           directlyProvides(sys.modules[__name__], I1)
         """
 
-    def InterfaceSpecification(*interfaces):
+    def Declaration(*interfaces):
         """Create an interface specification
 
         The arguments are one or more interfaces or interface
-        specifications (IInterfaceSpecification objects).
+        specifications (IDeclaration objects).
 
-        A new interface specification (IInterfaceSpecification) with
+        A new interface specification (IDeclaration) with
         the given interfaces is returned.
         """
 
@@ -801,7 +773,7 @@
         This function is called in a class definition.
 
         The arguments are one or more interfaces or interface
-        specifications (IInterfaceSpecification objects).
+        specifications (IDeclaration objects).
 
         The interfaces given (including the interfaces in the
         specifications) are removed from any interfaces previously
@@ -835,7 +807,7 @@
         """Declare the interfaces not implemented for instances of a class
 
         The arguments after the class are one or more interfaces or
-        interface specifications (IInterfaceSpecification objects).
+        interface specifications (IDeclaration objects).
 
         The interfaces given (including the interfaces in the
         specifications) cancel previous declarations for the same




More information about the Zodb-checkins mailing list