Anonymous avatar Anonymous committed c87124d

Country codes moved to separate module

Comments (0)

Files changed (2)

         raise RuntimeError('ip2cc database is broken') # must never reach here
 
     
-# ISO 3166-1 A2 codes (latest change: 2009-03-03)
-cc2name = {
-    'AD': 'ANDORRA',
-    'AE': 'UNITED ARAB EMIRATES',
-    'AF': 'AFGHANISTAN',
-    'AG': 'ANTIGUA AND BARBUDA',
-    'AI': 'ANGUILLA',
-    'AL': 'ALBANIA',
-    'AM': 'ARMENIA',
-    'AN': 'NETHERLANDS ANTILLES',
-    'AO': 'ANGOLA',
-    'AQ': 'ANTARCTICA',
-    'AR': 'ARGENTINA',
-    'AS': 'AMERICAN SAMOA',
-    'AT': 'AUSTRIA',
-    'AU': 'AUSTRALIA',
-    'AW': 'ARUBA',
-    'AX': '\xc5LAND ISLANDS',
-    'AZ': 'AZERBAIJAN',
-    'BA': 'BOSNIA AND HERZEGOVINA',
-    'BB': 'BARBADOS',
-    'BD': 'BANGLADESH',
-    'BE': 'BELGIUM',
-    'BF': 'BURKINA FASO',
-    'BG': 'BULGARIA',
-    'BH': 'BAHRAIN',
-    'BI': 'BURUNDI',
-    'BJ': 'BENIN',
-    'BL': 'SAINT BARTH\xc9LEMY',
-    'BM': 'BERMUDA',
-    'BN': 'BRUNEI DARUSSALAM',
-    'BO': 'BOLIVIA',
-    'BR': 'BRAZIL',
-    'BS': 'BAHAMAS',
-    'BT': 'BHUTAN',
-    'BV': 'BOUVET ISLAND',
-    'BW': 'BOTSWANA',
-    'BY': 'BELARUS',
-    'BZ': 'BELIZE',
-    'CA': 'CANADA',
-    'CC': 'COCOS (KEELING) ISLANDS',
-    'CD': 'CONGO, THE DEMOCRATIC REPUBLIC OF THE',
-    'CF': 'CENTRAL AFRICAN REPUBLIC',
-    'CG': 'CONGO',
-    'CH': 'SWITZERLAND',
-    'CI': "C\xd4TE D'IVOIRE",
-    'CK': 'COOK ISLANDS',
-    'CL': 'CHILE',
-    'CM': 'CAMEROON',
-    'CN': 'CHINA',
-    'CO': 'COLOMBIA',
-    'CR': 'COSTA RICA',
-    'CU': 'CUBA',
-    'CV': 'CAPE VERDE',
-    'CX': 'CHRISTMAS ISLAND',
-    'CY': 'CYPRUS',
-    'CZ': 'CZECH REPUBLIC',
-    'DE': 'GERMANY',
-    'DJ': 'DJIBOUTI',
-    'DK': 'DENMARK',
-    'DM': 'DOMINICA',
-    'DO': 'DOMINICAN REPUBLIC',
-    'DZ': 'ALGERIA',
-    'EC': 'ECUADOR',
-    'EE': 'ESTONIA',
-    'EG': 'EGYPT',
-    'EH': 'WESTERN SAHARA',
-    'ER': 'ERITREA',
-    'ES': 'SPAIN',
-    'ET': 'ETHIOPIA',
-    'FI': 'FINLAND',
-    'FJ': 'FIJI',
-    'FK': 'FALKLAND ISLANDS (MALVINAS)',
-    'FM': 'MICRONESIA, FEDERATED STATES OF',
-    'FO': 'FAROE ISLANDS',
-    'FR': 'FRANCE',
-    'GA': 'GABON',
-    'GB': 'UNITED KINGDOM',
-    'GD': 'GRENADA',
-    'GE': 'GEORGIA',
-    'GF': 'FRENCH GUIANA',
-    'GG': 'GUERNSEY',
-    'GH': 'GHANA',
-    'GI': 'GIBRALTAR',
-    'GL': 'GREENLAND',
-    'GM': 'GAMBIA',
-    'GN': 'GUINEA',
-    'GP': 'GUADELOUPE',
-    'GQ': 'EQUATORIAL GUINEA',
-    'GR': 'GREECE',
-    'GS': 'SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS',
-    'GT': 'GUATEMALA',
-    'GU': 'GUAM',
-    'GW': 'GUINEA-BISSAU',
-    'GY': 'GUYANA',
-    'HK': 'HONG KONG',
-    'HM': 'HEARD ISLAND AND MCDONALD ISLANDS',
-    'HN': 'HONDURAS',
-    'HR': 'CROATIA',
-    'HT': 'HAITI',
-    'HU': 'HUNGARY',
-    'ID': 'INDONESIA',
-    'IE': 'IRELAND',
-    'IL': 'ISRAEL',
-    'IM': 'ISLE OF MAN',
-    'IN': 'INDIA',
-    'IO': 'BRITISH INDIAN OCEAN TERRITORY',
-    'IQ': 'IRAQ',
-    'IR': 'IRAN, ISLAMIC REPUBLIC OF',
-    'IS': 'ICELAND',
-    'IT': 'ITALY',
-    'JE': 'JERSEY',
-    'JM': 'JAMAICA',
-    'JO': 'JORDAN',
-    'JP': 'JAPAN',
-    'KE': 'KENYA',
-    'KG': 'KYRGYZSTAN',
-    'KH': 'CAMBODIA',
-    'KI': 'KIRIBATI',
-    'KM': 'COMOROS',
-    'KN': 'SAINT KITTS AND NEVIS',
-    'KP': "KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF",
-    'KR': 'KOREA, REPUBLIC OF',
-    'KW': 'KUWAIT',
-    'KY': 'CAYMAN ISLANDS',
-    'KZ': 'KAZAKHSTAN',
-    'LA': "LAO PEOPLE'S DEMOCRATIC REPUBLIC",
-    'LB': 'LEBANON',
-    'LC': 'SAINT LUCIA',
-    'LI': 'LIECHTENSTEIN',
-    'LK': 'SRI LANKA',
-    'LR': 'LIBERIA',
-    'LS': 'LESOTHO',
-    'LT': 'LITHUANIA',
-    'LU': 'LUXEMBOURG',
-    'LV': 'LATVIA',
-    'LY': 'LIBYAN ARAB JAMAHIRIYA',
-    'MA': 'MOROCCO',
-    'MC': 'MONACO',
-    'MD': 'MOLDOVA, REPUBLIC OF',
-    'ME': 'MONTENEGRO',
-    'MF': 'SAINT MARTIN',
-    'MG': 'MADAGASCAR',
-    'MH': 'MARSHALL ISLANDS',
-    'MK': 'MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF',
-    'ML': 'MALI',
-    'MM': 'MYANMAR',
-    'MN': 'MONGOLIA',
-    'MO': 'MACAO',
-    'MP': 'NORTHERN MARIANA ISLANDS',
-    'MQ': 'MARTINIQUE',
-    'MR': 'MAURITANIA',
-    'MS': 'MONTSERRAT',
-    'MT': 'MALTA',
-    'MU': 'MAURITIUS',
-    'MV': 'MALDIVES',
-    'MW': 'MALAWI',
-    'MX': 'MEXICO',
-    'MY': 'MALAYSIA',
-    'MZ': 'MOZAMBIQUE',
-    'NA': 'NAMIBIA',
-    'NC': 'NEW CALEDONIA',
-    'NE': 'NIGER',
-    'NF': 'NORFOLK ISLAND',
-    'NG': 'NIGERIA',
-    'NI': 'NICARAGUA',
-    'NL': 'NETHERLANDS',
-    'NO': 'NORWAY',
-    'NP': 'NEPAL',
-    'NR': 'NAURU',
-    'NU': 'NIUE',
-    'NZ': 'NEW ZEALAND',
-    'OM': 'OMAN',
-    'PA': 'PANAMA',
-    'PE': 'PERU',
-    'PF': 'FRENCH POLYNESIA',
-    'PG': 'PAPUA NEW GUINEA',
-    'PH': 'PHILIPPINES',
-    'PK': 'PAKISTAN',
-    'PL': 'POLAND',
-    'PM': 'SAINT PIERRE AND MIQUELON',
-    'PN': 'PITCAIRN',
-    'PR': 'PUERTO RICO',
-    'PS': 'PALESTINIAN TERRITORY, OCCUPIED',
-    'PT': 'PORTUGAL',
-    'PW': 'PALAU',
-    'PY': 'PARAGUAY',
-    'QA': 'QATAR',
-    'RE': 'R\xc9UNION',
-    'RO': 'ROMANIA',
-    'RS': 'SERBIA',
-    'RU': 'RUSSIAN FEDERATION',
-    'RW': 'RWANDA',
-    'SA': 'SAUDI ARABIA',
-    'SB': 'SOLOMON ISLANDS',
-    'SC': 'SEYCHELLES',
-    'SD': 'SUDAN',
-    'SE': 'SWEDEN',
-    'SG': 'SINGAPORE',
-    'SH': 'SAINT HELENA',
-    'SI': 'SLOVENIA',
-    'SJ': 'SVALBARD AND JAN MAYEN',
-    'SK': 'SLOVAKIA',
-    'SL': 'SIERRA LEONE',
-    'SM': 'SAN MARINO',
-    'SN': 'SENEGAL',
-    'SO': 'SOMALIA',
-    'SR': 'SURINAME',
-    'ST': 'SAO TOME AND PRINCIPE',
-    'SV': 'EL SALVADOR',
-    'SY': 'SYRIAN ARAB REPUBLIC',
-    'SZ': 'SWAZILAND',
-    'TC': 'TURKS AND CAICOS ISLANDS',
-    'TD': 'CHAD',
-    'TF': 'FRENCH SOUTHERN TERRITORIES',
-    'TG': 'TOGO',
-    'TH': 'THAILAND',
-    'TJ': 'TAJIKISTAN',
-    'TK': 'TOKELAU',
-    'TL': 'TIMOR-LESTE',
-    'TM': 'TURKMENISTAN',
-    'TN': 'TUNISIA',
-    'TO': 'TONGA',
-    'TR': 'TURKEY',
-    'TT': 'TRINIDAD AND TOBAGO',
-    'TV': 'TUVALU',
-    'TW': 'TAIWAN, PROVINCE OF CHINA',
-    'TZ': 'TANZANIA, UNITED REPUBLIC OF',
-    'UA': 'UKRAINE',
-    'UG': 'UGANDA',
-    'UM': 'UNITED STATES MINOR OUTLYING ISLANDS',
-    'US': 'UNITED STATES',
-    'UY': 'URUGUAY',
-    'UZ': 'UZBEKISTAN',
-    'VA': 'HOLY SEE (VATICAN CITY STATE)',
-    'VC': 'SAINT VINCENT AND THE GRENADINES',
-    'VE': 'VENEZUELA, BOLIVARIAN REPUBLIC OF',
-    'VG': 'VIRGIN ISLANDS, BRITISH',
-    'VI': 'VIRGIN ISLANDS, U.S.',
-    'VN': 'VIET NAM',
-    'VU': 'VANUATU',
-    'WF': 'WALLIS AND FUTUNA',
-    'WS': 'SAMOA',
-    'YE': 'YEMEN',
-    'YT': 'MAYOTTE',
-    'ZA': 'SOUTH AFRICA',
-    'ZM': 'ZAMBIA',
-    'ZW': 'ZIMBABWE'
-}
+import iso3166_1
 
 # Additional codes used by registrars
