[Zodb-checkins] CVS: Zope3/src/zope/interface -
declarations.py:1.16.12.1 pyskel.py:1.3.20.1
Sidnei da Silva
sidnei at x3ng.com.br
Wed Aug 13 10:37:26 EDT 2003
Update of /cvs-repository/Zope3/src/zope/interface
In directory cvs.zope.org:/tmp/cvs-serv28777/src/zope/interface
Modified Files:
Tag: dreamcatcher-ttwschema-branch
declarations.py pyskel.py
Log Message:
__name__-geddon. Use getName for getting the name of interfaces
=== Zope3/src/zope/interface/declarations.py 1.16 => 1.16.12.1 ===
--- Zope3/src/zope/interface/declarations.py:1.16 Mon Jun 30 12:32:46 2003
+++ Zope3/src/zope/interface/declarations.py Wed Aug 13 09:36:49 2003
@@ -96,10 +96,10 @@
>>> class C(A, B):
... pass
>>> classImplements(C, I1, I2)
- >>> [i.__name__ for i in implementedBy(C)]
+ >>> [i.getName() for i in implementedBy(C)]
['I1', 'I2', 'I3', 'I4']
>>> classImplements(C, I5)
- >>> [i.__name__ for i in implementedBy(C)]
+ >>> [i.getName() for i in implementedBy(C)]
['I1', 'I2', 'I5', 'I3', 'I4']
Instances of ``C`` provide ``I1``, ``I2``, ``I5``, and whatever interfaces
@@ -186,9 +186,9 @@
...
>>> c = C()
>>> directlyProvides(c, I4)
- >>> [i.__name__ for i in providedBy(c)]
+ >>> [i.getName() for i in providedBy(c)]
['I4', 'I31', 'I1', 'I2']
- >>> [i.__name__ for i in providedBy(c).flattened()]
+ >>> [i.getName() for i in providedBy(c).flattened()]
['I4', 'I31', 'I3', 'I1', 'I2', 'Interface']
>>> int(I1 in providedBy(c))
1
@@ -206,9 +206,9 @@
...
>>> c = D()
>>> directlyProvides(c, I4)
- >>> [i.__name__ for i in providedBy(c)]
+ >>> [i.getName() for i in providedBy(c)]
['I4', 'I5', 'I31']
- >>> [i.__name__ for i in providedBy(c).flattened()]
+ >>> [i.getName() for i in providedBy(c).flattened()]
['I4', 'I5', 'I31', 'I3', 'Interface']
>>> int(I1 in providedBy(c))
0
@@ -400,9 +400,9 @@
>>> class C:
... implements(IFoo)
... classProvides(IFooFactory)
- >>> [i.__name__ for i in C.__providedBy__]
+ >>> [i.getName() for i in C.__providedBy__]
['IFooFactory']
- >>> [i.__name__ for i in C().__providedBy__]
+ >>> [i.getName() for i in C().__providedBy__]
['IFoo']
"""
@@ -517,11 +517,11 @@
>>> spec = InterfaceSpecification(I2, I3)
>>> spec = InterfaceSpecification(I4, spec)
>>> i = iter(spec)
- >>> i.next().__name__
+ >>> i.next().getName()
'I4'
- >>> i.next().__name__
+ >>> i.next().getName()
'I2'
- >>> i.next().__name__
+ >>> i.next().getName()
'I3'
>>> list(i)
[]
@@ -546,15 +546,15 @@
>>> spec = InterfaceSpecification(I2, I3)
>>> spec = InterfaceSpecification(I4, spec)
>>> i = spec.flattened()
- >>> i.next().__name__
+ >>> i.next().getName()
'I4'
- >>> i.next().__name__
+ >>> i.next().getName()
'I2'
- >>> i.next().__name__
+ >>> i.next().getName()
'I1'
- >>> i.next().__name__
+ >>> i.next().getName()
'I3'
- >>> i.next().__name__
+ >>> i.next().getName()
'Interface'
>>> list(i)
[]
@@ -614,24 +614,24 @@
>>> class I4(I3): pass
...
>>> spec = InterfaceSpecification()
- >>> [iface.__name__ for iface in spec]
+ >>> [iface.getName() for iface in spec]
[]
- >>> [iface.__name__ for iface in spec+I1]
+ >>> [iface.getName() for iface in spec+I1]
['I1']
- >>> [iface.__name__ for iface in I1+spec]
+ >>> [iface.getName() for iface in I1+spec]
['I1']
>>> spec2 = spec
>>> spec += I1
- >>> [iface.__name__ for iface in spec]
+ >>> [iface.getName() for iface in spec]
['I1']
- >>> [iface.__name__ for iface in spec2]
+ >>> [iface.getName() for iface in spec2]
[]
>>> spec2 += InterfaceSpecification(I3, I4)
- >>> [iface.__name__ for iface in spec2]
+ >>> [iface.getName() for iface in spec2]
['I3', 'I4']
- >>> [iface.__name__ for iface in spec+spec2]
+ >>> [iface.getName() for iface in spec+spec2]
['I1', 'I3', 'I4']
- >>> [iface.__name__ for iface in spec2+spec]
+ >>> [iface.getName() for iface in spec2+spec]
['I3', 'I4', 'I1']
"""
@@ -656,22 +656,22 @@
>>> class I4(I3): pass
...
>>> spec = InterfaceSpecification()
- >>> [iface.__name__ for iface in spec]
+ >>> [iface.getName() for iface in spec]
[]
>>> spec -= I1
- >>> [iface.__name__ for iface in spec]
+ >>> [iface.getName() for iface in spec]
[]
>>> spec -= InterfaceSpecification(I1, I2)
- >>> [iface.__name__ for iface in spec]
+ >>> [iface.getName() for iface in spec]
[]
>>> spec = InterfaceSpecification(I2, I4)
- >>> [iface.__name__ for iface in spec]
+ >>> [iface.getName() for iface in spec]
['I2', 'I4']
- >>> [iface.__name__ for iface in spec - I4]
+ >>> [iface.getName() for iface in spec - I4]
['I2']
- >>> [iface.__name__ for iface in spec - I1]
+ >>> [iface.getName() for iface in spec - I1]
['I4']
- >>> [iface.__name__ for iface
+ >>> [iface.getName() for iface
... in spec - InterfaceSpecification(I3, I4)]
['I2']
@@ -776,11 +776,11 @@
...
>>> class B(A): implements(I3)
...
- >>> [i.__name__ for i in B.__implements__]
+ >>> [i.getName() for i in B.__implements__]
['I3', 'I2']
>>> b = B()
>>> directlyProvides(b, I4)
- >>> [i.__name__ for i in b.__implements__]
+ >>> [i.getName() for i in b.__implements__]
['I3', 'I2']
"""
@@ -819,7 +819,7 @@
...
>>> class C:
... classProvides(IFooFactory)
- >>> [i.__name__ for i in C.__provides__]
+ >>> [i.getName() for i in C.__provides__]
['IFooFactory']
>>> getattr(C(), '__provides__', 0)
0
@@ -866,7 +866,7 @@
>>> class C(A, B):
... pass
>>> classImplementsOnly(C, I1, I2)
- >>> [i.__name__ for i in implementedBy(C)]
+ >>> [i.getName() for i in implementedBy(C)]
['I1', 'I2']
Instances of ``C`` provide only ``I1``, ``I2``, and regardless of
@@ -988,7 +988,7 @@
... implements(I2)
>>> class C2(C1):
... implements(I3)
- >>> [i.__name__ for i in implementedBy(C2)]
+ >>> [i.getName() for i in implementedBy(C2)]
['I3', 'I2']
"""
@@ -1185,9 +1185,9 @@
>>> class C:
... implements(IFoo)
... classProvides(IFooFactory)
- >>> [i.__name__ for i in C.__providedBy__]
+ >>> [i.getName() for i in C.__providedBy__]
['IFooFactory']
- >>> [i.__name__ for i in C().__providedBy__]
+ >>> [i.getName() for i in C().__providedBy__]
['IFoo']
if equivalent to::
@@ -1200,9 +1200,9 @@
>>> class C:
... implements(IFoo)
>>> directlyProvides(C, IFooFactory)
- >>> [i.__name__ for i in C.__providedBy__]
+ >>> [i.getName() for i in C.__providedBy__]
['IFooFactory']
- >>> [i.__name__ for i in C().__providedBy__]
+ >>> [i.getName() for i in C().__providedBy__]
['IFoo']
=== Zope3/src/zope/interface/pyskel.py 1.3 => 1.3.20.1 ===
--- Zope3/src/zope/interface/pyskel.py:1.3 Thu Jun 5 17:53:28 2003
+++ Zope3/src/zope/interface/pyskel.py Wed Aug 13 09:36:49 2003
@@ -83,12 +83,12 @@
if class_name.startswith('I'):
class_name = class_name[1:]
print "from zope.interface import implements"
- print "from %s import %s" % (iface.__module__, iface.__name__)
+ print "from %s import %s" % (iface.__module__, iface.getName())
print
print "class %s:" %class_name
- print " __doc__ = %s.__doc__" % iface.__name__
+ print " __doc__ = %s.__doc__" % iface.getName()
print
- print " implements(%s)" %iface.__name__
+ print " implements(%s)" %iface.getName()
print
rskel(iface, iface, 0)
@@ -165,7 +165,7 @@
def getAttributesInOrder(interface, order):
# order is the dictionary returned from guessOrder().
# interface is a metaclass-based interface object.
- name_order = order.get(interface.__name__)
+ name_order = order.get(interface.getName())
if name_order is None:
# Something's wrong. Oh well.
More information about the Zodb-checkins
mailing list