This file is indexed.

/usr/lib/python2.7/dist-packages/crochet/_resultstore.py is in python-crochet 1.4.0-0ubuntu2.

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
"""
In-memory store for EventualResults.
"""

import threading

from twisted.python import log

from ._util import synchronized


class ResultStore(object):
    """
    An in-memory store for EventualResult instances.

    Each EventualResult put in the store gets a unique identifier, which can
    be used to retrieve it later. This is useful for referring to results in
    e.g. web sessions.

    EventualResults that are not retrieved by shutdown will be logged if they
    have an error result.
    """
    def __init__(self):
        self._counter = 0
        self._stored = {}
        self._lock = threading.Lock()

    @synchronized
    def store(self, deferred_result):
        """
        Store a EventualResult.

        Return an integer, a unique identifier that can be used to retrieve
        the object.
        """
        self._counter += 1
        self._stored[self._counter] = deferred_result
        return self._counter

    @synchronized
    def retrieve(self, result_id):
        """
        Return the given EventualResult, and remove it from the store.
        """
        return self._stored.pop(result_id)

    @synchronized
    def log_errors(self):
        """
        Log errors for all stored EventualResults that have error results.
        """
        for result in self._stored.values():
            failure = result.original_failure()
            if failure is not None:
                log.err(failure, "Unhandled error in stashed EventualResult:")