-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from RHDZMOTA/DEV
2022-09-18 RELEASE-PRD (1)
- Loading branch information
Showing
6 changed files
with
71 additions
and
1 deletion.
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 +1 @@ | ||
2.2.0 | ||
2.3.0 |
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 @@ | ||
from .country_codes import Country |
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,29 @@ | ||
import os | ||
import enum | ||
import json | ||
|
||
|
||
from rhdzmota.settings import logger_manager | ||
|
||
|
||
logger = logger_manager.get_logger(name=__name__) | ||
|
||
|
||
class Country(enum.Enum): | ||
MEXICO = "MX" | ||
|
||
@property | ||
def subdivisions_data_filepath(self) -> str: | ||
filename = f"{self.value}.json".lower() | ||
filepath = os.path.join(os.path.dirname(__file__), "datafiles", filename) | ||
if os.path.exists(filepath): | ||
return filepath | ||
logger.error("Missing datafile for %s", self.name) | ||
return os.path.join(os.path.dirname(filepath), "default.json") | ||
|
||
@property | ||
def subdivisions(self): | ||
data_filepath = self.subdivisions_data_filepath | ||
with open(data_filepath, "r") as file: | ||
payload = json.loads(file.read()) | ||
return enum.Enum(self.name, payload) |
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 @@ | ||
{} |
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,34 @@ | ||
{ | ||
"AGU": "Aguascalientes", | ||
"BCN": "Baja California", | ||
"BCS": "Baja California Sur", | ||
"CAM": "Campeche", | ||
"CHP": "Chiapas", | ||
"CHH": "Chihuahua", | ||
"CMX": "Ciudad de M\u00e9xico", | ||
"COA": "Coahuila de Zaragoza", | ||
"COL": "Colima", | ||
"DUR": "Durango", | ||
"GUA": "Guanajuato", | ||
"GRO": "Guerrero", | ||
"HID": "Hidalgo", | ||
"JAL": "Jalisco", | ||
"MIC": "Michoac\u00e1n de Ocampo", | ||
"MOR": "Morelos", | ||
"MEX": "M\u00e9xico", | ||
"NAY": "Nayarit", | ||
"NLE": "Nuevo Le\u00f3n", | ||
"OAX": "Oaxaca", | ||
"PUE": "Puebla", | ||
"QUE": "Quer\u00e9taro", | ||
"ROO": "Quintana Roo", | ||
"SLP": "San Luis Potos\u00ed", | ||
"SIN": "Sinaloa", | ||
"SON": "Sonora", | ||
"TAB": "Tabasco", | ||
"TAM": "Tamaulipas", | ||
"TLA": "Tlaxcala", | ||
"VER": "Veracruz de Ignacio de la Llave", | ||
"YUC": "Yucat\u00e1n", | ||
"ZAC": "Zacatecas" | ||
} |