This file is indexed.

/usr/lib/python2.7/dist-packages/envisage/service.py is in python-envisage 4.1.0-2.

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
""" A trait type used to access services. """


# Standard library imports.
import logging

# Enthought library imports.
from traits.api import TraitType


# Logging.
logger = logging.getLogger(__name__)


class Service(TraitType):
    """ A trait type used to access services.

    Note that this is a trait *type* and hence does *NOT* have traits itself
    (i.e. it does *not* inherit from 'HasTraits').

    """

    ###########################################################################
    # 'object' interface.
    ###########################################################################

    def __init__(
        self, protocol=None, query='', minimize='', maximize='', **metadata
    ):
        """ Constructor. """

        super(Service, self).__init__(**metadata)

        # The protocol that the service must provide.
        self._protocol = protocol

        # The optional query.
        self._query = query

        # The optional name of the trait/property to minimize.
        self._minimize = minimize

        # The optional name of the trait/property to maximize.
        self._maximize = maximize

        return

    ###########################################################################
    # 'TraitType' interface.
    ###########################################################################

    def get(self, obj, trait_name):
        """ Trait type getter. """

        service_registry = self._get_service_registry(obj)

        obj = service_registry.get_service(
            self._protocol, self._query, self._minimize, self._maximize
        )

        return obj

    def set(self, obj, name, value):
        """ Trait type setter. """

        raise SystemError('Service traits cannot be set')

    ###########################################################################
    # Private interface.
    ###########################################################################

    def _get_service_registry(self, obj):
        """ Return the service registry in effect for an object. """

        service_registry = getattr(obj, 'service_registry', None)
        if service_registry is None:
            raise ValueError(
                'The "Service" trait type can only be used within objects ' \
                'that have a reference to a service registry via their ' \
                '"service_registry" trait. ' \
                'Object <%s> Service protocol <%s>' % (obj, self._protocol)
            )

        return service_registry

#### EOF ######################################################################