pax_global_header00006660000000000000000000000064135424324040014513gustar00rootroot0000000000000052 comment=a45d7d9db9c64950775544c88d50e09891fee070 pycountry-19.8.18+ds1/000077500000000000000000000000001354243240400144425ustar00rootroot00000000000000pycountry-19.8.18+ds1/HISTORY.txt000066400000000000000000000146511354243240400163530ustar00rootroot00000000000000Changes ======= 19.8.18 (2019-08-18) -------------------- - Fix installation on systems that don't have UTF-8 as default encoding. (#13422) - Remove superfluous print debugging output. (#13424) 19.7.15 (2019-07-15) -------------------- - Update to iso-codes 4.3. - Add support for ISO 639-5 (Language Families and Groups). - Drop support for Python 2. - Add `search_fuzzy()` function to the countries database. This allows for dealing with user searches that aren't really aware of ISO 3166 (so, like, actual human beings). A bit of character normalization and prioritizing matches between multiple criteria allows building somewhat reasonable suggestion/autocompletion lists. (#13418) Caveat emptor: no attention has been paid to performance in this feature. 18.12.8 (2018-12-08) -------------------- WARNING: This release contains a subtle but important API change that may break integrations! Looking at #13416 I realized that I made a terrible API design choice with respect to how the `get` function should behave in Python. Probably under the influence of either too little or too much whiskey I went and implemented `get` so that it raises a KeyError instead of doing the Pythonic thing and returning None and allowing to customize the `default`. There was a bit of back-and-forth around this code in previous releases (specifically touching edge cases to have the Subdivision API behave "reasonably", although there doesn't seem to be *one* right way there.) Anyway, when preparing this release and reviewing #13416 and the other related issues and changes from the past I noticed my mistake an decide to fix it going forward. So, from now on `get` will behave as expected in Python and yes, this means you will have to update your integration code carefully now checking for `None` returns instead of expecting KeyErrors. This is work, but I think it's worthwhile to uphold this convention within the Python community. - Switch API from "get + KeyError" to " get + default=None". This is a subtle API-breaking change. Please update carefully. (#13416) - Update to iso-codes 4.1. 18.5.26 (2018-05-26) -------------------- - Fix #13394: incorrect KeyError shadowing in Subdivisions.get() - Fix #13398: make lazy loading thread-safe. 18.5.20 (2018-05-20) -------------------- - Update to iso-codes 3.79. 18.2.23 (2018-02-23) -------------------- - Update to iso-codes 3.78. 17.9.23 (2017-09-23) -------------------- - Update to iso-codes 3.76, which fixes #13398. 17.5.14 (2017-05-14) -------------------- - Update to iso-codes 3.75, which fixes #13389 again. (bad parent codes for GB). - Switch from building on drone.io (discontinued service) to bitbucket's Pipelines. - Update pytest dependencies to get rid of API warnings. 17.01.08 (2017-01-08) --------------------- - Update to iso-codes 3.73, which fixes #13389 (bad parent codes for CZ). 17.01.02 (2017-01-02) --------------------- - Return empty lists from the subdivision database if the country exists but does not have any subdivisions. Fixes #13374. - Some typo fixes. Thanks to @VictorMireyev. - Update to iso-codes-3.72. 16.11.27.1 (2016-11-27) ----------------------- - 16.11.27 was a brown bag release. I merged the PRs online, but didn't pull them. Well. This is what 16.11.27 actually should have been. 16.11.27 (2016-11-27) --------------------- - Fix encoding issue on Python 3 (which seems to have been limited to some platforms.) Via PR17, fixes #13386. Thanks to @masroore and @hiaselhans. - Documentation fix: iso639_1_code is not a valid key for languages any more. Fixes #13387, thanks to @jmitzka. - Update to iso-codes-3.71. 16.11.08 (2016-11-08) --------------------- This release was heavily supported by @zware who fixed some of the issues I overlooked in the last releases and a few enhancements. * All data objects now have a repr() that includes all values. (@zware) * All database objects now have a lookup method that takes a value and returns the first data object that has an attribute that matches the value. Note that searching is halted when the first match is found. (@zware) * Clean up historical countries: the deleted flag is gone and there is no database that holds both historical and present countries any longer. The record formats are too different to keep this facade up reasonably well. * Fix parent lookup for subdivisions. * Update README to correctly show the updated field names. * Update pins for the packages we depend on. * Reduce Python test coverage to Python 2.7 and 3.5 -- I can't sustain running a bazillion Python versions all the time forever. * Fix Python 3 compatibility (@zware) 16.10.23rc3 (2016-10-23) ------------------------ - Incorporate some typos and suggested README improvements from @Pander in #13375. 16.10.23rc2 (2016-10-23) ------------------------ - Adapt README to the new attributes. 16.10.23rc1 (2016-10-23) ------------------------ This is a major change. The upstream packages have been revamped from the former XML databases to use JSON. They adapted their schemata a bit and thus made some of the structures in pycountry superfluous (yay!). Memory usage went down when all databases are loaded (32.7 MiB down from 83.6 MiB) and performance has gone up (not measured scientifically, but it's noticable when loading the DBs in an interactive session). To mark this major change, I'm also switch from the existing (not useful) SemVer-based version numbers to CalVer-based numbers using YY.MM.DD.micro as the pattern. To avoid adding more complexity I have removed code that really only was necessary because of the complexity of using the XML databases. Here's what you need to know: - I updated to iso-codes 3.70 which is a lot fresher than the last release. - Attribute names have changed. There is no longer a mapping going on between the sources and the object attributes. Take a look at the JSON files (or inspect the objects) to see which fields are supported. You can also inspect the automatically build indexes (db.indices) to see all keys in a database. Not every object supports every attribute - this depends on the quality of the data from pkg-isocodes. Attribute names are more coherent now, too. Note that "alpha2", "alpha4", etc. are now using an underscore as that's the pattern in the upstream packages. So it's "alpha_2" now. - HistoricCountries no longer includes countries that still exist. I removed the computed fields that were meant to make it easy to filter. pycountry-19.8.18+ds1/LICENSE.txt000066400000000000000000000576331354243240400163030ustar00rootroot00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS pycountry-19.8.18+ds1/MANIFEST.in000066400000000000000000000001101354243240400161700ustar00rootroot00000000000000include *.txt include *.rst graft src/pycountry global-exclude *.py[co] pycountry-19.8.18+ds1/PKG-INFO000066400000000000000000000456411354243240400155510ustar00rootroot00000000000000Metadata-Version: 1.1 Name: pycountry Version: 19.8.18 Summary: ISO country, subdivision, language, currency and script definitions and their translations Home-page: UNKNOWN Author: Christian Theune Author-email: ct@flyingcircus.io License: LGPL 2.1 Description: pycountry ========= pycountry provides the ISO databases for the standards: 639-3 Languages 3166 Countries 3166-3 Deleted countries 3166-2 Subdivisions of countries 4217 Currencies 15924 Scripts The package includes a copy from Debian's `pkg-isocodes `_ and makes the data accessible through a Python API. Translation files for the various strings are included as well. Data update policy ------------------ No changes to the data will be accepted into pycountry. This is a pure wrapper around the ISO standard using the `pkg-isocodes` database from Debian *as is*. If you need changes to the politicial situation in the world, please talk to the ISO or Debian people, not me. Donations / Monetary Support ---------------------------- This is a small project that I maintain in my personal time. I am not interested in personal financial gain. However, if you would like to support the project then I would love if you would donate to `Feminist Frequency `_ instead. Also, let the world know you did so, so that others can follow your path. Contributions ------------- The code lives in a `bitbucket Mercurial repository `_, and issues must be reported in `project bugtracker `_. Countries (ISO 3166) -------------------- Countries are accessible through a database object that is already configured upon import of pycountry and works as an iterable: .. code:: pycon >>> import pycountry >>> len(pycountry.countries) 249 >>> list(pycountry.countries)[0] Country(alpha_2='AF', alpha_3='AFG', name='Afghanistan', numeric='004', official_name='Islamic Republic of Afghanistan') Specific countries can be looked up by their various codes and provide the information included in the standard as attributes: .. code:: pycon >>> germany = pycountry.countries.get(alpha_2='DE') >>> germany Country(alpha_2='DE', alpha_3='DEU', name='Germany', numeric='276', official_name='Federal Republic of Germany') >>> germany.alpha_2 'DE' >>> germany.alpha_3 'DEU' >>> germany.numeric '276' >>> germany.name 'Germany' >>> germany.official_name 'Federal Republic of Germany' The `historic_countries` database contains former countries that have been removed from the standard and are now included in ISO 3166-3, excluding existing ones: .. code:: pycon >>> ussr = pycountry.historic_countries.get(alpha_3='SUN') >>> ussr Country(alpha_3='SUN', alpha_4='SUHH', withdrawal_date='1992-08-30', name='USSR, Union of Soviet Socialist Republics', numeric='810') >>> ussr.alpha_4 'SUHH' >>> ussr.alpha_3 'SUN' >>> ussr.name 'USSR, Union of Soviet Socialist Republics' >>> ussr.withdrawal_date '1992-08-30' There's also a "fuzzy" search to help people discover "proper" countries for names that might only actually be subdivisions. The fuzziness also includes normalizing unicode accents. There's also a bit of prioritization included to prefer matches on country names before subdivision names and have countries with more matches be listed before ones with fewer matches: .. code:: pycon >>> pycountry.countries.search_fuzzy('England') [Country(alpha_2='GB', alpha_3='GBR', name='United Kingdom', numeric='826', official_name='United Kingdom of Great Britain and Northern Ireland')] >>> pycountry.countries.search_fuzzy('Cote') [Country(alpha_2='CI', alpha_3='CIV', name="Côte d'Ivoire", numeric='384', official_name="Republic of Côte d'Ivoire"), Country(alpha_2='FR', alpha_3='FRA', name='France', numeric='250', official_name='French Republic'), Country(alpha_2='HN', alpha_3='HND', name='Honduras', numeric='340', official_name='Republic of Honduras')] Country subdivisions (ISO 3166-2) --------------------------------- The country subdivisions are a little more complex than the countries itself because they provide a nested and typed structure. All subdivisons can be accessed directly: .. code:: pycon >>> len(pycountry.subdivisions) 4847 >>> list(pycountry.subdivisions)[0] Subdivision(code='AD-07', country_code='AD', name='Andorra la Vella', parent_code=None, type='Parish') Subdivisions can be accessed using their unique code and provide at least their code, name and type: .. code:: pycon >>> de_st = pycountry.subdivisions.get(code='DE-ST') >>> de_st.code 'DE-ST' >>> de_st.name 'Sachsen-Anhalt' >>> de_st.type 'State' >>> de_st.country Country(alpha_2='DE', alpha_3='DEU', name='Germany', numeric='276', official_name='Federal Republic of Germany') Some subdivisions specify another subdivision as a parent: .. code:: pycon >>> al_br = pycountry.subdivisions.get(code='AL-BU') >>> al_br.code 'AL-BU' >>> al_br.name 'Bulqiz\xeb' >>> al_br.type 'District' >>> al_br.parent_code 'AL-09' >>> al_br.parent Subdivision(code='AL-09', country_code='AL', name='Dib\xebr', parent_code=None, type='County') >>> al_br.parent.name 'Dib\xebr' The divisions of a single country can be queried using the country_code index: .. code:: pycon >>> len(pycountry.subdivisions.get(country_code='DE')) 16 >>> len(pycountry.subdivisions.get(country_code='US')) 57 Scripts (ISO 15924) ------------------- Scripts are available from a database similar to the countries: .. code:: pycon >>> len(pycountry.scripts) 169 >>> list(pycountry.scripts)[0] Script(alpha_4='Afak', name='Afaka', numeric='439') >>> latin = pycountry.scripts.get(name='Latin') >>> latin Script(alpha_4='Latn', name='Latin', numeric='215') >>> latin.alpha4 'Latn' >>> latin.name 'Latin' >>> latin.numeric '215' Currencies (ISO 4217) --------------------- The currencies database is, again, similar to the ones before: .. code:: pycon >>> len(pycountry.currencies) 182 >>> list(pycountry.currencies)[0] Currency(alpha_3='AED', name='UAE Dirham', numeric='784') >>> argentine_peso = pycountry.currencies.get(alpha_3='ARS') >>> argentine_peso Currency(alpha_3='ARS', name='Argentine Peso', numeric='032') >>> argentine_peso.alpha_3 'ARS' >>> argentine_peso.name 'Argentine Peso' >>> argentine_peso.numeric '032' Languages (ISO 639-3) --------------------- The languages database is similar too: .. code:: pycon >>> len(pycountry.languages) 7874 >>> list(pycountry.languages)[0] Language(alpha_3='aaa', name='Ghotuo', scope='I', type='L') >>> aragonese = pycountry.languages.get(alpha_2='an') >>> aragonese.alpha_2 'an' >>> aragonese.alpha_3 'arg' >>> aragonese.name 'Aragonese' >>> bengali = pycountry.languages.get(alpha_2='bn') >>> bengali.name 'Bengali' >>> bengali.common_name 'Bangla' Locales ------- Locales are available in the `pycountry.LOCALES_DIR` subdirectory of this package. The translation domains are called `isoXXX` according to the standard they provide translations for. The directory is structured in a way compatible to Python's gettext module. Here is an example translating language names: .. code:: pycon >>> import gettext >>> german = gettext.translation('iso3166', pycountry.LOCALES_DIR, ... languages=['de']) >>> german.install() >>> _('Germany') 'Deutschland' Lookups ------- For each database (countries, languages, scripts, etc.), you can also look up entities case insensitively without knowing which key the value may match. For example: .. code:: pycon >>> pycountry.countries.lookup('de') The search ends with the first match, which is returned. Changes ======= 19.8.18 (2019-08-18) -------------------- - Fix installation on systems that don't have UTF-8 as default encoding. (#13422) - Remove superfluous print debugging output. (#13424) 19.7.15 (2019-07-15) -------------------- - Update to iso-codes 4.3. - Add support for ISO 639-5 (Language Families and Groups). - Drop support for Python 2. - Add `search_fuzzy()` function to the countries database. This allows for dealing with user searches that aren't really aware of ISO 3166 (so, like, actual human beings). A bit of character normalization and prioritizing matches between multiple criteria allows building somewhat reasonable suggestion/autocompletion lists. (#13418) Caveat emptor: no attention has been paid to performance in this feature. 18.12.8 (2018-12-08) -------------------- WARNING: This release contains a subtle but important API change that may break integrations! Looking at #13416 I realized that I made a terrible API design choice with respect to how the `get` function should behave in Python. Probably under the influence of either too little or too much whiskey I went and implemented `get` so that it raises a KeyError instead of doing the Pythonic thing and returning None and allowing to customize the `default`. There was a bit of back-and-forth around this code in previous releases (specifically touching edge cases to have the Subdivision API behave "reasonably", although there doesn't seem to be *one* right way there.) Anyway, when preparing this release and reviewing #13416 and the other related issues and changes from the past I noticed my mistake an decide to fix it going forward. So, from now on `get` will behave as expected in Python and yes, this means you will have to update your integration code carefully now checking for `None` returns instead of expecting KeyErrors. This is work, but I think it's worthwhile to uphold this convention within the Python community. - Switch API from "get + KeyError" to " get + default=None". This is a subtle API-breaking change. Please update carefully. (#13416) - Update to iso-codes 4.1. 18.5.26 (2018-05-26) -------------------- - Fix #13394: incorrect KeyError shadowing in Subdivisions.get() - Fix #13398: make lazy loading thread-safe. 18.5.20 (2018-05-20) -------------------- - Update to iso-codes 3.79. 18.2.23 (2018-02-23) -------------------- - Update to iso-codes 3.78. 17.9.23 (2017-09-23) -------------------- - Update to iso-codes 3.76, which fixes #13398. 17.5.14 (2017-05-14) -------------------- - Update to iso-codes 3.75, which fixes #13389 again. (bad parent codes for GB). - Switch from building on drone.io (discontinued service) to bitbucket's Pipelines. - Update pytest dependencies to get rid of API warnings. 17.01.08 (2017-01-08) --------------------- - Update to iso-codes 3.73, which fixes #13389 (bad parent codes for CZ). 17.01.02 (2017-01-02) --------------------- - Return empty lists from the subdivision database if the country exists but does not have any subdivisions. Fixes #13374. - Some typo fixes. Thanks to @VictorMireyev. - Update to iso-codes-3.72. 16.11.27.1 (2016-11-27) ----------------------- - 16.11.27 was a brown bag release. I merged the PRs online, but didn't pull them. Well. This is what 16.11.27 actually should have been. 16.11.27 (2016-11-27) --------------------- - Fix encoding issue on Python 3 (which seems to have been limited to some platforms.) Via PR17, fixes #13386. Thanks to @masroore and @hiaselhans. - Documentation fix: iso639_1_code is not a valid key for languages any more. Fixes #13387, thanks to @jmitzka. - Update to iso-codes-3.71. 16.11.08 (2016-11-08) --------------------- This release was heavily supported by @zware who fixed some of the issues I overlooked in the last releases and a few enhancements. * All data objects now have a repr() that includes all values. (@zware) * All database objects now have a lookup method that takes a value and returns the first data object that has an attribute that matches the value. Note that searching is halted when the first match is found. (@zware) * Clean up historical countries: the deleted flag is gone and there is no database that holds both historical and present countries any longer. The record formats are too different to keep this facade up reasonably well. * Fix parent lookup for subdivisions. * Update README to correctly show the updated field names. * Update pins for the packages we depend on. * Reduce Python test coverage to Python 2.7 and 3.5 -- I can't sustain running a bazillion Python versions all the time forever. * Fix Python 3 compatibility (@zware) 16.10.23rc3 (2016-10-23) ------------------------ - Incorporate some typos and suggested README improvements from @Pander in #13375. 16.10.23rc2 (2016-10-23) ------------------------ - Adapt README to the new attributes. 16.10.23rc1 (2016-10-23) ------------------------ This is a major change. The upstream packages have been revamped from the former XML databases to use JSON. They adapted their schemata a bit and thus made some of the structures in pycountry superfluous (yay!). Memory usage went down when all databases are loaded (32.7 MiB down from 83.6 MiB) and performance has gone up (not measured scientifically, but it's noticable when loading the DBs in an interactive session). To mark this major change, I'm also switch from the existing (not useful) SemVer-based version numbers to CalVer-based numbers using YY.MM.DD.micro as the pattern. To avoid adding more complexity I have removed code that really only was necessary because of the complexity of using the XML databases. Here's what you need to know: - I updated to iso-codes 3.70 which is a lot fresher than the last release. - Attribute names have changed. There is no longer a mapping going on between the sources and the object attributes. Take a look at the JSON files (or inspect the objects) to see which fields are supported. You can also inspect the automatically build indexes (db.indices) to see all keys in a database. Not every object supports every attribute - this depends on the quality of the data from pkg-isocodes. Attribute names are more coherent now, too. Note that "alpha2", "alpha4", etc. are now using an underscore as that's the pattern in the upstream packages. So it's "alpha_2" now. - HistoricCountries no longer includes countries that still exist. I removed the computed fields that were meant to make it easy to filter. Keywords: country subdivision language currency iso 3166 639 4217 15924 3166-2 Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: Intended Audience :: Information Technology Classifier: License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2) Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Topic :: Software Development :: Internationalization Classifier: Topic :: Software Development :: Localization pycountry-19.8.18+ds1/README.rst000066400000000000000000000170251354243240400161360ustar00rootroot00000000000000pycountry ========= pycountry provides the ISO databases for the standards: 639-3 Languages 3166 Countries 3166-3 Deleted countries 3166-2 Subdivisions of countries 4217 Currencies 15924 Scripts The package includes a copy from Debian's `pkg-isocodes `_ and makes the data accessible through a Python API. Translation files for the various strings are included as well. Data update policy ------------------ No changes to the data will be accepted into pycountry. This is a pure wrapper around the ISO standard using the `pkg-isocodes` database from Debian *as is*. If you need changes to the politicial situation in the world, please talk to the ISO or Debian people, not me. Donations / Monetary Support ---------------------------- This is a small project that I maintain in my personal time. I am not interested in personal financial gain. However, if you would like to support the project then I would love if you would donate to `Feminist Frequency `_ instead. Also, let the world know you did so, so that others can follow your path. Contributions ------------- The code lives in a `bitbucket Mercurial repository `_, and issues must be reported in `project bugtracker `_. Countries (ISO 3166) -------------------- Countries are accessible through a database object that is already configured upon import of pycountry and works as an iterable: .. code:: pycon >>> import pycountry >>> len(pycountry.countries) 249 >>> list(pycountry.countries)[0] Country(alpha_2='AF', alpha_3='AFG', name='Afghanistan', numeric='004', official_name='Islamic Republic of Afghanistan') Specific countries can be looked up by their various codes and provide the information included in the standard as attributes: .. code:: pycon >>> germany = pycountry.countries.get(alpha_2='DE') >>> germany Country(alpha_2='DE', alpha_3='DEU', name='Germany', numeric='276', official_name='Federal Republic of Germany') >>> germany.alpha_2 'DE' >>> germany.alpha_3 'DEU' >>> germany.numeric '276' >>> germany.name 'Germany' >>> germany.official_name 'Federal Republic of Germany' The `historic_countries` database contains former countries that have been removed from the standard and are now included in ISO 3166-3, excluding existing ones: .. code:: pycon >>> ussr = pycountry.historic_countries.get(alpha_3='SUN') >>> ussr Country(alpha_3='SUN', alpha_4='SUHH', withdrawal_date='1992-08-30', name='USSR, Union of Soviet Socialist Republics', numeric='810') >>> ussr.alpha_4 'SUHH' >>> ussr.alpha_3 'SUN' >>> ussr.name 'USSR, Union of Soviet Socialist Republics' >>> ussr.withdrawal_date '1992-08-30' There's also a "fuzzy" search to help people discover "proper" countries for names that might only actually be subdivisions. The fuzziness also includes normalizing unicode accents. There's also a bit of prioritization included to prefer matches on country names before subdivision names and have countries with more matches be listed before ones with fewer matches: .. code:: pycon >>> pycountry.countries.search_fuzzy('England') [Country(alpha_2='GB', alpha_3='GBR', name='United Kingdom', numeric='826', official_name='United Kingdom of Great Britain and Northern Ireland')] >>> pycountry.countries.search_fuzzy('Cote') [Country(alpha_2='CI', alpha_3='CIV', name="Côte d'Ivoire", numeric='384', official_name="Republic of Côte d'Ivoire"), Country(alpha_2='FR', alpha_3='FRA', name='France', numeric='250', official_name='French Republic'), Country(alpha_2='HN', alpha_3='HND', name='Honduras', numeric='340', official_name='Republic of Honduras')] Country subdivisions (ISO 3166-2) --------------------------------- The country subdivisions are a little more complex than the countries itself because they provide a nested and typed structure. All subdivisons can be accessed directly: .. code:: pycon >>> len(pycountry.subdivisions) 4847 >>> list(pycountry.subdivisions)[0] Subdivision(code='AD-07', country_code='AD', name='Andorra la Vella', parent_code=None, type='Parish') Subdivisions can be accessed using their unique code and provide at least their code, name and type: .. code:: pycon >>> de_st = pycountry.subdivisions.get(code='DE-ST') >>> de_st.code 'DE-ST' >>> de_st.name 'Sachsen-Anhalt' >>> de_st.type 'State' >>> de_st.country Country(alpha_2='DE', alpha_3='DEU', name='Germany', numeric='276', official_name='Federal Republic of Germany') Some subdivisions specify another subdivision as a parent: .. code:: pycon >>> al_br = pycountry.subdivisions.get(code='AL-BU') >>> al_br.code 'AL-BU' >>> al_br.name 'Bulqiz\xeb' >>> al_br.type 'District' >>> al_br.parent_code 'AL-09' >>> al_br.parent Subdivision(code='AL-09', country_code='AL', name='Dib\xebr', parent_code=None, type='County') >>> al_br.parent.name 'Dib\xebr' The divisions of a single country can be queried using the country_code index: .. code:: pycon >>> len(pycountry.subdivisions.get(country_code='DE')) 16 >>> len(pycountry.subdivisions.get(country_code='US')) 57 Scripts (ISO 15924) ------------------- Scripts are available from a database similar to the countries: .. code:: pycon >>> len(pycountry.scripts) 169 >>> list(pycountry.scripts)[0] Script(alpha_4='Afak', name='Afaka', numeric='439') >>> latin = pycountry.scripts.get(name='Latin') >>> latin Script(alpha_4='Latn', name='Latin', numeric='215') >>> latin.alpha4 'Latn' >>> latin.name 'Latin' >>> latin.numeric '215' Currencies (ISO 4217) --------------------- The currencies database is, again, similar to the ones before: .. code:: pycon >>> len(pycountry.currencies) 182 >>> list(pycountry.currencies)[0] Currency(alpha_3='AED', name='UAE Dirham', numeric='784') >>> argentine_peso = pycountry.currencies.get(alpha_3='ARS') >>> argentine_peso Currency(alpha_3='ARS', name='Argentine Peso', numeric='032') >>> argentine_peso.alpha_3 'ARS' >>> argentine_peso.name 'Argentine Peso' >>> argentine_peso.numeric '032' Languages (ISO 639-3) --------------------- The languages database is similar too: .. code:: pycon >>> len(pycountry.languages) 7874 >>> list(pycountry.languages)[0] Language(alpha_3='aaa', name='Ghotuo', scope='I', type='L') >>> aragonese = pycountry.languages.get(alpha_2='an') >>> aragonese.alpha_2 'an' >>> aragonese.alpha_3 'arg' >>> aragonese.name 'Aragonese' >>> bengali = pycountry.languages.get(alpha_2='bn') >>> bengali.name 'Bengali' >>> bengali.common_name 'Bangla' Locales ------- Locales are available in the `pycountry.LOCALES_DIR` subdirectory of this package. The translation domains are called `isoXXX` according to the standard they provide translations for. The directory is structured in a way compatible to Python's gettext module. Here is an example translating language names: .. code:: pycon >>> import gettext >>> german = gettext.translation('iso3166', pycountry.LOCALES_DIR, ... languages=['de']) >>> german.install() >>> _('Germany') 'Deutschland' Lookups ------- For each database (countries, languages, scripts, etc.), you can also look up entities case insensitively without knowing which key the value may match. For example: .. code:: pycon >>> pycountry.countries.lookup('de') The search ends with the first match, which is returned. pycountry-19.8.18+ds1/TODO.txt000066400000000000000000000000551354243240400157500ustar00rootroot00000000000000- Watch usability of ISO 3166-2 integration. pycountry-19.8.18+ds1/setup.cfg000066400000000000000000000001471354243240400162650ustar00rootroot00000000000000[zest.releaser] create-wheel = yes [bdist_wheel] universal = 1 [egg_info] tag_build = tag_date = 0 pycountry-19.8.18+ds1/setup.py000066400000000000000000000032361354243240400161600ustar00rootroot00000000000000# vim:fileencoding=utf-8 # Copyright -2014 (c) gocept gmbh & co. kg # Copyright 2015- (c) Flying Circus Internet Operations GmbH # See also LICENSE.txt from io import open from setuptools import setup, find_packages setup( name='pycountry', version='19.8.18', author='Christian Theune', author_email='ct@flyingcircus.io', description='ISO country, subdivision, language, currency and script ' 'definitions and their translations', long_description=( open('README.rst', encoding='utf-8').read() + '\n' + open('HISTORY.txt', encoding='utf-8').read()), license='LGPL 2.1', keywords='country subdivision language currency iso 3166 639 4217 ' '15924 3166-2', classifiers=[ # See: https://pypi.python.org/pypi?:action=list_classifiers 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'Intended Audience :: Information Technology', 'License :: OSI Approved :: ' 'GNU Lesser General Public License v2 (LGPLv2)', 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Topic :: Software Development :: Internationalization', 'Topic :: Software Development :: Localization', ], zip_safe=False, packages=find_packages('src'), include_package_data=True, package_dir={'': 'src'}) pycountry-19.8.18+ds1/src/000077500000000000000000000000001354243240400152315ustar00rootroot00000000000000pycountry-19.8.18+ds1/src/pycountry.egg-info/000077500000000000000000000000001354243240400207775ustar00rootroot00000000000000pycountry-19.8.18+ds1/src/pycountry.egg-info/PKG-INFO000066400000000000000000000456411354243240400221060ustar00rootroot00000000000000Metadata-Version: 1.1 Name: pycountry Version: 19.8.18 Summary: ISO country, subdivision, language, currency and script definitions and their translations Home-page: UNKNOWN Author: Christian Theune Author-email: ct@flyingcircus.io License: LGPL 2.1 Description: pycountry ========= pycountry provides the ISO databases for the standards: 639-3 Languages 3166 Countries 3166-3 Deleted countries 3166-2 Subdivisions of countries 4217 Currencies 15924 Scripts The package includes a copy from Debian's `pkg-isocodes `_ and makes the data accessible through a Python API. Translation files for the various strings are included as well. Data update policy ------------------ No changes to the data will be accepted into pycountry. This is a pure wrapper around the ISO standard using the `pkg-isocodes` database from Debian *as is*. If you need changes to the politicial situation in the world, please talk to the ISO or Debian people, not me. Donations / Monetary Support ---------------------------- This is a small project that I maintain in my personal time. I am not interested in personal financial gain. However, if you would like to support the project then I would love if you would donate to `Feminist Frequency `_ instead. Also, let the world know you did so, so that others can follow your path. Contributions ------------- The code lives in a `bitbucket Mercurial repository `_, and issues must be reported in `project bugtracker `_. Countries (ISO 3166) -------------------- Countries are accessible through a database object that is already configured upon import of pycountry and works as an iterable: .. code:: pycon >>> import pycountry >>> len(pycountry.countries) 249 >>> list(pycountry.countries)[0] Country(alpha_2='AF', alpha_3='AFG', name='Afghanistan', numeric='004', official_name='Islamic Republic of Afghanistan') Specific countries can be looked up by their various codes and provide the information included in the standard as attributes: .. code:: pycon >>> germany = pycountry.countries.get(alpha_2='DE') >>> germany Country(alpha_2='DE', alpha_3='DEU', name='Germany', numeric='276', official_name='Federal Republic of Germany') >>> germany.alpha_2 'DE' >>> germany.alpha_3 'DEU' >>> germany.numeric '276' >>> germany.name 'Germany' >>> germany.official_name 'Federal Republic of Germany' The `historic_countries` database contains former countries that have been removed from the standard and are now included in ISO 3166-3, excluding existing ones: .. code:: pycon >>> ussr = pycountry.historic_countries.get(alpha_3='SUN') >>> ussr Country(alpha_3='SUN', alpha_4='SUHH', withdrawal_date='1992-08-30', name='USSR, Union of Soviet Socialist Republics', numeric='810') >>> ussr.alpha_4 'SUHH' >>> ussr.alpha_3 'SUN' >>> ussr.name 'USSR, Union of Soviet Socialist Republics' >>> ussr.withdrawal_date '1992-08-30' There's also a "fuzzy" search to help people discover "proper" countries for names that might only actually be subdivisions. The fuzziness also includes normalizing unicode accents. There's also a bit of prioritization included to prefer matches on country names before subdivision names and have countries with more matches be listed before ones with fewer matches: .. code:: pycon >>> pycountry.countries.search_fuzzy('England') [Country(alpha_2='GB', alpha_3='GBR', name='United Kingdom', numeric='826', official_name='United Kingdom of Great Britain and Northern Ireland')] >>> pycountry.countries.search_fuzzy('Cote') [Country(alpha_2='CI', alpha_3='CIV', name="Côte d'Ivoire", numeric='384', official_name="Republic of Côte d'Ivoire"), Country(alpha_2='FR', alpha_3='FRA', name='France', numeric='250', official_name='French Republic'), Country(alpha_2='HN', alpha_3='HND', name='Honduras', numeric='340', official_name='Republic of Honduras')] Country subdivisions (ISO 3166-2) --------------------------------- The country subdivisions are a little more complex than the countries itself because they provide a nested and typed structure. All subdivisons can be accessed directly: .. code:: pycon >>> len(pycountry.subdivisions) 4847 >>> list(pycountry.subdivisions)[0] Subdivision(code='AD-07', country_code='AD', name='Andorra la Vella', parent_code=None, type='Parish') Subdivisions can be accessed using their unique code and provide at least their code, name and type: .. code:: pycon >>> de_st = pycountry.subdivisions.get(code='DE-ST') >>> de_st.code 'DE-ST' >>> de_st.name 'Sachsen-Anhalt' >>> de_st.type 'State' >>> de_st.country Country(alpha_2='DE', alpha_3='DEU', name='Germany', numeric='276', official_name='Federal Republic of Germany') Some subdivisions specify another subdivision as a parent: .. code:: pycon >>> al_br = pycountry.subdivisions.get(code='AL-BU') >>> al_br.code 'AL-BU' >>> al_br.name 'Bulqiz\xeb' >>> al_br.type 'District' >>> al_br.parent_code 'AL-09' >>> al_br.parent Subdivision(code='AL-09', country_code='AL', name='Dib\xebr', parent_code=None, type='County') >>> al_br.parent.name 'Dib\xebr' The divisions of a single country can be queried using the country_code index: .. code:: pycon >>> len(pycountry.subdivisions.get(country_code='DE')) 16 >>> len(pycountry.subdivisions.get(country_code='US')) 57 Scripts (ISO 15924) ------------------- Scripts are available from a database similar to the countries: .. code:: pycon >>> len(pycountry.scripts) 169 >>> list(pycountry.scripts)[0] Script(alpha_4='Afak', name='Afaka', numeric='439') >>> latin = pycountry.scripts.get(name='Latin') >>> latin Script(alpha_4='Latn', name='Latin', numeric='215') >>> latin.alpha4 'Latn' >>> latin.name 'Latin' >>> latin.numeric '215' Currencies (ISO 4217) --------------------- The currencies database is, again, similar to the ones before: .. code:: pycon >>> len(pycountry.currencies) 182 >>> list(pycountry.currencies)[0] Currency(alpha_3='AED', name='UAE Dirham', numeric='784') >>> argentine_peso = pycountry.currencies.get(alpha_3='ARS') >>> argentine_peso Currency(alpha_3='ARS', name='Argentine Peso', numeric='032') >>> argentine_peso.alpha_3 'ARS' >>> argentine_peso.name 'Argentine Peso' >>> argentine_peso.numeric '032' Languages (ISO 639-3) --------------------- The languages database is similar too: .. code:: pycon >>> len(pycountry.languages) 7874 >>> list(pycountry.languages)[0] Language(alpha_3='aaa', name='Ghotuo', scope='I', type='L') >>> aragonese = pycountry.languages.get(alpha_2='an') >>> aragonese.alpha_2 'an' >>> aragonese.alpha_3 'arg' >>> aragonese.name 'Aragonese' >>> bengali = pycountry.languages.get(alpha_2='bn') >>> bengali.name 'Bengali' >>> bengali.common_name 'Bangla' Locales ------- Locales are available in the `pycountry.LOCALES_DIR` subdirectory of this package. The translation domains are called `isoXXX` according to the standard they provide translations for. The directory is structured in a way compatible to Python's gettext module. Here is an example translating language names: .. code:: pycon >>> import gettext >>> german = gettext.translation('iso3166', pycountry.LOCALES_DIR, ... languages=['de']) >>> german.install() >>> _('Germany') 'Deutschland' Lookups ------- For each database (countries, languages, scripts, etc.), you can also look up entities case insensitively without knowing which key the value may match. For example: .. code:: pycon >>> pycountry.countries.lookup('de') The search ends with the first match, which is returned. Changes ======= 19.8.18 (2019-08-18) -------------------- - Fix installation on systems that don't have UTF-8 as default encoding. (#13422) - Remove superfluous print debugging output. (#13424) 19.7.15 (2019-07-15) -------------------- - Update to iso-codes 4.3. - Add support for ISO 639-5 (Language Families and Groups). - Drop support for Python 2. - Add `search_fuzzy()` function to the countries database. This allows for dealing with user searches that aren't really aware of ISO 3166 (so, like, actual human beings). A bit of character normalization and prioritizing matches between multiple criteria allows building somewhat reasonable suggestion/autocompletion lists. (#13418) Caveat emptor: no attention has been paid to performance in this feature. 18.12.8 (2018-12-08) -------------------- WARNING: This release contains a subtle but important API change that may break integrations! Looking at #13416 I realized that I made a terrible API design choice with respect to how the `get` function should behave in Python. Probably under the influence of either too little or too much whiskey I went and implemented `get` so that it raises a KeyError instead of doing the Pythonic thing and returning None and allowing to customize the `default`. There was a bit of back-and-forth around this code in previous releases (specifically touching edge cases to have the Subdivision API behave "reasonably", although there doesn't seem to be *one* right way there.) Anyway, when preparing this release and reviewing #13416 and the other related issues and changes from the past I noticed my mistake an decide to fix it going forward. So, from now on `get` will behave as expected in Python and yes, this means you will have to update your integration code carefully now checking for `None` returns instead of expecting KeyErrors. This is work, but I think it's worthwhile to uphold this convention within the Python community. - Switch API from "get + KeyError" to " get + default=None". This is a subtle API-breaking change. Please update carefully. (#13416) - Update to iso-codes 4.1. 18.5.26 (2018-05-26) -------------------- - Fix #13394: incorrect KeyError shadowing in Subdivisions.get() - Fix #13398: make lazy loading thread-safe. 18.5.20 (2018-05-20) -------------------- - Update to iso-codes 3.79. 18.2.23 (2018-02-23) -------------------- - Update to iso-codes 3.78. 17.9.23 (2017-09-23) -------------------- - Update to iso-codes 3.76, which fixes #13398. 17.5.14 (2017-05-14) -------------------- - Update to iso-codes 3.75, which fixes #13389 again. (bad parent codes for GB). - Switch from building on drone.io (discontinued service) to bitbucket's Pipelines. - Update pytest dependencies to get rid of API warnings. 17.01.08 (2017-01-08) --------------------- - Update to iso-codes 3.73, which fixes #13389 (bad parent codes for CZ). 17.01.02 (2017-01-02) --------------------- - Return empty lists from the subdivision database if the country exists but does not have any subdivisions. Fixes #13374. - Some typo fixes. Thanks to @VictorMireyev. - Update to iso-codes-3.72. 16.11.27.1 (2016-11-27) ----------------------- - 16.11.27 was a brown bag release. I merged the PRs online, but didn't pull them. Well. This is what 16.11.27 actually should have been. 16.11.27 (2016-11-27) --------------------- - Fix encoding issue on Python 3 (which seems to have been limited to some platforms.) Via PR17, fixes #13386. Thanks to @masroore and @hiaselhans. - Documentation fix: iso639_1_code is not a valid key for languages any more. Fixes #13387, thanks to @jmitzka. - Update to iso-codes-3.71. 16.11.08 (2016-11-08) --------------------- This release was heavily supported by @zware who fixed some of the issues I overlooked in the last releases and a few enhancements. * All data objects now have a repr() that includes all values. (@zware) * All database objects now have a lookup method that takes a value and returns the first data object that has an attribute that matches the value. Note that searching is halted when the first match is found. (@zware) * Clean up historical countries: the deleted flag is gone and there is no database that holds both historical and present countries any longer. The record formats are too different to keep this facade up reasonably well. * Fix parent lookup for subdivisions. * Update README to correctly show the updated field names. * Update pins for the packages we depend on. * Reduce Python test coverage to Python 2.7 and 3.5 -- I can't sustain running a bazillion Python versions all the time forever. * Fix Python 3 compatibility (@zware) 16.10.23rc3 (2016-10-23) ------------------------ - Incorporate some typos and suggested README improvements from @Pander in #13375. 16.10.23rc2 (2016-10-23) ------------------------ - Adapt README to the new attributes. 16.10.23rc1 (2016-10-23) ------------------------ This is a major change. The upstream packages have been revamped from the former XML databases to use JSON. They adapted their schemata a bit and thus made some of the structures in pycountry superfluous (yay!). Memory usage went down when all databases are loaded (32.7 MiB down from 83.6 MiB) and performance has gone up (not measured scientifically, but it's noticable when loading the DBs in an interactive session). To mark this major change, I'm also switch from the existing (not useful) SemVer-based version numbers to CalVer-based numbers using YY.MM.DD.micro as the pattern. To avoid adding more complexity I have removed code that really only was necessary because of the complexity of using the XML databases. Here's what you need to know: - I updated to iso-codes 3.70 which is a lot fresher than the last release. - Attribute names have changed. There is no longer a mapping going on between the sources and the object attributes. Take a look at the JSON files (or inspect the objects) to see which fields are supported. You can also inspect the automatically build indexes (db.indices) to see all keys in a database. Not every object supports every attribute - this depends on the quality of the data from pkg-isocodes. Attribute names are more coherent now, too. Note that "alpha2", "alpha4", etc. are now using an underscore as that's the pattern in the upstream packages. So it's "alpha_2" now. - HistoricCountries no longer includes countries that still exist. I removed the computed fields that were meant to make it easy to filter. Keywords: country subdivision language currency iso 3166 639 4217 15924 3166-2 Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: Intended Audience :: Information Technology Classifier: License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2) Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Topic :: Software Development :: Internationalization Classifier: Topic :: Software Development :: Localization pycountry-19.8.18+ds1/src/pycountry.egg-info/SOURCES.txt000066400000000000000000001103411354243240400226630ustar00rootroot00000000000000HISTORY.txt LICENSE.txt MANIFEST.in README.rst TODO.txt setup.cfg setup.py src/pycountry/__init__.py src/pycountry/db.py src/pycountry.egg-info/PKG-INFO src/pycountry.egg-info/SOURCES.txt src/pycountry.egg-info/dependency_links.txt src/pycountry.egg-info/not-zip-safe src/pycountry.egg-info/top_level.txt src/pycountry/databases/iso15924.json src/pycountry/databases/iso3166-1.json src/pycountry/databases/iso3166-2.json src/pycountry/databases/iso3166-3.json src/pycountry/databases/iso4217.json src/pycountry/databases/iso639-3.json src/pycountry/databases/iso639-5.json src/pycountry/locales/ab/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/ace/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/ach/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/af/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/af/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/af/LC_MESSAGES/iso3166.mo src/pycountry/locales/af/LC_MESSAGES/iso639-3.mo src/pycountry/locales/af/LC_MESSAGES/iso639_3.mo src/pycountry/locales/ak/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/am/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/am/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/am/LC_MESSAGES/iso3166.mo src/pycountry/locales/am/LC_MESSAGES/iso639-3.mo src/pycountry/locales/am/LC_MESSAGES/iso639_3.mo src/pycountry/locales/an/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/ar/LC_MESSAGES/iso15924.mo src/pycountry/locales/ar/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/ar/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/ar/LC_MESSAGES/iso3166.mo src/pycountry/locales/ar/LC_MESSAGES/iso4217.mo src/pycountry/locales/ar/LC_MESSAGES/iso639-3.mo src/pycountry/locales/ar/LC_MESSAGES/iso639_3.mo src/pycountry/locales/as/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/as/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/as/LC_MESSAGES/iso3166.mo src/pycountry/locales/ast/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/ast/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/ast/LC_MESSAGES/iso3166.mo src/pycountry/locales/ast/LC_MESSAGES/iso639-3.mo src/pycountry/locales/ast/LC_MESSAGES/iso639_3.mo src/pycountry/locales/ay/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/az/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/az/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/az/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/az/LC_MESSAGES/iso3166.mo src/pycountry/locales/az/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/az/LC_MESSAGES/iso639-3.mo src/pycountry/locales/az/LC_MESSAGES/iso639_3.mo src/pycountry/locales/ba/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/bar/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/be/LC_MESSAGES/iso15924.mo src/pycountry/locales/be/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/be/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/be/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/be/LC_MESSAGES/iso3166.mo src/pycountry/locales/be/LC_MESSAGES/iso4217.mo src/pycountry/locales/be/LC_MESSAGES/iso639-5.mo src/pycountry/locales/bg/LC_MESSAGES/iso15924.mo src/pycountry/locales/bg/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/bg/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/bg/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/bg/LC_MESSAGES/iso3166.mo src/pycountry/locales/bg/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/bg/LC_MESSAGES/iso639-3.mo src/pycountry/locales/bg/LC_MESSAGES/iso639_3.mo src/pycountry/locales/bi/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/bn/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/bn/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/bn/LC_MESSAGES/iso3166.mo src/pycountry/locales/bn/LC_MESSAGES/iso639-3.mo src/pycountry/locales/bn/LC_MESSAGES/iso639_3.mo src/pycountry/locales/bn_IN/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/bn_IN/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/bn_IN/LC_MESSAGES/iso3166.mo src/pycountry/locales/br/LC_MESSAGES/iso15924.mo src/pycountry/locales/br/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/br/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/br/LC_MESSAGES/iso3166.mo src/pycountry/locales/br/LC_MESSAGES/iso4217.mo src/pycountry/locales/br/LC_MESSAGES/iso639-3.mo src/pycountry/locales/br/LC_MESSAGES/iso639_3.mo src/pycountry/locales/bs/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/bs/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/bs/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/bs/LC_MESSAGES/iso3166.mo src/pycountry/locales/bs/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/bs/LC_MESSAGES/iso639-3.mo src/pycountry/locales/bs/LC_MESSAGES/iso639_3.mo src/pycountry/locales/byn/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/byn/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/byn/LC_MESSAGES/iso3166.mo src/pycountry/locales/byn/LC_MESSAGES/iso639-3.mo src/pycountry/locales/byn/LC_MESSAGES/iso639_3.mo src/pycountry/locales/ca/LC_MESSAGES/iso15924.mo src/pycountry/locales/ca/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/ca/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/ca/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/ca/LC_MESSAGES/iso3166.mo src/pycountry/locales/ca/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/ca/LC_MESSAGES/iso4217.mo src/pycountry/locales/ca/LC_MESSAGES/iso639-3.mo src/pycountry/locales/ca/LC_MESSAGES/iso639_3.mo src/pycountry/locales/ce/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/ch/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/chr/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/ckb/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/crh/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/crh/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/crh/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/crh/LC_MESSAGES/iso3166.mo src/pycountry/locales/crh/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/crh/LC_MESSAGES/iso639-3.mo src/pycountry/locales/crh/LC_MESSAGES/iso639_3.mo src/pycountry/locales/cs/LC_MESSAGES/iso15924.mo src/pycountry/locales/cs/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/cs/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/cs/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/cs/LC_MESSAGES/iso3166.mo src/pycountry/locales/cs/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/cs/LC_MESSAGES/iso4217.mo src/pycountry/locales/cs/LC_MESSAGES/iso639-3.mo src/pycountry/locales/cs/LC_MESSAGES/iso639_3.mo src/pycountry/locales/csb/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/cv/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/cy/LC_MESSAGES/iso15924.mo src/pycountry/locales/cy/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/cy/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/cy/LC_MESSAGES/iso3166.mo src/pycountry/locales/cy/LC_MESSAGES/iso639-3.mo src/pycountry/locales/cy/LC_MESSAGES/iso639_3.mo src/pycountry/locales/da/LC_MESSAGES/iso15924.mo src/pycountry/locales/da/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/da/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/da/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/da/LC_MESSAGES/iso3166.mo src/pycountry/locales/da/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/da/LC_MESSAGES/iso4217.mo src/pycountry/locales/da/LC_MESSAGES/iso639-3.mo src/pycountry/locales/da/LC_MESSAGES/iso639-5.mo src/pycountry/locales/da/LC_MESSAGES/iso639_3.mo src/pycountry/locales/de/LC_MESSAGES/iso15924.mo src/pycountry/locales/de/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/de/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/de/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/de/LC_MESSAGES/iso3166.mo src/pycountry/locales/de/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/de/LC_MESSAGES/iso4217.mo src/pycountry/locales/de/LC_MESSAGES/iso639-3.mo src/pycountry/locales/de/LC_MESSAGES/iso639-5.mo src/pycountry/locales/de/LC_MESSAGES/iso639_3.mo src/pycountry/locales/dv/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/dz/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/dz/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/dz/LC_MESSAGES/iso3166.mo src/pycountry/locales/ee/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/el/LC_MESSAGES/iso15924.mo src/pycountry/locales/el/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/el/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/el/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/el/LC_MESSAGES/iso3166.mo src/pycountry/locales/el/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/el/LC_MESSAGES/iso4217.mo src/pycountry/locales/el/LC_MESSAGES/iso639-3.mo src/pycountry/locales/el/LC_MESSAGES/iso639-5.mo src/pycountry/locales/el/LC_MESSAGES/iso639_3.mo src/pycountry/locales/en/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/en/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/eo/LC_MESSAGES/iso15924.mo src/pycountry/locales/eo/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/eo/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/eo/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/eo/LC_MESSAGES/iso3166.mo src/pycountry/locales/eo/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/eo/LC_MESSAGES/iso639-3.mo src/pycountry/locales/eo/LC_MESSAGES/iso639_3.mo src/pycountry/locales/es/LC_MESSAGES/iso15924.mo src/pycountry/locales/es/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/es/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/es/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/es/LC_MESSAGES/iso3166.mo src/pycountry/locales/es/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/es/LC_MESSAGES/iso4217.mo src/pycountry/locales/es/LC_MESSAGES/iso639-3.mo src/pycountry/locales/es/LC_MESSAGES/iso639_3.mo src/pycountry/locales/et/LC_MESSAGES/iso15924.mo src/pycountry/locales/et/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/et/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/et/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/et/LC_MESSAGES/iso3166.mo src/pycountry/locales/et/LC_MESSAGES/iso4217.mo src/pycountry/locales/et/LC_MESSAGES/iso639-3.mo src/pycountry/locales/et/LC_MESSAGES/iso639-5.mo src/pycountry/locales/et/LC_MESSAGES/iso639_3.mo src/pycountry/locales/eu/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/eu/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/eu/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/eu/LC_MESSAGES/iso3166.mo src/pycountry/locales/eu/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/eu/LC_MESSAGES/iso639-3.mo src/pycountry/locales/eu/LC_MESSAGES/iso639_3.mo src/pycountry/locales/fa/LC_MESSAGES/iso15924.mo src/pycountry/locales/fa/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/fa/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/fa/LC_MESSAGES/iso3166.mo src/pycountry/locales/fa/LC_MESSAGES/iso639-3.mo src/pycountry/locales/fa/LC_MESSAGES/iso639_3.mo src/pycountry/locales/ff/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/fi/LC_MESSAGES/iso15924.mo src/pycountry/locales/fi/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/fi/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/fi/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/fi/LC_MESSAGES/iso3166.mo src/pycountry/locales/fi/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/fi/LC_MESSAGES/iso4217.mo src/pycountry/locales/fi/LC_MESSAGES/iso639-3.mo src/pycountry/locales/fi/LC_MESSAGES/iso639_3.mo src/pycountry/locales/fo/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/fo/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/fo/LC_MESSAGES/iso3166.mo src/pycountry/locales/fr/LC_MESSAGES/iso15924.mo src/pycountry/locales/fr/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/fr/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/fr/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/fr/LC_MESSAGES/iso3166.mo src/pycountry/locales/fr/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/fr/LC_MESSAGES/iso4217.mo src/pycountry/locales/fr/LC_MESSAGES/iso639-3.mo src/pycountry/locales/fr/LC_MESSAGES/iso639-5.mo src/pycountry/locales/fr/LC_MESSAGES/iso639_3.mo src/pycountry/locales/frp/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/fur/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/fy/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/ga/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/ga/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/ga/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/ga/LC_MESSAGES/iso3166.mo src/pycountry/locales/ga/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/ga/LC_MESSAGES/iso4217.mo src/pycountry/locales/ga/LC_MESSAGES/iso639-3.mo src/pycountry/locales/ga/LC_MESSAGES/iso639_3.mo src/pycountry/locales/gez/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/gez/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/gez/LC_MESSAGES/iso3166.mo src/pycountry/locales/gez/LC_MESSAGES/iso639-3.mo src/pycountry/locales/gez/LC_MESSAGES/iso639_3.mo src/pycountry/locales/gl/LC_MESSAGES/iso15924.mo src/pycountry/locales/gl/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/gl/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/gl/LC_MESSAGES/iso3166.mo src/pycountry/locales/gl/LC_MESSAGES/iso4217.mo src/pycountry/locales/gl/LC_MESSAGES/iso639-3.mo src/pycountry/locales/gl/LC_MESSAGES/iso639_3.mo src/pycountry/locales/gn/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/gu/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/gu/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/gu/LC_MESSAGES/iso3166.mo src/pycountry/locales/gu/LC_MESSAGES/iso639-3.mo src/pycountry/locales/gu/LC_MESSAGES/iso639_3.mo src/pycountry/locales/gv/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/ha/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/haw/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/haw/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/haw/LC_MESSAGES/iso3166.mo src/pycountry/locales/he/LC_MESSAGES/iso15924.mo src/pycountry/locales/he/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/he/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/he/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/he/LC_MESSAGES/iso3166.mo src/pycountry/locales/he/LC_MESSAGES/iso639-3.mo src/pycountry/locales/he/LC_MESSAGES/iso639_3.mo src/pycountry/locales/hi/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/hi/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/hi/LC_MESSAGES/iso3166.mo src/pycountry/locales/hi/LC_MESSAGES/iso639-3.mo src/pycountry/locales/hi/LC_MESSAGES/iso639_3.mo src/pycountry/locales/hr/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/hr/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/hr/LC_MESSAGES/iso3166.mo src/pycountry/locales/hr/LC_MESSAGES/iso4217.mo src/pycountry/locales/hr/LC_MESSAGES/iso639-3.mo src/pycountry/locales/hr/LC_MESSAGES/iso639_3.mo src/pycountry/locales/ht/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/hu/LC_MESSAGES/iso15924.mo src/pycountry/locales/hu/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/hu/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/hu/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/hu/LC_MESSAGES/iso3166.mo src/pycountry/locales/hu/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/hu/LC_MESSAGES/iso4217.mo src/pycountry/locales/hu/LC_MESSAGES/iso639-3.mo src/pycountry/locales/hu/LC_MESSAGES/iso639-5.mo src/pycountry/locales/hu/LC_MESSAGES/iso639_3.mo src/pycountry/locales/hy/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/hy/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/hy/LC_MESSAGES/iso3166.mo src/pycountry/locales/ia/LC_MESSAGES/iso15924.mo src/pycountry/locales/ia/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/ia/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/ia/LC_MESSAGES/iso3166.mo src/pycountry/locales/id/LC_MESSAGES/iso15924.mo src/pycountry/locales/id/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/id/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/id/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/id/LC_MESSAGES/iso3166.mo src/pycountry/locales/id/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/id/LC_MESSAGES/iso4217.mo src/pycountry/locales/id/LC_MESSAGES/iso639-3.mo src/pycountry/locales/id/LC_MESSAGES/iso639-5.mo src/pycountry/locales/id/LC_MESSAGES/iso639_3.mo src/pycountry/locales/io/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/is/LC_MESSAGES/iso15924.mo src/pycountry/locales/is/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/is/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/is/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/is/LC_MESSAGES/iso3166.mo src/pycountry/locales/is/LC_MESSAGES/iso4217.mo src/pycountry/locales/is/LC_MESSAGES/iso639-3.mo src/pycountry/locales/is/LC_MESSAGES/iso639-5.mo src/pycountry/locales/is/LC_MESSAGES/iso639_3.mo src/pycountry/locales/it/LC_MESSAGES/iso15924.mo src/pycountry/locales/it/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/it/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/it/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/it/LC_MESSAGES/iso3166.mo src/pycountry/locales/it/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/it/LC_MESSAGES/iso4217.mo src/pycountry/locales/it/LC_MESSAGES/iso639-3.mo src/pycountry/locales/it/LC_MESSAGES/iso639-5.mo src/pycountry/locales/it/LC_MESSAGES/iso639_3.mo src/pycountry/locales/iu/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/ja/LC_MESSAGES/iso15924.mo src/pycountry/locales/ja/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/ja/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/ja/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/ja/LC_MESSAGES/iso3166.mo src/pycountry/locales/ja/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/ja/LC_MESSAGES/iso4217.mo src/pycountry/locales/ja/LC_MESSAGES/iso639-3.mo src/pycountry/locales/ja/LC_MESSAGES/iso639_3.mo src/pycountry/locales/jam/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/ka/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/ka/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/ka/LC_MESSAGES/iso3166.mo src/pycountry/locales/kab/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/ki/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/kk/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/kk/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/kk/LC_MESSAGES/iso3166.mo src/pycountry/locales/kl/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/km/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/km/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/km/LC_MESSAGES/iso3166.mo src/pycountry/locales/kn/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/kn/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/kn/LC_MESSAGES/iso3166.mo src/pycountry/locales/kn/LC_MESSAGES/iso639-3.mo src/pycountry/locales/kn/LC_MESSAGES/iso639_3.mo src/pycountry/locales/ko/LC_MESSAGES/iso15924.mo src/pycountry/locales/ko/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/ko/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/ko/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/ko/LC_MESSAGES/iso3166.mo src/pycountry/locales/ko/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/ko/LC_MESSAGES/iso4217.mo src/pycountry/locales/ko/LC_MESSAGES/iso639-3.mo src/pycountry/locales/ko/LC_MESSAGES/iso639_3.mo src/pycountry/locales/kok/LC_MESSAGES/iso639-3.mo src/pycountry/locales/kok/LC_MESSAGES/iso639_3.mo src/pycountry/locales/ku/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/ku/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/ku/LC_MESSAGES/iso3166.mo src/pycountry/locales/kv/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/kw/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/ky/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/ky/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/lo/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/lt/LC_MESSAGES/iso15924.mo src/pycountry/locales/lt/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/lt/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/lt/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/lt/LC_MESSAGES/iso3166.mo src/pycountry/locales/lt/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/lt/LC_MESSAGES/iso4217.mo src/pycountry/locales/lt/LC_MESSAGES/iso639-3.mo src/pycountry/locales/lt/LC_MESSAGES/iso639_3.mo src/pycountry/locales/lv/LC_MESSAGES/iso15924.mo src/pycountry/locales/lv/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/lv/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/lv/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/lv/LC_MESSAGES/iso3166.mo src/pycountry/locales/lv/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/lv/LC_MESSAGES/iso4217.mo src/pycountry/locales/lv/LC_MESSAGES/iso639-3.mo src/pycountry/locales/lv/LC_MESSAGES/iso639_3.mo src/pycountry/locales/mai/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/mhr/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/mi/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/mi/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/mi/LC_MESSAGES/iso3166.mo src/pycountry/locales/mi/LC_MESSAGES/iso639-3.mo src/pycountry/locales/mi/LC_MESSAGES/iso639_3.mo src/pycountry/locales/mk/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/mk/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/mk/LC_MESSAGES/iso3166.mo src/pycountry/locales/mk/LC_MESSAGES/iso639-3.mo src/pycountry/locales/mk/LC_MESSAGES/iso639_3.mo src/pycountry/locales/ml/LC_MESSAGES/iso15924.mo src/pycountry/locales/ml/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/ml/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/ml/LC_MESSAGES/iso3166.mo src/pycountry/locales/mn/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/mn/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/mn/LC_MESSAGES/iso3166.mo src/pycountry/locales/mn/LC_MESSAGES/iso4217.mo src/pycountry/locales/mn/LC_MESSAGES/iso639-3.mo src/pycountry/locales/mn/LC_MESSAGES/iso639_3.mo src/pycountry/locales/mo/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/mr/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/mr/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/mr/LC_MESSAGES/iso3166.mo src/pycountry/locales/mr/LC_MESSAGES/iso639-3.mo src/pycountry/locales/mr/LC_MESSAGES/iso639_3.mo src/pycountry/locales/ms/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/ms/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/ms/LC_MESSAGES/iso3166.mo src/pycountry/locales/ms/LC_MESSAGES/iso639-3.mo src/pycountry/locales/ms/LC_MESSAGES/iso639_3.mo src/pycountry/locales/mt/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/mt/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/mt/LC_MESSAGES/iso3166.mo src/pycountry/locales/mt/LC_MESSAGES/iso639-3.mo src/pycountry/locales/mt/LC_MESSAGES/iso639_3.mo src/pycountry/locales/my/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/na/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/nah/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/nb/LC_MESSAGES/iso15924.mo src/pycountry/locales/nb/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/nb/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/nb/LC_MESSAGES/iso3166.mo src/pycountry/locales/nb/LC_MESSAGES/iso4217.mo src/pycountry/locales/nb/LC_MESSAGES/iso639-3.mo src/pycountry/locales/nb/LC_MESSAGES/iso639_3.mo src/pycountry/locales/nb_NO/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/nb_NO/LC_MESSAGES/iso639-5.mo src/pycountry/locales/ne/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/ne/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/ne/LC_MESSAGES/iso3166.mo src/pycountry/locales/nl/LC_MESSAGES/iso15924.mo src/pycountry/locales/nl/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/nl/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/nl/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/nl/LC_MESSAGES/iso3166.mo src/pycountry/locales/nl/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/nl/LC_MESSAGES/iso4217.mo src/pycountry/locales/nl/LC_MESSAGES/iso639-3.mo src/pycountry/locales/nl/LC_MESSAGES/iso639-5.mo src/pycountry/locales/nl/LC_MESSAGES/iso639_3.mo src/pycountry/locales/nn/LC_MESSAGES/iso15924.mo src/pycountry/locales/nn/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/nn/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/nn/LC_MESSAGES/iso3166.mo src/pycountry/locales/nn/LC_MESSAGES/iso4217.mo src/pycountry/locales/nn/LC_MESSAGES/iso639-3.mo src/pycountry/locales/nn/LC_MESSAGES/iso639_3.mo src/pycountry/locales/nso/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/nso/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/nso/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/nso/LC_MESSAGES/iso3166.mo src/pycountry/locales/nso/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/nso/LC_MESSAGES/iso639-3.mo src/pycountry/locales/nso/LC_MESSAGES/iso639_3.mo src/pycountry/locales/nv/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/oc/LC_MESSAGES/iso15924.mo src/pycountry/locales/oc/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/oc/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/oc/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/oc/LC_MESSAGES/iso3166.mo src/pycountry/locales/oc/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/oc/LC_MESSAGES/iso4217.mo src/pycountry/locales/oc/LC_MESSAGES/iso639-3.mo src/pycountry/locales/oc/LC_MESSAGES/iso639_3.mo src/pycountry/locales/or/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/or/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/or/LC_MESSAGES/iso3166.mo src/pycountry/locales/or/LC_MESSAGES/iso639-3.mo src/pycountry/locales/or/LC_MESSAGES/iso639_3.mo src/pycountry/locales/pa/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/pa/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/pa/LC_MESSAGES/iso3166.mo src/pycountry/locales/pa/LC_MESSAGES/iso639-3.mo src/pycountry/locales/pa/LC_MESSAGES/iso639_3.mo src/pycountry/locales/pap/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/pi/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/pl/LC_MESSAGES/iso15924.mo src/pycountry/locales/pl/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/pl/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/pl/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/pl/LC_MESSAGES/iso3166.mo src/pycountry/locales/pl/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/pl/LC_MESSAGES/iso4217.mo src/pycountry/locales/pl/LC_MESSAGES/iso639-3.mo src/pycountry/locales/pl/LC_MESSAGES/iso639-5.mo src/pycountry/locales/pl/LC_MESSAGES/iso639_3.mo src/pycountry/locales/ps/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/ps/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/ps/LC_MESSAGES/iso3166.mo src/pycountry/locales/ps/LC_MESSAGES/iso639-3.mo src/pycountry/locales/ps/LC_MESSAGES/iso639_3.mo src/pycountry/locales/pt/LC_MESSAGES/iso15924.mo src/pycountry/locales/pt/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/pt/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/pt/LC_MESSAGES/iso3166.mo src/pycountry/locales/pt/LC_MESSAGES/iso4217.mo src/pycountry/locales/pt/LC_MESSAGES/iso639-3.mo src/pycountry/locales/pt/LC_MESSAGES/iso639_3.mo src/pycountry/locales/pt_BR/LC_MESSAGES/iso15924.mo src/pycountry/locales/pt_BR/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/pt_BR/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/pt_BR/LC_MESSAGES/iso3166.mo src/pycountry/locales/pt_BR/LC_MESSAGES/iso4217.mo src/pycountry/locales/pt_BR/LC_MESSAGES/iso639-3.mo src/pycountry/locales/pt_BR/LC_MESSAGES/iso639_3.mo src/pycountry/locales/ro/LC_MESSAGES/iso15924.mo src/pycountry/locales/ro/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/ro/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/ro/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/ro/LC_MESSAGES/iso3166.mo src/pycountry/locales/ro/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/ro/LC_MESSAGES/iso4217.mo src/pycountry/locales/ro/LC_MESSAGES/iso639-3.mo src/pycountry/locales/ro/LC_MESSAGES/iso639_3.mo src/pycountry/locales/ru/LC_MESSAGES/iso15924.mo src/pycountry/locales/ru/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/ru/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/ru/LC_MESSAGES/iso3166.mo src/pycountry/locales/ru/LC_MESSAGES/iso4217.mo src/pycountry/locales/ru/LC_MESSAGES/iso639-3.mo src/pycountry/locales/ru/LC_MESSAGES/iso639_3.mo src/pycountry/locales/rw/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/rw/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/rw/LC_MESSAGES/iso3166.mo src/pycountry/locales/rw/LC_MESSAGES/iso4217.mo src/pycountry/locales/rw/LC_MESSAGES/iso639-3.mo src/pycountry/locales/rw/LC_MESSAGES/iso639_3.mo src/pycountry/locales/sc/LC_MESSAGES/iso15924.mo src/pycountry/locales/sc/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/sc/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/sc/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/sc/LC_MESSAGES/iso4217.mo src/pycountry/locales/sc/LC_MESSAGES/iso639-3.mo src/pycountry/locales/sc/LC_MESSAGES/iso639-5.mo src/pycountry/locales/sd/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/si/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/si/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/si/LC_MESSAGES/iso3166.mo src/pycountry/locales/sk/LC_MESSAGES/iso15924.mo src/pycountry/locales/sk/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/sk/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/sk/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/sk/LC_MESSAGES/iso3166.mo src/pycountry/locales/sk/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/sk/LC_MESSAGES/iso4217.mo src/pycountry/locales/sk/LC_MESSAGES/iso639-3.mo src/pycountry/locales/sk/LC_MESSAGES/iso639_3.mo src/pycountry/locales/sl/LC_MESSAGES/iso15924.mo src/pycountry/locales/sl/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/sl/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/sl/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/sl/LC_MESSAGES/iso3166.mo src/pycountry/locales/sl/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/sl/LC_MESSAGES/iso4217.mo src/pycountry/locales/sl/LC_MESSAGES/iso639-3.mo src/pycountry/locales/sl/LC_MESSAGES/iso639_3.mo src/pycountry/locales/so/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/so/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/so/LC_MESSAGES/iso3166.mo src/pycountry/locales/son/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/sq/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/sq/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/sq/LC_MESSAGES/iso3166.mo src/pycountry/locales/sr/LC_MESSAGES/iso15924.mo src/pycountry/locales/sr/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/sr/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/sr/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/sr/LC_MESSAGES/iso3166.mo src/pycountry/locales/sr/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/sr/LC_MESSAGES/iso4217.mo src/pycountry/locales/sr/LC_MESSAGES/iso639-3.mo src/pycountry/locales/sr/LC_MESSAGES/iso639-5.mo src/pycountry/locales/sr/LC_MESSAGES/iso639_3.mo src/pycountry/locales/sr@latin/LC_MESSAGES/iso15924.mo src/pycountry/locales/sr@latin/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/sr@latin/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/sr@latin/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/sr@latin/LC_MESSAGES/iso3166.mo src/pycountry/locales/sr@latin/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/sr@latin/LC_MESSAGES/iso4217.mo src/pycountry/locales/sr@latin/LC_MESSAGES/iso639-3.mo src/pycountry/locales/sr@latin/LC_MESSAGES/iso639-5.mo src/pycountry/locales/sr@latin/LC_MESSAGES/iso639_3.mo src/pycountry/locales/sv/LC_MESSAGES/iso15924.mo src/pycountry/locales/sv/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/sv/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/sv/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/sv/LC_MESSAGES/iso3166.mo src/pycountry/locales/sv/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/sv/LC_MESSAGES/iso4217.mo src/pycountry/locales/sv/LC_MESSAGES/iso639-3.mo src/pycountry/locales/sv/LC_MESSAGES/iso639-5.mo src/pycountry/locales/sv/LC_MESSAGES/iso639_3.mo src/pycountry/locales/sw/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/sw/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/sw/LC_MESSAGES/iso3166.mo src/pycountry/locales/ta/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/ta/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/ta/LC_MESSAGES/iso3166.mo src/pycountry/locales/ta/LC_MESSAGES/iso639-3.mo src/pycountry/locales/ta/LC_MESSAGES/iso639_3.mo src/pycountry/locales/te/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/te/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/te/LC_MESSAGES/iso3166.mo src/pycountry/locales/tg/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/th/LC_MESSAGES/iso15924.mo src/pycountry/locales/th/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/th/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/th/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/th/LC_MESSAGES/iso3166.mo src/pycountry/locales/th/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/th/LC_MESSAGES/iso4217.mo src/pycountry/locales/th/LC_MESSAGES/iso639-3.mo src/pycountry/locales/th/LC_MESSAGES/iso639_3.mo src/pycountry/locales/ti/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/ti/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/ti/LC_MESSAGES/iso3166.mo src/pycountry/locales/ti/LC_MESSAGES/iso639-3.mo src/pycountry/locales/ti/LC_MESSAGES/iso639_3.mo src/pycountry/locales/tig/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/tig/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/tig/LC_MESSAGES/iso3166.mo src/pycountry/locales/tig/LC_MESSAGES/iso639-3.mo src/pycountry/locales/tig/LC_MESSAGES/iso639_3.mo src/pycountry/locales/tk/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/tk/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/tk/LC_MESSAGES/iso3166.mo src/pycountry/locales/tl/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/tl/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/tl/LC_MESSAGES/iso3166.mo src/pycountry/locales/tr/LC_MESSAGES/iso15924.mo src/pycountry/locales/tr/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/tr/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/tr/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/tr/LC_MESSAGES/iso3166.mo src/pycountry/locales/tr/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/tr/LC_MESSAGES/iso4217.mo src/pycountry/locales/tr/LC_MESSAGES/iso639-3.mo src/pycountry/locales/tr/LC_MESSAGES/iso639_3.mo src/pycountry/locales/tt/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/tt/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/tt/LC_MESSAGES/iso3166.mo src/pycountry/locales/tt/LC_MESSAGES/iso639-3.mo src/pycountry/locales/tt/LC_MESSAGES/iso639_3.mo src/pycountry/locales/tt@iqtelif/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/tt@iqtelif/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/tt@iqtelif/LC_MESSAGES/iso3166.mo src/pycountry/locales/tt@iqtelif/LC_MESSAGES/iso639-3.mo src/pycountry/locales/tt@iqtelif/LC_MESSAGES/iso639_3.mo src/pycountry/locales/ug/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/ug/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/ug/LC_MESSAGES/iso3166.mo src/pycountry/locales/uk/LC_MESSAGES/iso15924.mo src/pycountry/locales/uk/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/uk/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/uk/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/uk/LC_MESSAGES/iso3166.mo src/pycountry/locales/uk/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/uk/LC_MESSAGES/iso4217.mo src/pycountry/locales/uk/LC_MESSAGES/iso639-3.mo src/pycountry/locales/uk/LC_MESSAGES/iso639-5.mo src/pycountry/locales/uk/LC_MESSAGES/iso639_3.mo src/pycountry/locales/ur/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/uz/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/ve/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/ve/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/ve/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/ve/LC_MESSAGES/iso3166.mo src/pycountry/locales/ve/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/ve/LC_MESSAGES/iso639-3.mo src/pycountry/locales/ve/LC_MESSAGES/iso639_3.mo src/pycountry/locales/vi/LC_MESSAGES/iso15924.mo src/pycountry/locales/vi/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/vi/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/vi/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/vi/LC_MESSAGES/iso3166.mo src/pycountry/locales/vi/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/vi/LC_MESSAGES/iso4217.mo src/pycountry/locales/vi/LC_MESSAGES/iso639-3.mo src/pycountry/locales/vi/LC_MESSAGES/iso639_3.mo src/pycountry/locales/wa/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/wa/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/wa/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/wa/LC_MESSAGES/iso3166.mo src/pycountry/locales/wa/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/wa/LC_MESSAGES/iso639-3.mo src/pycountry/locales/wa/LC_MESSAGES/iso639_3.mo src/pycountry/locales/wal/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/wal/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/wal/LC_MESSAGES/iso3166.mo src/pycountry/locales/wo/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/wo/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/wo/LC_MESSAGES/iso3166.mo src/pycountry/locales/xh/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/xh/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/xh/LC_MESSAGES/iso3166.mo src/pycountry/locales/xh/LC_MESSAGES/iso639-3.mo src/pycountry/locales/xh/LC_MESSAGES/iso639_3.mo src/pycountry/locales/yo/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/zh_CN/LC_MESSAGES/iso15924.mo src/pycountry/locales/zh_CN/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/zh_CN/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/zh_CN/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/zh_CN/LC_MESSAGES/iso3166.mo src/pycountry/locales/zh_CN/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/zh_CN/LC_MESSAGES/iso4217.mo src/pycountry/locales/zh_CN/LC_MESSAGES/iso639-3.mo src/pycountry/locales/zh_CN/LC_MESSAGES/iso639_3.mo src/pycountry/locales/zh_HK/LC_MESSAGES/iso15924.mo src/pycountry/locales/zh_HK/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/zh_HK/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/zh_HK/LC_MESSAGES/iso3166.mo src/pycountry/locales/zh_HK/LC_MESSAGES/iso4217.mo src/pycountry/locales/zh_Hant/LC_MESSAGES/iso639-5.mo src/pycountry/locales/zh_TW/LC_MESSAGES/iso15924.mo src/pycountry/locales/zh_TW/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/zh_TW/LC_MESSAGES/iso3166-2.mo src/pycountry/locales/zh_TW/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/zh_TW/LC_MESSAGES/iso3166.mo src/pycountry/locales/zh_TW/LC_MESSAGES/iso3166_2.mo src/pycountry/locales/zh_TW/LC_MESSAGES/iso4217.mo src/pycountry/locales/zh_TW/LC_MESSAGES/iso639-3.mo src/pycountry/locales/zh_TW/LC_MESSAGES/iso639_3.mo src/pycountry/locales/zu/LC_MESSAGES/iso3166-1.mo src/pycountry/locales/zu/LC_MESSAGES/iso3166-3.mo src/pycountry/locales/zu/LC_MESSAGES/iso3166.mo src/pycountry/locales/zu/LC_MESSAGES/iso639-3.mo src/pycountry/locales/zu/LC_MESSAGES/iso639_3.mo src/pycountry/tests/test_general.pypycountry-19.8.18+ds1/src/pycountry.egg-info/dependency_links.txt000066400000000000000000000000011354243240400250450ustar00rootroot00000000000000 pycountry-19.8.18+ds1/src/pycountry.egg-info/not-zip-safe000066400000000000000000000000011354243240400232250ustar00rootroot00000000000000 pycountry-19.8.18+ds1/src/pycountry.egg-info/top_level.txt000066400000000000000000000000121354243240400235220ustar00rootroot00000000000000pycountry pycountry-19.8.18+ds1/src/pycountry/000077500000000000000000000000001354243240400173055ustar00rootroot00000000000000pycountry-19.8.18+ds1/src/pycountry/__init__.py000066400000000000000000000152431354243240400214230ustar00rootroot00000000000000# vim:fileencoding=utf-8 """pycountry""" import os.path import unicodedata import pycountry.db try: from pkg_resources import resource_filename except ImportError: def resource_filename(package_or_requirement, resource_name): return os.path.join(os.path.dirname(__file__), resource_name) LOCALES_DIR = resource_filename('pycountry', 'locales') DATABASE_DIR = resource_filename('pycountry', 'databases') def remove_accents(input_str): # Borrowed from https://stackoverflow.com/a/517974/1509718 nfkd_form = unicodedata.normalize('NFKD', input_str) return u"".join([c for c in nfkd_form if not unicodedata.combining(c)]) class ExistingCountries(pycountry.db.Database): """Provides access to an ISO 3166 database (Countries).""" data_class_name = 'Country' root_key = '3166-1' def search_fuzzy(self, query): query = remove_accents(query.strip().lower()) # A country-code to points mapping for later sorting countries # based on the query's matching incidence. results = {} def add_result(country, points): results.setdefault(country.alpha_2, 0) results[country.alpha_2] += points # Prio 1: exact matches on country names try: add_result(countries.lookup(query), 50) except LookupError: pass # Prio 2: exact matches on subdivision names for candidate in subdivisions: for v in candidate._fields.values(): if v is None: continue v = remove_accents(v.lower()) # Some names include alternative versions which we want to # match exactly. for v in v.split(';'): if v == query: add_result(candidate.country, 49) break # Prio 3: partial matches on country names for candidate in countries: # Higher priority for a match on the common name for v in [candidate._fields.get('name'), candidate._fields.get('official_name')]: if v is None: continue v = remove_accents(v.lower()) if query in v: # This prefers countries with a match early in their name # and also balances against countries with a number of # partial matches and their name containing 'new' in the # middle add_result(candidate, max([5, 30-(2*v.find(query))])) break # Prio 4: partial matches on subdivision names for candidate in subdivisions: v = candidate._fields.get('name') if v is None: continue v = remove_accents(v.lower()) if query in v: add_result(candidate.country, max([1, 5-v.find(query)])) if not results: raise LookupError(query) results = [ countries.get(alpha_2=x[0]) # sort by points first by alpha2 code second, ensure stable results # the min allows us to sort reversely on the points but ascending # on the country code. for x in sorted(results.items(), key=lambda x: (-x[1], x[0]))] return results class HistoricCountries(pycountry.db.Database): """Provides access to an ISO 3166-3 database (Countries that have been removed from the standard).""" data_class_name = 'Country' root_key = '3166-3' class Scripts(pycountry.db.Database): """Provides access to an ISO 15924 database (Scripts).""" data_class_name = 'Script' root_key = '15924' class Currencies(pycountry.db.Database): """Provides access to an ISO 4217 database (Currencies).""" data_class_name = 'Currency' root_key = '4217' class Languages(pycountry.db.Database): """Provides access to an ISO 639-1/2T/3 database (Languages).""" no_index = ['status', 'scope', 'type', 'inverted_name', 'common_name'] data_class_name = 'Language' root_key = '639-3' class LanguageFamilies(pycountry.db.Database): """Provides access to an ISO 639-5 database (Language Families and Groups).""" data_class_name = 'LanguageFamily' root_key = '639-5' class Subdivision(pycountry.db.Data): def __init__(self, **kw): if 'parent' in kw: kw['parent_code'] = kw['parent'] else: kw['parent_code'] = None super(Subdivision, self).__init__(**kw) self.country_code = self.code.split('-')[0] if self.parent_code is not None: self.parent_code = '%s-%s' % (self.country_code, self.parent_code) @property def country(self): return countries.get(alpha_2=self.country_code) @property def parent(self): if not self.parent_code: return None return subdivisions.get(code=self.parent_code) class Subdivisions(pycountry.db.Database): # Note: subdivisions can be hierarchical to other subdivisions. The # parent_code attribute is related to other subdivisons, *not* # the country! data_class_base = Subdivision data_class_name = 'Subdivision' no_index = ['name', 'parent_code', 'parent', 'type'] root_key = '3166-2' def _load(self, *args, **kw): super(Subdivisions, self)._load(*args, **kw) # Add index for the country code. self.indices['country_code'] = {} for subdivision in self: divs = self.indices['country_code'].setdefault( subdivision.country_code, set()) divs.add(subdivision) def get(self, **kw): default = kw.setdefault('default', None) subdivisions = super(Subdivisions, self).get(**kw) if subdivisions is default and 'country_code' in kw: # This handles the case where we know about a country but there # are no subdivisions: we return an empty list in this case # (sticking to the expected type here) instead of None. if countries.get(alpha_2=kw['country_code']) is not None: return [] return subdivisions countries = ExistingCountries(os.path.join(DATABASE_DIR, 'iso3166-1.json')) subdivisions = Subdivisions(os.path.join(DATABASE_DIR, 'iso3166-2.json')) historic_countries = HistoricCountries( os.path.join(DATABASE_DIR, 'iso3166-3.json')) currencies = Currencies(os.path.join(DATABASE_DIR, 'iso4217.json')) languages = Languages(os.path.join(DATABASE_DIR, 'iso639-3.json')) language_families = LanguageFamilies( os.path.join(DATABASE_DIR, 'iso639-5.json')) scripts = Scripts(os.path.join(DATABASE_DIR, 'iso15924.json')) pycountry-19.8.18+ds1/src/pycountry/db.py000066400000000000000000000073611354243240400202530ustar00rootroot00000000000000# vim:fileencoding=utf-8 from io import open import json import logging import threading logger = logging.getLogger('pycountry.db') try: unicode except NameError: unicode = str class Data(object): def __init__(self, **fields): self._fields = fields def __getattr__(self, key): if key not in self._fields: raise AttributeError return self._fields[key] def __setattr__(self, key, value): if key != '_fields': self._fields[key] = value super(Data, self).__setattr__(key, value) def __repr__(self): cls_name = self.__class__.__name__ fields = ', '.join('%s=%r' % i for i in sorted(self._fields.items())) return '%s(%s)' % (cls_name, fields) def __dir__(self): return dir(self.__class__) + list(self._fields) def lazy_load(f): def load_if_needed(self, *args, **kw): if not self._is_loaded: with self._load_lock: self._load() return f(self, *args, **kw) return load_if_needed class Database(object): data_class_base = Data data_class_name = None root_key = None no_index = [] def __init__(self, filename): self.filename = filename self._is_loaded = False self._load_lock = threading.Lock() def _load(self): if self._is_loaded: # Help keeping the _load_if_needed code easier # to read. return self.objects = [] self.index_names = set() self.indices = {} self.data_class = type( self.data_class_name, (self.data_class_base,), {}) with open(self.filename, 'r', encoding="utf-8") as f: tree = json.load(f) for entry in tree[self.root_key]: obj = self.data_class(**entry) self.objects.append(obj) # Inject into index. for key, value in entry.items(): if key in self.no_index: continue index = self.indices.setdefault(key, {}) if value in index: logger.debug( '%s %r already taken in index %r and will be ' 'ignored. This is an error in the databases.' % (self.data_class_name, value, key)) index[value] = obj self._is_loaded = True # Public API @lazy_load def __iter__(self): return iter(self.objects) @lazy_load def __len__(self): return len(self.objects) @lazy_load def get(self, **kw): kw.setdefault('default', None) default = kw.pop('default') if len(kw) != 1: raise TypeError('Only one criteria may be given') field, value = kw.popitem() index = self.indices[field] try: return index[value] except KeyError: # Pythonic APIs implementing get() shouldn't raise KeyErrors. # Those are a bit unexpected and they should rather support # returning `None` by default and allow customization. return default @lazy_load def lookup(self, value): # try relatively quick exact matches first if isinstance(value, (str, unicode)): value = value.lower() for key in self.indices: try: return self.indices[key][value] except LookupError: pass # then try slower case-insensitive lookups for candidate in self: for v in candidate._fields.values(): if v is None: continue if v.lower() == value: return candidate raise LookupError('Could not find a record for %r' % value) pycountry-19.8.18+ds1/src/pycountry/tests/000077500000000000000000000000001354243240400204475ustar00rootroot00000000000000pycountry-19.8.18+ds1/src/pycountry/tests/test_general.py000066400000000000000000000166311354243240400235040ustar00rootroot00000000000000import gettext import re import pycountry import pycountry.db import pytest @pytest.fixture(autouse=True, scope='session') def logging(): import logging logging.basicConfig(level=logging.DEBUG) def test_country_list(): assert len(pycountry.countries) == 249 assert isinstance(list(pycountry.countries)[0], pycountry.db.Data) def test_country_fuzzy_search(): results = pycountry.countries.search_fuzzy(u'England') assert len(results) == 1 assert results[0] == pycountry.countries.get(alpha_2='GB') # Match alternative names exactly and thus GB ends up with Wales # before Australia. results = pycountry.countries.search_fuzzy(u'Wales') assert len(results) == 2 assert results[0] == pycountry.countries.get(alpha_2='GB') assert results[1] == pycountry.countries.get(alpha_2='AU') # Match with accents removed, first a country with a partial match in the # country name, then a country with multiple subdivision partial matches, # and then a country with a single subdivision match. results = pycountry.countries.search_fuzzy(u'Cote') assert len(results) == 3 assert results[0] == pycountry.countries.get(alpha_2='CI') assert results[1] == pycountry.countries.get(alpha_2='FR') assert results[2] == pycountry.countries.get(alpha_2='HN') # A somewhat carefully balanced point system allows for a (bias-based) # graceful sorting of common substrings being used in multiple matches: results = pycountry.countries.search_fuzzy(u'New') assert results[0] == pycountry.countries.get(alpha_2='NC') assert results[1] == pycountry.countries.get(alpha_2='NZ') assert results[2] == pycountry.countries.get(alpha_2='PG') assert results[3] == pycountry.countries.get(alpha_2='GB') assert results[4] == pycountry.countries.get(alpha_2='US') assert results[5] == pycountry.countries.get(alpha_2='CA') assert results[6] == pycountry.countries.get(alpha_2='AU') assert results[7] == pycountry.countries.get(alpha_2='MH') def test_germany_has_all_attributes(): germany = pycountry.countries.get(alpha_2='DE') assert germany.alpha_2 == u'DE' assert germany.alpha_3 == u'DEU' assert germany.numeric == u'276' assert germany.name == u'Germany' assert germany.official_name == u'Federal Republic of Germany' def test_subdivisions_directly_accessible(): assert len(pycountry.subdivisions) == 4844 assert isinstance(list(pycountry.subdivisions)[0], pycountry.db.Data) de_st = pycountry.subdivisions.get(code='DE-ST') assert de_st.code == u'DE-ST' assert de_st.name == u'Sachsen-Anhalt' assert de_st.type == u'State' assert de_st.parent is None assert de_st.parent_code is None assert de_st.country is pycountry.countries.get(alpha_2='DE') def test_subdivisions_have_subdivision_as_parent(): al_br = pycountry.subdivisions.get(code='AL-BU') assert al_br.code == u'AL-BU' assert al_br.name == u'Bulqiz\xeb' assert al_br.type == u'District' assert al_br.parent_code == u'AL-09' assert al_br.parent is pycountry.subdivisions.get(code='AL-09') assert al_br.parent.name == u'Dib\xebr' def test_query_subdivisions_of_country(): assert len(pycountry.subdivisions.get(country_code='DE')) == 16 assert len(pycountry.subdivisions.get(country_code='US')) == 57 def test_scripts(): assert len(pycountry.scripts) == 182 assert isinstance(list(pycountry.scripts)[0], pycountry.db.Data) latin = pycountry.scripts.get(name='Latin') assert latin.alpha_4 == u'Latn' assert latin.name == u'Latin' assert latin.numeric == u'215' def test_currencies(): assert len(pycountry.currencies) == 170 assert isinstance(list(pycountry.currencies)[0], pycountry.db.Data) argentine_peso = pycountry.currencies.get(alpha_3='ARS') assert argentine_peso.alpha_3 == u'ARS' assert argentine_peso.name == u'Argentine Peso' assert argentine_peso.numeric == u'032' def test_languages(): assert len(pycountry.languages) == 7847 assert isinstance(list(pycountry.languages)[0], pycountry.db.Data) aragonese = pycountry.languages.get(alpha_2='an') assert aragonese.alpha_2 == u'an' assert aragonese.alpha_3 == u'arg' assert aragonese.name == u'Aragonese' bengali = pycountry.languages.get(alpha_2='bn') assert bengali.name == u'Bengali' assert bengali.common_name == u'Bangla' def test_language_families(): assert len(pycountry.language_families) == 115 assert isinstance(list(pycountry.language_families)[0], pycountry.db.Data) aragonese = pycountry.languages.get(alpha_3='arg') assert aragonese.alpha_3 == u'arg' assert aragonese.name == u'Aragonese' def test_locales(): german = gettext.translation( 'iso3166', pycountry.LOCALES_DIR, languages=['de']) german.install() assert __builtins__['_']('Germany') == 'Deutschland' def test_removed_countries(): ussr = pycountry.historic_countries.get(alpha_3='SUN') assert isinstance(ussr, pycountry.db.Data) assert ussr.alpha_4 == u'SUHH' assert ussr.alpha_3 == u'SUN' assert ussr.name == u'USSR, Union of Soviet Socialist Republics' assert ussr.withdrawal_date == u'1992-08-30' def test_repr(): assert re.match("Country\\(alpha_2=u?'DE', " "alpha_3=u?'DEU', " "name=u?'Germany', " "numeric=u?'276', " "official_name=u?'Federal Republic of Germany'\\)", repr(pycountry.countries.get(alpha_2='DE'))) def test_dir(): germany = pycountry.countries.get(alpha_2='DE') for n in 'alpha_2', 'alpha_3', 'name', 'numeric', 'official_name': assert n in dir(germany) def test_get(): c = pycountry.countries with pytest.raises(TypeError): c.get(alpha_2='DE', alpha_3='DEU') assert c.get(alpha_2='DE') == c.get(alpha_3='DEU') assert c.get(alpha_2='Foo') is None tracer = object() assert c.get(alpha_2='Foo', default=tracer) is tracer def test_lookup(): c = pycountry.countries g = c.get(alpha_2='DE') assert g == c.lookup('de') assert g == c.lookup('DEU') assert g == c.lookup('276') assert g == c.lookup('germany') assert g == c.lookup('Federal Republic of Germany') # try a generated field bqaq = pycountry.historic_countries.get(alpha_4='BQAQ') assert bqaq == pycountry.historic_countries.lookup('atb') german = pycountry.languages.get(alpha_2='de') assert german == pycountry.languages.lookup('De') euro = pycountry.currencies.get(alpha_3='EUR') assert euro == pycountry.currencies.lookup('euro') latin = pycountry.scripts.get(name='Latin') assert latin == pycountry.scripts.lookup('latn') al_bu = pycountry.subdivisions.get(code='AL-BU') assert al_bu == pycountry.subdivisions.lookup('al-bu') with pytest.raises(LookupError): pycountry.countries.lookup('bogus country') with pytest.raises(LookupError): pycountry.countries.lookup(12345) def test_subdivision_parent(): s = pycountry.subdivisions sd = s.get(code='CV-BV') assert sd.parent_code == 'CV-B' assert sd.parent is s.get(code=sd.parent_code) def test_subdivision_missing_code_raises_keyerror(): s = pycountry.subdivisions assert s.get(code='US-ZZ') is None def test_subdivision_empty_list(): s = pycountry.subdivisions assert len(s.get(country_code='DE')) == 16 assert len(s.get(country_code='JE')) == 0 assert s.get(country_code='FOOBAR') is None