This file is indexed.

/usr/lib/python3/dist-packages/PIL/features.py is in python3-pil 3.1.2-0ubuntu1.

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
from PIL import Image

modules = {
    "pil": "PIL._imaging",
    "tkinter": "PIL._imagingtk",
    "freetype2": "PIL._imagingft",
    "littlecms2": "PIL._imagingcms",
    "webp": "PIL._webp",
    "transp_webp": ("WEBP", "WebPDecoderBuggyAlpha")
}


def check_module(feature):
    if feature not in modules:
        raise ValueError("Unknown module %s" % feature)

    module = modules[feature]

    method_to_call = None
    if type(module) is tuple:
        module, method_to_call = module

    try:
        imported_module = __import__(module)
    except ImportError:
        # If a method is being checked, None means that
        # rather than the method failing, the module required for the method
        # failed to be imported first
        return None if method_to_call else False

    if method_to_call:
        method = getattr(imported_module, method_to_call)
        return method() is True
    else:
        return True


def get_supported_modules():
    supported_modules = []
    for feature in modules:
        if check_module(feature):
            supported_modules.append(feature)
    return supported_modules

codecs = {
    "jpg": "jpeg",
    "jpg_2000": "jpeg2k",
    "zlib": "zip",
    "libtiff": "libtiff"
}


def check_codec(feature):
    if feature not in codecs:
        raise ValueError("Unknown codec %s" % feature)

    codec = codecs[feature]

    return codec + "_encoder" in dir(Image.core)


def get_supported_codecs():
    supported_codecs = []
    for feature in codecs:
        if check_codec(feature):
            supported_codecs.append(feature)
    return supported_codecs