This file is indexed.

/usr/share/pyshared/geopy/geohash.py is in python-geopy 0.95.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
from geopy import Point

class Geohash(object):
    ENCODE_MAP = '0123456789bcdefghjkmnpqrstuvwxyz'
    DECODE_MAP = dict([(char, i) for i, char in enumerate(ENCODE_MAP)])

    def __init__(self, point_class=Point, precision=12):
        self.point_class = point_class
        self.precision = precision

    def encode(self, *args, **kwargs):
        precision = kwargs.pop('precision', self.precision)
        point = Point(*args, **kwargs)
        lat_min, latitude, lat_max = -90, 0, 90
        long_min, longitude, long_max = -180, 0, 180
        string = ''
        bytes = []
        odd_bit = False
        for i in xrange(precision):
            byte = 0
            for bit in (16, 8, 4, 2, 1):
                if odd_bit:
                    if point.latitude >= latitude:
                        byte |= bit
                        lat_min = latitude
                    else:
                        lat_max = latitude
                    latitude = (lat_min + lat_max) / 2.
                else:
                    if point.longitude >= longitude:
                        byte |= bit
                        long_min = longitude
                    else:
                        long_max = longitude
                    longitude = (long_min + long_max) / 2.
                odd_bit = not odd_bit
            bytes.append(byte) 
        return ''.join([self.ENCODE_MAP[byte] for byte in bytes])

    def decode(self, string):
        lat_min, latitude, lat_max = -90, 0, 90
        long_min, longitude, long_max = -180, 0, 180
        odd_bit = False
        for char in string:
            try:
                byte = self.DECODE_MAP[char]
            except KeyError:
                raise ValueError("Invalid hash: unexpected character %r." % (char,))
            else:
                for bit in (16, 8, 4, 2, 1):
                    if odd_bit:
                        if byte & bit:
                            lat_min = latitude
                        else:
                            lat_max = latitude
                        latitude = (lat_min + lat_max) / 2.
                    else:
                        if byte & bit:
                            long_min = longitude
                        else:
                            long_max = longitude
                        longitude = (long_min + long_max) / 2.
                    odd_bit = not odd_bit
        point = self.point_class((latitude, longitude))
        point.error = (lat_max - latitude, long_max - longitude)
        return point