countries-dictionary 2.3.0__py3-none-any.whl → 3.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.

@@ -1,67 +0,0 @@
1
- """Some prepared functions which might or might not be helpful"""
2
-
3
- from countries_dictionary import countries
4
- from countries_dictionary.russia import russia
5
- from countries_dictionary.vietnam import vietnam
6
- import json
7
-
8
- def chosen_dictionary(dictionary="countries"):
9
- """Returns one of the dictionaries depends on the parameter. Used in other functions"""
10
- if dictionary.casefold() == "countries": return countries
11
- elif dictionary.casefold() == "russia": return russia
12
- elif dictionary.casefold() == "vietnam": return vietnam
13
- else: raise Exception("This dictionary does not exist (yet)")
14
-
15
- def json_dictionary(indent: int | str | None = None, dictionary="countries"):
16
- """Converts the chosen dictionary into a JSON string"""
17
- x = chosen_dictionary(dictionary)
18
- return json.dumps(x, indent=indent)
19
-
20
- def sorted_dictionary(chosen_key: str, reverse: bool = True, dictionary="countries"):
21
- """Sorts the chosen dictionary by a sortable key"""
22
- x = chosen_dictionary(dictionary)
23
- return dict(sorted(x.items(), key=lambda item: item[1][chosen_key], reverse=reverse))
24
-
25
- def filtered_dictionary(chosen_key: str, chosen_value: int | str, dictionary="countries"):
26
- """Filters the chosen dictionary by a key"""
27
- x = chosen_dictionary(dictionary)
28
- if chosen_key == "continents" or chosen_key == "official languages":
29
- return dict(filter(lambda item: chosen_value in item[1][chosen_key], x.items()))
30
- else: return dict(filter(lambda item: item[1][chosen_key] == chosen_value, x.items()))
31
- # This is still under development
32
-
33
- def countries_population_density():
34
- """Returns the countries dictionary with the `"population density"` key included in the countries' keys
35
- - Population density (in people per square kilometre) = Population / Land area"""
36
- new_countries = countries
37
- for x in countries: new_countries[x]["population density"] = countries[x]["population"] / countries[x]["land area"]
38
- return new_countries
39
-
40
- def russia_population_density():
41
- """Returns the Russia dictionary with the `"population density"` key included in the countries' keys
42
- - Population density (in people per square kilometre) = Population / Land area"""
43
- new_russia = russia
44
- for x in russia: new_russia[x]["population density"] = russia[x]["population"] / russia[x]["area"]
45
- return new_russia
46
-
47
- def vietnam_population_density():
48
- """Returns the Vietnam dictionary with the `"population density"` key included in the countries' keys
49
- - Population density (in people per square kilometre) = Population / Area"""
50
- new_vietnam = vietnam
51
- for x in vietnam: new_vietnam[x]["population density"] = vietnam[x]["population"] / vietnam[x]["area"]
52
- return new_vietnam
53
-
54
- def countries_population_density():
55
- """Returns the countries dictionary with the `"GDP per capita"` key included in the countries' keys
56
- - GDP per capita (in dollars per person) = Nominal GDP / Population"""
57
- new_countries = countries
58
- for x in countries: new_countries[x]["GDP per capita"] = countries[x]["nominal GDP"] / countries[x]["population"]
59
- return new_countries
60
-
61
- def countries_france_censored():
62
- """Returns the countries dictionary with the `"France"` key gets censored `"Fr*nce"`
63
- (This is only a joke, I don't support hate against France and French people)"""
64
- new_countries = countries
65
- new_countries["Fr*nce"] = new_countries.pop("France")
66
- new_countries = dict(sorted(new_countries.items()))
67
- return new_countries
@@ -1,9 +0,0 @@
1
- countries_dictionary/__init__.py,sha256=NXYVcOhGJ0Jza3jTvgykUvAX38L75KVxxffwY-2obsU,62813
2
- countries_dictionary/quick_variables.py,sha256=No05p1EbmHSOgbU6-FZhgNq21GJ8--k6UaHSvPgNdJo,3550
3
- countries_dictionary/russia.py,sha256=iHm3n54urJtKnzXfWGuTD-4vf23hH2ysKCIV0LTmF6g,20097
4
- countries_dictionary/vietnam.py,sha256=6aaV7QPhEHDFvPXPVJBr95wYHsJacC_Hr587_PnVdlE,6424
5
- countries_dictionary-2.3.0.dist-info/licenses/LICENCE,sha256=gcuuhKKc5-dwvyvHsXjlC9oM6N5gZ6umYbC8ewW1Yvg,35821
6
- countries_dictionary-2.3.0.dist-info/METADATA,sha256=egZq2TzW3jMCNSa-1nGzP5gfRcCgWx1zSGW159pqSWo,42891
7
- countries_dictionary-2.3.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
8
- countries_dictionary-2.3.0.dist-info/top_level.txt,sha256=7tkD6sfiOQ__y-Eb2rnPUU0Lbhr_wtFBNcRus-aU4Zw,21
9
- countries_dictionary-2.3.0.dist-info/RECORD,,