This file is indexed.

/usr/lib/pypy/dist-packages/rawkit/util.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
""":mod:`rawkit.util` --- Utility functions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

These functions perform helpful tasks which don't really fit anywhere else such
as searching for Raw files on the disk, or checking what cameras are supported
by LibRaw.
"""

import ctypes
import os

from libraw.bindings import LibRaw
from libraw.errors import FileUnsupported


def discover(path):
    """
    Recursively search for raw files in a given directory.

    Args:
        path (str): A tree to recursively search.
    """
    file_list = []
    libraw = LibRaw()
    raw = libraw.libraw_init(0)

    for root, _, files in os.walk(path):
        for file_name in files:
            file_path = os.path.join(root, file_name).encode('ascii')
            try:
                libraw.libraw_open_file(raw, file_path)
            except FileUnsupported:
                continue
            finally:
                libraw.libraw_recycle(raw)
            file_list.append(file_path)

    libraw.libraw_close(raw)
    return file_list


def camera_list():
    """
    Return a list of cameras which are supported by the currently linked
    version of LibRaw.

    Returns:
        str array: A list of supported cameras.
    """

    libraw = LibRaw()
    libraw.libraw_cameraList.restype = ctypes.POINTER(
        ctypes.c_char_p * libraw.libraw_cameraCount()
    )
    data_pointer = libraw.libraw_cameraList()
    return [x.decode('ascii') for x in data_pointer.contents]