Guest User

Untitled

a guest
Nov 22nd, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.94 KB | None | 0 0
  1. # all country codes present, except GB.
  2. # GB has been changed to UK
  3. COUNTRIES = (
  4. ("AD", "Andorra"),
  5. ("AE", "United Arab Emirates"),
  6. ("AF", "Afghanistan"),
  7. ("AG", "Antigua and Barbuda"),
  8. ("AI", "Anguilla"),
  9. ("AL", "Albania"),
  10. ("AM", "Armenia"),
  11. ("AO", "Angola"),
  12. ("AQ", "Antarctica"),
  13. ("AR", "Argentina"),
  14. ("AS", "American Samoa"),
  15. ("AT", "Austria"),
  16. ("AU", "Australia"),
  17. ("AW", "Aruba"),
  18. ("AX", "Åland Islands"),
  19. ("AZ", "Azerbaijan"),
  20. ("BA", "Bosnia and Herzegovina"),
  21. ("BB", "Barbados"),
  22. ("BD", "Bangladesh"),
  23. ("BE", "Belgium"),
  24. ("BF", "Burkina Faso"),
  25. ("BG", "Bulgaria"),
  26. ("BH", "Bahrain"),
  27. ("BI", "Burundi"),
  28. ("BJ", "Benin"),
  29. ("BL", "Saint Barthelemy"),
  30. ("BM", "Bermuda"),
  31. ("BN", "Brunei Darussalam"),
  32. ("BO", "Bolivia"),
  33. ("BQ", "Bonaire, Sint Eustatius and Saba"),
  34. ("BR", "Brazil"),
  35. ("BS", "Bahamas"),
  36. ("BT", "Bhutan"),
  37. ("BV", "Bouvet Island"),
  38. ("BW", "Botswana"),
  39. ("BY", "Belarus"),
  40. ("BZ", "Belize"),
  41. ("CA", "Canada"),
  42. ("CB", "Caribbean Nations"),
  43. ("CC", "Cocos (Keeling) Islands"),
  44. ("CD", "Democratic Republic of the Congo"),
  45. ("CF", "Central African Republic"),
  46. ("CG", "Republic of the Congo"),
  47. ("CH", "Switzerland"),
  48. ("CI", "Côte d'Ivoire"),
  49. ("CK", "Cook Islands"),
  50. ("CL", "Chile"),
  51. ("CM", "Cameroon"),
  52. ("CN", "China"),
  53. ("CO", "Colombia"),
  54. ("CR", "Costa Rica"),
  55. ("CU", "Cuba"),
  56. ("CV", "Cabo Verde"),
  57. ("CW", "Curaçao"),
  58. ("CX", "Christmas Island"),
  59. ("CY", "Cyprus"),
  60. ("CZ", "Czech Republic"),
  61. ("DE", "Germany"),
  62. ("DJ", "Djibouti"),
  63. ("DK", "Denmark"),
  64. ("DM", "Dominica"),
  65. ("DO", "Dominican Republic"),
  66. ("DZ", "Algeria"),
  67. ("EC", "Ecuador"),
  68. ("EE", "Estonia"),
  69. ("EG", "Egypt"),
  70. ("EH", "Western Sahara"),
  71. ("ER", "Eritrea"),
  72. ("ES", "Spain"),
  73. ("ET", "Ethiopia"),
  74. ("FI", "Finland"),
  75. ("FJ", "Fiji"),
  76. ("FK", "Falkland Islands [Malvinas]"),
  77. ("FM", "Micronesia"),
  78. ("FO", "Faroe Islands"),
  79. ("FR", "France"),
  80. ("GA", "Gabon"),
  81. ("GD", "Grenada"),
  82. ("GE", "Georgia"),
  83. ("GF", "French Guiana"),
  84. ("GG", "Guernsey"),
  85. ("GH", "Ghana"),
  86. ("GI", "Gibraltar"),
  87. ("GL", "Greenland"),
  88. ("GM", "Gambia"),
  89. ("GN", "Guinea"),
  90. ("GP", "Guadeloupe"),
  91. ("GQ", "Equatorial Guinea"),
  92. ("GR", "Greece"),
  93. ("GS", "South Georgia and the South Sandwich Islands"),
  94. ("GT", "Guatemala"),
  95. ("GU", "Guam"),
  96. ("GW", "Guinea-Bissau"),
  97. ("GY", "Guyana"),
  98. ("HK", "Hong Kong"),
  99. ("HM", "Heard Island and McDonald Islands"),
  100. ("HN", "Honduras"),
  101. ("HR", "Croatia"),
  102. ("HT", "Haiti"),
  103. ("HU", "Hungary"),
  104. ("ID", "Indonesia"),
  105. ("IE", "Ireland"),
  106. ("IL", "Israel"),
  107. ("IM", "Isle of Man"),
  108. ("IN", "India"),
  109. ("IO", "British Indian Ocean Territory"),
  110. ("IQ", "Iraq"),
  111. ("IR", "Iran"),
  112. ("IS", "Iceland"),
  113. ("IT", "Italy"),
  114. ("JE", "Jersey"),
  115. ("JM", "Jamaica"),
  116. ("JO", "Jordan"),
  117. ("JP", "Japan"),
  118. ("KE", "Kenya"),
  119. ("KG", "Kyrgyzstan"),
  120. ("KH", "Cambodia"),
  121. ("KI", "Kiribati"),
  122. ("KM", "Comoros"),
  123. ("KN", "Saint Kitts and Nevis"),
  124. ("KP", "North Korea"),
  125. ("KR", "South Korea"),
  126. ("KW", "Kuwait"),
  127. ("KY", "Cayman Islands"),
  128. ("KZ", "Kazakhstan"),
  129. ("LA", "Lao People's Democratic Republic"),
  130. ("LB", "Lebanon"),
  131. ("LC", "Saint Lucia"),
  132. ("LI", "Liechtenstein"),
  133. ("LK", "Sri Lanka"),
  134. ("LR", "Liberia"),
  135. ("LS", "Lesotho"),
  136. ("LT", "Lithuania"),
  137. ("LU", "Luxembourg"),
  138. ("LV", "Latvia"),
  139. ("LY", "Libya"),
  140. ("MA", "Morocco"),
  141. ("MC", "Monaco"),
  142. ("MD", "Moldova"),
  143. ("ME", "Montenegro"),
  144. ("MF", "Saint Martin"),
  145. ("MG", "Madagascar"),
  146. ("MH", "Marshall Islands"),
  147. ("MK", "Macedonia"),
  148. ("ML", "Mali"),
  149. ("MM", "Myanmar"),
  150. ("MN", "Mongolia"),
  151. ("MO", "Macao"),
  152. ("MP", "Northern Mariana Islands"),
  153. ("MQ", "Martinique"),
  154. ("MR", "Mauritania"),
  155. ("MS", "Montserrat"),
  156. ("MT", "Malta"),
  157. ("MU", "Mauritius"),
  158. ("MV", "Maldives"),
  159. ("MW", "Malawi"),
  160. ("MX", "Mexico"),
  161. ("MY", "Malaysia"),
  162. ("MZ", "Mozambique"),
  163. ("NA", "Namibia"),
  164. ("NC", "New Caledonia"),
  165. ("NE", "Niger"),
  166. ("NF", "Norfolk Island"),
  167. ("NG", "Nigeria"),
  168. ("NI", "Nicaragua"),
  169. ("NL", "Netherlands"),
  170. ("NO", "Norway"),
  171. ("NP", "Nepal"),
  172. ("NR", "Nauru"),
  173. ("NU", "Niue"),
  174. ("NZ", "New Zealand"),
  175. ("OM", "Oman"),
  176. ("PA", "Panama"),
  177. ("PE", "Peru"),
  178. ("PF", "French Polynesia"),
  179. ("PG", "Papua New Guinea"),
  180. ("PH", "Philippines"),
  181. ("PK", "Pakistan"),
  182. ("PL", "Poland"),
  183. ("PM", "Saint Pierre and Miquelon"),
  184. ("PN", "Pitcairn"),
  185. ("PR", "Puerto Rico"),
  186. ("PS", "Palestine"),
  187. ("PT", "Portugal"),
  188. ("PW", "Palau"),
  189. ("PY", "Paraguay"),
  190. ("QA", "Qatar"),
  191. ("RE", "Réunion"),
  192. ("RO", "Romania"),
  193. ("RS", "Serbia"),
  194. ("RU", "Russian Federation"),
  195. ("RW", "Rwanda"),
  196. ("SA", "Saudi Arabia"),
  197. ("SB", "Solomon Islands"),
  198. ("SC", "Seychelles"),
  199. ("SD", "Sudan"),
  200. ("SE", "Sweden"),
  201. ("SG", "Singapore"),
  202. ("SH", "Saint Helena, Ascension and Tristan da Cunha"),
  203. ("SI", "Slovenia"),
  204. ("SJ", "Svalbard and Jan Mayen"),
  205. ("SK", "Slovakia"),
  206. ("SL", "Sierra Leone"),
  207. ("SM", "San Marino"),
  208. ("SN", "Senegal"),
  209. ("SO", "Somalia"),
  210. ("SR", "Suriname"),
  211. ("SS", "South Sudan"),
  212. ("ST", "Sao Tome and Principe"),
  213. ("SV", "El Salvador"),
  214. ("SX", "Sint Maarten (Dutch part)"),
  215. ("SY", "Syrian Arab Republic"),
  216. ("SZ", "Swaziland"),
  217. ("TC", "Turks and Caicos Islands"),
  218. ("TD", "Chad"),
  219. ("TF", "French Southern Territories"),
  220. ("TG", "Togo"),
  221. ("TH", "Thailand"),
  222. ("TJ", "Tajikistan"),
  223. ("TK", "Tokelau"),
  224. ("TL", "Timor-Leste"),
  225. ("TM", "Turkmenistan"),
  226. ("TN", "Tunisia"),
  227. ("TO", "Tonga"),
  228. ("TR", "Turkey"),
  229. ("TT", "Trinidad and Tobago"),
  230. ("TV", "Tuvalu"),
  231. ("TW", "Taiwan"),
  232. ("TZ", "Tanzania"),
  233. ("UA", "Ukraine"),
  234. ("UG", "Uganda"),
  235. ("UK", "United Kingdom"),
  236. ("UM", "United States Minor Outlying Islands"),
  237. ("US", "United States of America"),
  238. ("UY", "Uruguay"),
  239. ("UZ", "Uzbekistan"),
  240. ("VA", "Holy See"),
  241. ("VC", "Saint Vincent and the Grenadines"),
  242. ("VE", "Venezuela"),
  243. ("VG", "Virgin Islands (British)"),
  244. ("VI", "Virgin Islands (U.S.)"),
  245. ("VN", "Vietnam"),
  246. ("VU", "Vanuatu"),
  247. ("WF", "Wallis and Futuna"),
  248. ("WS", "Samoa"),
  249. ("YE", "Yemen"),
  250. ("YT", "Mayotte"),
  251. ("ZA", "South Africa"),
  252. ("ZM", "Zambia"),
  253. ("ZW", "Zimbabwe"),
  254. )
  255.  
  256. COUNTRY_TO_REGION = {
  257. "AD": 3,
  258. "AE": 4,
  259. "AF": 2,
  260. "AG": 0,
  261. "AI": 0,
  262. "AL": 3,
  263. "AM": 4,
  264. "AO": 4,
  265. "AQ": 6,
  266. "AR": 0,
  267. "AS": 5,
  268. "AT": 3,
  269. "AU": 2,
  270. "AW": 0,
  271. "AX": 3,
  272. "AZ": 4,
  273. "BA": 3,
  274. "BB": 0,
  275. "BD": 2,
  276. "BE": 3,
  277. "BF": 4,
  278. "BG": 3,
  279. "BH": 4,
  280. "BI": 4,
  281. "BJ": 4,
  282. "BL": 0,
  283. "BM": 1,
  284. "BN": 2,
  285. "BO": 0,
  286. "BQ": 0,
  287. "BR": 0,
  288. "BS": 0,
  289. "BT": 2,
  290. "BV": 6,
  291. "BW": 4,
  292. "BY": 3,
  293. "BZ": 0,
  294. "CA": 1,
  295. "CB": 0,
  296. "CC": 6,
  297. "CD": 4,
  298. "CF": 4,
  299. "CG": 4,
  300. "CH": 3,
  301. "CI": 4,
  302. "CK": 5,
  303. "CL": 0,
  304. "CM": 4,
  305. "CN": 2,
  306. "CO": 0,
  307. "CR": 0,
  308. "CU": 0,
  309. "CV": 4,
  310. "CW": 0,
  311. "CX": 6,
  312. "CY": 4,
  313. "CZ": 3,
  314. "DE": 3,
  315. "DJ": 4,
  316. "DK": 3,
  317. "DM": 0,
  318. "DO": 0,
  319. "DZ": 4,
  320. "EC": 0,
  321. "EE": 3,
  322. "EG": 4,
  323. "EH": 4,
  324. "ER": 4,
  325. "ES": 3,
  326. "ET": 4,
  327. "FI": 3,
  328. "FJ": 5,
  329. "FK": 0,
  330. "FM": 5,
  331. "FO": 3,
  332. "FR": 3,
  333. "GA": 4,
  334. "GD": 0,
  335. "GE": 4,
  336. "GF": 0,
  337. "GG": 3,
  338. "GH": 4,
  339. "GI": 3,
  340. "GL": 1,
  341. "GM": 4,
  342. "GN": 4,
  343. "GP": 0,
  344. "GQ": 4,
  345. "GR": 3,
  346. "GS": 6,
  347. "GT": 0,
  348. "GU": 5,
  349. "GW": 4,
  350. "GY": 0,
  351. "HK": 2,
  352. "HM": 6,
  353. "HN": 0,
  354. "HR": 3,
  355. "HT": 0,
  356. "HU": 3,
  357. "ID": 2,
  358. "IE": 3,
  359. "IL": 4,
  360. "IM": 3,
  361. "IN": 2,
  362. "IO": 6,
  363. "IQ": 4,
  364. "IR": 4,
  365. "IS": 3,
  366. "IT": 3,
  367. "JE": 3,
  368. "JM": 0,
  369. "JO": 4,
  370. "JP": 2,
  371. "KE": 4,
  372. "KG": 2,
  373. "KH": 2,
  374. "KI": 5,
  375. "KM": 4,
  376. "KN": 0,
  377. "KP": 2,
  378. "KR": 2,
  379. "KW": 4,
  380. "KY": 0,
  381. "KZ": 2,
  382. "LA": 2,
  383. "LB": 4,
  384. "LC": 0,
  385. "LI": 3,
  386. "LK": 2,
  387. "LR": 4,
  388. "LS": 4,
  389. "LT": 3,
  390. "LU": 3,
  391. "LV": 3,
  392. "LY": 4,
  393. "MA": 4,
  394. "MC": 3,
  395. "MD": 3,
  396. "ME": 3,
  397. "MF": 0,
  398. "MG": 4,
  399. "MH": 5,
  400. "MK": 3,
  401. "ML": 4,
  402. "MM": 2,
  403. "MN": 2,
  404. "MO": 2,
  405. "MP": 5,
  406. "MQ": 0,
  407. "MR": 4,
  408. "MS": 0,
  409. "MT": 3,
  410. "MU": 4,
  411. "MV": 2,
  412. "MW": 4,
  413. "MX": 0,
  414. "MY": 2,
  415. "MZ": 4,
  416. "NA": 4,
  417. "NC": 5,
  418. "NE": 4,
  419. "NF": 2,
  420. "NG": 4,
  421. "NI": 0,
  422. "NL": 3,
  423. "NO": 3,
  424. "NP": 2,
  425. "NR": 5,
  426. "NU": 5,
  427. "NZ": 2,
  428. "OM": 4,
  429. "PA": 0,
  430. "PE": 0,
  431. "PF": 5,
  432. "PG": 5,
  433. "PH": 2,
  434. "PK": 2,
  435. "PL": 3,
  436. "PM": 1,
  437. "PN": 5,
  438. "PR": 0,
  439. "PS": 4,
  440. "PT": 3,
  441. "PW": 5,
  442. "PY": 0,
  443. "QA": 4,
  444. "RE": 4,
  445. "RO": 3,
  446. "RS": 3,
  447. "RU": 3,
  448. "RW": 4,
  449. "SA": 4,
  450. "SB": 5,
  451. "SC": 4,
  452. "SD": 4,
  453. "SE": 3,
  454. "SG": 2,
  455. "SH": 4,
  456. "SI": 3,
  457. "SJ": 3,
  458. "SK": 3,
  459. "SL": 4,
  460. "SM": 3,
  461. "SN": 4,
  462. "SO": 4,
  463. "SR": 0,
  464. "SS": 4,
  465. "ST": 4,
  466. "SV": 0,
  467. "SX": 0,
  468. "SY": 4,
  469. "SZ": 4,
  470. "TC": 0,
  471. "TD": 4,
  472. "TF": 6,
  473. "TG": 4,
  474. "TH": 2,
  475. "TJ": 2,
  476. "TK": 5,
  477. "TL": 2,
  478. "TM": 4,
  479. "TN": 4,
  480. "TO": 5,
  481. "TR": 4,
  482. "TT": 0,
  483. "TV": 5,
  484. "TW": 2,
  485. "TZ": 4,
  486. "UA": 3,
  487. "UG": 4,
  488. "UK": 3,
  489. "UM": 6,
  490. "US": 1,
  491. "UY": 0,
  492. "UZ": 2,
  493. "VA": 3,
  494. "VC": 0,
  495. "VE": 0,
  496. "VG": 0,
  497. "VI": 0,
  498. "VN": 2,
  499. "VU": 5,
  500. "WF": 5,
  501. "WS": 5,
  502. "YE": 4,
  503. "YT": 4,
  504. "ZA": 4,
  505. "ZM": 4,
  506. "ZW": 4
  507. }
  508.  
  509. REGIONS = (
  510. (0, "Americas - Central & Latin"),
  511. (1, "Americas - Northern"),
  512. (2, "Asia Pacific"),
  513. (3, "Europe"),
  514. (4, "Middle East & Africa"),
  515. (5, "Oceania"),
  516. (6, "Others"),
  517. )
Add Comment
Please, Sign In to add comment