This file is indexed.

/usr/lib/python3/dist-packages/Pykka-1.2.0.egg-info is in python3-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
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
Metadata-Version: 1.1
Name: Pykka
Version: 1.2.0
Summary: Pykka is a Python implementation of the actor model
Home-page: http://www.pykka.org/
Author: Stein Magnus Jodal
Author-email: stein.magnus@jodal.no
License: Apache License, Version 2.0
Description: =====
        Pykka
        =====
        
        Pykka is a Python implementation of the `actor model
        <http://en.wikipedia.org/wiki/Actor_model>`_. The actor model introduces some
        simple rules to control the sharing of state and cooperation between execution
        units, which makes it easier to build concurrent applications.
        
        
        Rules of the actor model
        ========================
        
        - An actor is an execution unit that executes concurrently with other actors.
        
        - An actor does not share state with anybody else, but it can have its own
          state.
        
        - An actor can only communicate with other actors by sending and receiving
          messages. It can only send messages to actors whose address it has.
        
        - When an actor receives a message it may take actions like:
        
          - altering its own state, e.g. so that it can react differently to a
            future message,
          - sending messages to other actors, or
          - starting new actors.
        
          None of the actions are required, and they may be applied in any order.
        
        - An actor only processes one message at a time. In other words, a single actor
          does not give you any concurrency, and it does not need to use locks
          internally to protect its own state.
        
        
        The actor implementations
        =========================
        
        Pykka's actor API comes with the following implementations:
        
        - Threads: Each ``ThreadingActor`` is executed by a regular thread, i.e.
          ``threading.Thread``. As handles for future results, it uses
          ``ThreadingFuture`` which is a thin wrapper around a ``Queue.Queue``. It has
          no dependencies outside Python itself. ``ThreadingActor`` plays well
          together with non-actor threads.
        
          Note: If you monkey patch the standard library with ``gevent`` or
          ``eventlet`` you can still use ``ThreadingActor`` and ``ThreadingFuture``.
          Python's threads will transparently use the underlying implementation
          provided by gevent or Eventlet.
        
        - gevent: Each ``GeventActor`` is executed by a gevent greenlet. `gevent
          <http://www.gevent.org/>`_ is a coroutine-based Python networking library
          built on top of a libevent (in 0.13) or libev (in 1.0) event loop.
          ``GeventActor`` is generally faster than ``ThreadingActor``, but as of gevent
          0.13 it doesn't work in processes with other threads, which limits when it
          can be used. With gevent 1.0, which is currently available as a release
          candidate, this is no longer an issue. Pykka works with both gevent 0.13 and
          1.0.
        
        - Eventlet: Each ``EventletActor`` is executed by a Eventlet greenlet. Pykka is
          tested with Eventlet 0.12.1.
        
        Pykka has an extensive test suite, and is tested on CPython 2.6, 2.7, and 3.2+,
        as well as PyPy. gevent and eventlet are currently not available for CPython
        3.x or PyPy.
        
        
        A basic actor
        =============
        
        In its most basic form, a Pykka actor is a class with an
        ``on_receive(message)`` method::
        
            import pykka
        
            class Greeter(pykka.ThreadingActor):
                def on_receive(self, message):
                    print('Hi there!')
        
        To start an actor, you call the class' method ``start()``, which starts the
        actor and returns an actor reference which can be used to communicate with the
        running actor::
        
            actor_ref = Greeter.start()
        
        If you need to pass arguments to the actor upon creation, you can pass them to
        the ``start()`` method, and receive them using the regular ``__init__()``
        method::
        
            import pykka
        
            class Greeter(pykka.ThreadingActor):
                def __init__(self, greeting='Hi there!'):
                    super(Greeter, self).__init__()
                    self.greeting = greeting
        
                def on_receive(self, message):
                    print(self.greeting)
        
            actor_ref = Greeter.start(greeting='Hi you!')
        
        It can be useful to know that the init method is run in the execution context
        that starts the actor. There are also hooks for running code in the actor's own
        execution context when the actor starts, when it stops, and when an unhandled
        exception is raised. Check out the full API docs for the details.
        
        To stop an actor, you can either call ``stop()`` on the ``actor_ref``::
        
            actor_ref.stop()
        
        Or, if an actor wants to stop itself, it can simply do so::
        
            self.stop()
        
        Once an actor has been stopped, it cannot be restarted.
        
        
        Sending messages
        ----------------
        
        To send a message to the actor, you can either use the ``tell()`` method or the
        ``ask()`` method on the ``actor_ref`` object. ``tell()`` will fire of a message
        without waiting for an answer. In other words, it will never block. ``ask()``
        will by default block until an answer is returned, potentially forever. If you
        provide a ``timeout`` keyword argument to ``ask()``, you can specify for how
        long it should wait for an answer. If you want an answer, but don't need it
        right away because you have other stuff you can do first, you can pass
        ``block=False``, and ``ask()`` will immediately return a "future" object.
        
        The message itself must always be a dict, but you're mostly free to use
        whatever dict keys you want to.
        
        Summarized in code::
        
            actor_ref.tell({'msg': 'Hi!'})
            # => Returns nothing. Will never block.
        
            answer = actor_ref.ask({'msg': 'Hi?'})
            # => May block forever waiting for an answer
        
            answer = actor_ref.ask({'msg': 'Hi?'}, timeout=3)
            # => May wait 3s for an answer, then raises exception if no answer.
        
            future = actor_ref.ask({'msg': 'Hi?'}, block=False)
            # => Will return a future object immediately.
            answer = future.get()
            # => May block forever waiting for an answer
            answer = future.get(timeout=0.1)
            # => May wait 0.1s for an answer, then raises exception if no answer.
        
        For performance reasons, Pykka **does not** clone the dict you send before
        delivering it to the receiver. You are yourself responsible for either using
        immutable data structures or to ``copy.deepcopy()`` the data you're sending off
        to other actors.
        
        
        Replying to messages
        --------------------
        
        If a message is sent using ``actor_ref.ask()`` you can reply to the sender of
        the message by simply returning a value from ``on_receive`` method::
        
            import pykka
        
            class Greeter(pykka.ThreadingActor):
                def on_receive(self, message):
                    return 'Hi there!'
        
            actor_ref = Greeter.start()
        
            answer = actor_ref.ask('Hi?')
            print(answer)
            # => 'Hi there!'
        
        ``None`` is a valid response so if you return ``None`` explicitly, or don't
        return at all, a response containing ``None`` will be returned to the sender.
        
        From the point of view of the actor it doesn't matter whether the message was
        sent using ``actor_ref.tell()`` or ``actor_ref.ask()`` . When the sender
        doesn't expect a response the ``on_receive`` return value will be ignored.
        
        The situation is similar in regard to exceptions: when ``actor_ref.ask()`` is
        used and you raise an exception from within ``on_receive`` method it will
        propagate to the sender::
        
            import pykka
        
            class Raiser(pykka.ThreadingActor):
                def on_receive(self, message):
                    raise Exception('Oops')
        
            actor_ref = Raiser.start()
        
            try:
                actor_ref.ask('How are you?')
            except Exception as e:
                print(repr(e))
                # => Exception('Oops')
        
        
        Actor proxies
        =============
        
        With the basic building blocks provided by actors and futures, we got
        everything we need to build more advanced abstractions. Pykka provides a single
        abstraction on top of the basic actor model, named "actor proxies". You can use
        Pykka without proxies, but we've found it to be a very convenient abstraction
        when builing `Mopidy <http://www.mopidy.com/>`_.
        
        Let's create an actor and start it::
        
            import pykka
        
            class Calculator(pykka.ThreadingActor):
                def __init__(self):
                    super(Calculator, self).__init__()
                    self.last_result = None
        
                def add(self, a, b=None):
                    if b is not None:
                        self.last_result = a + b
                    else:
                        self.last_result += a
                    return self.last_result
        
                def sub(self, a, b=None):
                    if b is not None:
                        self.last_result = a - b
                    else:
                        self.last_result -= a
                    return self.last_result
        
            actor_ref = Calculator.start()
        
        You can create a proxy from any reference to a running actor::
        
            proxy = actor_ref.proxy()
        
        The proxy object will use introspection to figure out what public attributes
        and methods the actor has, and then mirror the full API of the actor. Any
        attribute or method prefixed with underscore will be ignored, which is the
        convention for keeping stuff private in Python.
        
        When we access attributes or call methods on the proxy, it will ask the actor
        to access the given attribute or call the given method, and return the result
        to us. All results are wrapped in "future" objects, so you must use the
        ``get()`` method to get the actual data::
        
            future = proxy.add(1, 3)
            future.get()
            # => 4
        
            proxy.last_result.get()
            # => 4
        
        Since an actor only processes one message at the time and all messages are kept
        in order, you don't need to add the call to ``get()`` just to block
        processing until the actor has completed processing your last message::
        
            proxy.sub(5)
            proxy.add(3)
            proxy.last_result.get()
            # => 2
        
        Since assignment doesn't return anything, it works just like on regular
        objects::
        
            proxy.last_result = 17
            proxy.last_result.get()
            # => 17
        
        Under the hood, the proxy does everything by sending messages to the actor
        using the regular ``actor_ref.ask()`` method we talked about previously.
        By doing so, it maintains the actor model restrictions. The only "magic"
        happening here is some basic introspection and automatic building of three
        different message types; one for method calls, one for attribute reads, and one
        for attribute writes.
        
        
        Traversable attributes on proxies
        ---------------------------------
        
        Sometimes you'll want to access an actor attribute's methods or attributes
        through a proxy. For this case, Pykka supports "traversable attributes". By
        marking an actor attribute as traversable, Pykka will not return the attribute
        when accessed, but wrap it in a new proxy which is returned instead.
        
        To mark an attribute as traversable, simply set the ``pykka_traversable``
        attribute to ``True``::
        
            import pykka
        
            class AnActor(pykka.ThreadingActor):
                playback = Playback()
        
            class Playback(object):
                pykka_traversable = True
        
                def play(self):
                    # ...
                    return True
        
            proxy = AnActor.start().proxy()
            play_success = proxy.playback.play().get()
        
        You can access methods and attributes nested as deep as you like, as long as
        all attributes on the path between the actor and the method or attribute on the
        end is marked as traversable.
        
        
        Examples
        ========
        
        See the ``examples/`` dir in `Pykka's Git repo
        <https://github.com/jodal/pykka/>`_ for some runnable examples.
        
        
        What Pykka is not
        =================
        
        Much of the naming of concepts and methods in Pykka is taken from the `Akka
        <http://akka.io/>`_ project which implements actors on the JVM. Though, Pykka
        does not aim to be a Python port of Akka, and supports far fewer features.
        
        Notably, Pykka **does not** support the following features:
        
        - Supervision: Linking actors, supervisors, or supervisor groups.
        
        - Remoting: Communicating with actors running on other hosts.
        
        - Routers: Pykka does not come with a set of predefined message routers, though
          you may make your own actors for routing messages.
        
        
        Installation
        ============
        
        Install Pykka's dependencies:
        
        - Python 2.6, 2.7, or 3.2+
        
        - Optionally, Python 2.6/2.7 only:
        
          - `gevent <http://www.gevent.org/>`_, if you want to use gevent based actors
            from ``pykka.gevent``.
        
          - `eventlet <http://eventlet.net/>`_, if you want to use eventlet based actors
            from ``pykka.eventlet``. Eventlet is known to work with PyPy 2.0 as well
            but Pykka is not tested with it yet.
        
        To install Pykka you can use pip::
        
            pip install pykka
        
        To upgrade your Pykka installation to the latest released version::
        
            pip install --upgrade pykka
        
        To install the latest development snapshot::
        
            pip install pykka==dev
        
        
        License
        =======
        
        Pykka is licensed under the `Apache License, Version 2.0
        <http://www.apache.org/licenses/LICENSE-2.0>`_.
        
        
        Project resources
        =================
        
        - `Documentation <http://www.pykka.org/>`_
        - `Source code <https://github.com/jodal/pykka>`_
        - `Issue tracker <https://github.com/jodal/pykka/issues>`_
        - `CI server <https://travis-ci.org/jodal/pykka>`_
        - `Download development snapshot
          <https://github.com/jodal/pykka/tarball/master#egg=pykka-dev>`_
        
        .. image:: https://travis-ci.org/jodal/pykka.png?branch=master
            :target: https://travis-ci.org/jodal/pykka
        
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Libraries