This file is indexed.

/usr/lib/python3/dist-packages/tblib-1.2.0.egg-info/PKG-INFO is in python3-tblib 1.2.0-1.

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
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
Metadata-Version: 1.1
Name: tblib
Version: 1.2.0
Summary: Traceback fiddling library. For now allows you to pickle tracebacks and raise exceptions with pickled tracebacks in different processes. This allows better error handling when running code over multiple processes (imagine multiprocessing, billiard, futures, celery etc).
Home-page: https://github.com/ionelmc/python-tblib
Author: Ionel Cristian Mărieș
Author-email: contact@ionelmc.ro
License: BSD
Description: =====
        tblib
        =====
        
        .. list-table::
            :stub-columns: 1
        
            * - docs
              - |docs|
            * - tests
              - | |travis| |appveyor| |requires|
                | |coveralls| |codecov|
                | |landscape| |scrutinizer| |codacy| |codeclimate|
            * - package
              - |version| |downloads| |wheel| |supported-versions| |supported-implementations|
        
        .. |docs| image:: https://readthedocs.org/projects/python-tblib/badge/?style=flat
            :target: https://readthedocs.org/projects/python-tblib
            :alt: Documentation Status
        
        .. |travis| image:: https://travis-ci.org/ionelmc/python-tblib.svg?branch=master
            :alt: Travis-CI Build Status
            :target: https://travis-ci.org/ionelmc/python-tblib
        
        .. |appveyor| image:: https://ci.appveyor.com/api/projects/status/github/ionelmc/python-tblib?branch=master&svg=true
            :alt: AppVeyor Build Status
            :target: https://ci.appveyor.com/project/ionelmc/python-tblib
        
        .. |requires| image:: https://requires.io/github/ionelmc/python-tblib/requirements.svg?branch=master
            :alt: Requirements Status
            :target: https://requires.io/github/ionelmc/python-tblib/requirements/?branch=master
        
        .. |coveralls| image:: https://coveralls.io/repos/ionelmc/python-tblib/badge.svg?branch=master&service=github
            :alt: Coverage Status
            :target: https://coveralls.io/r/ionelmc/python-tblib
        
        .. |codecov| image:: https://codecov.io/github/ionelmc/python-tblib/coverage.svg?branch=master
            :alt: Coverage Status
            :target: https://codecov.io/github/ionelmc/python-tblib
        
        .. |landscape| image:: https://landscape.io/github/ionelmc/python-tblib/master/landscape.svg?style=flat
            :target: https://landscape.io/github/ionelmc/python-tblib/master
            :alt: Code Quality Status
        
        .. |codacy| image:: https://img.shields.io/codacy/REPLACE_WITH_PROJECT_ID.svg?style=flat
            :target: https://www.codacy.com/app/ionelmc/python-tblib
            :alt: Codacy Code Quality Status
        
        .. |codeclimate| image:: https://codeclimate.com/github/ionelmc/python-tblib/badges/gpa.svg
           :target: https://codeclimate.com/github/ionelmc/python-tblib
           :alt: CodeClimate Quality Status
        .. |version| image:: https://img.shields.io/pypi/v/tblib.svg?style=flat
            :alt: PyPI Package latest release
            :target: https://pypi.python.org/pypi/tblib
        
        .. |downloads| image:: https://img.shields.io/pypi/dm/tblib.svg?style=flat
            :alt: PyPI Package monthly downloads
            :target: https://pypi.python.org/pypi/tblib
        
        .. |wheel| image:: https://img.shields.io/pypi/wheel/tblib.svg?style=flat
            :alt: PyPI Wheel
            :target: https://pypi.python.org/pypi/tblib
        
        .. |supported-versions| image:: https://img.shields.io/pypi/pyversions/tblib.svg?style=flat
            :alt: Supported versions
            :target: https://pypi.python.org/pypi/tblib
        
        .. |supported-implementations| image:: https://img.shields.io/pypi/implementation/tblib.svg?style=flat
            :alt: Supported implementations
            :target: https://pypi.python.org/pypi/tblib
        
        .. |scrutinizer| image:: https://img.shields.io/scrutinizer/g/ionelmc/python-tblib/master.svg?style=flat
            :alt: Scrutinizer Status
            :target: https://scrutinizer-ci.com/g/ionelmc/python-tblib/
        
        Traceback fiddling library. For now allows you to pickle tracebacks and raise exceptions with pickled tracebacks in different processes.
        This allows better error handling when running code over multiple processes (imagine multiprocessing, billiard, futures, celery etc).
        
        * Free software: BSD license
        
        Installation
        ============
        
        ::
        
            pip install tblib
        
        Documentation
        =============
        
        Pickling tracebacks
        -------------------
        
        **Note**: The traceback objects that come out are stripped of some attributes (like variables). But you'll be able to raise exceptions with
        those tracebacks or print them - that should cover 99% of the usecases.
        
        ::
        
            >>> from tblib import pickling_support
            >>> pickling_support.install()
            >>> import pickle, sys
            >>> def inner_0():
            ...     raise Exception('fail')
            ...
            >>> def inner_1():
            ...     inner_0()
            ...
            >>> def inner_2():
            ...     inner_1()
            ...
            >>> try:
            ...     inner_2()
            ... except:
            ...     s1 = pickle.dumps(sys.exc_info())
            ...
            >>> len(s1) > 1
            True
            >>> try:
            ...     inner_2()
            ... except:
            ...     s2 = pickle.dumps(sys.exc_info(), protocol=pickle.HIGHEST_PROTOCOL)
            ...
            >>> len(s2) > 1
            True
        
            >>> try:
            ...     import cPickle
            ... except ImportError:
            ...     import pickle as cPickle
            >>> try:
            ...     inner_2()
            ... except:
            ...     s3 = cPickle.dumps(sys.exc_info(), protocol=pickle.HIGHEST_PROTOCOL)
            ...
            >>> len(s3) > 1
            True
        
        Unpickling
        ----------
        
        ::
        
            >>> pickle.loads(s1)
            (<...Exception'>, Exception('fail',), <traceback object at ...>)
        
            >>> pickle.loads(s2)
            (<...Exception'>, Exception('fail',), <traceback object at ...>)
        
            >>> pickle.loads(s3)
            (<...Exception'>, Exception('fail',), <traceback object at ...>)
        
        Raising
        -------
        
        ::
        
            >>> from six import reraise
            >>> reraise(*pickle.loads(s1))
            Traceback (most recent call last):
              ...
              File "<doctest README.rst[14]>", line 1, in <module>
                reraise(*pickle.loads(s2))
              File "<doctest README.rst[8]>", line 2, in <module>
                inner_2()
              File "<doctest README.rst[5]>", line 2, in inner_2
                inner_1()
              File "<doctest README.rst[4]>", line 2, in inner_1
                inner_0()
              File "<doctest README.rst[3]>", line 2, in inner_0
                raise Exception('fail')
            Exception: fail
            >>> reraise(*pickle.loads(s2))
            Traceback (most recent call last):
              ...
              File "<doctest README.rst[14]>", line 1, in <module>
                reraise(*pickle.loads(s2))
              File "<doctest README.rst[8]>", line 2, in <module>
                inner_2()
              File "<doctest README.rst[5]>", line 2, in inner_2
                inner_1()
              File "<doctest README.rst[4]>", line 2, in inner_1
                inner_0()
              File "<doctest README.rst[3]>", line 2, in inner_0
                raise Exception('fail')
            Exception: fail
            >>> reraise(*pickle.loads(s3))
            Traceback (most recent call last):
              ...
              File "<doctest README.rst[14]>", line 1, in <module>
                reraise(*pickle.loads(s2))
              File "<doctest README.rst[8]>", line 2, in <module>
                inner_2()
              File "<doctest README.rst[5]>", line 2, in inner_2
                inner_1()
              File "<doctest README.rst[4]>", line 2, in inner_1
                inner_0()
              File "<doctest README.rst[3]>", line 2, in inner_0
                raise Exception('fail')
            Exception: fail
        
        What if we have a local stack, does it show correctly ?
        ```````````````````````````````````````````````````````
        
        Yes it does::
        
            >>> exc_info = pickle.loads(s3)
            >>> def local_0():
            ...     reraise(*exc_info)
            ...
            >>> def local_1():
            ...     local_0()
            ...
            >>> def local_2():
            ...     local_1()
            ...
            >>> local_2()
            Traceback (most recent call last):
              File "...doctest.py", line ..., in __run
                compileflags, 1) in test.globs
              File "<doctest README.rst[24]>", line 1, in <module>
                local_2()
              File "<doctest README.rst[23]>", line 2, in local_2
                local_1()
              File "<doctest README.rst[22]>", line 2, in local_1
                local_0()
              File "<doctest README.rst[21]>", line 2, in local_0
                reraise(*exc_info)
              File "<doctest README.rst[11]>", line 2, in <module>
                inner_2()
              File "<doctest README.rst[5]>", line 2, in inner_2
                inner_1()
              File "<doctest README.rst[4]>", line 2, in inner_1
                inner_0()
              File "<doctest README.rst[3]>", line 2, in inner_0
                raise Exception('fail')
            Exception: fail
        
        
        
        The tblib.Traceback object
        --------------------------
        
        It is used by the ``pickling_support``. You can use it too if you want more flexibility::
        
            >>> from tblib import Traceback
            >>> try:
            ...     inner_2()
            ... except:
            ...     et, ev, tb = sys.exc_info()
            ...     tb = Traceback(tb)
            ...     reraise(et, ev, tb.as_traceback())
            ...
            Traceback (most recent call last):
              ...
              File "<doctest README.rst[21]>", line 6, in <module>
                reraise(et, ev, tb.as_traceback())
              File "<doctest README.rst[21]>", line 2, in <module>
                inner_2()
              File "<doctest README.rst[5]>", line 2, in inner_2
                inner_1()
              File "<doctest README.rst[4]>", line 2, in inner_1
                inner_0()
              File "<doctest README.rst[3]>", line 2, in inner_0
                raise Exception('fail')
            Exception: fail
        
        
        You can use the ``to_dict`` method and the ``from_dict`` classmethod to
        convert a Traceback into and from a dictionary serializable by the stdlib
        json.JSONDecoder::
        
            >>> import json
            >>> from tblib import Traceback
            >>> from pprint import pprint
            >>> try:
            ...     inner_2()
            ... except:
            ...     et, ev, tb = sys.exc_info()
            ...     tb = Traceback(tb)
            ...     tb_dict = tb.to_dict()
            ...     pprint(tb_dict)
            {'tb_frame': {'f_code': {'co_filename': '<doctest README.rst[30]>',
                                     'co_name': '<module>'},
                          'f_globals': {'__name__': '__main__'}},
             'tb_lineno': 2,
             'tb_next': {'tb_frame': {'f_code': {'co_filename': ...
                                                 'co_name': 'inner_2'},
                                      'f_globals': {'__name__': '__main__'}},
                         'tb_lineno': 2,
                         'tb_next': {'tb_frame': {'f_code': {'co_filename': ...
                                                             'co_name': 'inner_1'},
                                                  'f_globals': {'__name__': '__main__'}},
                                     'tb_lineno': 2,
                                     'tb_next': {'tb_frame': {'f_code': {'co_filename': ...
                                                                         'co_name': 'inner_0'},
                                                              'f_globals': {'__name__': '__main__'}},
                                                 'tb_lineno': 2,
                                                 'tb_next': None}}}}
            >>> tb_json = json.dumps(tb_dict)
            >>> tb = Traceback.from_dict(json.loads(tb_json))
            >>> reraise(et, ev, tb.as_traceback())
            Traceback (most recent call last):
              ...
              File "<doctest README.rst[21]>", line 6, in <module>
                reraise(et, ev, tb.as_traceback())
              File "<doctest README.rst[21]>", line 2, in <module>
                inner_2()
              File "<doctest README.rst[5]>", line 2, in inner_2
                inner_1()
              File "<doctest README.rst[4]>", line 2, in inner_1
                inner_0()
              File "<doctest README.rst[3]>", line 2, in inner_0
                raise Exception('fail')
            Exception: fail
        
        
        
        
        Decorators
        ----------
        
        return_error
        ------------
        
        ::
        
            >>> from tblib.decorators import return_error
            >>> inner_2r = return_error(inner_2)
            >>> e = inner_2r()
            >>> e
            <tblib.decorators.Error object at ...>
            >>> e.reraise()
            Traceback (most recent call last):
              ...
              File "<doctest README.rst[26]>", line 1, in <module>
                e.reraise()
              File "...tblib...decorators.py", line 19, in reraise
                reraise(self.exc_type, self.exc_value, self.traceback)
              File "...tblib...decorators.py", line 25, in return_exceptions_wrapper
                return func(*args, **kwargs)
              File "<doctest README.rst[5]>", line 2, in inner_2
                inner_1()
              File "<doctest README.rst[4]>", line 2, in inner_1
                inner_0()
              File "<doctest README.rst[3]>", line 2, in inner_0
                raise Exception('fail')
            Exception: fail
        
        How's this useful ? Imagine you're using multiprocessing like this::
        
            >>> import traceback
            >>> from multiprocessing import Pool
            >>> from examples import func_a
            >>> if sys.version_info[:2] >= (3, 4):
            ...     import multiprocessing.pool
            ...     # Undo the fix for http://bugs.python.org/issue13831 so that we can see the effects of our change.
            ...     # because Python 3.4 will show the remote traceback (but as a string sadly)
            ...     multiprocessing.pool.ExceptionWithTraceback = lambda e, t: e
            >>> pool = Pool()
            >>> try:
            ...     for i in pool.map(func_a, range(5)):
            ...         print(i)
            ... except:
            ...     print(traceback.format_exc())
            ...
            Traceback (most recent call last):
              File "<doctest README.rst[...]>", line 2, in <module>
                for i in pool.map(func_a, range(5)):
              File "...multiprocessing...pool.py", line ..., in map
                ...
              File "...multiprocessing...pool.py", line ..., in get
                ...
            Exception: Guessing time !
            <BLANKLINE>
            >>> pool.terminate()
        
        Not very useful is it? Let's sort this out::
        
            >>> from tblib.decorators import apply_with_return_error, Error
            >>> from itertools import repeat
            >>> pool = Pool()
            >>> try:
            ...     for i in pool.map(apply_with_return_error, zip(repeat(func_a), range(5))):
            ...         if isinstance(i, Error):
            ...             i.reraise()
            ...         else:
            ...             print(i)
            ... except:
            ...     print(traceback.format_exc())
            ...
            Traceback (most recent call last):
              File "<doctest README.rst[...]>", line 4, in <module>
                i.reraise()
              File "...tblib...decorators.py", line ..., in reraise
                reraise(self.exc_type, self.exc_value, self.traceback)
              File "...tblib...decorators.py", line ..., in return_exceptions_wrapper
                return func(*args, **kwargs)
              File "...tblib...decorators.py", line ..., in apply_with_return_error
                return args[0](*args[1:])
              File "...examples.py", line 2, in func_a
                func_b()
              File "...examples.py", line 5, in func_b
                func_c()
              File "...examples.py", line 8, in func_c
                func_d()
              File "...examples.py", line 11, in func_d
                raise Exception("Guessing time !")
            Exception: Guessing time !
            <BLANKLINE>
            >>> pool.terminate()
        
        Much better !
        
        What if we have a local call stack ?
        ````````````````````````````````````
        
        ::
        
            >>> def local_0():
            ...     pool = Pool()
            ...     for i in pool.map(apply_with_return_error, zip(repeat(func_a), range(5))):
            ...         if isinstance(i, Error):
            ...             i.reraise()
            ...         else:
            ...             print(i)
            ...
            >>> def local_1():
            ...     local_0()
            ...
            >>> def local_2():
            ...     local_1()
            ...
            >>> try:
            ...     local_2()
            ... except:
            ...     print(traceback.format_exc())
            Traceback (most recent call last):
              File "<doctest README.rst[...]>", line 2, in <module>
                local_2()
              File "<doctest README.rst[...]>", line 2, in local_2
                local_1()
              File "<doctest README.rst[...]>", line 2, in local_1
                local_0()
              File "<doctest README.rst[...]>", line 5, in local_0
                i.reraise()
              File "...tblib...decorators.py", line 20, in reraise
                reraise(self.exc_type, self.exc_value, self.traceback)
              File "...tblib...decorators.py", line 27, in return_exceptions_wrapper
                return func(*args, **kwargs)
              File "...tblib...decorators.py", line 47, in apply_with_return_error
                return args[0](*args[1:])
              File "...tests...examples.py", line 2, in func_a
                func_b()
              File "...tests...examples.py", line 5, in func_b
                func_c()
              File "...tests...examples.py", line 8, in func_c
                func_d()
              File "...tests...examples.py", line 11, in func_d
                raise Exception("Guessing time !")
            Exception: Guessing time !
            <BLANKLINE>
        
        
        Credits
        =======
        
        * `mitsuhiko/jinja2 <https://github.com/mitsuhiko/jinja2>`_ for figuring a way to create traceback objects.
        
        
        Changelog
        =========
        
        1.2.0 (2015-12-18)
        ------------------
        
        * Fixed handling for tracebacks from generators and other internal improvements
          and optimizations. Contributed by DRayX in `#10 <https://github.com/ionelmc/python-tblib/issues/10>`_ 
          and `#11 <https://github.com/ionelmc/python-tblib/pull/11>`_.
        
        1.1.0 (2015-07-27)
        ------------------
        
        * Added support for Python 2.6. Contributed by Arcadiy Ivanov in 
          `#8 <https://github.com/ionelmc/python-tblib/pull/8>`_.
        
        1.0.0 (2015-03-30)
        ------------------
        
        * Added ``to_dict`` method and ``from_dict`` classmethod on Tracebacks.
          Contributed by beckjake in `#5 <https://github.com/ionelmc/python-tblib/pull/5>`_.
        
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: Unix
Classifier: Operating System :: POSIX
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Utilities