This file is indexed.

/usr/share/pyshared/brian/base.py is in python-brian 1.4.1-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
'''
Various base classes for Brian
'''

__all__ = ['ObjectContainer']


class ObjectContainer(object):
    '''
    Implements the contained_objects protocol
    
    The object contains an attribute _contained_objects and
    a property contained_objects whose getter just returns
    _contained_objects or an empty list, and whose setter
    appends _contained_objects with the objects. This makes
    classes which set the value of contained_objects without
    thinking about things like inheritance work correctly.
    You can still directly manipulate _contained_objects
    or do something like::
    
        co = obj.contained_objects
        co[:] = []
        
    Note that when extending the list, duplicate objects are removed.
    '''
    def get_contained_objects(self):
        if hasattr(self, '_contained_objects'):
            return self._contained_objects
        self._contained_objects = []
        return self._contained_objects

    def set_contained_objects(self, newobjs):
        self._contained_objects = self.get_contained_objects()
        ids = set(id(o) for o in self._contained_objects)
        newobjs = [o for o in newobjs if id(o) not in ids]
        self._contained_objects.extend(newobjs)

    contained_objects = property(fget=get_contained_objects,
                                 fset=set_contained_objects)

if __name__ == '__main__':
    from brian import *

    class A(NetworkOperation):
        def __init__(self):
            x = NetworkOperation(lambda:None)
            print 'A:', id(x)
            self.contained_objects = [x]

    class B(A):
        def __init__(self):
            super(B, self).__init__()
            x = NetworkOperation(lambda:None)
            print 'B:', id(x)
            self.contained_objects = [x]

    b = B()
    print map(id, b.contained_objects)