This file is indexed.

/usr/lib/python2.7/dist-packages/betamax/decorator.py is in python-betamax 0.5.1-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
import functools
import unittest

import requests

from . import recorder


def use_cassette(cassette_name, cassette_library_dir=None,
                 default_cassette_options={}, **use_cassette_kwargs):
    """Provide a Betamax-wrapped Session for convenience.

    .. versionadded:: 0.5.0

    This decorator can be used to get a plain Session that has been wrapped in
    Betamax. For example,

    .. code-block:: python

        from betamax.decorator import use_cassette

        @use_cassette('example-decorator', cassette_library_dir='.')
        def test_get(session):
            # do things with session

    :param str cassette_name:
        Name of the cassette file in which interactions will be stored.
    :param str cassette_library_dir:
        Directory in which cassette files will be stored.
    :param dict default_cassette_options:
        Dictionary of default cassette options to set for the cassette used
        when recording these interactions.
    :param \*\*use_cassette_kwargs:
        Keyword arguments passed to :meth:`~betamax.Betamax.use_cassette`
    """
    def actual_decorator(func):
        @functools.wraps(func)
        def test_wrapper(*args, **kwargs):
            session = requests.Session()
            recr = recorder.Betamax(
                session=session,
                cassette_library_dir=cassette_library_dir,
                default_cassette_options=default_cassette_options
            )

            if args:
                fst, args = args[0], args[1:]
                if isinstance(fst, unittest.TestCase):
                    args = (fst, session) + args
                else:
                    args = (session, fst) + args
            else:
                args = (session,)

            with recr.use_cassette(cassette_name, **use_cassette_kwargs):
                func(*args, **kwargs)

        return test_wrapper
    return actual_decorator