This file is indexed.

/usr/share/pyshared/glitch/multicontext.py is in python-glitch 0.6-3.

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
"Base class for objects that have per-context state."

class CacheEntry(object):
    def __init__(self, version, data):
        self.version = version
        self.data = data

class MultiContext(object):
    "Base class for objects that have per-context state."

    def __init__(self):
        self.version = 0

    def _context_create(self, ctx):
        "Create per-context state."
        raise NotImplementedError()

    def _context_update(self, ctx, old_data):
        "Update per-context state."
        raise NotImplementedError()

    def _context_delete(self, ctx, obj):
        "Delete per-context state."
        raise NotImplementedError()

    def context_delete(self, ctx):
        "Remove this object from the given context."

        cache = ctx.setdefault(self._context_key, {})
        entry = cache.get(self)

        if entry is not None:
            self._context_delete(ctx, entry.data)
            del cache[self]

    def context_get(self, ctx):
        """Get the instantiation of this object in the given context.

        This instantiates the object in the context if necessary.
        """

        cache = ctx.setdefault(self._context_key, {})
        entry = cache.get(self)

        if entry is not None:
            if entry.version < self.version:
                data = self._context_update(ctx, entry.data)
                entry.version = self.version
                entry.data = data
        else:
            data = self._context_create(ctx)
            entry = cache[self] = CacheEntry(self.version, data)

        return entry.data