This file is indexed.

/usr/lib/python2.7/dist-packages/pycadf/geolocation.py is in python-pycadf 0.4.1-0ubuntu1.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
 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
# -*- encoding: utf-8 -*-
#
# Copyright 2013 IBM Corp.
#
# Author: Matt Rutkowski <mrutkows@us.ibm.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

import six

from pycadf import cadftype
from pycadf import identifier

# Geolocation types can appear outside a cadf:Event record context, in these
# cases a typeURI may be used to identify the cadf:Geolocation data type.
TYPE_URI_GEOLOCATION = cadftype.CADF_VERSION_1_0_0 + 'geolocation'

GEO_KEYNAME_ID = "id"
GEO_KEYNAME_LATITUDE = "latitude"
GEO_KEYNAME_LONGITUDE = "longitude"
GEO_KEYNAME_ELEVATION = "elevation"
GEO_KEYNAME_ACCURACY = "accuracy"
GEO_KEYNAME_CITY = "city"
GEO_KEYNAME_STATE = "state"
GEO_KEYNAME_REGIONICANN = "regionICANN"
#GEO_KEYNAME_ANNOTATIONS = "annotations"

GEO_KEYNAMES = [GEO_KEYNAME_ID,
                GEO_KEYNAME_LATITUDE,
                GEO_KEYNAME_LONGITUDE,
                GEO_KEYNAME_ELEVATION,
                GEO_KEYNAME_ACCURACY,
                GEO_KEYNAME_CITY,
                GEO_KEYNAME_STATE,
                GEO_KEYNAME_REGIONICANN
                #GEO_KEYNAME_ANNOTATIONS
                ]


class Geolocation(cadftype.CADFAbstractType):

    id = cadftype.ValidatorDescriptor(GEO_KEYNAME_ID,
                                      lambda x: identifier.is_valid(x))
    # TODO(mrutkows): we may want to do more validation to make
    # sure numeric range represented by string is valid
    latitude = cadftype.ValidatorDescriptor(GEO_KEYNAME_LATITUDE,
                                            lambda x: isinstance(
                                                x, six.string_types))
    longitude = cadftype.ValidatorDescriptor(GEO_KEYNAME_LONGITUDE,
                                             lambda x: isinstance(
                                                 x, six.string_types))
    elevation = cadftype.ValidatorDescriptor(GEO_KEYNAME_ELEVATION,
                                             lambda x: isinstance(
                                                 x, six.string_types))
    accuracy = cadftype.ValidatorDescriptor(GEO_KEYNAME_ACCURACY,
                                            lambda x: isinstance(
                                                x, six.string_types))
    city = cadftype.ValidatorDescriptor(GEO_KEYNAME_CITY,
                                        lambda x: isinstance(
                                            x, six.string_types))
    state = cadftype.ValidatorDescriptor(GEO_KEYNAME_STATE,
                                         lambda x: isinstance(
                                             x, six.string_types))
    regionICANN = cadftype.ValidatorDescriptor(
        GEO_KEYNAME_REGIONICANN,
        lambda x: isinstance(x, six.string_types))

    def __init__(self, id=None, latitude=None, longitude=None,
                 elevation=None, accuracy=None, city=None, state=None,
                 regionICANN=None):

        # Geolocation.id
        if id is not None:
            setattr(self, GEO_KEYNAME_ID, id)

        # Geolocation.latitude
        if latitude is not None:
            setattr(self, GEO_KEYNAME_LATITUDE, latitude)

        # Geolocation.longitude
        if longitude is not None:
            setattr(self, GEO_KEYNAME_LONGITUDE, longitude)

        # Geolocation.elevation
        if elevation is not None:
            setattr(self, GEO_KEYNAME_ELEVATION, elevation)

        # Geolocation.accuracy
        if accuracy is not None:
            setattr(self, GEO_KEYNAME_ACCURACY, accuracy)

        # Geolocation.city
        if city is not None:
            setattr(self, GEO_KEYNAME_CITY, city)

        # Geolocation.state
        if state is not None:
            setattr(self, GEO_KEYNAME_STATE, state)

        # Geolocation.regionICANN
        if regionICANN is not None:
            setattr(self, GEO_KEYNAME_REGIONICANN, regionICANN)

    # TODO(mrutkows): add mechanism for annotations, OpenStack may choose
    # not to support this "extension mechanism" and is not required (and not
    # critical in many audit contexts)
    def set_annotations(self, value):
        raise NotImplementedError()
        # setattr(self, GEO_KEYNAME_ANNOTATIONS, value)

    # self validate cadf:Geolocation type
    def is_valid(self):
        return True