countries-dictionary 9.0.0.dev2__tar.gz → 9.0.0.dev3__tar.gz
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.
- {countries_dictionary-9.0.0.dev2 → countries_dictionary-9.0.0.dev3}/PKG-INFO +1 -1
- {countries_dictionary-9.0.0.dev2 → countries_dictionary-9.0.0.dev3}/pyproject.toml +1 -1
- {countries_dictionary-9.0.0.dev2 → countries_dictionary-9.0.0.dev3}/src/countries_dictionary/tools/quick_functions.py +9 -5
- {countries_dictionary-9.0.0.dev2 → countries_dictionary-9.0.0.dev3}/src/countries_dictionary.egg-info/PKG-INFO +1 -1
- {countries_dictionary-9.0.0.dev2 → countries_dictionary-9.0.0.dev3}/LICENCE +0 -0
- {countries_dictionary-9.0.0.dev2 → countries_dictionary-9.0.0.dev3}/README.md +0 -0
- {countries_dictionary-9.0.0.dev2 → countries_dictionary-9.0.0.dev3}/setup.cfg +0 -0
- {countries_dictionary-9.0.0.dev2 → countries_dictionary-9.0.0.dev3}/src/countries_dictionary/__init__.py +0 -0
- {countries_dictionary-9.0.0.dev2 → countries_dictionary-9.0.0.dev3}/src/countries_dictionary/countries.py +0 -0
- {countries_dictionary-9.0.0.dev2 → countries_dictionary-9.0.0.dev3}/src/countries_dictionary/russia.py +0 -0
- {countries_dictionary-9.0.0.dev2 → countries_dictionary-9.0.0.dev3}/src/countries_dictionary/themed/__init__.py +0 -0
- {countries_dictionary-9.0.0.dev2 → countries_dictionary-9.0.0.dev3}/src/countries_dictionary/themed/communist_states.py +0 -0
- {countries_dictionary-9.0.0.dev2 → countries_dictionary-9.0.0.dev3}/src/countries_dictionary/themed/european_union.py +0 -0
- {countries_dictionary-9.0.0.dev2 → countries_dictionary-9.0.0.dev3}/src/countries_dictionary/tools/iso_finder.py +0 -0
- {countries_dictionary-9.0.0.dev2 → countries_dictionary-9.0.0.dev3}/src/countries_dictionary/united_states.py +0 -0
- {countries_dictionary-9.0.0.dev2 → countries_dictionary-9.0.0.dev3}/src/countries_dictionary/unrecognised_states/__init__.py +0 -0
- {countries_dictionary-9.0.0.dev2 → countries_dictionary-9.0.0.dev3}/src/countries_dictionary/unrecognised_states/transnistria.py +0 -0
- {countries_dictionary-9.0.0.dev2 → countries_dictionary-9.0.0.dev3}/src/countries_dictionary/unrecognised_states/unrecognised.py +0 -0
- {countries_dictionary-9.0.0.dev2 → countries_dictionary-9.0.0.dev3}/src/countries_dictionary/vietnam.py +0 -0
- {countries_dictionary-9.0.0.dev2 → countries_dictionary-9.0.0.dev3}/src/countries_dictionary.egg-info/SOURCES.txt +0 -0
- {countries_dictionary-9.0.0.dev2 → countries_dictionary-9.0.0.dev3}/src/countries_dictionary.egg-info/dependency_links.txt +0 -0
- {countries_dictionary-9.0.0.dev2 → countries_dictionary-9.0.0.dev3}/src/countries_dictionary.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: countries_dictionary
|
|
3
|
-
Version: 9.0.0.
|
|
3
|
+
Version: 9.0.0.dev3
|
|
4
4
|
Summary: Provides dictionaries contains countries and unrecognised states and information about them
|
|
5
5
|
Author-email: Ngô Trần Quang Thiện <quangthienngotran@gmail.com>
|
|
6
6
|
License: GNU GENERAL PUBLIC LICENSE
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "countries_dictionary"
|
|
7
|
-
version = "9.0.0.
|
|
7
|
+
version = "9.0.0.dev3"
|
|
8
8
|
description = "Provides dictionaries contains countries and unrecognised states and information about them"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.7"
|
|
@@ -1,32 +1,36 @@
|
|
|
1
|
-
from countries_dictionary import COUNTRIES, RUSSIA, UNITED_STATES, VIETNAM, UNRECOGNISED_STATES, TRANSNISTRIA
|
|
1
|
+
from countries_dictionary import COUNTRIES, RUSSIA, UNITED_STATES, VIETNAM, UNRECOGNISED_STATES, TRANSNISTRIA, COMMUNIST_STATES, EUROPEAN_UNION
|
|
2
2
|
|
|
3
3
|
from json import dumps
|
|
4
4
|
from copy import deepcopy
|
|
5
5
|
|
|
6
6
|
def quick_function(dictionary: str = "countries", addition: str = ""):
|
|
7
7
|
"""Returns one of the dictionaries depends on the `dictionary` parameter and modify it depends on the `addition` parameter."""
|
|
8
|
+
themed = ("communist_states", "communist_state", "communist states", "communist state", "communist", "eu", "europe", "european_union", "european union")
|
|
8
9
|
match dictionary.casefold():
|
|
9
10
|
case "countries": thanhbinh = deepcopy(COUNTRIES)
|
|
10
11
|
case "russia": thanhbinh = deepcopy(RUSSIA)
|
|
11
12
|
case "united states" | "america": thanhbinh = deepcopy(UNITED_STATES)
|
|
12
13
|
case "vietnam": thanhbinh = deepcopy(VIETNAM)
|
|
13
|
-
case "unrecognised_states" | "unrecognized_states" | "unrecognised" | "unrecognized": thanhbinh = deepcopy(UNRECOGNISED_STATES)
|
|
14
|
+
case "unrecognised_states" | "unrecognized_states" | "unrecognised states" | "unrecognized states" | "unrecognised" | "unrecognized": thanhbinh = deepcopy(UNRECOGNISED_STATES)
|
|
14
15
|
case "transnistria" | "pridnestrovie": thanhbinh = deepcopy(TRANSNISTRIA)
|
|
16
|
+
case "communist_states" | "communist_state" | "communist states" | "communist state" | "communist": thanhbinh = deepcopy(COMMUNIST_STATES)
|
|
17
|
+
case "eu" | "europe" | "european_union" | "european union": thanhbinh = deepcopy(EUROPEAN_UNION)
|
|
15
18
|
case _: raise Exception("This dictionary does not exist (yet)")
|
|
16
19
|
match addition.casefold():
|
|
17
|
-
case "population density":
|
|
20
|
+
case "population density" if dictionary.casefold() not in themed:
|
|
18
21
|
if dictionary.casefold() in ("countries", "unrecognised_states", "unrecognized_states", "unrecognised", "unrecognized"):
|
|
19
22
|
for x in thanhbinh: thanhbinh[x]["population density"] = thanhbinh[x]["population"] / thanhbinh[x]["land area"]
|
|
20
23
|
else:
|
|
21
24
|
for x in thanhbinh: thanhbinh[x]["population density"] = thanhbinh[x]["population"] / thanhbinh[x]["area"]
|
|
22
|
-
case "gdp per capita":
|
|
25
|
+
case "gdp per capita" if dictionary.casefold() not in themed:
|
|
23
26
|
if dictionary.casefold() in ("countries", "unrecognised_states", "unrecognized_states", "unrecognised", "unrecognized"):
|
|
24
27
|
for x in thanhbinh: thanhbinh[x]["GDP per capita"] = thanhbinh[x]["nominal GDP"] / thanhbinh[x]["population"]
|
|
25
28
|
else: raise Exception("Only works with the Countries and Unrecognised states dictionary")
|
|
26
|
-
case "iso 3166-2":
|
|
29
|
+
case "iso 3166-2" if dictionary.casefold() not in themed:
|
|
27
30
|
if dictionary.casefold() == "countries":
|
|
28
31
|
for x in thanhbinh: thanhbinh[x]["ISO 3166-2"] = "ISO 3166-2:" + thanhbinh[x]["ISO 3166-1"]["alpha-2"]
|
|
29
32
|
else: raise Exception("Only works with the Countries dictionary")
|
|
33
|
+
case _ if dictionary.casefold() in themed: raise Exception("You can not modify a themed dictionary.")
|
|
30
34
|
return thanhbinh
|
|
31
35
|
|
|
32
36
|
def json_dictionary(dictionary: str = "countries", addition: str = "", indent: int | str | None = None):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: countries_dictionary
|
|
3
|
-
Version: 9.0.0.
|
|
3
|
+
Version: 9.0.0.dev3
|
|
4
4
|
Summary: Provides dictionaries contains countries and unrecognised states and information about them
|
|
5
5
|
Author-email: Ngô Trần Quang Thiện <quangthienngotran@gmail.com>
|
|
6
6
|
License: GNU GENERAL PUBLIC LICENSE
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|