This file is indexed.

/usr/share/pyshared/pyvtk/PolyData.py is in python-pyvtk 0.4.74-3build1.

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
122
123
#!/usr/bin/env python
"""
PolyData
"""
"""

Copyright 2001 Pearu Peterson all rights reserved,
Pearu Peterson <pearu@ioc.ee>          
Permission to use, modify, and distribute this software is given under the
terms of the LGPL.  See http://www.fsf.org

NO WARRANTY IS EXPRESSED OR IMPLIED.  USE AT YOUR OWN RISK.
$Revision: 1.6 $
$Date: 2002-11-19 20:40:11 $
Pearu Peterson
"""

import DataSet
import common

class PolyData(DataSet.DataSet):
    """
    Usage:
      PolyData(<sequence of 3-tuples of points>,
               vertices = <sequence of sequences>
               lines = <sequence of sequences>,
               polygons = <sequence of sequences>
               triangle_strips = <sequence of sequences>,
               )
    Attributes:
      points
      vertices
      lines
      polygons
      triangle_strips
    Public methods:
      get_size()
      get_cell_size()
      to_string(format = 'ascii')
      get_points()
      <DataSetAttr class>(...)
    """

    def __init__(self,points,
                 vertices=[],lines=[],polygons=[],triangle_strips=[]):
        self.points = self.get_3_tuple_list(points,(0,0,0))
        self.vertices = self.get_seq_seq(vertices,[])
        self.lines = self.get_seq_seq(lines,[])
        self.polygons = self.get_seq_seq(polygons,[])
        self.triangle_strips = self.get_seq_seq(triangle_strips,[])
        sz = len(self.points)
        for k in ['vertices','lines','polygons','triangle_strips']:
            if self._check_int_seq(getattr(self,k),sz):
                raise ValueError,'%s must be (seq of seq|seq) integers less than %s'%(k,sz)

    def to_string(self, format='ascii'):
        t = self.get_datatype(self.points)
        ret = ['DATASET POLYDATA',
               'POINTS %s %s'%(self.get_size(),t),
               self.seq_to_string(self.points,format,t)]
        for k in ['vertices','lines','polygons','triangle_strips']:
            kv = getattr(self,k)
            if kv==[] or kv[0]==[]: continue
            sz = self._get_nof_objs(kv)+len(kv)
            ret += ['%s %s %s'%(k.upper(),len(kv),sz),
                    self.seq_to_string([[len(v)]+list(v) for v in kv],format,'int')]
        return '\n'.join(ret)

    def get_cell_size(self):
        sz = 0
        for k in ['vertices','lines','polygons','triangle_strips']:
            kv = getattr(self,k)
            if kv==[] or kv[0]==[]: continue
            sz += len(kv)
        return sz

    def get_points(self):
        return self.points

def polydata_fromfile(f,self):
    """Use VtkData(<filename>)."""
    points = []
    vertices = []
    lines = []
    polygons = []
    triangle_strips = []
    l = common._getline(f)
    k,n,datatype = [s.strip().lower() for s in l.split(' ')]
    if k!='points':
        raise ValueError, 'expected points but got %s'%(`k`)
    n = eval(n)
    assert datatype in ['bit','unsigned_char','char','unsigned_short','short','unsigned_int','int','unsigned_long','long','float','double'],`datatype`

    self.message('\tgetting %s points'%n)
    while len(points) < 3*n:
        l = common._getline(f)
        points += map(eval,l.split(' '))
    assert len(points)==3*n
    while 1:
        l = common._getline(f)
        if l is None:
            break
        sl = l.split(' ')
        k = sl[0].strip().lower()
        if k not in ['vertices','lines','polygons','triangle_strips']:
            break
        assert len(sl)==3
        n,size = map(eval,[sl[1],sl[2]])
        lst = []
        while len(lst) < size:
            l = common._getline(f)
            lst += map(eval,l.split(' '))
        assert len(lst)==size
        lst2 = []
        j = 0
        for i in range(n):
            lst2.append(lst[j+1:j+lst[j]+1])
            j += lst[j]+1
        exec '%s = lst2'%k
    return PolyData(points,vertices,lines,polygons,triangle_strips),l

if __name__ == "__main__":
    print PolyData([[1,2],[2,4],4,5.4],[[1],[0]],[],[1,2,3])