/usr/lib/python2.7/dist-packages/shapely/iterops.py is in python-shapely 1.5.13-1build1.
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 | """
Iterative forms of operations
"""
from shapely.geos import PredicateError
from shapely.topology import Delegating
class IterOp(Delegating):
"""A generating non-data descriptor.
"""
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")
try:
retval = self.fn(context._geom, this_geom._geom)
except Exception as err:
self._check_topology(err, context, this_geom)
if bool(retval) == value:
yield ob
# utilities
disjoint = IterOp('disjoint')
touches = IterOp('touches')
intersects = IterOp('intersects')
crosses = IterOp('crosses')
within = IterOp('within')
contains = IterOp('contains')
overlaps = IterOp('overlaps')
equals = IterOp('equals')
|