This file is indexed.

/usr/lib/python2.7/dist-packages/nibabel/tripwire.py is in python-nibabel 2.0.2-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
""" Class to raise error for missing modules or other misfortunes
"""


class TripWireError(AttributeError):
    """ Exception if trying to use TripWire object """
    # Has to be subclass of AttributeError, to work round Python 3.5 inspection
    # for doctests.  Python 3.5 looks for a ``__wrapped__`` attribute during
    # initialization of doctests, and only allows AttributeError as signal this
    # is not present.


def is_tripwire(obj):
    """ Returns True if `obj` appears to be a TripWire object

    Examples
    --------
    >>> is_tripwire(object())
    False
    >>> is_tripwire(TripWire('some message'))
    True
    """
    try:
        obj.any_attribute
    except TripWireError:
        return True
    except:
        pass
    return False


class TripWire(object):
    """ Class raising error if used

    Standard use is to proxy modules that we could not import

    Examples
    --------
    >>> a_module = TripWire('We do not have a_module')
    >>> a_module.do_silly_thing('with silly string') #doctest: +IGNORE_EXCEPTION_DETAIL
    Traceback (most recent call last):
        ...
    TripWireError: We do not have a_module
    """
    def __init__(self, msg):
        self._msg = msg

    def __getattr__(self, attr_name):
        ''' Raise informative error accessing attributes '''
        raise TripWireError(self._msg)