|
29 | 29 |
|
30 | 30 | import operator |
31 | 31 | import re |
32 | | - |
| 32 | +import sys |
| 33 | +import pathlib |
| 34 | +this_folder = pathlib.Path(__file__).parent.resolve() |
| 35 | +sys.path.append(f"{this_folder}") |
| 36 | +sys.path.append(f"{this_folder}/..") |
| 37 | +from common import extra_synonyms |
33 | 38 | import pycountry |
34 | 39 |
|
35 | | -extra_synonyms = {"VN": {"Vietnam"}, "US": {"USA", "the US", r"U.S", r"U.S.", "U.S.A."}, "CZ": {"Czech Rep", "Czech Republic"}, |
36 | | - "AE": {"UAE", r"U.A.E."}, |
37 | | - "KR": {"Korea", "Republic of Korea"}, "KP": {"North Korea", "Democratic People's Republic of Korea", "Democratic Peoples Republic of Korea", "DPRK", r"D.P.R.K."}, |
38 | | - "CI": {"Ivory Coast", "Cote d'Ivoire", "Cote dIvoire", "Cote Divoire"}, "CD": {"Congo, The Democratic Republic", "Congo, Democratic Republic", |
39 | | - "Democratic Republic of the Congo", |
40 | | - "Democratic Republic of Congo", "DR Congo", "DRC"}, |
41 | | - "CV": {"Cape Verde"}, "SH": {"St. Helena", "St Helena"}, |
42 | | - "GB": {"Britain", "United Kingdom", "UK", r"U.K", r"U.K."}, |
43 | | - "RU": {"Russia"}, "VA": {"Holy See"}, "BN": {"Brunei"}, "LA": {"Laos", "LPDR"}, |
44 | | - "VG": {"British Virgin Islands", "Virgin Islands (British)", "Virgin Islands, British", |
45 | | - 'Virgin Islands (Great Britain)', |
46 | | - 'Virgin Islands (GB)', |
47 | | - 'Virgin Islands (Britain)', |
48 | | - 'Virgin Islands (UK)' |
49 | | - }, |
50 | | - "VI": {"Virgin Islands (US)", "Virgin Islands (U.S.)", "Virgin Islands, US", "Virgin Islands, U.S.", |
51 | | - 'Virgin Islands (USA)', |
52 | | - 'Virgin Islands (U.S.A.)', |
53 | | - 'USA Virgin Islands', |
54 | | - 'U.S. Virgin Islands', |
55 | | - 'US Virgin Islands', |
56 | | - 'American Virgin Islands', |
57 | | - 'U.S.A. Virgin Islands', |
58 | | - }, |
59 | | - "SY": {"Syria"}, "GE": {"Republic of Georgia"}, |
60 | | - 'GM': {'gambia, republic of', 'gambia republic', 'republic of gambia', 'republic of the gambia'}, |
61 | | - "NL": {"Nerlands"}, "IR": {"Iran"}, "AE": {"UAE", "U.A.E."}, |
62 | | - "MK": {"Macedonia, The Former Yugoslav Republic of", "Macedonia, Former", "FYROM"}, |
63 | | - "RS": {"Kosovo", "Former Yugoslavia", "Former Serbia and Montenegro"}, |
64 | | - # Kosovo currently mapped to Serbia for technical reasons because Kosovo is not currently its own 2 letter code in Debian or Pycountry (the dependencies of this library) |
65 | | - "SZ": {"Swaziland", "eswatini", "eSwatini"}, |
66 | | - "LY": {"Libyan Arab Jamahiriya"}, |
67 | | - "PS": {"Palestinian Territories, Occupied", "Palestinian Territory, occupied", "Palestine, Occupied", |
68 | | - "Occupied Palestine"}, |
69 | | - "CN": {"Macau"}, |
70 | | - "LC": {"St Lucia", "St. Lucia"}, |
71 | | - "KN": {"St Kitts and Nevis", "St. Kitts and Nevis"}, |
72 | | - "VC": {"St Vincent and the Grenadines", "St. Vincent and the Grenadines"}, |
73 | | - # For compatibility with various versions of pycountry |
74 | | - "TR": {"Turkey", "Turkiye", "Türkiye"}, |
75 | | - "GQ": {"equatorial Guinea", "ecuatorial Guinea", "Equatorial Guinea", "Ecuatorial Guinea", |
76 | | - "Guinea equatorial", "Guinea ecuatorial", "Guinea Equatorial", "Guinea Ecuatorial"} |
77 | | - } |
78 | 40 | countries_maps = {} |
79 | 41 |
|
80 | 42 | def _add_variant(name: str, country): |
|
0 commit comments