This file is indexed.

/usr/share/pyshared/shapely/iterops.py is in python-shapely 1.2.14-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
"""
Iterative forms of operations
"""

from ctypes import c_char_p, c_size_t
from shapely.geos import lgeos, PredicateError


def geos_from_geometry(geom):
    data = geom.to_wkb()
    return lgeos.GEOSGeomFromWKB_buf(
                        c_char_p(data),
                        c_size_t(len(data))
                        )


class IterOp(object):
    
    """A generating non-data descriptor.
    """
    
    def __init__(self, fn):
        self.fn = fn
    
    def __call__(self, context, iterator, value=True):
        if context._geom is None:
            raise ValueError("Null geometry supports no operations")
        for item in iterator:
            try:
                this_geom, ob = item
            except TypeError:
                this_geom = item
                ob = this_geom
            if not this_geom._geom:
                raise ValueError("Null geometry supports no operations")
            retval = self.fn(context._geom, this_geom._geom)
            if retval == 2:
                raise PredicateError(
                    "Failed to evaluate %s" % repr(self.fn))
            elif bool(retval) == value:
                yield ob


# utilities
disjoint = IterOp(lgeos.GEOSDisjoint)
touches = IterOp(lgeos.GEOSTouches)
intersects = IterOp(lgeos.GEOSIntersects)
crosses = IterOp(lgeos.GEOSCrosses)
within = IterOp(lgeos.GEOSWithin)
contains = IterOp(lgeos.GEOSContains)
overlaps = IterOp(lgeos.GEOSOverlaps)
equals = IterOp(lgeos.GEOSEquals)