__init__.py 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. ##############################################################################
  2. #
  3. # Copyright (c) 2001, 2002 Zope Foundation and Contributors.
  4. # All Rights Reserved.
  5. #
  6. # This software is subject to the provisions of the Zope Public License,
  7. # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
  8. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
  9. # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  10. # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
  11. # FOR A PARTICULAR PURPOSE.
  12. #
  13. ##############################################################################
  14. """Interfaces
  15. This package implements the Python "scarecrow" proposal.
  16. The package exports two objects, `Interface` and `Attribute` directly. It also
  17. exports several helper methods. Interface is used to create an interface with
  18. a class statement, as in:
  19. class IMyInterface(Interface):
  20. '''Interface documentation
  21. '''
  22. def meth(arg1, arg2):
  23. '''Documentation for meth
  24. '''
  25. # Note that there is no self argument
  26. To find out what you can do with interfaces, see the interface
  27. interface, `IInterface` in the `interfaces` module.
  28. The package has several public modules:
  29. o `declarations` provides utilities to declare interfaces on objects. It
  30. also provides a wide range of helpful utilities that aid in managing
  31. declared interfaces. Most of its public names are however imported here.
  32. o `document` has a utility for documenting an interface as structured text.
  33. o `exceptions` has the interface-defined exceptions
  34. o `interfaces` contains a list of all public interfaces for this package.
  35. o `verify` has utilities for verifying implementations of interfaces.
  36. See the module doc strings for more information.
  37. """
  38. __docformat__ = 'restructuredtext'
  39. from zope.interface.interface import Interface
  40. from zope.interface.interface import _wire
  41. # Need to actually get the interface elements to implement the right interfaces
  42. _wire()
  43. del _wire
  44. from zope.interface.declarations import Declaration
  45. from zope.interface.declarations import alsoProvides
  46. from zope.interface.declarations import classImplements
  47. from zope.interface.declarations import classImplementsOnly
  48. from zope.interface.declarations import classProvides
  49. from zope.interface.declarations import directlyProvidedBy
  50. from zope.interface.declarations import directlyProvides
  51. from zope.interface.declarations import implementedBy
  52. from zope.interface.declarations import implementer
  53. from zope.interface.declarations import implementer_only
  54. from zope.interface.declarations import implements
  55. from zope.interface.declarations import implementsOnly
  56. from zope.interface.declarations import moduleProvides
  57. from zope.interface.declarations import named
  58. from zope.interface.declarations import noLongerProvides
  59. from zope.interface.declarations import providedBy
  60. from zope.interface.declarations import provider
  61. from zope.interface.exceptions import Invalid
  62. from zope.interface.interface import Attribute
  63. from zope.interface.interface import invariant
  64. from zope.interface.interface import taggedValue
  65. # The following are to make spec pickles cleaner
  66. from zope.interface.declarations import Provides
  67. from zope.interface.interfaces import IInterfaceDeclaration
  68. moduleProvides(IInterfaceDeclaration)
  69. __all__ = ('Interface', 'Attribute') + tuple(IInterfaceDeclaration)