countries-dictionary 3.1.4__tar.gz → 4.0.1__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.
Potentially problematic release.
This version of countries-dictionary might be problematic. Click here for more details.
- {countries_dictionary-3.1.4 → countries_dictionary-4.0.1}/PKG-INFO +59 -106
- countries_dictionary-4.0.1/README.md +144 -0
- {countries_dictionary-3.1.4 → countries_dictionary-4.0.1}/countries_dictionary/__init__.py +418 -26
- countries_dictionary-4.0.1/countries_dictionary/iso_finder.py +36 -0
- {countries_dictionary-3.1.4 → countries_dictionary-4.0.1}/countries_dictionary/quick_functions.py +12 -3
- {countries_dictionary-3.1.4 → countries_dictionary-4.0.1}/countries_dictionary/russia.py +181 -1
- {countries_dictionary-3.1.4 → countries_dictionary-4.0.1}/countries_dictionary/united_states.py +116 -80
- countries_dictionary-4.0.1/countries_dictionary/unrecognised_states/__init__.py +133 -0
- countries_dictionary-4.0.1/countries_dictionary/unrecognised_states/transnistria.py +38 -0
- {countries_dictionary-3.1.4 → countries_dictionary-4.0.1}/countries_dictionary/vietnam.py +73 -3
- {countries_dictionary-3.1.4 → countries_dictionary-4.0.1}/countries_dictionary.egg-info/PKG-INFO +59 -106
- {countries_dictionary-3.1.4 → countries_dictionary-4.0.1}/countries_dictionary.egg-info/SOURCES.txt +3 -1
- {countries_dictionary-3.1.4 → countries_dictionary-4.0.1}/pyproject.toml +3 -3
- countries_dictionary-3.1.4/README.md +0 -191
- countries_dictionary-3.1.4/countries_dictionary/iso_finder.py +0 -17
- {countries_dictionary-3.1.4 → countries_dictionary-4.0.1}/LICENCE +0 -0
- {countries_dictionary-3.1.4 → countries_dictionary-4.0.1}/countries_dictionary.egg-info/dependency_links.txt +0 -0
- {countries_dictionary-3.1.4 → countries_dictionary-4.0.1}/countries_dictionary.egg-info/top_level.txt +0 -0
- {countries_dictionary-3.1.4 → countries_dictionary-4.0.1}/setup.cfg +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: countries_dictionary
|
|
3
|
-
Version:
|
|
4
|
-
Summary: Provides a dictionary contains
|
|
3
|
+
Version: 4.0.1
|
|
4
|
+
Summary: Provides a dictionary 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
|
|
7
7
|
Version 3, 29 June 2007
|
|
@@ -679,58 +679,31 @@ License: GNU GENERAL PUBLIC LICENSE
|
|
|
679
679
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
|
680
680
|
Project-URL: Homepage, https://github.com/ThienFakeVN/countries_dictionary/
|
|
681
681
|
Project-URL: Repository, https://github.com/ThienFakeVN/countries_dictionary/
|
|
682
|
-
Keywords: countries,dictionary,united nations,
|
|
682
|
+
Keywords: countries,states,dictionary,united nations,russia,united states,vietnam,iso
|
|
683
683
|
Requires-Python: >=3.7
|
|
684
684
|
Description-Content-Type: text/markdown
|
|
685
685
|
License-File: LICENCE
|
|
686
686
|
Dynamic: license-file
|
|
687
687
|
|
|
688
688
|
# Countries Dictionary
|
|
689
|
-
Countries Dictionary provides
|
|
690
|
-
- A dictionary contains all members and observer states of the United Nations and information about them:
|
|
691
|
-
- Formal name
|
|
692
|
-
- Continent(s) of the country's mainland
|
|
693
|
-
- Area and land area (in square kilometre)
|
|
694
|
-
- Population
|
|
695
|
-
- Official language(s)
|
|
696
|
-
- Nominal GDP (in dollar)
|
|
697
|
-
- Human Development Index
|
|
698
|
-
- ISO 3166-1 codes
|
|
699
|
-
- Another dictionary contains all federal subjects of the Russian Federation (including occupied zones in Ukraine) and information about them:
|
|
700
|
-
- Federal district
|
|
701
|
-
- Economic region
|
|
702
|
-
- Capital or administrative centre
|
|
703
|
-
- Area (in square kilometre)
|
|
704
|
-
- Population
|
|
705
|
-
- Another one contains all provinces and municipalities of the Socialist Republic of Vietnam and information about them:
|
|
706
|
-
- Region
|
|
707
|
-
- Administrative centre
|
|
708
|
-
- Area (in square kilometre)
|
|
709
|
-
- Population
|
|
710
|
-
- Another one contains all states, federal district and inhabited territories of the United States of America and information about them:
|
|
711
|
-
- Capital
|
|
712
|
-
- Date of ratification/establishment/acquiring
|
|
713
|
-
- Area (in square kilometre)
|
|
714
|
-
- Population
|
|
715
|
-
- House Representatives
|
|
716
|
-
- Postal code
|
|
717
|
-
- Some functions which you might find helpful
|
|
689
|
+
Countries Dictionary is a data-oriented module which provides dictionaries of countries and states, from members of UN to unrecognised ones.
|
|
718
690
|
|
|
719
691
|
I created this module as an offline source of countries' information which is easy to access and use by coders.
|
|
720
692
|
|
|
721
693
|
See [CHANGELOG.md](https://github.com/ThienFakeVN/countries_dictionary/blob/main/CHANGELOG.md) for changes of releases.
|
|
722
694
|
|
|
723
|
-
Before using, it is recommended to see the code on [GitHub](https://github.com/ThienFakeVN/countries_dictionary/) or the below section to understand how the module works and how you can use it
|
|
724
|
-
|
|
695
|
+
Before using, it is recommended to see the code on [GitHub](https://github.com/ThienFakeVN/countries_dictionary/) <!--or the below section--> to understand how the module works and how you can use it.
|
|
696
|
+
<!--
|
|
725
697
|
## Codes
|
|
726
698
|
### Main Countries Dictionary
|
|
727
|
-
#### Structure
|
|
728
699
|
The Countries Dictionary has a structure like this:
|
|
729
700
|
```python
|
|
730
701
|
COUNTRIES = {
|
|
731
702
|
"Afghanistan": {
|
|
732
703
|
"formal name": "Islamic Emirate of Afghanistan",
|
|
704
|
+
"motto": "There is no god but God; Muhammad is the messenger of God",
|
|
733
705
|
"continents": ["Asia"],
|
|
706
|
+
"landlocked": True,
|
|
734
707
|
"area": 652864.0,
|
|
735
708
|
"land area": 652230.0,
|
|
736
709
|
"population": 42045000,
|
|
@@ -743,115 +716,58 @@ COUNTRIES = {
|
|
|
743
716
|
}
|
|
744
717
|
```
|
|
745
718
|
|
|
746
|
-
#### Usage example
|
|
747
|
-
```python
|
|
748
|
-
from countries_dictionary import COUNTRIES # Remember to import the module!
|
|
749
|
-
|
|
750
|
-
# Prints the formal name of the country
|
|
751
|
-
print(COUNTRIES["Vietnam"]["formal name"])
|
|
752
|
-
|
|
753
|
-
# Compares the population of two countries
|
|
754
|
-
print(COUNTRIES["North Korea"]["population"] > COUNTRIES["South Korea"]["population"])
|
|
755
|
-
print(COUNTRIES["North Korea"]["population"] == COUNTRIES["South Korea"]["population"])
|
|
756
|
-
print(COUNTRIES["North Korea"]["population"] < COUNTRIES["South Korea"]["population"])
|
|
757
|
-
|
|
758
|
-
# Creates the list of all countries
|
|
759
|
-
list_of_countries = list(COUNTRIES.keys())
|
|
760
|
-
print(list_of_countries)
|
|
761
|
-
```
|
|
762
|
-
|
|
763
719
|
### Russia dictionary
|
|
764
|
-
#### Structure
|
|
765
720
|
The Russia dictionary has a structure like this:
|
|
766
721
|
```python
|
|
767
722
|
RUSSIA = {
|
|
768
723
|
"Adygea": {
|
|
769
724
|
"federal district": "Southern",
|
|
770
725
|
"economic region": "North Caucasus",
|
|
726
|
+
"landlocked": True,
|
|
771
727
|
"capital/administrative centre": "Maykop",
|
|
772
728
|
"area": 7792.0,
|
|
773
|
-
"population": 501038
|
|
729
|
+
"population": 501038,
|
|
730
|
+
"ISO 3166-2:RU": "RU-AD",
|
|
731
|
+
},
|
|
774
732
|
# ...
|
|
775
733
|
}
|
|
776
734
|
```
|
|
777
735
|
|
|
778
|
-
#### Usage example
|
|
779
|
-
```python
|
|
780
|
-
from countries_dictionary.russia import RUSSIA # Remember to import the module
|
|
781
|
-
|
|
782
|
-
# Prints the administrative centre of a krai
|
|
783
|
-
print(RUSSIA["Primorsky Krai"]["capital/administrative centre"])
|
|
784
|
-
|
|
785
|
-
# Sees if the two federal subjects are in the same federal district
|
|
786
|
-
print(RUSSIA["Tuva"]["federal district"] == RUSSIA["Altai Republic"]["federal district"])
|
|
787
|
-
|
|
788
|
-
# Creates the list of all federal subjects
|
|
789
|
-
list_of_federal_subjects = list(RUSSIA.keys())
|
|
790
|
-
print(list_of_federal_subjects)
|
|
791
|
-
```
|
|
792
|
-
|
|
793
736
|
### United States dictionary
|
|
794
|
-
#### Structure
|
|
795
737
|
The United States dictionary has a structure like this:
|
|
796
738
|
```python
|
|
797
739
|
UNITED_STATES = {
|
|
798
740
|
"Alabama": {
|
|
799
741
|
"capital": "Montgomery",
|
|
800
742
|
"date of ratification/establishment/acquiring": "1819.12.14",
|
|
743
|
+
"landlocked": False,
|
|
801
744
|
"area": 135767.0,
|
|
802
745
|
"population": 5024279,
|
|
803
746
|
"House Representatives": 7,
|
|
804
|
-
"
|
|
805
|
-
}
|
|
747
|
+
"ISO 3166-2:US": "US-AL",
|
|
748
|
+
},
|
|
806
749
|
# ...
|
|
807
750
|
}
|
|
808
751
|
```
|
|
809
752
|
|
|
810
|
-
#### Usage example
|
|
811
|
-
```python
|
|
812
|
-
from countries_dictionary.united_states import UNITED_STATES # Remember to import the module...
|
|
813
|
-
|
|
814
|
-
# Prints the postal code of a state
|
|
815
|
-
print(UNITED_STATES["Ohio"]["postal code"])
|
|
816
|
-
|
|
817
|
-
# Compares the numbers of House Representatives of two states
|
|
818
|
-
print(UNITED_STATES["Oklahoma"]["House Representatives"] > UNITED_STATES["Connecticut"]["House Representatives"])
|
|
819
|
-
print(UNITED_STATES["Oklahoma"]["House Representatives"] == UNITED_STATES["Connecticut"]["House Representatives"])
|
|
820
|
-
print(UNITED_STATES["Oklahoma"]["House Representatives"] < UNITED_STATES["Connecticut"]["House Representatives"])
|
|
821
|
-
|
|
822
|
-
# Creates the list of all states
|
|
823
|
-
list_of_states = list(UNITED_STATES.keys())
|
|
824
|
-
print(list_of_states)
|
|
825
|
-
```
|
|
826
|
-
|
|
827
753
|
### Vietnam dictionary
|
|
828
|
-
#### Structure
|
|
829
754
|
The Vietnam dictionary has a structure like this:
|
|
830
755
|
```python
|
|
831
756
|
VIETNAM = {
|
|
832
757
|
"Hanoi": {
|
|
833
758
|
"region": "Red River Delta",
|
|
759
|
+
"landlocked": True,
|
|
834
760
|
"administrative centre": "Hoàn Kiếm ward",
|
|
835
761
|
"area": 3359.84,
|
|
836
|
-
"population": 8807523
|
|
762
|
+
"population": 8807523,
|
|
763
|
+
"ISO 3166-2:VN": "VN-HN",
|
|
764
|
+
},
|
|
837
765
|
# ...
|
|
838
766
|
}
|
|
839
767
|
```
|
|
840
768
|
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
from countries_dictionary.vietnam import VIETNAM # Of course...
|
|
844
|
-
|
|
845
|
-
# Prints the population of a province
|
|
846
|
-
print(VIETNAM["Ho Chi Minh City"]["population"])
|
|
847
|
-
|
|
848
|
-
# Sees if the two provinces are in the same region
|
|
849
|
-
print(VIETNAM["Nghệ An province"]["region"] == VIETNAM["Hà Tĩnh province"]["region"])
|
|
850
|
-
|
|
851
|
-
# Creates the list of all provinces
|
|
852
|
-
list_of_provinces = list(VIETNAM.keys())
|
|
853
|
-
print(list_of_provinces)
|
|
854
|
-
```
|
|
769
|
+
### Countries Languages
|
|
770
|
+
Unused, as of now...
|
|
855
771
|
|
|
856
772
|
### Quick functions
|
|
857
773
|
There are many functions in this submodule.
|
|
@@ -870,9 +786,46 @@ print(iso["Russia"]["ISO 3166-2"])
|
|
|
870
786
|
### ISO finder
|
|
871
787
|
*ISO finder* is a module which provides a function which has the same name. *ISO finder* can find a country based on the provided ISO code. Note that it does not include US states' postal codes.
|
|
872
788
|
```python
|
|
873
|
-
from countries_dictionary.iso_finder import iso_finder
|
|
789
|
+
from countries_dictionary.iso_finder import iso_finder # 🥀
|
|
874
790
|
|
|
875
791
|
print(iso_finder("VN"))
|
|
876
792
|
print(iso_finder("RUS"))
|
|
877
793
|
print(iso_finder("840"))
|
|
878
794
|
```
|
|
795
|
+
|
|
796
|
+
### Unrecognised states
|
|
797
|
+
The unrecognised states Dictionary has a structure like this:
|
|
798
|
+
|
|
799
|
+
```python
|
|
800
|
+
UNRECOGNISED_STATES = {
|
|
801
|
+
"Cook Islands": {
|
|
802
|
+
"formal name": "Cook Islands",
|
|
803
|
+
"motto": "",
|
|
804
|
+
"continents": ["Oceania"],
|
|
805
|
+
"landlocked": False,
|
|
806
|
+
"area": 236.0,
|
|
807
|
+
"land area": 236.0,
|
|
808
|
+
"population": 15040,
|
|
809
|
+
"official languages": ["English", "Cook Islands Māori", "Pukapukan"],
|
|
810
|
+
"nominal GDP": 384000000,
|
|
811
|
+
"HDI": 0,
|
|
812
|
+
"ISO 3166-1": {"alpha-2": "CK", "alpha-3": "COK", "numeric": "184"},
|
|
813
|
+
},
|
|
814
|
+
# ...
|
|
815
|
+
# Additional information may be added as comments in the codes
|
|
816
|
+
}
|
|
817
|
+
```
|
|
818
|
+
|
|
819
|
+
### Transnistria
|
|
820
|
+
The Transnistria Dictionary has a structure like this:
|
|
821
|
+
```python
|
|
822
|
+
TRANSNISTRIA = {
|
|
823
|
+
"Camenca": {
|
|
824
|
+
"administrative centre": "Camenca",
|
|
825
|
+
"area": 434.5,
|
|
826
|
+
"population": 21000,
|
|
827
|
+
},
|
|
828
|
+
# ...
|
|
829
|
+
}
|
|
830
|
+
```
|
|
831
|
+
-->
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# Countries Dictionary
|
|
2
|
+
Countries Dictionary is a data-oriented module which provides dictionaries of countries and states, from members of UN to unrecognised ones.
|
|
3
|
+
|
|
4
|
+
I created this module as an offline source of countries' information which is easy to access and use by coders.
|
|
5
|
+
|
|
6
|
+
See [CHANGELOG.md](https://github.com/ThienFakeVN/countries_dictionary/blob/main/CHANGELOG.md) for changes of releases.
|
|
7
|
+
|
|
8
|
+
Before using, it is recommended to see the code on [GitHub](https://github.com/ThienFakeVN/countries_dictionary/) <!--or the below section--> to understand how the module works and how you can use it.
|
|
9
|
+
<!--
|
|
10
|
+
## Codes
|
|
11
|
+
### Main Countries Dictionary
|
|
12
|
+
The Countries Dictionary has a structure like this:
|
|
13
|
+
```python
|
|
14
|
+
COUNTRIES = {
|
|
15
|
+
"Afghanistan": {
|
|
16
|
+
"formal name": "Islamic Emirate of Afghanistan",
|
|
17
|
+
"motto": "There is no god but God; Muhammad is the messenger of God",
|
|
18
|
+
"continents": ["Asia"],
|
|
19
|
+
"landlocked": True,
|
|
20
|
+
"area": 652864.0,
|
|
21
|
+
"land area": 652230.0,
|
|
22
|
+
"population": 42045000,
|
|
23
|
+
"official languages": ["Dari", "Pashto"],
|
|
24
|
+
"nominal GDP": 16417000000,
|
|
25
|
+
"HDI": 0.496,
|
|
26
|
+
"ISO 3166-1": {"alpha-2": "AF", "alpha-3": "AFG", "numeric": "004"},
|
|
27
|
+
},
|
|
28
|
+
# ...
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Russia dictionary
|
|
33
|
+
The Russia dictionary has a structure like this:
|
|
34
|
+
```python
|
|
35
|
+
RUSSIA = {
|
|
36
|
+
"Adygea": {
|
|
37
|
+
"federal district": "Southern",
|
|
38
|
+
"economic region": "North Caucasus",
|
|
39
|
+
"landlocked": True,
|
|
40
|
+
"capital/administrative centre": "Maykop",
|
|
41
|
+
"area": 7792.0,
|
|
42
|
+
"population": 501038,
|
|
43
|
+
"ISO 3166-2:RU": "RU-AD",
|
|
44
|
+
},
|
|
45
|
+
# ...
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### United States dictionary
|
|
50
|
+
The United States dictionary has a structure like this:
|
|
51
|
+
```python
|
|
52
|
+
UNITED_STATES = {
|
|
53
|
+
"Alabama": {
|
|
54
|
+
"capital": "Montgomery",
|
|
55
|
+
"date of ratification/establishment/acquiring": "1819.12.14",
|
|
56
|
+
"landlocked": False,
|
|
57
|
+
"area": 135767.0,
|
|
58
|
+
"population": 5024279,
|
|
59
|
+
"House Representatives": 7,
|
|
60
|
+
"ISO 3166-2:US": "US-AL",
|
|
61
|
+
},
|
|
62
|
+
# ...
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Vietnam dictionary
|
|
67
|
+
The Vietnam dictionary has a structure like this:
|
|
68
|
+
```python
|
|
69
|
+
VIETNAM = {
|
|
70
|
+
"Hanoi": {
|
|
71
|
+
"region": "Red River Delta",
|
|
72
|
+
"landlocked": True,
|
|
73
|
+
"administrative centre": "Hoàn Kiếm ward",
|
|
74
|
+
"area": 3359.84,
|
|
75
|
+
"population": 8807523,
|
|
76
|
+
"ISO 3166-2:VN": "VN-HN",
|
|
77
|
+
},
|
|
78
|
+
# ...
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Countries Languages
|
|
83
|
+
Unused, as of now...
|
|
84
|
+
|
|
85
|
+
### Quick functions
|
|
86
|
+
There are many functions in this submodule.
|
|
87
|
+
```python
|
|
88
|
+
import countries_dictionary.quick_functions as qf # What have you expected?
|
|
89
|
+
|
|
90
|
+
# Converts the dictionary into JSON and creates/overwrites a JSON file which contains the converted dictionary
|
|
91
|
+
with open("countries_dictionary.json", "w") as f:
|
|
92
|
+
f.write(qf.json_dictionary(indent=4))
|
|
93
|
+
|
|
94
|
+
# Prints a ISO 3166-2 code of a country
|
|
95
|
+
iso = qf.countries_iso_3166_2()
|
|
96
|
+
print(iso["Russia"]["ISO 3166-2"])
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### ISO finder
|
|
100
|
+
*ISO finder* is a module which provides a function which has the same name. *ISO finder* can find a country based on the provided ISO code. Note that it does not include US states' postal codes.
|
|
101
|
+
```python
|
|
102
|
+
from countries_dictionary.iso_finder import iso_finder # 🥀
|
|
103
|
+
|
|
104
|
+
print(iso_finder("VN"))
|
|
105
|
+
print(iso_finder("RUS"))
|
|
106
|
+
print(iso_finder("840"))
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Unrecognised states
|
|
110
|
+
The unrecognised states Dictionary has a structure like this:
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
UNRECOGNISED_STATES = {
|
|
114
|
+
"Cook Islands": {
|
|
115
|
+
"formal name": "Cook Islands",
|
|
116
|
+
"motto": "",
|
|
117
|
+
"continents": ["Oceania"],
|
|
118
|
+
"landlocked": False,
|
|
119
|
+
"area": 236.0,
|
|
120
|
+
"land area": 236.0,
|
|
121
|
+
"population": 15040,
|
|
122
|
+
"official languages": ["English", "Cook Islands Māori", "Pukapukan"],
|
|
123
|
+
"nominal GDP": 384000000,
|
|
124
|
+
"HDI": 0,
|
|
125
|
+
"ISO 3166-1": {"alpha-2": "CK", "alpha-3": "COK", "numeric": "184"},
|
|
126
|
+
},
|
|
127
|
+
# ...
|
|
128
|
+
# Additional information may be added as comments in the codes
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Transnistria
|
|
133
|
+
The Transnistria Dictionary has a structure like this:
|
|
134
|
+
```python
|
|
135
|
+
TRANSNISTRIA = {
|
|
136
|
+
"Camenca": {
|
|
137
|
+
"administrative centre": "Camenca",
|
|
138
|
+
"area": 434.5,
|
|
139
|
+
"population": 21000,
|
|
140
|
+
},
|
|
141
|
+
# ...
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
-->
|