-
Notifications
You must be signed in to change notification settings - Fork 516
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
43 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from . import airports, countries | ||
from .isbn import ISBN | ||
from .phone_numbers import PhoneNumber | ||
from .zip_codes import ZipCode | ||
from . import airports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"""Generate valid country codes and names.""" | ||
from enum import Enum | ||
|
||
try: | ||
import pycountry | ||
except ImportError: | ||
raise ImportError( | ||
'The `countries` module requires "pycountry" to be installed. You can install it with "pip install pycountry"' | ||
) | ||
|
||
ALPHA_2_CODE = [(country.alpha_2, country.alpha_2) for country in pycountry.countries] | ||
Alpha2 = Enum("Alpha_2", ALPHA_2_CODE) # type:ignore | ||
|
||
ALPHA_3_CODE = [(country.alpha_3, country.alpha_3) for country in pycountry.countries] | ||
Alpha3 = Enum("Alpha_2", ALPHA_3_CODE) # type:ignore | ||
|
||
NUMERIC_CODE = [(country.numeric, country.numeric) for country in pycountry.countries] | ||
Numeric = Enum("Numeric_code", NUMERIC_CODE) # type:ignore | ||
|
||
NAME = [(country.name, country.name) for country in pycountry.countries] | ||
Name = Enum("Name", NAME) # type:ignore | ||
|
||
FLAG = [(country.flag, country.flag) for country in pycountry.countries] | ||
Flag = Enum("Flag", FLAG) # type:ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters