pygeoip.const

Package pygeoip :: Module const |
[frames] | no frames]

# Source Code for Module pygeoip.const

      1  # -*- coding: utf-8 -*-
      2  """
      3  Constants for the database parser
      4
      5  @author: Jennifer Ennis <zaylea@gmail.com>
      6  @author: William Tisäter <william@defunct.cc>
      7
      8  @license: Copyright(C) 2004 MaxMind LLC
      9
     10  This program is free software: you can redistribute it and/or modify
     11  it under the terms of the GNU Lesser General Public License as published by
     12  the Free Software Foundation, either version 3 of the License, or
     13  (at your option) any later version.
     14
     15  This program is distributed in the hope that it will be useful,
     16  but WITHOUT ANY WARRANTY; without even the implied warranty of
     17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     18  GNU General Public License for more details.
     19
     20  You should have received a copy of the GNU Lesser General Public License
     21  along with this program.  If not, see <http://www.gnu.org/licenses/lgpl.txt>.
     22  """
     23
     24  from platform import python_version_tuple
     25
     26  PY2 = python_version_tuple()[0] == '2'
     27  PY3 = python_version_tuple()[0] == '3'
     28
     29  GEOIP_STANDARD = 0
     30  GEOIP_MEMORY_CACHE = 1
     31
     32  DMA_MAP = {
     33      500: 'Portland-Auburn, ME',
     34      501: 'New York, NY',
     35      502: 'Binghamton, NY',
     36      503: 'Macon, GA',
     37      504: 'Philadelphia, PA',
     38      505: 'Detroit, MI',
     39      506: 'Boston, MA',
     40      507: 'Savannah, GA',
     41      508: 'Pittsburgh, PA',
     42      509: 'Ft Wayne, IN',
     43      510: 'Cleveland, OH',
     44      511: 'Washington, DC',
     45      512: 'Baltimore, MD',
     46      513: 'Flint, MI',
     47      514: 'Buffalo, NY',
     48      515: 'Cincinnati, OH',
     49      516: 'Erie, PA',
     50      517: 'Charlotte, NC',
     51      518: 'Greensboro, NC',
     52      519: 'Charleston, SC',
     53      520: 'Augusta, GA',
     54      521: 'Providence, RI',
     55      522: 'Columbus, GA',
     56      523: 'Burlington, VT',
     57      524: 'Atlanta, GA',
     58      525: 'Albany, GA',
     59      526: 'Utica-Rome, NY',
     60      527: 'Indianapolis, IN',
     61      528: 'Miami, FL',
     62      529: 'Louisville, KY',
     63      530: 'Tallahassee, FL',
     64      531: 'Tri-Cities, TN',
     65      532: 'Albany-Schenectady-Troy, NY',
     66      533: 'Hartford, CT',
     67      534: 'Orlando, FL',
     68      535: 'Columbus, OH',
     69      536: 'Youngstown-Warren, OH',
     70      537: 'Bangor, ME',
     71      538: 'Rochester, NY',
     72      539: 'Tampa, FL',
     73      540: 'Traverse City-Cadillac, MI',
     74      541: 'Lexington, KY',
     75      542: 'Dayton, OH',
     76      543: 'Springfield-Holyoke, MA',
     77      544: 'Norfolk-Portsmouth, VA',
     78      545: 'Greenville-New Bern-Washington, NC',
     79      546: 'Columbia, SC',
     80      547: 'Toledo, OH',
     81      548: 'West Palm Beach, FL',
     82      549: 'Watertown, NY',
     83      550: 'Wilmington, NC',
     84      551: 'Lansing, MI',
     85      552: 'Presque Isle, ME',
     86      553: 'Marquette, MI',
     87      554: 'Wheeling, WV',
     88      555: 'Syracuse, NY',
     89      556: 'Richmond-Petersburg, VA',
     90      557: 'Knoxville, TN',
     91      558: 'Lima, OH',
     92      559: 'Bluefield-Beckley-Oak Hill, WV',
     93      560: 'Raleigh-Durham, NC',
     94      561: 'Jacksonville, FL',
     95      563: 'Grand Rapids, MI',
     96      564: 'Charleston-Huntington, WV',
     97      565: 'Elmira, NY',
     98      566: 'Harrisburg-Lancaster-Lebanon-York, PA',
     99      567: 'Greenville-Spartenburg, SC',
    100      569: 'Harrisonburg, VA',
    101      570: 'Florence-Myrtle Beach, SC',
    102      571: 'Ft Myers, FL',
    103      573: 'Roanoke-Lynchburg, VA',
    104      574: 'Johnstown-Altoona, PA',
    105      575: 'Chattanooga, TN',
    106      576: 'Salisbury, MD',
    107      577: 'Wilkes Barre-Scranton, PA',
    108      581: 'Terre Haute, IN',
    109      582: 'Lafayette, IN',
    110      583: 'Alpena, MI',
    111      584: 'Charlottesville, VA',
    112      588: 'South Bend, IN',
    113      592: 'Gainesville, FL',
    114      596: 'Zanesville, OH',
    115      597: 'Parkersburg, WV',
    116      598: 'Clarksburg-Weston, WV',
    117      600: 'Corpus Christi, TX',
    118      602: 'Chicago, IL',
    119      603: 'Joplin-Pittsburg, MO',
    120      604: 'Columbia-Jefferson City, MO',
    121      605: 'Topeka, KS',
    122      606: 'Dothan, AL',
    123      609: 'St Louis, MO',
    124      610: 'Rockford, IL',
    125      611: 'Rochester-Mason City-Austin, MN',
    126      612: 'Shreveport, LA',
    127      613: 'Minneapolis-St Paul, MN',
    128      616: 'Kansas City, MO',
    129      617: 'Milwaukee, WI',
    130      618: 'Houston, TX',
    131      619: 'Springfield, MO',
    132      620: 'Tuscaloosa, AL',
    133      622: 'New Orleans, LA',
    134      623: 'Dallas-Fort Worth, TX',
    135      624: 'Sioux City, IA',
    136      625: 'Waco-Temple-Bryan, TX',
    137      626: 'Victoria, TX',
    138      627: 'Wichita Falls, TX',
    139      628: 'Monroe, LA',
    140      630: 'Birmingham, AL',
    141      631: 'Ottumwa-Kirksville, IA',
    142      632: 'Paducah, KY',
    143      633: 'Odessa-Midland, TX',
    144      634: 'Amarillo, TX',
    145      635: 'Austin, TX',
    146      636: 'Harlingen, TX',
    147      637: 'Cedar Rapids-Waterloo, IA',
    148      638: 'St Joseph, MO',
    149      639: 'Jackson, TN',
    150      640: 'Memphis, TN',
    151      641: 'San Antonio, TX',
    152      642: 'Lafayette, LA',
    153      643: 'Lake Charles, LA',
    154      644: 'Alexandria, LA',
    155      646: 'Anniston, AL',
    156      647: 'Greenwood-Greenville, MS',
    157      648: 'Champaign-Springfield-Decatur, IL',
    158      649: 'Evansville, IN',
    159      650: 'Oklahoma City, OK',
    160      651: 'Lubbock, TX',
    161      652: 'Omaha, NE',
    162      656: 'Panama City, FL',
    163      657: 'Sherman, TX',
    164      658: 'Green Bay-Appleton, WI',
    165      659: 'Nashville, TN',
    166      661: 'San Angelo, TX',
    167      662: 'Abilene-Sweetwater, TX',
    168      669: 'Madison, WI',
    169      670: 'Ft Smith-Fay-Springfield, AR',
    170      671: 'Tulsa, OK',
    171      673: 'Columbus-Tupelo-West Point, MS',
    172      675: 'Peoria-Bloomington, IL',
    173      676: 'Duluth, MN',
    174      678: 'Wichita, KS',
    175      679: 'Des Moines, IA',
    176      682: 'Davenport-Rock Island-Moline, IL',
    177      686: 'Mobile, AL',
    178      687: 'Minot-Bismarck-Dickinson, ND',
    179      691: 'Huntsville, AL',
    180      692: 'Beaumont-Port Author, TX',
    181      693: 'Little Rock-Pine Bluff, AR',
    182      698: 'Montgomery, AL',
    183      702: 'La Crosse-Eau Claire, WI',
    184      705: 'Wausau-Rhinelander, WI',
    185      709: 'Tyler-Longview, TX',
    186      710: 'Hattiesburg-Laurel, MS',
    187      711: 'Meridian, MS',
    188      716: 'Baton Rouge, LA',
    189      717: 'Quincy, IL',
    190      718: 'Jackson, MS',
    191      722: 'Lincoln-Hastings, NE',
    192      724: 'Fargo-Valley City, ND',
    193      725: 'Sioux Falls, SD',
    194      734: 'Jonesboro, AR',
    195      736: 'Bowling Green, KY',
    196      737: 'Mankato, MN',
    197      740: 'North Platte, NE',
    198      743: 'Anchorage, AK',
    199      744: 'Honolulu, HI',
    200      745: 'Fairbanks, AK',
    201      746: 'Biloxi-Gulfport, MS',
    202      747: 'Juneau, AK',
    203      749: 'Laredo, TX',
    204      751: 'Denver, CO',
    205      752: 'Colorado Springs, CO',
    206      753: 'Phoenix, AZ',
    207      754: 'Butte-Bozeman, MT',
    208      755: 'Great Falls, MT',
    209      756: 'Billings, MT',
    210      757: 'Boise, ID',
    211      758: 'Idaho Falls-Pocatello, ID',
    212      759: 'Cheyenne, WY',
    213      760: 'Twin Falls, ID',
    214      762: 'Missoula, MT',
    215      764: 'Rapid City, SD',
    216      765: 'El Paso, TX',
    217      766: 'Helena, MT',
    218      767: 'Casper-Riverton, WY',
    219      770: 'Salt Lake City, UT',
    220      771: 'Yuma, AZ',
    221      773: 'Grand Junction, CO',
    222      789: 'Tucson, AZ',
    223      790: 'Albuquerque, NM',
    224      798: 'Glendive, MT',
    225      800: 'Bakersfield, CA',
    226      801: 'Eugene, OR',
    227      802: 'Eureka, CA',
    228      803: 'Los Angeles, CA',
    229      804: 'Palm Springs, CA',
    230      807: 'San Francisco, CA',
    231      810: 'Yakima-Pasco, WA',
    232      811: 'Reno, NV',
    233      813: 'Medford-Klamath Falls, OR',
    234      819: 'Seattle-Tacoma, WA',
    235      820: 'Portland, OR',
    236      821: 'Bend, OR',
    237      825: 'San Diego, CA',
    238      828: 'Monterey-Salinas, CA',
    239      839: 'Las Vegas, NV',
    240      855: 'Santa Barbara, CA',
    241      862: 'Sacramento, CA',
    242      866: 'Fresno, CA',
    243      868: 'Chico-Redding, CA',
    244      881: 'Spokane, WA'
    245  }
    246
    247  COUNTRY_CODES = (
    248      '',
    249      'AP', 'EU', 'AD', 'AE', 'AF', 'AG', 'AI', 'AL', 'AM', 'AN', 'AO', 'AQ',
    250      'AR', 'AS', 'AT', 'AU', 'AW', 'AZ', 'BA', 'BB', 'BD', 'BE', 'BF', 'BG',
    251      'BH', 'BI', 'BJ', 'BM', 'BN', 'BO', 'BR', 'BS', 'BT', 'BV', 'BW', 'BY',
    252      'BZ', 'CA', 'CC', 'CD', 'CF', 'CG', 'CH', 'CI', 'CK', 'CL', 'CM', 'CN',
    253      'CO', 'CR', 'CU', 'CV', 'CX', 'CY', 'CZ', 'DE', 'DJ', 'DK', 'DM', 'DO',
    254      'DZ', 'EC', 'EE', 'EG', 'EH', 'ER', 'ES', 'ET', 'FI', 'FJ', 'FK', 'FM',
    255      'FO', 'FR', 'FX', 'GA', 'GB', 'GD', 'GE', 'GF', 'GH', 'GI', 'GL', 'GM',
    256      'GN', 'GP', 'GQ', 'GR', 'GS', 'GT', 'GU', 'GW', 'GY', 'HK', 'HM', 'HN',
    257      'HR', 'HT', 'HU', 'ID', 'IE', 'IL', 'IN', 'IO', 'IQ', 'IR', 'IS', 'IT',
    258      'JM', 'JO', 'JP', 'KE', 'KG', 'KH', 'KI', 'KM', 'KN', 'KP', 'KR', 'KW',
    259      'KY', 'KZ', 'LA', 'LB', 'LC', 'LI', 'LK', 'LR', 'LS', 'LT', 'LU', 'LV',
    260      'LY', 'MA', 'MC', 'MD', 'MG', 'MH', 'MK', 'ML', 'MM', 'MN', 'MO', 'MP',
    261      'MQ', 'MR', 'MS', 'MT', 'MU', 'MV', 'MW', 'MX', 'MY', 'MZ', 'NA', 'NC',
    262      'NE', 'NF', 'NG', 'NI', 'NL', 'NO', 'NP', 'NR', 'NU', 'NZ', 'OM', 'PA',
    263      'PE', 'PF', 'PG', 'PH', 'PK', 'PL', 'PM', 'PN', 'PR', 'PS', 'PT', 'PW',
    264      'PY', 'QA', 'RE', 'RO', 'RU', 'RW', 'SA', 'SB', 'SC', 'SD', 'SE', 'SG',
    265      'SH', 'SI', 'SJ', 'SK', 'SL', 'SM', 'SN', 'SO', 'SR', 'ST', 'SV', 'SY',
    266      'SZ', 'TC', 'TD', 'TF', 'TG', 'TH', 'TJ', 'TK', 'TM', 'TN', 'TO', 'TL',
    267      'TR', 'TT', 'TV', 'TW', 'TZ', 'UA', 'UG', 'UM', 'US', 'UY', 'UZ', 'VA',
    268      'VC', 'VE', 'VG', 'VI', 'VN', 'VU', 'WF', 'WS', 'YE', 'YT', 'RS', 'ZA',
    269      'ZM', 'ME', 'ZW', 'A1', 'A2', 'O1', 'AX', 'GG', 'IM', 'JE', 'BL', 'MF',
    270      'BQ', 'SS'
    271  )
    272
    273  COUNTRY_CODES3 = (
    274      '', 'AP', 'EU', 'AND', 'ARE', 'AFG', 'ATG', 'AIA', 'ALB', 'ARM', 'ANT',
    275      'AGO', 'AQ', 'ARG', 'ASM', 'AUT', 'AUS', 'ABW', 'AZE', 'BIH', 'BRB', 'BGD',
    276      'BEL', 'BFA', 'BGR', 'BHR', 'BDI', 'BEN', 'BMU', 'BRN', 'BOL', 'BRA',
    277      'BHS', 'BTN', 'BV', 'BWA', 'BLR', 'BLZ', 'CAN', 'CC', 'COD', 'CAF', 'COG',
    278      'CHE', 'CIV', 'COK', 'CHL', 'CMR', 'CHN', 'COL', 'CRI', 'CUB', 'CPV', 'CX',
    279      'CYP', 'CZE', 'DEU', 'DJI', 'DNK', 'DMA', 'DOM', 'DZA', 'ECU', 'EST',
    280      'EGY', 'ESH', 'ERI', 'ESP', 'ETH', 'FIN', 'FJI', 'FLK', 'FSM', 'FRO',
    281      'FRA', 'FX', 'GAB', 'GBR', 'GRD', 'GEO', 'GUF', 'GHA', 'GIB', 'GRL', 'GMB',
    282      'GIN', 'GLP', 'GNQ', 'GRC', 'GS', 'GTM', 'GUM', 'GNB', 'GUY', 'HKG', 'HM',
    283      'HND', 'HRV', 'HTI', 'HUN', 'IDN', 'IRL', 'ISR', 'IND', 'IO', 'IRQ', 'IRN',
    284      'ISL', 'ITA', 'JAM', 'JOR', 'JPN', 'KEN', 'KGZ', 'KHM', 'KIR', 'COM',
    285      'KNA', 'PRK', 'KOR', 'KWT', 'CYM', 'KAZ', 'LAO', 'LBN', 'LCA', 'LIE',
    286      'LKA', 'LBR', 'LSO', 'LTU', 'LUX', 'LVA', 'LBY', 'MAR', 'MCO', 'MDA',
    287      'MDG', 'MHL', 'MKD', 'MLI', 'MMR', 'MNG', 'MAC', 'MNP', 'MTQ', 'MRT',
    288      'MSR', 'MLT', 'MUS', 'MDV', 'MWI', 'MEX', 'MYS', 'MOZ', 'NAM', 'NCL',
    289      'NER', 'NFK', 'NGA', 'NIC', 'NLD', 'NOR', 'NPL', 'NRU', 'NIU', 'NZL',
    290      'OMN', 'PAN', 'PER', 'PYF', 'PNG', 'PHL', 'PAK', 'POL', 'SPM', 'PCN',
    291      'PRI', 'PSE', 'PRT', 'PLW', 'PRY', 'QAT', 'REU', 'ROU', 'RUS', 'RWA',
    292      'SAU', 'SLB', 'SYC', 'SDN', 'SWE', 'SGP', 'SHN', 'SVN', 'SJM', 'SVK',
    293      'SLE', 'SMR', 'SEN', 'SOM', 'SUR', 'STP', 'SLV', 'SYR', 'SWZ', 'TCA',
    294      'TCD', 'TF', 'TGO', 'THA', 'TJK', 'TKL', 'TKM', 'TUN', 'TON', 'TLS', 'TUR',
    295      'TTO', 'TUV', 'TWN', 'TZA', 'UKR', 'UGA', 'UM', 'USA', 'URY', 'UZB', 'VAT',
    296      'VCT', 'VEN', 'VGB', 'VIR', 'VNM', 'VUT', 'WLF', 'WSM', 'YEM', 'YT', 'SRB',
    297      'ZAF', 'ZMB', 'MNE', 'ZWE', 'A1', 'A2', 'O1', 'ALA', 'GGY', 'IMN', 'JEY',
    298      'BLM', 'MAF', 'BES', 'SSD'
    299  )
    300
    301  COUNTRY_NAMES = (
    302      '', 'Asia/Pacific Region', 'Europe', 'Andorra', 'United Arab Emirates',
    303      'Afghanistan', 'Antigua and Barbuda', 'Anguilla', 'Albania', 'Armenia',
    304      'Netherlands Antilles', 'Angola', 'Antarctica', 'Argentina',
    305      'American Samoa', 'Austria', 'Australia', 'Aruba', 'Azerbaijan',
    306      'Bosnia and Herzegovina', 'Barbados', 'Bangladesh', 'Belgium',
    307      'Burkina Faso', 'Bulgaria', 'Bahrain', 'Burundi', 'Benin', 'Bermuda',
    308      'Brunei Darussalam', 'Bolivia', 'Brazil', 'Bahamas', 'Bhutan',
    309      'Bouvet Island', 'Botswana', 'Belarus', 'Belize', 'Canada',
    310      'Cocos (Keeling) Islands', 'Congo, The Democratic Republic of the',
    311      'Central African Republic', 'Congo', 'Switzerland', 'Cote D\'Ivoire',
    312      'Cook Islands', 'Chile', 'Cameroon', 'China', 'Colombia', 'Costa Rica',
    313      'Cuba', 'Cape Verde', 'Christmas Island', 'Cyprus', 'Czech Republic',
    314      'Germany', 'Djibouti', 'Denmark', 'Dominica', 'Dominican Republic',
    315      'Algeria', 'Ecuador', 'Estonia', 'Egypt', 'Western Sahara', 'Eritrea',
    316      'Spain', 'Ethiopia', 'Finland', 'Fiji', 'Falkland Islands (Malvinas)',
    317      'Micronesia, Federated States of', 'Faroe Islands', 'France',
    318      'France, Metropolitan', 'Gabon', 'United Kingdom', 'Grenada', 'Georgia',
    319      'French Guiana', 'Ghana', 'Gibraltar', 'Greenland', 'Gambia', 'Guinea',
    320      'Guadeloupe', 'Equatorial Guinea', 'Greece',
    321      'South Georgia and the South Sandwich Islands', 'Guatemala', 'Guam',
    322      'Guinea-Bissau', 'Guyana', 'Hong Kong',
    323      'Heard Island and McDonald Islands', 'Honduras', 'Croatia', 'Haiti',
    324      'Hungary', 'Indonesia', 'Ireland', 'Israel', 'India',
    325      'British Indian Ocean Territory', 'Iraq', 'Iran, Islamic Republic of',
    326      'Iceland', 'Italy', 'Jamaica', 'Jordan', 'Japan', 'Kenya', 'Kyrgyzstan',
    327      'Cambodia', 'Kiribati', 'Comoros', 'Saint Kitts and Nevis',
    328      'Korea, Democratic People\'s Republic of', 'Korea, Republic of', 'Kuwait',
    329      'Cayman Islands', 'Kazakhstan', 'Lao People\'s Democratic Republic',
    330      'Lebanon', 'Saint Lucia', 'Liechtenstein', 'Sri Lanka', 'Liberia',
    331      'Lesotho', 'Lithuania', 'Luxembourg', 'Latvia', 'Libya', 'Morocco',
    332      'Monaco', 'Moldova, Republic of', 'Madagascar', 'Marshall Islands',
    333      'Macedonia', 'Mali', 'Myanmar', 'Mongolia', 'Macau',
    334      'Northern Mariana Islands', 'Martinique', 'Mauritania', 'Montserrat',
    335      'Malta', 'Mauritius', 'Maldives', 'Malawi', 'Mexico', 'Malaysia',
    336      'Mozambique', 'Namibia', 'New Caledonia', 'Niger', 'Norfolk Island',
    337      'Nigeria', 'Nicaragua', 'Netherlands', 'Norway', 'Nepal', 'Nauru', 'Niue',
    338      'New Zealand', 'Oman', 'Panama', 'Peru', 'French Polynesia',
    339      'Papua New Guinea', 'Philippines', 'Pakistan', 'Poland',
    340      'Saint Pierre and Miquelon', 'Pitcairn Islands', 'Puerto Rico',
    341      'Palestinian Territory', 'Portugal', 'Palau', 'Paraguay', 'Qatar',
    342      'Reunion', 'Romania', 'Russian Federation', 'Rwanda', 'Saudi Arabia',
    343      'Solomon Islands', 'Seychelles', 'Sudan', 'Sweden', 'Singapore',
    344      'Saint Helena', 'Slovenia', 'Svalbard and Jan Mayen', 'Slovakia',
    345      'Sierra Leone', 'San Marino', 'Senegal', 'Somalia', 'Suriname',
    346      'Sao Tome and Principe', 'El Salvador', 'Syrian Arab Republic',
    347      'Swaziland', 'Turks and Caicos Islands', 'Chad',
    348      'French Southern Territories', 'Togo', 'Thailand', 'Tajikistan', 'Tokelau',
    349      'Turkmenistan', 'Tunisia', 'Tonga', 'Timor-Leste', 'Turkey',
    350      'Trinidad and Tobago', 'Tuvalu', 'Taiwan', 'Tanzania, United Republic of',
    351      'Ukraine', 'Uganda', 'United States Minor Outlying Islands',
    352      'United States', 'Uruguay', 'Uzbekistan', 'Holy See (Vatican City State)',
    353      'Saint Vincent and the Grenadines', 'Venezuela', 'Virgin Islands, British',
    354      'Virgin Islands, U.S.', 'Vietnam', 'Vanuatu', 'Wallis and Futuna', 'Samoa',
    355      'Yemen', 'Mayotte', 'Serbia', 'South Africa', 'Zambia', 'Montenegro',
    356      'Zimbabwe', 'Anonymous Proxy', 'Satellite Provider', 'Other',
    357      'Aland Islands', 'Guernsey', 'Isle of Man', 'Jersey', 'Saint Barthelemy',
    358      'Saint Martin', 'Bonaire, Sint Eustatius and Saba', 'South Sudan'
    359  )
    360
    361  CONTINENT_NAMES = (
    362      '--', 'AS', 'EU', 'EU', 'AS', 'AS', 'NA', 'NA', 'EU', 'AS', 'NA', 'AF',
    363      'AN', 'SA', 'OC', 'EU', 'OC', 'NA', 'AS', 'EU', 'NA', 'AS', 'EU', 'AF',
    364      'EU', 'AS', 'AF', 'AF', 'NA', 'AS', 'SA', 'SA', 'NA', 'AS', 'AN', 'AF',
    365      'EU', 'NA', 'NA', 'AS', 'AF', 'AF', 'AF', 'EU', 'AF', 'OC', 'SA', 'AF',
    366      'AS', 'SA', 'NA', 'NA', 'AF', 'AS', 'AS', 'EU', 'EU', 'AF', 'EU', 'NA',
    367      'NA', 'AF', 'SA', 'EU', 'AF', 'AF', 'AF', 'EU', 'AF', 'EU', 'OC', 'SA',
    368      'OC', 'EU', 'EU', 'NA', 'AF', 'EU', 'NA', 'AS', 'SA', 'AF', 'EU', 'NA',
    369      'AF', 'AF', 'NA', 'AF', 'EU', 'AN', 'NA', 'OC', 'AF', 'SA', 'AS', 'AN',
    370      'NA', 'EU', 'NA', 'EU', 'AS', 'EU', 'AS', 'AS', 'AS', 'AS', 'AS', 'EU',
    371      'EU', 'NA', 'AS', 'AS', 'AF', 'AS', 'AS', 'OC', 'AF', 'NA', 'AS', 'AS',
    372      'AS', 'NA', 'AS', 'AS', 'AS', 'NA', 'EU', 'AS', 'AF', 'AF', 'EU', 'EU',
    373      'EU', 'AF', 'AF', 'EU', 'EU', 'AF', 'OC', 'EU', 'AF', 'AS', 'AS', 'AS',
    374      'OC', 'NA', 'AF', 'NA', 'EU', 'AF', 'AS', 'AF', 'NA', 'AS', 'AF', 'AF',
    375      'OC', 'AF', 'OC', 'AF', 'NA', 'EU', 'EU', 'AS', 'OC', 'OC', 'OC', 'AS',
    376      'NA', 'SA', 'OC', 'OC', 'AS', 'AS', 'EU', 'NA', 'OC', 'NA', 'AS', 'EU',
    377      'OC', 'SA', 'AS', 'AF', 'EU', 'EU', 'AF', 'AS', 'OC', 'AF', 'AF', 'EU',
    378      'AS', 'AF', 'EU', 'EU', 'EU', 'AF', 'EU', 'AF', 'AF', 'SA', 'AF', 'NA',
    379      'AS', 'AF', 'NA', 'AF', 'AN', 'AF', 'AS', 'AS', 'OC', 'AS', 'AF', 'OC',
    380      'AS', 'EU', 'NA', 'OC', 'AS', 'AF', 'EU', 'AF', 'OC', 'NA', 'SA', 'AS',
    381      'EU', 'NA', 'SA', 'NA', 'NA', 'AS', 'OC', 'OC', 'OC', 'AS', 'AF', 'EU',
    382      'AF', 'AF', 'EU', 'AF', '--', '--', '--', 'EU', 'EU', 'EU', 'EU', 'NA',
    383      'NA', 'NA', 'AF'
    384  )
    385
    386  # storage / caching flags
    387  STANDARD = 0
    388  MEMORY_CACHE = 1
    389  MMAP_CACHE = 8
    390
    391  # Database structure constants
    392  COUNTRY_BEGIN = 16776960
    393  STATE_BEGIN_REV0 = 16700000
    394  STATE_BEGIN_REV1 = 16000000
    395
    396  STRUCTURE_INFO_MAX_SIZE = 20
    397  DATABASE_INFO_MAX_SIZE = 100
    398
    399  # Database editions
    400  COUNTRY_EDITION = 1
    401  COUNTRY_EDITION_V6 = 12
    402  REGION_EDITION_REV0 = 7
    403  REGION_EDITION_REV1 = 3
    404  CITY_EDITION_REV0 = 6
    405  CITY_EDITION_REV1 = 2
    406  CITY_EDITION_REV1_V6 = 30
    407  ORG_EDITION = 5
    408  ISP_EDITION = 4
    409  ASNUM_EDITION = 9
    410  ASNUM_EDITION_V6 = 21
    411  # Not yet supported databases
    412  PROXY_EDITION = 8
    413  NETSPEED_EDITION = 11
    414
    415  # Collection of databases
    416  IPV6_EDITIONS = (COUNTRY_EDITION_V6, ASNUM_EDITION_V6, CITY_EDITION_REV1_V6)
    417  CITY_EDITIONS = (CITY_EDITION_REV0, CITY_EDITION_REV1, CITY_EDITION_REV1_V6)
    418  REGION_EDITIONS = (REGION_EDITION_REV0, REGION_EDITION_REV1)
    419  REGION_CITY_EDITIONS = REGION_EDITIONS + CITY_EDITIONS
    420
    421  SEGMENT_RECORD_LENGTH = 3
    422  STANDARD_RECORD_LENGTH = 3
    423  ORG_RECORD_LENGTH = 4
    424  MAX_RECORD_LENGTH = 4
    425  MAX_ORG_RECORD_LENGTH = 300
    426  FULL_RECORD_LENGTH = 50
    427
    428  US_OFFSET = 1
    429  CANADA_OFFSET = 677
    430  WORLD_OFFSET = 1353
    431  FIPS_RANGE = 360
    432  ENCODING = 'iso-8859-1'
    433