This file is indexed.

/usr/lib/python2.7/dist-packages/HTMLgen/ImagePaletteH.py is in python-htmlgen 2.2.2-12.1ubuntu1.

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
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#
# The Python Imaging Library.
# $Id: ImagePalette.py,v 1.1 1998/05/14 21:34:58 friedric Exp friedric $
#
# image palette object
#
# History:
#	96-03-11 fl	Rewritten.
#	97-01-03 fl	Up and running.
#	97-08-23 fl	Added load hack
#
# Copyright (c) Secret Labs AB 1997.
# Copyright (c) Fredrik Lundh 1996-97.
#
# See the README file for information on usage and redistribution.
#
try:
    import array
    jpython = 0
except ImportError:
    import jarray
    jpython = 1
import ImageH

class ImagePalette:
    "Colour palette for palette mapped images"

    def __init__(self, mode = "RGB", palette = None):
        self.mode = mode
        self.palette = palette or range(256)*len(self.mode)
	if len(self.mode)*256 != len(self.palette):
	    raise ValueError, "wrong palette size"

    def tostring(self):
        if jpython == 0:
            return array.array("b", self.palette).tostring()
        else:
            return jarray.array(self.palette, "b").tostring()


    def save(self, fp):
        if type(fp) == type(""):
	    fp = open(fp, "w")
	fp.write("# Palette\n")
	fp.write("# Mode: %s\n" % self.mode)
	for i in range(256):
	    fp.write("%d" % i)
	    for j in range(i, len(self.palette), 256):
	        fp.write(" %d" % self.palette[j])
	    fp.write("\n")
        fp.close()

# --------------------------------------------------------------------
# Internal

class raw:
    def __init__(self, rawmode, data):
	self.rawmode = rawmode
	self.data = data

# --------------------------------------------------------------------
# Factories

def new(mode, data):
    ImageH.core.new_palette(mode, data)

def negative(mode = "RGB"):
    palette = range(256)
    palette.reverse()
    return ImagePalette(mode, palette * len(mode))

def random(mode = "RGB"):
    from random import randint
    palette = map(lambda a: randint(0, 255), [0]*256*len(mode))
    return ImagePalette(mode, palette)

def wedge(mode = "RGB"):
    return ImagePalette(mode, range(256) * len(mode))

def load(filename):

    # FIXME: supports GIMP gradients only

    fp = open(filename, "rb")

    lut = None

    if not lut:
        try:
            import GimpPaletteFile
            fp.seek(0)
            p = GimpPaletteFile.GimpPaletteFile(fp)
            lut = p.getpalette()
        except (SyntaxError, ValueError):
            pass

    if not lut:
        try:
            import GimpGradientFile
            fp.seek(0)
            p = GimpGradientFile.GimpGradientFile(fp)
            lut = p.getpalette()
        except (SyntaxError, ValueError):
            pass

    if not lut:
        try:
            import PaletteFile
            fp.seek(0)
            p = PaletteFile.PaletteFile(fp)
            lut = p.getpalette()
        except (SyntaxError, ValueError):
            pass

    if not lut:
        raise IOError, "cannot load palette"

    return lut # data, rawmode


# add some psuedocolour palettes as well