countries-dictionary 3.1.3__py3-none-any.whl → 4.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of countries-dictionary might be problematic. Click here for more details.
- countries_dictionary/__init__.py +418 -46
- countries_dictionary/iso_finder.py +36 -11
- countries_dictionary/quick_functions.py +12 -3
- countries_dictionary/russia.py +359 -90
- countries_dictionary/united_states.py +116 -80
- countries_dictionary/unrecognised_states/__init__.py +133 -0
- countries_dictionary/unrecognised_states/transnistria.py +38 -0
- countries_dictionary/vietnam.py +141 -37
- {countries_dictionary-3.1.3.dist-info → countries_dictionary-4.0.0.dist-info}/METADATA +59 -106
- countries_dictionary-4.0.0.dist-info/RECORD +13 -0
- countries_dictionary-3.1.3.dist-info/RECORD +0 -11
- {countries_dictionary-3.1.3.dist-info → countries_dictionary-4.0.0.dist-info}/WHEEL +0 -0
- {countries_dictionary-3.1.3.dist-info → countries_dictionary-4.0.0.dist-info}/licenses/LICENCE +0 -0
- {countries_dictionary-3.1.3.dist-info → countries_dictionary-4.0.0.dist-info}/top_level.txt +0 -0
|
@@ -1,11 +1,36 @@
|
|
|
1
|
-
from countries_dictionary import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
from countries_dictionary.quick_functions import countries_iso_3166_2
|
|
2
|
+
from countries_dictionary.russia import RUSSIA
|
|
3
|
+
from countries_dictionary.united_states import UNITED_STATES
|
|
4
|
+
from countries_dictionary.vietnam import VIETNAM
|
|
5
|
+
|
|
6
|
+
countries = countries_iso_3166_2()
|
|
7
|
+
|
|
8
|
+
def iso_finder(code: str, info_included: str = None):
|
|
9
|
+
"""Returns the name of the country and their chosen information based on the provided ISO code"""
|
|
10
|
+
for x in countries:
|
|
11
|
+
y = countries[x].get(info_included, "") if info_included else ""
|
|
12
|
+
iso_data = countries[x]["ISO 3166-1"]
|
|
13
|
+
if code in (iso_data["alpha-2"], iso_data["alpha-3"], iso_data["numeric"], countries[x]["ISO 3166-2"]): return [x, y]
|
|
14
|
+
raise Exception("No United Nations' member or observer state has this code")
|
|
15
|
+
|
|
16
|
+
def iso_ru_finder(code: str, info_included: str = None):
|
|
17
|
+
"""Returns the name of the Russian federal subject and their chosen information based on the provided ISO code
|
|
18
|
+
(For occupied zones in Ukraine, check the Ukraine dictionary, it hasn't released though)"""
|
|
19
|
+
for x in RUSSIA:
|
|
20
|
+
y = RUSSIA[x].get(info_included, "") if info_included else ""
|
|
21
|
+
if code == RUSSIA[x]["ISO 3166-2:RU"]: return [x, y]
|
|
22
|
+
raise Exception("No Russian federal subject has this code")
|
|
23
|
+
|
|
24
|
+
def iso_us_finder(code: str, info_included: str = None):
|
|
25
|
+
"""Returns the name of the US state or territory and their chosen information based on the provided ISO code"""
|
|
26
|
+
for x in UNITED_STATES:
|
|
27
|
+
y = UNITED_STATES[x].get(info_included, "") if info_included else ""
|
|
28
|
+
if code == UNITED_STATES[x]["ISO 3166-2:US"]: return [x, y]
|
|
29
|
+
raise Exception("No US state or territory has this code")
|
|
30
|
+
|
|
31
|
+
def iso_vn_finder(code: str, info_included: str = None):
|
|
32
|
+
"""Returns the name of the Vietnamese province and their chosen information based on the provided ISO code"""
|
|
33
|
+
for x in VIETNAM:
|
|
34
|
+
y = VIETNAM[x].get(info_included, "") if info_included else ""
|
|
35
|
+
if code == VIETNAM[x]["ISO 3166-2:VN"]: return [x, y]
|
|
36
|
+
raise Exception("No Vietnamese province has this code")
|
|
@@ -10,7 +10,7 @@ def chosen_dictionary(dictionary="countries"):
|
|
|
10
10
|
"""Returns one of the dictionaries depends on the parameter. Used in other functions"""
|
|
11
11
|
if dictionary.casefold() == "countries": return COUNTRIES
|
|
12
12
|
elif dictionary.casefold() == "russia": return RUSSIA
|
|
13
|
-
elif dictionary.casefold() == "united
|
|
13
|
+
elif dictionary.casefold() == "united states" or "america": return UNITED_STATES
|
|
14
14
|
elif dictionary.casefold() == "vietnam": return VIETNAM
|
|
15
15
|
else: raise Exception("This dictionary does not exist (yet)")
|
|
16
16
|
|
|
@@ -74,10 +74,19 @@ def countries_iso_3166_2():
|
|
|
74
74
|
for x in COUNTRIES: new_countries[x]["ISO 3166-2"] = "ISO 3166-2:" + COUNTRIES[x]["ISO 3166-1"]["alpha-2"]
|
|
75
75
|
return new_countries
|
|
76
76
|
|
|
77
|
+
# Fun functions, for entertainment purposes only
|
|
78
|
+
|
|
77
79
|
def countries_france_censored():
|
|
78
80
|
"""Returns the countries dictionary with the `France` key gets censored `Fr*nce`
|
|
79
|
-
|
|
81
|
+
|
|
82
|
+
(This is just a joke, I don't support hate against France and French people)"""
|
|
80
83
|
new_countries = COUNTRIES
|
|
81
84
|
new_countries["Fr*nce"] = new_countries.pop("France")
|
|
82
85
|
new_countries = dict(sorted(new_countries.items()))
|
|
83
|
-
return new_countries
|
|
86
|
+
return new_countries
|
|
87
|
+
|
|
88
|
+
def countries_allahu_akbar():
|
|
89
|
+
"""Returns the countries dictionary without most countries except the two countries whose mottos are "God is the Greatest". اَللَّٰهُ أَكْبَرُ!
|
|
90
|
+
|
|
91
|
+
(I'm not a Muslim, and this is just a joke, I don't support hate against Islam and these two countries)"""
|
|
92
|
+
return dict(filter(lambda item: item[1]["motto"] == "God is the Greatest", COUNTRIES.items()))
|