This file is indexed.

/usr/lib/pypy/dist-packages/libraw/callbacks.py is in pypy-rawkit 0.6.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
""":mod:`libraw.callbacks` --- LibRaw callback definitions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Warning:

    You will need to keep a reference to your callback functions for as long as
    you want to call them from C code, otherwise they may be garbage collected
    and lead to a segmentation fault.
"""

from ctypes import *  # noqa

memory_callback = CFUNCTYPE(c_void_p, c_char_p, c_char_p)
"""
Creates a callback for use when there are memory errors in LibRaw.

.. sourcecode:: python

    def memory_cb(data, file, where):
        pass

    cb = memory_callback(memory_cb)

    libraw.libraw_set_memerror_handler(libraw_data, cb, data)

Your callback function should map to the LibRaw C callback definition below:

.. sourcecode:: c

    typedef void (*memory_callback) (
        void *data, const char *file, const char *where
    );

Args:
    callback (function): The Python function to convert to a C callback.

Returns:
    _ctypes.PyCFuncPtrType: A C callback.
"""

data_callback = CFUNCTYPE(c_void_p, c_char_p, c_int)
"""
A callback for use when there are data errors in LibRaw.

.. sourcecode:: python

    def data_cb(data, file, offset):
        pass

    cb = data_callback(data_cb)

    libraw.libraw_set_dataerror_handler(libraw_data, cb, data)

Your callback function should map to the LibRaw C callback definition below:

.. sourcecode:: c

    typedef void (*data_callback) (
        void *data, const char *file, const int offset
    );

Args:
    callback (function): The Python function to convert to a C callback.

Returns:
    _ctypes.PyCFuncPtrType: A C callback.
"""

progress_callback = CFUNCTYPE(c_void_p, c_int, c_int, c_int)
"""
A callback that will be called to alert you to the stages of image processing.

.. sourcecode:: python

    def progress_cb(data, stage, iteration, expected):
        pass

    cb = progress_callback(progress_cb)

    libraw.libraw_set_progress_handler(libraw_data, cb, data)

Your callback function should map to the LibRaw C callback definition below:

.. sourcecode:: c

    typedef void (*progress_callback) (
        void *data, enum LibRaw_progress stage, int iterationa, int expected
    );

Args:
    callback (function): The Python function to convert to a C callback.

Returns:
    _ctypes.PyCFuncPtrType: A C callback.
"""