This file is indexed.

/usr/share/pyshared/grokcore/component/components.py is in python-grokcore.component 2.5-0ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
##############################################################################
#
# Copyright (c) 2006-2007 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Grok components"""

from zope.interface import implements

from grokcore.component.interfaces import IContext


class Adapter(object):
    """Base class for an adapter that adapts a single object (commonly referred
    to as the *context*).

    Use the ``context`` directive to specify which object to adapt and the
    ``implements`` directive to specify which interface the adapter will
    provide. If it's a named adapter, you may use the ``name`` directive to
    specify the name.

    .. attribute:: context

       The adapted object.

    """

    def __init__(self, context):
        self.context = context


class MultiAdapter(object):
    """Base class for an adapter that adapts *n* objects (where *n>=1*).

    Use the ``adapts`` directive to specify which kinds of objects are adapted
    and the ``implements`` directive to specify which interface the adapter
    will provide. If it's a named multi-adapter, you may use the ``name``
    directive to specify the name.

    Note that contrary to the Adapter, the MultiAdapter base class does not
    provide an `__init__` method. An `__init__` needs to accept the same number
    of arguments as are used in the `adapts` directive.

    """
    pass


class GlobalUtility(object):
    """Base class to define a globally registered utility.

    Base class for a globally registered utility. Unless you use the ``direct``
    directive to indicate that the class itself should be registered as a
    utility, the class will automatically be instantiated, therefore the
    constructor may not take any arguments. Use the ``implements`` directive to
    specify which interface the utility provides, or if that is not
    unambiguous, also use the ``provides`` directive to specify which of the
    implemented interfaces should be used when registering the utility. If it's
    a named utility, you may use the ``name`` directive to specify the name.

    """
    pass


class Subscription(object):
    """Base class for a subscription adapter.

    Subscriptions are similar to adapters, except that it is possible to
    register multiple unnamed subscriptions for identical ``context`` and
    ``provides``.

    Use the ``context`` directive to explicitly set the interface to adapt
    from. When omitted the current context is assumed. Use the ``implements``
    directive to specify which interface the subscription provides, or if that
    is not unambiguous, also use the ``provides`` directive to specify which of
    the implemented interfaces should be used when registering the subscription.

    """

    def __init__(self, context):
        self.context = context


class MultiSubscription(object):
    """Base class for a subscription multi-adapter.

    MultiSubscriptions are similar to multi adapters, except that it is
    possible to register multiple unnamed subscriptions for identical
    ``adapts`` and ``provides``.

    Use the ``adapts`` directive to explicitly set the multiple interfaces to
    adapt from. Use the ``implements`` directive to specify which interface the
    subscription provides, or if that is not unambiguous, also use the
    ``provides`` directive to specify which of the implemented interfaces
    should be used when registering the multi subscription.

    """


class Context(object):
    """Subclasses of this will automatically be found as potential contexts for
    adapters and other types of context-dependent components.

    """
    implements(IContext)