__init__.py 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. # pylint:disable=wrong-import-position,unused-import
  40. from zope.interface.interface import Interface
  41. from zope.interface.interface import _wire
  42. # Need to actually get the interface elements to implement the right interfaces
  43. _wire()
  44. del _wire
  45. from zope.interface.declarations import Declaration
  46. from zope.interface.declarations import alsoProvides
  47. from zope.interface.declarations import classImplements
  48. from zope.interface.declarations import classImplementsFirst
  49. from zope.interface.declarations import classImplementsOnly
  50. from zope.interface.declarations import classProvides
  51. from zope.interface.declarations import directlyProvidedBy
  52. from zope.interface.declarations import directlyProvides
  53. from zope.interface.declarations import implementedBy
  54. from zope.interface.declarations import implementer
  55. from zope.interface.declarations import implementer_only
  56. from zope.interface.declarations import implements
  57. from zope.interface.declarations import implementsOnly
  58. from zope.interface.declarations import moduleProvides
  59. from zope.interface.declarations import named
  60. from zope.interface.declarations import noLongerProvides
  61. from zope.interface.declarations import providedBy
  62. from zope.interface.declarations import provider
  63. from zope.interface.exceptions import Invalid
  64. from zope.interface.interface import Attribute
  65. from zope.interface.interface import interfacemethod
  66. from zope.interface.interface import invariant
  67. from zope.interface.interface import taggedValue
  68. # The following are to make spec pickles cleaner
  69. from zope.interface.declarations import Provides
  70. from zope.interface.interfaces import IInterfaceDeclaration
  71. moduleProvides(IInterfaceDeclaration)
  72. __all__ = ('Interface', 'Attribute') + tuple(IInterfaceDeclaration)
  73. assert all(k in globals() for k in __all__)