+cc2name = iso3166_1.cc2name.copy()
 cc2name.update({
     #'UK': cc2name['GB'],
     #'YU': 'FORMER YUGOSLAVIA',
+# ISO 3166-1 A2 codes (latest change: 2009-03-03)
+cc2name = {
+    'AD': 'ANDORRA',
+    'AE': 'UNITED ARAB EMIRATES',
+    'AF': 'AFGHANISTAN',
+    'AG': 'ANTIGUA AND BARBUDA',
+    'AI': 'ANGUILLA',
+    'AL': 'ALBANIA',
+    'AM': 'ARMENIA',
+    'AN': 'NETHERLANDS ANTILLES',
+    'AO': 'ANGOLA',
+    'AQ': 'ANTARCTICA',
+    'AR': 'ARGENTINA',
+    'AS': 'AMERICAN SAMOA',
+    'AT': 'AUSTRIA',
+    'AU': 'AUSTRALIA',
+    'AW': 'ARUBA',
+    'AX': '\xc5LAND ISLANDS',
+    'AZ': 'AZERBAIJAN',
+    'BA': 'BOSNIA AND HERZEGOVINA',
+    'BB': 'BARBADOS',
+    'BD': 'BANGLADESH',
+    'BE': 'BELGIUM',
+    'BF': 'BURKINA FASO',
+    'BG': 'BULGARIA',
+    'BH': 'BAHRAIN',
+    'BI': 'BURUNDI',
+    'BJ': 'BENIN',
+    'BL': 'SAINT BARTH\xc9LEMY',
+    'BM': 'BERMUDA',
+    'BN': 'BRUNEI DARUSSALAM',
+    'BO': 'BOLIVIA',
+    'BR': 'BRAZIL',
+    'BS': 'BAHAMAS',
+    'BT': 'BHUTAN',
+    'BV': 'BOUVET ISLAND',
+    'BW': 'BOTSWANA',
+    'BY': 'BELARUS',
+    'BZ': 'BELIZE',
+    'CA': 'CANADA',
+    'CC': 'COCOS (KEELING) ISLANDS',
+    'CD': 'CONGO, THE DEMOCRATIC REPUBLIC OF THE',
+    'CF': 'CENTRAL AFRICAN REPUBLIC',
+    'CG': 'CONGO',
+    'CH': 'SWITZERLAND',
+    'CI': "C\xd4TE D'IVOIRE",
+    'CK': 'COOK ISLANDS',
+    'CL': 'CHILE',
+    'CM': 'CAMEROON',
+    'CN': 'CHINA',
+    'CO': 'COLOMBIA',
+    'CR': 'COSTA RICA',
+    'CU': 'CUBA',
+    'CV': 'CAPE VERDE',
+    'CX': 'CHRISTMAS ISLAND',
+    'CY': 'CYPRUS',
+    'CZ': 'CZECH REPUBLIC',
+    'DE': 'GERMANY',
+    'DJ': 'DJIBOUTI',
+    'DK': 'DENMARK',
+    'DM': 'DOMINICA',
+    'DO': 'DOMINICAN REPUBLIC',
+    'DZ': 'ALGERIA',
+    'EC': 'ECUADOR',
+    'EE': 'ESTONIA',
+    'EG': 'EGYPT',
+    'EH': 'WESTERN SAHARA',
+    'ER': 'ERITREA',
+    'ES': 'SPAIN',
+    'ET': 'ETHIOPIA',
+    'FI': 'FINLAND',
+    'FJ': 'FIJI',
+    'FK': 'FALKLAND ISLANDS (MALVINAS)',
+    'FM': 'MICRONESIA, FEDERATED STATES OF',
+    'FO': 'FAROE ISLANDS',
+    'FR': 'FRANCE',
+    'GA': 'GABON',
+    'GB': 'UNITED KINGDOM',
+    'GD': 'GRENADA',
+    'GE': 'GEORGIA',
+    'GF': 'FRENCH GUIANA',
+    'GG': 'GUERNSEY',
+    'GH': 'GHANA',
+    'GI': 'GIBRALTAR',
+    'GL': 'GREENLAND',
+    'GM': 'GAMBIA',
+    'GN': 'GUINEA',
+    'GP': 'GUADELOUPE',
+    'GQ': 'EQUATORIAL GUINEA',
+    'GR': 'GREECE',
+    'GS': 'SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS',
+    'GT': 'GUATEMALA',
+    'GU': 'GUAM',
+    'GW': 'GUINEA-BISSAU',
+    'GY': 'GUYANA',
+    'HK': 'HONG KONG',
+    'HM': 'HEARD ISLAND AND MCDONALD ISLANDS',
+    'HN': 'HONDURAS',
+    'HR': 'CROATIA',
+    'HT': 'HAITI',
+    'HU': 'HUNGARY',
+    'ID': 'INDONESIA',
+    'IE': 'IRELAND',
+    'IL': 'ISRAEL',
+    'IM': 'ISLE OF MAN',
+    'IN': 'INDIA',
+    'IO': 'BRITISH INDIAN OCEAN TERRITORY',
+    'IQ': 'IRAQ',
+    'IR': 'IRAN, ISLAMIC REPUBLIC OF',
+    'IS': 'ICELAND',
+    'IT': 'ITALY',
+    'JE': 'JERSEY',
+    'JM': 'JAMAICA',
+    'JO': 'JORDAN',
+    'JP': 'JAPAN',
+    'KE': 'KENYA',
+    'KG': 'KYRGYZSTAN',
+    'KH': 'CAMBODIA',
+    'KI': 'KIRIBATI',
+    'KM': 'COMOROS',
+    'KN': 'SAINT KITTS AND NEVIS',
+    'KP': "KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF",
+    'KR': 'KOREA, REPUBLIC OF',
+    'KW': 'KUWAIT',
+    'KY': 'CAYMAN ISLANDS',
+    'KZ': 'KAZAKHSTAN',
+    'LA': "LAO PEOPLE'S DEMOCRATIC REPUBLIC",
+    'LB': 'LEBANON',
+    'LC': 'SAINT LUCIA',
+    'LI': 'LIECHTENSTEIN',
+    'LK': 'SRI LANKA',
+    'LR': 'LIBERIA',
+    'LS': 'LESOTHO',
+    'LT': 'LITHUANIA',
+    'LU': 'LUXEMBOURG',
+    'LV': 'LATVIA',
+    'LY': 'LIBYAN ARAB JAMAHIRIYA',
+    'MA': 'MOROCCO',
+    'MC': 'MONACO',
+    'MD': 'MOLDOVA, REPUBLIC OF',
+    'ME': 'MONTENEGRO',
+    'MF': 'SAINT MARTIN',
+    'MG': 'MADAGASCAR',
+    'MH': 'MARSHALL ISLANDS',
+    'MK': 'MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF',
+    'ML': 'MALI',
+    'MM': 'MYANMAR',
+    'MN': 'MONGOLIA',
+    'MO': 'MACAO',
+    'MP': 'NORTHERN MARIANA ISLANDS',
+    'MQ': 'MARTINIQUE',
+    'MR': 'MAURITANIA',
+    'MS': 'MONTSERRAT',
+    'MT': 'MALTA',
+    'MU': 'MAURITIUS',
+    'MV': 'MALDIVES',
+    'MW': 'MALAWI',
+    'MX': 'MEXICO',
+    'MY': 'MALAYSIA',
+    'MZ': 'MOZAMBIQUE',
+    'NA': 'NAMIBIA',
+    'NC': 'NEW CALEDONIA',
+    'NE': 'NIGER',
+    'NF': 'NORFOLK ISLAND',
+    'NG': 'NIGERIA',
+    'NI': 'NICARAGUA',
+    'NL': 'NETHERLANDS',
+    'NO': 'NORWAY',
+    'NP': 'NEPAL',
+    'NR': 'NAURU',
+    'NU': 'NIUE',
+    'NZ': 'NEW ZEALAND',
+    'OM': 'OMAN',
+    'PA': 'PANAMA',
+    'PE': 'PERU',
+    'PF': 'FRENCH POLYNESIA',
+    'PG': 'PAPUA NEW GUINEA',
+    'PH': 'PHILIPPINES',
+    'PK': 'PAKISTAN',
+    'PL': 'POLAND',
+    'PM': 'SAINT PIERRE AND MIQUELON',
+    'PN': 'PITCAIRN',
+    'PR': 'PUERTO RICO',
+    'PS': 'PALESTINIAN TERRITORY, OCCUPIED',
+    'PT': 'PORTUGAL',
+    'PW': 'PALAU',
+    'PY': 'PARAGUAY',
+    'QA': 'QATAR',
+    'RE': 'R\xc9UNION',
+    'RO': 'ROMANIA',
+    'RS': 'SERBIA',
+    'RU': 'RUSSIAN FEDERATION',
+    'RW': 'RWANDA',
+    'SA': 'SAUDI ARABIA',
+    'SB': 'SOLOMON ISLANDS',
+    'SC': 'SEYCHELLES',
+    'SD': 'SUDAN',
+    'SE': 'SWEDEN',
+    'SG': 'SINGAPORE',
+    'SH': 'SAINT HELENA',
+    'SI': 'SLOVENIA',
+    'SJ': 'SVALBARD AND JAN MAYEN',
+    'SK': 'SLOVAKIA',
+    'SL': 'SIERRA LEONE',
+    'SM': 'SAN MARINO',
+    'SN': 'SENEGAL',
+    'SO': 'SOMALIA',
+    'SR': 'SURINAME',
+    'ST': 'SAO TOME AND PRINCIPE',
+    'SV': 'EL SALVADOR',
+    'SY': 'SYRIAN ARAB REPUBLIC',
+    'SZ': 'SWAZILAND',
+    'TC': 'TURKS AND CAICOS ISLANDS',
+    'TD': 'CHAD',
+    'TF': 'FRENCH SOUTHERN TERRITORIES',
+    'TG': 'TOGO',
+    'TH': 'THAILAND',
+    'TJ': 'TAJIKISTAN',
+    'TK': 'TOKELAU',
+    'TL': 'TIMOR-LESTE',
+    'TM': 'TURKMENISTAN',
+    'TN': 'TUNISIA',
+    'TO': 'TONGA',
+    'TR': 'TURKEY',
+    'TT': 'TRINIDAD AND TOBAGO',
+    'TV': 'TUVALU',
+    'TW': 'TAIWAN, PROVINCE OF CHINA',
+    'TZ': 'TANZANIA, UNITED REPUBLIC OF',
+    'UA': 'UKRAINE',
+    'UG': 'UGANDA',
+    'UM': 'UNITED STATES MINOR OUTLYING ISLANDS',
+    'US': 'UNITED STATES',
+    'UY': 'URUGUAY',
+    'UZ': 'UZBEKISTAN',
+    'VA': 'HOLY SEE (VATICAN CITY STATE)',
+    'VC': 'SAINT VINCENT AND THE GRENADINES',
+    'VE': 'VENEZUELA, BOLIVARIAN REPUBLIC OF',
+    'VG': 'VIRGIN ISLANDS, BRITISH',
+    'VI': 'VIRGIN ISLANDS, U.S.',
+    'VN': 'VIET NAM',
+    'VU': 'VANUATU',
+    'WF': 'WALLIS AND FUTUNA',
+    'WS': 'SAMOA',
+    'YE': 'YEMEN',
+    'YT': 'MAYOTTE',
+    'ZA': 'SOUTH AFRICA',
+    'ZM': 'ZAMBIA',
+    'ZW': 'ZIMBABWE'
+}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.