[Zope3-checkins] CVS: Zope3/src/zope/interface - adapter.py:1.5 declarations.py:1.8
Sidnei da Silva
sidnei@x3ng.com.br
Wed, 21 May 2003 13:26:40 -0400
Update of /cvs-repository/Zope3/src/zope/interface
In directory cvs.zope.org:/tmp/cvs-serv29504/src/zope/interface
Modified Files:
adapter.py declarations.py
Log Message:
More tests for PROPFIND. General whitespace cleaning
=== Zope3/src/zope/interface/adapter.py 1.4 => 1.5 ===
--- Zope3/src/zope/interface/adapter.py:1.4 Sat May 3 12:36:05 2003
+++ Zope3/src/zope/interface/adapter.py Wed May 21 13:26:39 2003
@@ -102,7 +102,7 @@
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,
@@ -125,7 +125,7 @@
flattened = None,
else:
flattened = flattened()
-
+
for interface in flattened:
c = self._reg.get((interface, provide))
@@ -135,7 +135,7 @@
return c
if filter(c):
return c
-
+
c = self._reg.get((None, provide))
if c:
c = c[1]
=== Zope3/src/zope/interface/declarations.py 1.7 => 1.8 ===
--- Zope3/src/zope/interface/declarations.py:1.7 Thu May 15 15:07:44 2003
+++ Zope3/src/zope/interface/declarations.py Wed May 21 13:26:39 2003
@@ -1,7 +1,7 @@
##############################################################################
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
@@ -35,7 +35,7 @@
# We have 3 implementations of interface specifications:
#
# ImplementsSpecification
-# Holds specifications of interfaces of instances of classes.
+# Holds specifications of interfaces of instances of classes.
#
# ProvidesSpecification
# These are specifications for interfaces directly provided by
@@ -61,7 +61,7 @@
# This function is needed by _zope_interface_ospec and, so, must be
-# defined before _zope_interface_ospec is imported.
+# defined before _zope_interface_ospec is imported.
def classImplements(cls, *interfaces):
"""Declare additional interfaces implemented for instances of a class
@@ -111,7 +111,7 @@
)
# This function is needed by _zope_interface_ospec and, so, must be
-# defined before _zope_interface_ospec is imported.
+# defined before _zope_interface_ospec is imported.
def proxySig(cls):
# Get an implementation signature from a proxied class
@@ -139,7 +139,7 @@
return sig
# This function is needed by _zope_interface_ospec and, so, must be
-# defined before _zope_interface_ospec is imported.
+# defined before _zope_interface_ospec is imported.
def oldSpecSig(cls, implements):
implements = OnlyImplementsSpecification(implements)
_setImplements(cls, implements)
@@ -287,6 +287,7 @@
1
"""
return interface in self.interfaces
+
def __iter__(self):
"""Return an iterator for the interfaces in the specification
@@ -315,7 +316,7 @@
"""
return iter(self.interfaces)
-
+
def flattened(self):
"""Return an iterator of all included and extended interfaces
@@ -349,6 +350,7 @@
"""
return iter(self.__iro__)
+
def extends(self, interface):
"""Does the specification extend the given interface?
@@ -383,6 +385,7 @@
"""
return interface in self.set
+
def __add__(self, other):
"""Add twp specifications or a specification and an interface
@@ -552,7 +555,7 @@
r = cls.__dict__.get('__provides__')
if r is not None:
assert(r is self)
- return r
+ return r
raise AttributeError, '__provides__'
@@ -661,7 +664,7 @@
spec = getattr(self, '_specslot', self)
if spec is not self:
return spec
-
+
ob = self.ob
provides = getattr(ob, '__provides__', None)
if provides is not None:
@@ -714,11 +717,11 @@
# descriptors. We'll make sure we got one by trying to get
# the only attribute, which all specs have.
r.only
-
+
except AttributeError:
# No descriptor, so fall back to a plain object spec
r = ObjectSpecification(ob)
-
+
return r
def classImplementsOnly(cls, *interfaces):
@@ -876,7 +879,7 @@
return InterfaceSpecification(_gatherSpecs(class_, []))
-
+
def directlyProvidedBy(object):
"""Return the interfaces directly provided by the given object