This file is indexed.

/usr/lib/python3/dist-packages/gphoto2cffi/errors.py is in python3-gphoto2cffi 0.3~a1-1build1.

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
def error_from_code(errcode):
    from .backend import ffi, lib
    if errcode == lib.GP_ERROR_CORRUPTED_DATA:
        return CameraIOError(errcode, "Corrupted data received.")
    elif errcode == lib.GP_ERROR_FILE_EXISTS:
        return CameraIOError(errcode, "File already exists.")
    elif errcode == lib.GP_ERROR_FILE_NOT_FOUND:
        return CameraIOError(errcode, "File not found.")
    elif errcode == lib.GP_ERROR_DIRECTORY_NOT_FOUND:
        return CameraIOError(errcode, "Directory not found.")
    elif errcode == lib.GP_ERROR_DIRECTORY_EXISTS:
        return CameraIOError(errcode, "Directory already exists.")
    elif errcode == lib.GP_ERROR_NO_SPACE:
        return CameraIOError(errcode, "Not enough space.")
    elif errcode == lib.GP_ERROR_MODEL_NOT_FOUND:
        return UnsupportedDevice(errcode)
    elif errcode == lib.GP_ERROR_CAMERA_BUSY:
        return CameraBusy(errcode)
    elif errcode == lib.GP_ERROR_PATH_NOT_ABSOLUTE:
        return ValueError("Specified path is not absolute.")
    elif errcode == lib.GP_ERROR_CANCEL:
        return OperationCancelled(errcode)
    elif errcode == lib.GP_ERROR_CAMERA_ERROR:
        return CameraError(errcode, "Unspecified camera error.")
    elif errcode == lib.GP_ERROR_OS_FAILURE:
        return OSError("Unspecified failure of the operation system.")
    else:
        return GPhoto2Error(errcode,
                            ffi.string(lib.gp_result_as_string(errcode)))


class GPhoto2Error(Exception):
    def __init__(self, errcode=None, message=None):
        """ Generic exception type for all errors that originate in libgphoto2.

        Converts libgphoto2 error codes to their human readable message.

        :param errcode:     The libgphoto2 error code
        """
        self.error_code = errcode
        if message:
            super(GPhoto2Error, self).__init__(message)


class CameraIOError(GPhoto2Error, IOError):
    """ IOError on the camera itself. """
    pass


class UnsupportedDevice(GPhoto2Error):
    """ Specified camera model was not found.

    The specified model could not be found. This error is reported when the
    user specified a model that does not seem to be supported by any driver.
    """
    pass


class CameraBusy(GPhoto2Error):
    """ The camera is already busy.

    Camera I/O or a command is in progress.
    """
    pass


class OperationCancelled(GPhoto2Error):
    """ Cancellation successful.

    A cancellation requestion by the frontend via progress callback and
    GP_CONTEXT_FEEDBACK_CANCEL was successful and the transfer has been
    aborted.
    """
    pass


class CameraError(GPhoto2Error):
    """ Unspecified camera error

    The camera reported some kind of error. This can be either a photographic
    error, such as failure to autofocus, underexposure, or violating storage
    permission, anything else that stops the camera from performing the
    operation.
    """
    pass