This file is indexed.

/usr/lib/python2.7/dist-packages/pykka/gevent.py is in python-pykka 1.2.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
from __future__ import absolute_import

import sys as _sys

import gevent as _gevent
import gevent.event as _gevent_event
import gevent.queue as _gevent_queue

from pykka import Timeout as _Timeout
from pykka.actor import Actor as _Actor
from pykka.future import Future as _Future


class GeventFuture(_Future):
    """
    :class:`GeventFuture` implements :class:`pykka.Future` for use with
    :class:`GeventActor`.

    It encapsulates a :class:`gevent.event.AsyncResult` object which may be
    used directly, though it will couple your code with gevent.
    """

    #: The encapsulated :class:`gevent.event.AsyncResult`
    async_result = None

    def __init__(self, async_result=None):
        super(GeventFuture, self).__init__()
        if async_result is not None:
            self.async_result = async_result
        else:
            self.async_result = _gevent_event.AsyncResult()

    def get(self, timeout=None):
        try:
            return super(GeventFuture, self).get(timeout=timeout)
        except NotImplementedError:
            pass

        try:
            return self.async_result.get(timeout=timeout)
        except _gevent.Timeout as e:
            raise _Timeout(e)

    def set(self, value=None):
        assert not self.async_result.ready(), 'value has already been set'
        self.async_result.set(value)

    def set_exception(self, exc_info=None):
        if isinstance(exc_info, BaseException):
            exception = exc_info
        else:
            exc_info = exc_info or _sys.exc_info()
            exception = exc_info[1]
        self.async_result.set_exception(exception)


class GeventActor(_Actor):
    """
    :class:`GeventActor` implements :class:`pykka.Actor` using the `gevent
    <http://www.gevent.org/>`_ library. gevent is a coroutine-based Python
    networking library that uses greenlet to provide a high-level synchronous
    API on top of libevent event loop.

    This is a very fast implementation, but as of gevent 0.13.x it does not
    work in combination with other threads.
    """

    @staticmethod
    def _create_actor_inbox():
        return _gevent_queue.Queue()

    @staticmethod
    def _create_future():
        return GeventFuture()

    def _start_actor_loop(self):
        _gevent.Greenlet.spawn(self._actor_loop)