This file is indexed.

/usr/lib/python2.7/dist-packages/zope/schema/tests/states.py is in python-zope.schema 4.4.2-3.

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
124
125
126
127
128
129
130
##############################################################################
#
# Copyright (c) 2003 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Sample vocabulary supporting state abbreviations.
"""
from zope.schema._compat import u
from zope.interface import implementer
from zope.schema import interfaces
from zope.schema import Choice

# This table is based on information from the United States Postal Service:
# http://www.usps.com/ncsc/lookups/abbreviations.html#states
_states = {
    'AL': u('Alabama'),
    'AK': u('Alaska'),
    'AS': u('American Samoa'),
    'AZ': u('Arizona'),
    'AR': u('Arkansas'),
    'CA': u('California'),
    'CO': u('Colorado'),
    'CT': u('Connecticut'),
    'DE': u('Delaware'),
    'DC': u('District of Columbia'),
    'FM': u('Federated States of Micronesia'),
    'FL': u('Florida'),
    'GA': u('Georgia'),
    'GU': u('Guam'),
    'HI': u('Hawaii'),
    'ID': u('Idaho'),
    'IL': u('Illinois'),
    'IN': u('Indiana'),
    'IA': u('Iowa'),
    'KS': u('Kansas'),
    'KY': u('Kentucky'),
    'LA': u('Louisiana'),
    'ME': u('Maine'),
    'MH': u('Marshall Islands'),
    'MD': u('Maryland'),
    'MA': u('Massachusetts'),
    'MI': u('Michigan'),
    'MN': u('Minnesota'),
    'MS': u('Mississippi'),
    'MO': u('Missouri'),
    'MT': u('Montana'),
    'NE': u('Nebraska'),
    'NV': u('Nevada'),
    'NH': u('New Hampshire'),
    'NJ': u('New Jersey'),
    'NM': u('New Mexico'),
    'NY': u('New York'),
    'NC': u('North Carolina'),
    'ND': u('North Dakota'),
    'MP': u('Northern Mariana Islands'),
    'OH': u('Ohio'),
    'OK': u('Oklahoma'),
    'OR': u('Oregon'),
    'PW': u('Palau'),
    'PA': u('Pennsylvania'),
    'PR': u('Puerto Rico'),
    'RI': u('Rhode Island'),
    'SC': u('South Carolina'),
    'SD': u('South Dakota'),
    'TN': u('Tennessee'),
    'TX': u('Texas'),
    'UT': u('Utah'),
    'VT': u('Vermont'),
    'VI': u('Virgin Islands'),
    'VA': u('Virginia'),
    'WA': u('Washington'),
    'WV': u('West Virginia'),
    'WI': u('Wisconsin'),
    'WY': u('Wyoming'),
    }


@implementer(interfaces.ITerm)
class State(object):
    __slots__ = 'value', 'title'

    def __init__(self, value, title):
        self.value = value
        self.title = title

for v, p in _states.items():
    _states[v] = State(v, p)


class IStateVocabulary(interfaces.IVocabulary):
    """Vocabularies that support the states database conform to this."""


@implementer(IStateVocabulary)
class StateVocabulary(object):
    __slots__ = ()

    def __init__(self, object=None):
        pass

    def __contains__(self, value):
        return value in _states

    def __iter__(self):
        return iter(_states.values())

    def __len__(self):
        return len(_states)

    def getTerm(self, value):
        return _states[value]


class StateSelectionField(Choice):

    vocabulary = StateVocabulary()

    def __init__(self, **kw):
        super(StateSelectionField, self).__init__(
            vocabulary=StateSelectionField.vocabulary,
            **kw)
        self.vocabularyName = "states"