Previous topic

mmf.fit.lsq

This Page

mmf.interfaces

IArchivable() Interface for objects that suport archiving.
Interface()
Attribute(__name__[, __doc__]) Attribute descriptions ..
implements(*interfaces) Declare interfaces implemented by instances of a class

Inheritance diagram for mmf.interfaces:

Various Interfaces.

interface mmf.interfaces.IArchivable[source]

Bases: zope.interface.Interface

Interface for objects that suport archiving.

archive_1(env=None)[source]

Return (rep, args, imports).

Defines a representation rep of the instance self where the instance can be reconstructed from the string rep evaluated in the context of dict args with the specified imports = list of (module,iname,uiname) where one has either import module as uiname, from module import iname or from module import iname as uiname.

interface mmf.interfaces.Interface[source]
class mmf.interfaces.Attribute(__name__, __doc__='')[source]

Bases: zope.interface.interface.Element

Attribute descriptions

Attributes

interface

Methods

getDoc() Returns the documentation for the object.
getName() Returns the name of the object.
getTaggedValue(tag) Returns the value associated with ‘tag’.
getTaggedValueTags() Returns a list of all tags.
queryTaggedValue(tag[, default]) Returns the value associated with ‘tag’.
setTaggedValue(tag, value) Associates ‘value’ with ‘key’.

Create an ‘attribute’ description

Attributes

interface

Methods

getDoc() Returns the documentation for the object.
getName() Returns the name of the object.
getTaggedValue(tag) Returns the value associated with ‘tag’.
getTaggedValueTags() Returns a list of all tags.
queryTaggedValue(tag[, default]) Returns the value associated with ‘tag’.
setTaggedValue(tag, value) Associates ‘value’ with ‘key’.
__init__(__name__, __doc__='')[source]

Create an ‘attribute’ description

interface = None
mmf.interfaces.implements(*interfaces)[source]

Declare interfaces implemented by instances of a class

This function is called in a class definition.

The arguments are one or more interfaces or interface specifications (IDeclaration objects).

The interfaces given (including the interfaces in the specifications) are added to any interfaces previously declared.

Previous declarations include declarations for base classes unless implementsOnly was used.

This function is provided for convenience. It provides a more convenient way to call classImplements. For example:

implements(I1)

is equivalent to calling:

classImplements(C, I1)

after the class has been created.

Consider the following example:

>>> from zope.interface import Interface
>>> class IA1(Interface): pass
...
>>> class IA2(Interface): pass
...
>>> class IB(Interface): pass
...
>>> class IC(Interface): pass
...
>>> class A(object):
...     implements(IA1, IA2)
>>> class B(object):
...     implements(IB)

>>> class C(A, B):
...    implements(IC)

>>> ob = C()
>>> int(IA1 in providedBy(ob))
1
>>> int(IA2 in providedBy(ob))
1
>>> int(IB in providedBy(ob))
1
>>> int(IC in providedBy(ob))
1

Instances of C implement I1, I2, and whatever interfaces instances of A and B implement.