This file is indexed.

/usr/share/pyshared/guiqwt/tests/polygons.py is in python-guiqwt 2.3.1-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
# -*- coding: utf-8 -*-
#
# Copyright © 2011 CEA
# Ludovic Aubry
# Licensed under the terms of the CECILL License
# (see guiqwt/__init__.py for details)

"""PolygonMapItem test

PolygonMapItem is intended to display maps ie items containing
several hundreds of independent polygons.
"""

from __future__ import print_function

SHOW = True # Show test in GUI-based test launcher

from guiqwt.plot import ImageDialog
from guiqwt.curve import PolygonMapItem

from numpy.random import rand, randint
from numpy import (concatenate, linspace, int32, uint32, zeros, empty,
                   pi, cos, sin)


# Create a sample dataset consisting of tesselated circles randomly placed
# in a box
RMAX=.5
XMAX=YMAX=10.
NSEGMIN=4
NSEGMAX=300

def create_circle():
    x, y, rmax = rand(3)
    rmax*=RMAX
    x*=XMAX
    y*=YMAX
    nseg = randint(NSEGMIN, NSEGMAX)
    th = linspace(0, 2*pi, nseg)
    PTS = empty( (nseg, 2), float)
    PTS[:, 0] = x+rmax*cos(th)
    PTS[:, 1] = y+rmax*sin(th)
    return PTS

NCIRC=1000
COLORS=[
    (0xff000000, 0x8000ff00),
    (0xff0000ff, 0x800000ff),
    (0xff000000, 0x80ff0000),
    (0xff00ff00, 0x80000000),
]


def test():
    win = ImageDialog(edit=True, toolbar=True,
                      wintitle="Sample multi-polygon item")
    plot = win.get_plot()
    plot.set_aspect_ratio(lock=True)
    plot.set_antialiasing(False)
    plot.set_axis_direction('left', False)
    plot.set_axis_title("bottom", "Lon")
    plot.set_axis_title("left", "Lat")
    
    points = []
    offsets = zeros( (NCIRC, 2), int32)
    colors = zeros( (NCIRC, 2), uint32)
    npts = 0
    for k in range(NCIRC):
        pts = create_circle()
        offsets[k, 0] = k
        offsets[k, 1] = npts
        npts += pts.shape[0]
        points.append(pts)
        colors[k, 0] = COLORS[k%len(COLORS)][0]
        colors[k, 1] = COLORS[(3*k)%len(COLORS)][1]
    points = concatenate(points)
    
    print(NCIRC, "Polygons")
    print(points.shape[0], "Points")
    
    crv = PolygonMapItem()
    crv.set_data(points, offsets, colors)
    plot.add_item(crv, z=0)
    win.show()
    win.exec_()

if __name__ == '__main__':
    import guidata
    app = guidata.qapplication()
    test()