Successfully rewrite the CLI in go
This commit is contained in:
parent
c6f2327d2a
commit
feb756812d
19 changed files with 37236 additions and 74744 deletions
16
README.md
16
README.md
|
@ -3,20 +3,16 @@
|
||||||
Extract data from INSEE number (France)
|
Extract data from INSEE number (France)
|
||||||
|
|
||||||
## Getting started
|
## Getting started
|
||||||
### From package
|
### From sources
|
||||||
|
#### Run
|
||||||
```shell
|
```shell
|
||||||
# activate your venv
|
go run . 269059913116714 168127982980507
|
||||||
python -m pip install insee-number-translator
|
|
||||||
insee 269059913116714 168127982980507
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### From sources
|
#### Build & install
|
||||||
```shell
|
```shell
|
||||||
pyenv virtualenv 3.7.9 insee
|
go install
|
||||||
pyenv local insee
|
insee_number_translator 269059913116714 168127982980507
|
||||||
poetry install
|
|
||||||
# restart your shell
|
|
||||||
insee 269059913116714 168127982980507
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Data sources
|
## Data sources
|
||||||
|
|
36759
data/cities.go
Normal file
36759
data/cities.go
Normal file
File diff suppressed because it is too large
Load diff
9
data/continents.go
Normal file
9
data/continents.go
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
package data
|
||||||
|
|
||||||
|
var continents = map[string]string{
|
||||||
|
"1": "Europe",
|
||||||
|
"2": "Asie",
|
||||||
|
"3": "Afrique",
|
||||||
|
"4": "Amérique",
|
||||||
|
"5": "Océanie",
|
||||||
|
}
|
267
data/countries.go
Normal file
267
data/countries.go
Normal file
|
@ -0,0 +1,267 @@
|
||||||
|
package data
|
||||||
|
|
||||||
|
var countries = map[string][]string{
|
||||||
|
"99125": {"ALBANIE"},
|
||||||
|
"99109": {"ALLEMAGNE"},
|
||||||
|
"99130": {"ANDORRE"},
|
||||||
|
"99110": {"AUTRICHE"},
|
||||||
|
"99131": {"BELGIQUE"},
|
||||||
|
"99148": {"BIELORUSSIE"},
|
||||||
|
"99118": {"BOSNIE-HERZEGOVINE"},
|
||||||
|
"99111": {"BULGARIE"},
|
||||||
|
"99119": {"CROATIE"},
|
||||||
|
"99101": {"DANEMARK", "FEROE (ILES)"},
|
||||||
|
"99134": {"ESPAGNE"},
|
||||||
|
"99106": {"ESTONIE"},
|
||||||
|
"99156": {"EX-REPUBLIQUE YOUGOSLAVE DE MACEDOINE"},
|
||||||
|
"99105": {"FINLANDE"},
|
||||||
|
"99133": {"GIBRALTAR"},
|
||||||
|
"99126": {"GRECE"},
|
||||||
|
"99132": {"ROYAUME-UNI", "GUERNESEY", "JERSEY", "MAN (ILE)"},
|
||||||
|
"99112": {"HONGRIE"},
|
||||||
|
"99136": {"IRLANDE, ou EIRE"},
|
||||||
|
"99102": {"ISLANDE"},
|
||||||
|
"99127": {"ITALIE"},
|
||||||
|
"99157": {"KOSOVO"},
|
||||||
|
"99107": {"LETTONIE"},
|
||||||
|
"99113": {"LIECHTENSTEIN"},
|
||||||
|
"99108": {"LITUANIE"},
|
||||||
|
"99137": {"LUXEMBOURG"},
|
||||||
|
"99144": {"MALTE"},
|
||||||
|
"99151": {"MOLDAVIE"},
|
||||||
|
"99138": {"MONACO"},
|
||||||
|
"99120": {"MONTENEGRO"},
|
||||||
|
"99103": {"NORVEGE", "BOUVET (ILE)", "SVALBARD et ILE JAN MAYEN"},
|
||||||
|
"99135": {"PAYS-BAS", "ARUBA"},
|
||||||
|
"99122": {"POLOGNE"},
|
||||||
|
"99139": {"PORTUGAL"},
|
||||||
|
"99141": {"REPUBLIQUE DEMOCRATIQUE ALLEMANDE"},
|
||||||
|
"99142": {"REPUBLIQUE FEDERALE D'ALLEMAGNE"},
|
||||||
|
"99114": {"ROUMANIE"},
|
||||||
|
"99123": {"RUSSIE"},
|
||||||
|
"99128": {"SAINT-MARIN"},
|
||||||
|
"99121": {"SERBIE"},
|
||||||
|
"99117": {"SLOVAQUIE"},
|
||||||
|
"99145": {"SLOVENIE"},
|
||||||
|
"99104": {"SUEDE"},
|
||||||
|
"99140": {"SUISSE"},
|
||||||
|
"99115": {"TCHECOSLOVAQUIE"},
|
||||||
|
"99116": {"TCHEQUE (REPUBLIQUE)"},
|
||||||
|
"99124": {"TURQUIE D'EUROPE"},
|
||||||
|
"99155": {"UKRAINE"},
|
||||||
|
"99129": {"VATICAN, ou SAINT-SIEGE"},
|
||||||
|
"99212": {"AFGHANISTAN"},
|
||||||
|
"99201": {"ARABIE SAOUDITE"},
|
||||||
|
"99252": {"ARMENIE"},
|
||||||
|
"99253": {"AZERBAIDJAN"},
|
||||||
|
"99249": {"BAHREIN"},
|
||||||
|
"99246": {"BANGLADESH"},
|
||||||
|
"99214": {"BHOUTAN"},
|
||||||
|
"99224": {"BIRMANIE"},
|
||||||
|
"99225": {"BRUNEI"},
|
||||||
|
"99234": {"CAMBODGE"},
|
||||||
|
"99216": {"CHINE"},
|
||||||
|
"99254": {"CHYPRE"},
|
||||||
|
"99237": {"COREE"},
|
||||||
|
"99239": {"COREE (REPUBLIQUE DE)"},
|
||||||
|
"99238": {"COREE (REPUBLIQUE POPULAIRE DEMOCRATIQUE DE)"},
|
||||||
|
"99247": {"EMIRATS ARABES UNIS"},
|
||||||
|
"99228": {"ETATS MALAIS NON FEDERES"},
|
||||||
|
"99255": {"GEORGIE"},
|
||||||
|
"99230": {"HONG-KONG"},
|
||||||
|
"99223": {"INDE", "GOA"},
|
||||||
|
"99231": {"INDONESIE"},
|
||||||
|
"99204": {"IRAN"},
|
||||||
|
"99203": {"IRAQ"},
|
||||||
|
"99207": {"ISRAEL"},
|
||||||
|
"99217": {"JAPON"},
|
||||||
|
"99222": {"JORDANIE"},
|
||||||
|
"99211": {"KAMTCHATKA"},
|
||||||
|
"99256": {"KAZAKHSTAN"},
|
||||||
|
"99257": {"KIRGHIZISTAN"},
|
||||||
|
"99240": {"KOWEIT"},
|
||||||
|
"99241": {"LAOS"},
|
||||||
|
"99205": {"LIBAN"},
|
||||||
|
"99232": {"MACAO"},
|
||||||
|
"99227": {"MALAISIE"},
|
||||||
|
"99229": {"MALDIVES"},
|
||||||
|
"99218": {"MANDCHOURIE"},
|
||||||
|
"99242": {"MONGOLIE"},
|
||||||
|
"99215": {"NEPAL"},
|
||||||
|
"99250": {"OMAN"},
|
||||||
|
"99258": {"OUZBEKISTAN"},
|
||||||
|
"99213": {"PAKISTAN"},
|
||||||
|
"99261": {"PALESTINE (Etat de)"},
|
||||||
|
"99220": {"PHILIPPINES"},
|
||||||
|
"99221": {"POSSESSIONS BRITANNIQUES AU PROCHE-ORIENT"},
|
||||||
|
"99248": {"QATAR"},
|
||||||
|
"99209": {"SIBERIE"},
|
||||||
|
"99226": {"SINGAPOUR"},
|
||||||
|
"99235": {"SRI LANKA"},
|
||||||
|
"99206": {"SYRIE"},
|
||||||
|
"99259": {"TADJIKISTAN"},
|
||||||
|
"99236": {"TAIWAN"},
|
||||||
|
"99219": {"THAILANDE"},
|
||||||
|
"99262": {"TIMOR ORIENTAL"},
|
||||||
|
"99210": {"TURKESTAN RUSSE"},
|
||||||
|
"99260": {"TURKMENISTAN"},
|
||||||
|
"99208": {"TURQUIE"},
|
||||||
|
"99243": {"VIET NAM"},
|
||||||
|
"99244": {"VIET NAM DU NORD"},
|
||||||
|
"99245": {"VIET NAM DU SUD"},
|
||||||
|
"99251": {"YEMEN"},
|
||||||
|
"99233": {"YEMEN DEMOCRATIQUE"},
|
||||||
|
"99202": {"YEMEN (REPUBLIQUE ARABE DU)"},
|
||||||
|
"99319": {"ACORES, MADERE"},
|
||||||
|
"99303": {"AFRIQUE DU SUD"},
|
||||||
|
"99352": {"ALGERIE"},
|
||||||
|
"99395": {"ANGOLA"},
|
||||||
|
"99327": {"BENIN"},
|
||||||
|
"99347": {"BOTSWANA"},
|
||||||
|
"99331": {"BURKINA"},
|
||||||
|
"99321": {"BURUNDI"},
|
||||||
|
"99322": {"CAMEROUN"},
|
||||||
|
"99305": {"CAMEROUN ET TOGO"},
|
||||||
|
"99396": {"CAP-VERT"},
|
||||||
|
"99323": {"CENTRAFRICAINE (REPUBLIQUE)"},
|
||||||
|
"99397": {"COMORES"},
|
||||||
|
"99324": {"CONGO"},
|
||||||
|
"99312": {"CONGO (REPUBLIQUE DEMOCRATIQUE)"},
|
||||||
|
"99326": {"COTE D'IVOIRE"},
|
||||||
|
"99399": {"DJIBOUTI"},
|
||||||
|
"99301": {"EGYPTE"},
|
||||||
|
"99317": {"ERYTHREE"},
|
||||||
|
"99391": {"ESWATINI"},
|
||||||
|
"99315": {"ETHIOPIE"},
|
||||||
|
"99328": {"GABON"},
|
||||||
|
"99304": {"GAMBIE"},
|
||||||
|
"99329": {"GHANA"},
|
||||||
|
"99330": {"GUINEE"},
|
||||||
|
"99314": {"GUINEE EQUATORIALE"},
|
||||||
|
"99392": {"GUINEE-BISSAU"},
|
||||||
|
"99320": {"ILES PORTUGAISES DE L'OCEAN INDIEN"},
|
||||||
|
"99332": {"KENYA"},
|
||||||
|
"99348": {"LESOTHO"},
|
||||||
|
"99302": {"LIBERIA"},
|
||||||
|
"99316": {"LIBYE"},
|
||||||
|
"99333": {"MADAGASCAR"},
|
||||||
|
"99334": {"MALAWI"},
|
||||||
|
"99335": {"MALI"},
|
||||||
|
"99350": {"MAROC"},
|
||||||
|
"99390": {"MAURICE"},
|
||||||
|
"99336": {"MAURITANIE"},
|
||||||
|
"99393": {"MOZAMBIQUE"},
|
||||||
|
"99311": {"NAMIBIE"},
|
||||||
|
"99337": {"NIGER"},
|
||||||
|
"99338": {"NIGERIA"},
|
||||||
|
"99339": {"OUGANDA"},
|
||||||
|
"99313": {"PROVINCES ESPAGNOLES D'AFRIQUE", "PRESIDES", "CANARIES (ILES)"},
|
||||||
|
"99340": {"RWANDA"},
|
||||||
|
"99389": {"SAHARA OCCIDENTAL"},
|
||||||
|
"99306": {"SAINTE HELENE, ASCENSION ET TRISTAN DA CUNHA"},
|
||||||
|
"99394": {"SAO TOME-ET-PRINCIPE"},
|
||||||
|
"99341": {"SENEGAL"},
|
||||||
|
"99398": {"SEYCHELLES"},
|
||||||
|
"99342": {"SIERRA LEONE"},
|
||||||
|
"99318": {"SOMALIE"},
|
||||||
|
"99343": {"SOUDAN"},
|
||||||
|
"99307": {"SOUDAN ANGLO-EGYPTIEN, KENYA, OUGANDA"},
|
||||||
|
"99349": {"SOUDAN DU SUD"},
|
||||||
|
"99325": {"TANGER"},
|
||||||
|
"99309": {"TANZANIE"},
|
||||||
|
"99344": {"TCHAD"},
|
||||||
|
"99345": {"TOGO"},
|
||||||
|
"99351": {"TUNISIE"},
|
||||||
|
"99346": {"ZAMBIE"},
|
||||||
|
"99308": {"ZANZIBAR", "OCEAN INDIEN (TERRITOIRE BRITANNIQUE DE L')"},
|
||||||
|
"99310": {"ZIMBABWE"},
|
||||||
|
"99441": {"ANTIGUA-ET-BARBUDA"},
|
||||||
|
"99431": {"ANTILLES NEERLANDAISES"},
|
||||||
|
"99415": {"ARGENTINE"},
|
||||||
|
"99436": {"BAHAMAS"},
|
||||||
|
"99434": {"BARBADE"},
|
||||||
|
"99429": {"BELIZE"},
|
||||||
|
"99425": {
|
||||||
|
"BERMUDES",
|
||||||
|
"ANGUILLA",
|
||||||
|
"CAIMANES (ILES)",
|
||||||
|
"MONTSERRAT",
|
||||||
|
"TURKS ET CAIQUES (ILES)",
|
||||||
|
"VIERGES BRITANNIQUES (ILES)",
|
||||||
|
"TERRITOIRES DU ROYAUME-UNI AUX ANTILLES",
|
||||||
|
},
|
||||||
|
"99418": {"BOLIVIE"},
|
||||||
|
"99443": {"BONAIRE, SAINT EUSTACHE ET SABA"},
|
||||||
|
"99416": {"BRESIL"},
|
||||||
|
"99401": {"CANADA"},
|
||||||
|
"99417": {"CHILI"},
|
||||||
|
"99419": {"COLOMBIE"},
|
||||||
|
"99406": {"COSTA RICA"},
|
||||||
|
"99407": {"CUBA"},
|
||||||
|
"99444": {"CURAÇAO"},
|
||||||
|
"99408": {"DOMINICAINE (REPUBLIQUE)"},
|
||||||
|
"99438": {"DOMINIQUE"},
|
||||||
|
"99414": {"EL SALVADOR"},
|
||||||
|
"99420": {"EQUATEUR"},
|
||||||
|
"99404": {"ETATS-UNIS", "ALASKA"},
|
||||||
|
"99435": {"GRENADE"},
|
||||||
|
"99430": {"GROENLAND"},
|
||||||
|
"99409": {"GUATEMALA"},
|
||||||
|
"99428": {"GUYANA"},
|
||||||
|
"99410": {"HAITI"},
|
||||||
|
"99411": {"HONDURAS"},
|
||||||
|
"99426": {"JAMAIQUE"},
|
||||||
|
"99403": {"LABRADOR"},
|
||||||
|
"99427": {
|
||||||
|
"MALOUINES, OU FALKLAND (ILES)",
|
||||||
|
"GEORGIE DU SUD ET LES ILES SANDWICH DU SUD",
|
||||||
|
"TERR. DU ROYAUME-UNI DANS L'ATLANTIQUE SUD",
|
||||||
|
},
|
||||||
|
"99405": {"MEXIQUE"},
|
||||||
|
"99412": {"NICARAGUA"},
|
||||||
|
"99413": {"PANAMA"},
|
||||||
|
"99421": {"PARAGUAY"},
|
||||||
|
"99422": {"PEROU"},
|
||||||
|
"99432": {
|
||||||
|
"PORTO RICO",
|
||||||
|
"VIERGES DES ETATS-UNIS (ILES)",
|
||||||
|
"TERR. DES ETATS-UNIS D'AMERIQUE EN AMERIQUE",
|
||||||
|
},
|
||||||
|
"99442": {"SAINT-CHRISTOPHE-ET-NIEVES"},
|
||||||
|
"99439": {"SAINTE-LUCIE"},
|
||||||
|
"99445": {"SAINT-MARTIN (PARTIE NEERLANDAISE)"},
|
||||||
|
"99440": {"SAINT-VINCENT-ET-LES GRENADINES"},
|
||||||
|
"99437": {"SURINAME"},
|
||||||
|
"99402": {"TERRE-NEUVE"},
|
||||||
|
"99433": {"TRINITE-ET-TOBAGO"},
|
||||||
|
"99423": {"URUGUAY"},
|
||||||
|
"99424": {"VENEZUELA"},
|
||||||
|
"99501": {
|
||||||
|
"AUSTRALIE",
|
||||||
|
"CHRISTMAS (ILE)",
|
||||||
|
"COCOS ou KEELING (ILES)",
|
||||||
|
"HEARD ET MACDONALD (ILES)",
|
||||||
|
"NORFOLK (ILE)",
|
||||||
|
},
|
||||||
|
"99508": {"FIDJI"},
|
||||||
|
"99504": {"HAWAII (ILES)"},
|
||||||
|
"99513": {"KIRIBATI"},
|
||||||
|
"99515": {"MARSHALL (ILES)"},
|
||||||
|
"99516": {"MICRONESIE (ETATS FEDERES DE)"},
|
||||||
|
"99507": {"NAURU"},
|
||||||
|
"99502": {"NOUVELLE-ZELANDE", "COOK (ILES)", "NIUE", "TOKELAU"},
|
||||||
|
"99517": {"PALAOS (ILES)"},
|
||||||
|
"99510": {"PAPOUASIE-NOUVELLE-GUINEE"},
|
||||||
|
"99503": {"PITCAIRN (ILE)"},
|
||||||
|
"99512": {"SALOMON (ILES)"},
|
||||||
|
"99506": {"SAMOA OCCIDENTALES"},
|
||||||
|
"99505": {
|
||||||
|
"GUAM",
|
||||||
|
"SAMOA AMERICAINES",
|
||||||
|
"MARIANNES DU NORD (ILES)",
|
||||||
|
"TERR. DES ETATS-UNIS D'AMERIQUE EN OCEANIE",
|
||||||
|
},
|
||||||
|
"99509": {"TONGA"},
|
||||||
|
"99511": {"TUVALU"},
|
||||||
|
"99514": {"VANUATU"},
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
package main
|
package data
|
||||||
|
|
||||||
var DEPARTMENTS = map[string]string{
|
var departments = map[string]string{
|
||||||
"01": "Ain",
|
"01": "Ain",
|
||||||
"02": "Aisne",
|
"02": "Aisne",
|
||||||
"03": "Allier",
|
"03": "Allier",
|
150
data/insee_data.go
Normal file
150
data/insee_data.go
Normal file
|
@ -0,0 +1,150 @@
|
||||||
|
package data
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type InseeData struct {
|
||||||
|
InseeNumber string
|
||||||
|
Gender string
|
||||||
|
Year int
|
||||||
|
Month time.Month
|
||||||
|
Department string
|
||||||
|
City string
|
||||||
|
Foreign bool
|
||||||
|
Country string
|
||||||
|
OrderOfBirth int
|
||||||
|
ControlKey int
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewInseeData(inseeNumber string) (*InseeData, error) {
|
||||||
|
if len(inseeNumber) != 15 {
|
||||||
|
return nil, fmt.Errorf("provided insee number must contain 15 characters")
|
||||||
|
}
|
||||||
|
num := inseeNumber
|
||||||
|
department := num[5:7]
|
||||||
|
city := num[7:10]
|
||||||
|
if department == "97" || department == "98" {
|
||||||
|
department = num[5:8]
|
||||||
|
city = num[8:10]
|
||||||
|
}
|
||||||
|
dep, err := strconv.Atoi(department)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
foreign := false
|
||||||
|
country := "FR"
|
||||||
|
if (dep >= 91 && dep <= 96) || dep == 99 {
|
||||||
|
foreign = true
|
||||||
|
country = city
|
||||||
|
city = "unknown"
|
||||||
|
department = "unknown"
|
||||||
|
}
|
||||||
|
order, err := strconv.Atoi(num[10:13])
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
controlKey, err := strconv.Atoi(num[13:])
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
monthInt, err := strconv.Atoi(num[3:5])
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
month := time.Month(monthInt)
|
||||||
|
year, err := strconv.Atoi(num[1:3])
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
year += 2000
|
||||||
|
now := time.Now()
|
||||||
|
birthday := time.Date(year, month, 1, 0, 0, 0, 0, time.UTC)
|
||||||
|
if birthday.After(now) {
|
||||||
|
year -= 100
|
||||||
|
}
|
||||||
|
gender := num[0:1]
|
||||||
|
if gender == "1" {
|
||||||
|
gender = "Male"
|
||||||
|
} else {
|
||||||
|
gender = "Female"
|
||||||
|
}
|
||||||
|
return &InseeData{
|
||||||
|
InseeNumber: num,
|
||||||
|
Gender: gender,
|
||||||
|
Year: year,
|
||||||
|
Month: month,
|
||||||
|
Department: department,
|
||||||
|
City: city,
|
||||||
|
Foreign: foreign,
|
||||||
|
Country: country,
|
||||||
|
OrderOfBirth: order,
|
||||||
|
ControlKey: controlKey,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (insee InseeData) IsValid() (bool, error) {
|
||||||
|
num := strings.Replace(insee.InseeNumber, "2A", "19", 1)
|
||||||
|
num = strings.Replace(num, "2B", "18", 1)[:len(num)-2]
|
||||||
|
numInt, err := strconv.Atoi(num)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
code := 97 - (numInt % 97)
|
||||||
|
return code == insee.ControlKey, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (insee InseeData) String() string {
|
||||||
|
var message []string
|
||||||
|
valid, err := insee.IsValid()
|
||||||
|
if err != nil {
|
||||||
|
return err.Error()
|
||||||
|
}
|
||||||
|
if valid {
|
||||||
|
message = append(message, "The number is valid.")
|
||||||
|
} else {
|
||||||
|
message = append(message, "The number is invalid.")
|
||||||
|
}
|
||||||
|
msg := fmt.Sprintf("You're a %s, born in %s, probably in %d.", insee.Gender, insee.Month, insee.Year)
|
||||||
|
message = append(message, msg)
|
||||||
|
|
||||||
|
var zoneType string
|
||||||
|
var line string
|
||||||
|
if insee.Foreign {
|
||||||
|
zoneType = "country"
|
||||||
|
line = "You were born outside France, "
|
||||||
|
country, present := countries["99"+insee.Country]
|
||||||
|
continent := continents[insee.Country[0:1]]
|
||||||
|
continent = fmt.Sprintf(" (%s)", continent)
|
||||||
|
if present && len(country) > 1 {
|
||||||
|
line += "probably in either one of these countries/territories: "
|
||||||
|
line += strings.Join(country, ", ")
|
||||||
|
line += continent
|
||||||
|
} else if present && len(country) == 1 {
|
||||||
|
line += fmt.Sprintf("in %s%s", country[0], continent)
|
||||||
|
} else {
|
||||||
|
line += "in an unknown country numbered " + insee.Country
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
zoneType = "city"
|
||||||
|
city, cityPresent := cities[insee.Department+insee.City]
|
||||||
|
department, depPresent := departments[insee.Department]
|
||||||
|
if !depPresent {
|
||||||
|
department = "unknown department"
|
||||||
|
}
|
||||||
|
|
||||||
|
if cityPresent {
|
||||||
|
line = fmt.Sprintf("You were born in %s, %s (%s), France.", city.Name, city.ZipCode, department)
|
||||||
|
} else {
|
||||||
|
line = fmt.Sprintf("You were born in an unknown city numbered %s, which is located in %s, in France", insee.City, department)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
message = append(message, line)
|
||||||
|
line = fmt.Sprintf("You were the %dth to be born in this %s on this month.", insee.OrderOfBirth, zoneType)
|
||||||
|
message = append(message, line)
|
||||||
|
|
||||||
|
return strings.Join(message, "\n")
|
||||||
|
}
|
22
data/insee_data_test.go
Normal file
22
data/insee_data_test.go
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
package data
|
||||||
|
|
||||||
|
import "testing"
|
||||||
|
|
||||||
|
func TestNewInseeDataValid(t *testing.T) {
|
||||||
|
number := "269059913116714"
|
||||||
|
insee, err := NewInseeData(number)
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
if insee.InseeNumber != number {
|
||||||
|
t.Errorf("InseeNumber KO. Got %s, expected %s", insee.InseeNumber, number)
|
||||||
|
}
|
||||||
|
foreign := true
|
||||||
|
if insee.Foreign != foreign {
|
||||||
|
t.Errorf("Foreign KO. Got %t, expected %t", insee.Foreign, foreign)
|
||||||
|
}
|
||||||
|
gender := "Female"
|
||||||
|
if insee.Gender != gender {
|
||||||
|
t.Errorf("Gender KO. Got %s, expected %s", insee.Gender, gender)
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,275 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
var CONTINENTS = map[string]string{
|
|
||||||
"1": "Europe",
|
|
||||||
"2": "Asie",
|
|
||||||
"3": "Afrique",
|
|
||||||
"4": "Amérique",
|
|
||||||
"5": "Océanie",
|
|
||||||
}
|
|
||||||
|
|
||||||
var COUNTRIES = map[string][]string{
|
|
||||||
"99125": {"ALBANIE"},
|
|
||||||
"99109": {"ALLEMAGNE"},
|
|
||||||
"99130": {"ANDORRE"},
|
|
||||||
"99110": {"AUTRICHE"},
|
|
||||||
"99131": {"BELGIQUE"},
|
|
||||||
"99148": {"BIELORUSSIE"},
|
|
||||||
"99118": {"BOSNIE-HERZEGOVINE"},
|
|
||||||
"99111": {"BULGARIE"},
|
|
||||||
"99119": {"CROATIE"},
|
|
||||||
"99101": {"DANEMARK", "FEROE (ILES)"},
|
|
||||||
"99134": {"ESPAGNE"},
|
|
||||||
"99106": {"ESTONIE"},
|
|
||||||
"99156": {"EX-REPUBLIQUE YOUGOSLAVE DE MACEDOINE"},
|
|
||||||
"99105": {"FINLANDE"},
|
|
||||||
"99133": {"GIBRALTAR"},
|
|
||||||
"99126": {"GRECE"},
|
|
||||||
"99132": {"ROYAUME-UNI", "GUERNESEY", "JERSEY", "MAN (ILE)"},
|
|
||||||
"99112": {"HONGRIE"},
|
|
||||||
"99136": {"IRLANDE, ou EIRE"},
|
|
||||||
"99102": {"ISLANDE"},
|
|
||||||
"99127": {"ITALIE"},
|
|
||||||
"99157": {"KOSOVO"},
|
|
||||||
"99107": {"LETTONIE"},
|
|
||||||
"99113": {"LIECHTENSTEIN"},
|
|
||||||
"99108": {"LITUANIE"},
|
|
||||||
"99137": {"LUXEMBOURG"},
|
|
||||||
"99144": {"MALTE"},
|
|
||||||
"99151": {"MOLDAVIE"},
|
|
||||||
"99138": {"MONACO"},
|
|
||||||
"99120": {"MONTENEGRO"},
|
|
||||||
"99103": {"NORVEGE", "BOUVET (ILE)", "SVALBARD et ILE JAN MAYEN"},
|
|
||||||
"99135": {"PAYS-BAS", "ARUBA"},
|
|
||||||
"99122": {"POLOGNE"},
|
|
||||||
"99139": {"PORTUGAL"},
|
|
||||||
"99141": {"REPUBLIQUE DEMOCRATIQUE ALLEMANDE"},
|
|
||||||
"99142": {"REPUBLIQUE FEDERALE D'ALLEMAGNE"},
|
|
||||||
"99114": {"ROUMANIE"},
|
|
||||||
"99123": {"RUSSIE"},
|
|
||||||
"99128": {"SAINT-MARIN"},
|
|
||||||
"99121": {"SERBIE"},
|
|
||||||
"99117": {"SLOVAQUIE"},
|
|
||||||
"99145": {"SLOVENIE"},
|
|
||||||
"99104": {"SUEDE"},
|
|
||||||
"99140": {"SUISSE"},
|
|
||||||
"99115": {"TCHECOSLOVAQUIE"},
|
|
||||||
"99116": {"TCHEQUE (REPUBLIQUE)"},
|
|
||||||
"99124": {"TURQUIE D'EUROPE"},
|
|
||||||
"99155": {"UKRAINE"},
|
|
||||||
"99129": {"VATICAN, ou SAINT-SIEGE"},
|
|
||||||
"99212": {"AFGHANISTAN"},
|
|
||||||
"99201": {"ARABIE SAOUDITE"},
|
|
||||||
"99252": {"ARMENIE"},
|
|
||||||
"99253": {"AZERBAIDJAN"},
|
|
||||||
"99249": {"BAHREIN"},
|
|
||||||
"99246": {"BANGLADESH"},
|
|
||||||
"99214": {"BHOUTAN"},
|
|
||||||
"99224": {"BIRMANIE"},
|
|
||||||
"99225": {"BRUNEI"},
|
|
||||||
"99234": {"CAMBODGE"},
|
|
||||||
"99216": {"CHINE"},
|
|
||||||
"99254": {"CHYPRE"},
|
|
||||||
"99237": {"COREE"},
|
|
||||||
"99239": {"COREE (REPUBLIQUE DE)"},
|
|
||||||
"99238": {"COREE (REPUBLIQUE POPULAIRE DEMOCRATIQUE DE)"},
|
|
||||||
"99247": {"EMIRATS ARABES UNIS"},
|
|
||||||
"99228": {"ETATS MALAIS NON FEDERES"},
|
|
||||||
"99255": {"GEORGIE"},
|
|
||||||
"99230": {"HONG-KONG"},
|
|
||||||
"99223": {"INDE", "GOA"},
|
|
||||||
"99231": {"INDONESIE"},
|
|
||||||
"99204": {"IRAN"},
|
|
||||||
"99203": {"IRAQ"},
|
|
||||||
"99207": {"ISRAEL"},
|
|
||||||
"99217": {"JAPON"},
|
|
||||||
"99222": {"JORDANIE"},
|
|
||||||
"99211": {"KAMTCHATKA"},
|
|
||||||
"99256": {"KAZAKHSTAN"},
|
|
||||||
"99257": {"KIRGHIZISTAN"},
|
|
||||||
"99240": {"KOWEIT"},
|
|
||||||
"99241": {"LAOS"},
|
|
||||||
"99205": {"LIBAN"},
|
|
||||||
"99232": {"MACAO"},
|
|
||||||
"99227": {"MALAISIE"},
|
|
||||||
"99229": {"MALDIVES"},
|
|
||||||
"99218": {"MANDCHOURIE"},
|
|
||||||
"99242": {"MONGOLIE"},
|
|
||||||
"99215": {"NEPAL"},
|
|
||||||
"99250": {"OMAN"},
|
|
||||||
"99258": {"OUZBEKISTAN"},
|
|
||||||
"99213": {"PAKISTAN"},
|
|
||||||
"99261": {"PALESTINE (Etat de)"},
|
|
||||||
"99220": {"PHILIPPINES"},
|
|
||||||
"99221": {"POSSESSIONS BRITANNIQUES AU PROCHE-ORIENT"},
|
|
||||||
"99248": {"QATAR"},
|
|
||||||
"99209": {"SIBERIE"},
|
|
||||||
"99226": {"SINGAPOUR"},
|
|
||||||
"99235": {"SRI LANKA"},
|
|
||||||
"99206": {"SYRIE"},
|
|
||||||
"99259": {"TADJIKISTAN"},
|
|
||||||
"99236": {"TAIWAN"},
|
|
||||||
"99219": {"THAILANDE"},
|
|
||||||
"99262": {"TIMOR ORIENTAL"},
|
|
||||||
"99210": {"TURKESTAN RUSSE"},
|
|
||||||
"99260": {"TURKMENISTAN"},
|
|
||||||
"99208": {"TURQUIE"},
|
|
||||||
"99243": {"VIET NAM"},
|
|
||||||
"99244": {"VIET NAM DU NORD"},
|
|
||||||
"99245": {"VIET NAM DU SUD"},
|
|
||||||
"99251": {"YEMEN"},
|
|
||||||
"99233": {"YEMEN DEMOCRATIQUE"},
|
|
||||||
"99202": {"YEMEN (REPUBLIQUE ARABE DU)"},
|
|
||||||
"99319": {"ACORES, MADERE"},
|
|
||||||
"99303": {"AFRIQUE DU SUD"},
|
|
||||||
"99352": {"ALGERIE"},
|
|
||||||
"99395": {"ANGOLA"},
|
|
||||||
"99327": {"BENIN"},
|
|
||||||
"99347": {"BOTSWANA"},
|
|
||||||
"99331": {"BURKINA"},
|
|
||||||
"99321": {"BURUNDI"},
|
|
||||||
"99322": {"CAMEROUN"},
|
|
||||||
"99305": {"CAMEROUN ET TOGO"},
|
|
||||||
"99396": {"CAP-VERT"},
|
|
||||||
"99323": {"CENTRAFRICAINE (REPUBLIQUE)"},
|
|
||||||
"99397": {"COMORES"},
|
|
||||||
"99324": {"CONGO"},
|
|
||||||
"99312": {"CONGO (REPUBLIQUE DEMOCRATIQUE)"},
|
|
||||||
"99326": {"COTE D'IVOIRE"},
|
|
||||||
"99399": {"DJIBOUTI"},
|
|
||||||
"99301": {"EGYPTE"},
|
|
||||||
"99317": {"ERYTHREE"},
|
|
||||||
"99391": {"ESWATINI"},
|
|
||||||
"99315": {"ETHIOPIE"},
|
|
||||||
"99328": {"GABON"},
|
|
||||||
"99304": {"GAMBIE"},
|
|
||||||
"99329": {"GHANA"},
|
|
||||||
"99330": {"GUINEE"},
|
|
||||||
"99314": {"GUINEE EQUATORIALE"},
|
|
||||||
"99392": {"GUINEE-BISSAU"},
|
|
||||||
"99320": {"ILES PORTUGAISES DE L'OCEAN INDIEN"},
|
|
||||||
"99332": {"KENYA"},
|
|
||||||
"99348": {"LESOTHO"},
|
|
||||||
"99302": {"LIBERIA"},
|
|
||||||
"99316": {"LIBYE"},
|
|
||||||
"99333": {"MADAGASCAR"},
|
|
||||||
"99334": {"MALAWI"},
|
|
||||||
"99335": {"MALI"},
|
|
||||||
"99350": {"MAROC"},
|
|
||||||
"99390": {"MAURICE"},
|
|
||||||
"99336": {"MAURITANIE"},
|
|
||||||
"99393": {"MOZAMBIQUE"},
|
|
||||||
"99311": {"NAMIBIE"},
|
|
||||||
"99337": {"NIGER"},
|
|
||||||
"99338": {"NIGERIA"},
|
|
||||||
"99339": {"OUGANDA"},
|
|
||||||
"99313": {"PROVINCES ESPAGNOLES D'AFRIQUE", "PRESIDES", "CANARIES (ILES)"},
|
|
||||||
"99340": {"RWANDA"},
|
|
||||||
"99389": {"SAHARA OCCIDENTAL"},
|
|
||||||
"99306": {"SAINTE HELENE, ASCENSION ET TRISTAN DA CUNHA"},
|
|
||||||
"99394": {"SAO TOME-ET-PRINCIPE"},
|
|
||||||
"99341": {"SENEGAL"},
|
|
||||||
"99398": {"SEYCHELLES"},
|
|
||||||
"99342": {"SIERRA LEONE"},
|
|
||||||
"99318": {"SOMALIE"},
|
|
||||||
"99343": {"SOUDAN"},
|
|
||||||
"99307": {"SOUDAN ANGLO-EGYPTIEN, KENYA, OUGANDA"},
|
|
||||||
"99349": {"SOUDAN DU SUD"},
|
|
||||||
"99325": {"TANGER"},
|
|
||||||
"99309": {"TANZANIE"},
|
|
||||||
"99344": {"TCHAD"},
|
|
||||||
"99345": {"TOGO"},
|
|
||||||
"99351": {"TUNISIE"},
|
|
||||||
"99346": {"ZAMBIE"},
|
|
||||||
"99308": {"ZANZIBAR", "OCEAN INDIEN (TERRITOIRE BRITANNIQUE DE L')"},
|
|
||||||
"99310": {"ZIMBABWE"},
|
|
||||||
"99441": {"ANTIGUA-ET-BARBUDA"},
|
|
||||||
"99431": {"ANTILLES NEERLANDAISES"},
|
|
||||||
"99415": {"ARGENTINE"},
|
|
||||||
"99436": {"BAHAMAS"},
|
|
||||||
"99434": {"BARBADE"},
|
|
||||||
"99429": {"BELIZE"},
|
|
||||||
"99425": {
|
|
||||||
"BERMUDES",
|
|
||||||
"ANGUILLA",
|
|
||||||
"CAIMANES (ILES)",
|
|
||||||
"MONTSERRAT",
|
|
||||||
"TURKS ET CAIQUES (ILES)",
|
|
||||||
"VIERGES BRITANNIQUES (ILES)",
|
|
||||||
"TERRITOIRES DU ROYAUME-UNI AUX ANTILLES",
|
|
||||||
},
|
|
||||||
"99418": {"BOLIVIE"},
|
|
||||||
"99443": {"BONAIRE, SAINT EUSTACHE ET SABA"},
|
|
||||||
"99416": {"BRESIL"},
|
|
||||||
"99401": {"CANADA"},
|
|
||||||
"99417": {"CHILI"},
|
|
||||||
"99419": {"COLOMBIE"},
|
|
||||||
"99406": {"COSTA RICA"},
|
|
||||||
"99407": {"CUBA"},
|
|
||||||
"99444": {"CURAÇAO"},
|
|
||||||
"99408": {"DOMINICAINE (REPUBLIQUE)"},
|
|
||||||
"99438": {"DOMINIQUE"},
|
|
||||||
"99414": {"EL SALVADOR"},
|
|
||||||
"99420": {"EQUATEUR"},
|
|
||||||
"99404": {"ETATS-UNIS", "ALASKA"},
|
|
||||||
"99435": {"GRENADE"},
|
|
||||||
"99430": {"GROENLAND"},
|
|
||||||
"99409": {"GUATEMALA"},
|
|
||||||
"99428": {"GUYANA"},
|
|
||||||
"99410": {"HAITI"},
|
|
||||||
"99411": {"HONDURAS"},
|
|
||||||
"99426": {"JAMAIQUE"},
|
|
||||||
"99403": {"LABRADOR"},
|
|
||||||
"99427": {
|
|
||||||
"MALOUINES, OU FALKLAND (ILES)",
|
|
||||||
"GEORGIE DU SUD ET LES ILES SANDWICH DU SUD",
|
|
||||||
"TERR. DU ROYAUME-UNI DANS L'ATLANTIQUE SUD",
|
|
||||||
},
|
|
||||||
"99405": {"MEXIQUE"},
|
|
||||||
"99412": {"NICARAGUA"},
|
|
||||||
"99413": {"PANAMA"},
|
|
||||||
"99421": {"PARAGUAY"},
|
|
||||||
"99422": {"PEROU"},
|
|
||||||
"99432": {
|
|
||||||
"PORTO RICO",
|
|
||||||
"VIERGES DES ETATS-UNIS (ILES)",
|
|
||||||
"TERR. DES ETATS-UNIS D'AMERIQUE EN AMERIQUE",
|
|
||||||
},
|
|
||||||
"99442": {"SAINT-CHRISTOPHE-ET-NIEVES"},
|
|
||||||
"99439": {"SAINTE-LUCIE"},
|
|
||||||
"99445": {"SAINT-MARTIN (PARTIE NEERLANDAISE)"},
|
|
||||||
"99440": {"SAINT-VINCENT-ET-LES GRENADINES"},
|
|
||||||
"99437": {"SURINAME"},
|
|
||||||
"99402": {"TERRE-NEUVE"},
|
|
||||||
"99433": {"TRINITE-ET-TOBAGO"},
|
|
||||||
"99423": {"URUGUAY"},
|
|
||||||
"99424": {"VENEZUELA"},
|
|
||||||
"99501": {
|
|
||||||
"AUSTRALIE",
|
|
||||||
"CHRISTMAS (ILE)",
|
|
||||||
"COCOS ou KEELING (ILES)",
|
|
||||||
"HEARD ET MACDONALD (ILES)",
|
|
||||||
"NORFOLK (ILE)",
|
|
||||||
},
|
|
||||||
"99508": {"FIDJI"},
|
|
||||||
"99504": {"HAWAII (ILES)"},
|
|
||||||
"99513": {"KIRIBATI"},
|
|
||||||
"99515": {"MARSHALL (ILES)"},
|
|
||||||
"99516": {"MICRONESIE (ETATS FEDERES DE)"},
|
|
||||||
"99507": {"NAURU"},
|
|
||||||
"99502": {"NOUVELLE-ZELANDE", "COOK (ILES)", "NIUE", "TOKELAU"},
|
|
||||||
"99517": {"PALAOS (ILES)"},
|
|
||||||
"99510": {"PAPOUASIE-NOUVELLE-GUINEE"},
|
|
||||||
"99503": {"PITCAIRN (ILE)"},
|
|
||||||
"99512": {"SALOMON (ILES)"},
|
|
||||||
"99506": {"SAMOA OCCIDENTALES"},
|
|
||||||
"99505": {
|
|
||||||
"GUAM",
|
|
||||||
"SAMOA AMERICAINES",
|
|
||||||
"MARIANNES DU NORD (ILES)",
|
|
||||||
"TERR. DES ETATS-UNIS D'AMERIQUE EN OCEANIE",
|
|
||||||
},
|
|
||||||
"99509": {"TONGA"},
|
|
||||||
"99511": {"TUVALU"},
|
|
||||||
"99514": {"VANUATU"},
|
|
||||||
}
|
|
|
@ -1,273 +0,0 @@
|
||||||
CONTINENTS = {
|
|
||||||
"1": "Europe",
|
|
||||||
"2": "Asie",
|
|
||||||
"3": "Afrique",
|
|
||||||
"4": "Amérique",
|
|
||||||
"5": "Océanie",
|
|
||||||
}
|
|
||||||
|
|
||||||
COUNTRIES = {
|
|
||||||
"99125": ["ALBANIE"],
|
|
||||||
"99109": ["ALLEMAGNE"],
|
|
||||||
"99130": ["ANDORRE"],
|
|
||||||
"99110": ["AUTRICHE"],
|
|
||||||
"99131": ["BELGIQUE"],
|
|
||||||
"99148": ["BIELORUSSIE"],
|
|
||||||
"99118": ["BOSNIE-HERZEGOVINE"],
|
|
||||||
"99111": ["BULGARIE"],
|
|
||||||
"99119": ["CROATIE"],
|
|
||||||
"99101": ["DANEMARK", "FEROE (ILES)"],
|
|
||||||
"99134": ["ESPAGNE"],
|
|
||||||
"99106": ["ESTONIE"],
|
|
||||||
"99156": ["EX-REPUBLIQUE YOUGOSLAVE DE MACEDOINE"],
|
|
||||||
"99105": ["FINLANDE"],
|
|
||||||
"99133": ["GIBRALTAR"],
|
|
||||||
"99126": ["GRECE"],
|
|
||||||
"99132": ["ROYAUME-UNI", "GUERNESEY", "JERSEY", "MAN (ILE)"],
|
|
||||||
"99112": ["HONGRIE"],
|
|
||||||
"99136": ["IRLANDE, ou EIRE"],
|
|
||||||
"99102": ["ISLANDE"],
|
|
||||||
"99127": ["ITALIE"],
|
|
||||||
"99157": ["KOSOVO"],
|
|
||||||
"99107": ["LETTONIE"],
|
|
||||||
"99113": ["LIECHTENSTEIN"],
|
|
||||||
"99108": ["LITUANIE"],
|
|
||||||
"99137": ["LUXEMBOURG"],
|
|
||||||
"99144": ["MALTE"],
|
|
||||||
"99151": ["MOLDAVIE"],
|
|
||||||
"99138": ["MONACO"],
|
|
||||||
"99120": ["MONTENEGRO"],
|
|
||||||
"99103": ["NORVEGE", "BOUVET (ILE)", "SVALBARD et ILE JAN MAYEN"],
|
|
||||||
"99135": ["PAYS-BAS", "ARUBA"],
|
|
||||||
"99122": ["POLOGNE"],
|
|
||||||
"99139": ["PORTUGAL"],
|
|
||||||
"99141": ["REPUBLIQUE DEMOCRATIQUE ALLEMANDE"],
|
|
||||||
"99142": ["REPUBLIQUE FEDERALE D'ALLEMAGNE"],
|
|
||||||
"99114": ["ROUMANIE"],
|
|
||||||
"99123": ["RUSSIE"],
|
|
||||||
"99128": ["SAINT-MARIN"],
|
|
||||||
"99121": ["SERBIE"],
|
|
||||||
"99117": ["SLOVAQUIE"],
|
|
||||||
"99145": ["SLOVENIE"],
|
|
||||||
"99104": ["SUEDE"],
|
|
||||||
"99140": ["SUISSE"],
|
|
||||||
"99115": ["TCHECOSLOVAQUIE"],
|
|
||||||
"99116": ["TCHEQUE (REPUBLIQUE)"],
|
|
||||||
"99124": ["TURQUIE D'EUROPE"],
|
|
||||||
"99155": ["UKRAINE"],
|
|
||||||
"99129": ["VATICAN, ou SAINT-SIEGE"],
|
|
||||||
"99212": ["AFGHANISTAN"],
|
|
||||||
"99201": ["ARABIE SAOUDITE"],
|
|
||||||
"99252": ["ARMENIE"],
|
|
||||||
"99253": ["AZERBAIDJAN"],
|
|
||||||
"99249": ["BAHREIN"],
|
|
||||||
"99246": ["BANGLADESH"],
|
|
||||||
"99214": ["BHOUTAN"],
|
|
||||||
"99224": ["BIRMANIE"],
|
|
||||||
"99225": ["BRUNEI"],
|
|
||||||
"99234": ["CAMBODGE"],
|
|
||||||
"99216": ["CHINE"],
|
|
||||||
"99254": ["CHYPRE"],
|
|
||||||
"99237": ["COREE"],
|
|
||||||
"99239": ["COREE (REPUBLIQUE DE)"],
|
|
||||||
"99238": ["COREE (REPUBLIQUE POPULAIRE DEMOCRATIQUE DE)"],
|
|
||||||
"99247": ["EMIRATS ARABES UNIS"],
|
|
||||||
"99228": ["ETATS MALAIS NON FEDERES"],
|
|
||||||
"99255": ["GEORGIE"],
|
|
||||||
"99230": ["HONG-KONG"],
|
|
||||||
"99223": ["INDE", "GOA"],
|
|
||||||
"99231": ["INDONESIE"],
|
|
||||||
"99204": ["IRAN"],
|
|
||||||
"99203": ["IRAQ"],
|
|
||||||
"99207": ["ISRAEL"],
|
|
||||||
"99217": ["JAPON"],
|
|
||||||
"99222": ["JORDANIE"],
|
|
||||||
"99211": ["KAMTCHATKA"],
|
|
||||||
"99256": ["KAZAKHSTAN"],
|
|
||||||
"99257": ["KIRGHIZISTAN"],
|
|
||||||
"99240": ["KOWEIT"],
|
|
||||||
"99241": ["LAOS"],
|
|
||||||
"99205": ["LIBAN"],
|
|
||||||
"99232": ["MACAO"],
|
|
||||||
"99227": ["MALAISIE"],
|
|
||||||
"99229": ["MALDIVES"],
|
|
||||||
"99218": ["MANDCHOURIE"],
|
|
||||||
"99242": ["MONGOLIE"],
|
|
||||||
"99215": ["NEPAL"],
|
|
||||||
"99250": ["OMAN"],
|
|
||||||
"99258": ["OUZBEKISTAN"],
|
|
||||||
"99213": ["PAKISTAN"],
|
|
||||||
"99261": ["PALESTINE (Etat de)"],
|
|
||||||
"99220": ["PHILIPPINES"],
|
|
||||||
"99221": ["POSSESSIONS BRITANNIQUES AU PROCHE-ORIENT"],
|
|
||||||
"99248": ["QATAR"],
|
|
||||||
"99209": ["SIBERIE"],
|
|
||||||
"99226": ["SINGAPOUR"],
|
|
||||||
"99235": ["SRI LANKA"],
|
|
||||||
"99206": ["SYRIE"],
|
|
||||||
"99259": ["TADJIKISTAN"],
|
|
||||||
"99236": ["TAIWAN"],
|
|
||||||
"99219": ["THAILANDE"],
|
|
||||||
"99262": ["TIMOR ORIENTAL"],
|
|
||||||
"99210": ["TURKESTAN RUSSE"],
|
|
||||||
"99260": ["TURKMENISTAN"],
|
|
||||||
"99208": ["TURQUIE"],
|
|
||||||
"99243": ["VIET NAM"],
|
|
||||||
"99244": ["VIET NAM DU NORD"],
|
|
||||||
"99245": ["VIET NAM DU SUD"],
|
|
||||||
"99251": ["YEMEN"],
|
|
||||||
"99233": ["YEMEN DEMOCRATIQUE"],
|
|
||||||
"99202": ["YEMEN (REPUBLIQUE ARABE DU)"],
|
|
||||||
"99319": ["ACORES, MADERE"],
|
|
||||||
"99303": ["AFRIQUE DU SUD"],
|
|
||||||
"99352": ["ALGERIE"],
|
|
||||||
"99395": ["ANGOLA"],
|
|
||||||
"99327": ["BENIN"],
|
|
||||||
"99347": ["BOTSWANA"],
|
|
||||||
"99331": ["BURKINA"],
|
|
||||||
"99321": ["BURUNDI"],
|
|
||||||
"99322": ["CAMEROUN"],
|
|
||||||
"99305": ["CAMEROUN ET TOGO"],
|
|
||||||
"99396": ["CAP-VERT"],
|
|
||||||
"99323": ["CENTRAFRICAINE (REPUBLIQUE)"],
|
|
||||||
"99397": ["COMORES"],
|
|
||||||
"99324": ["CONGO"],
|
|
||||||
"99312": ["CONGO (REPUBLIQUE DEMOCRATIQUE)"],
|
|
||||||
"99326": ["COTE D'IVOIRE"],
|
|
||||||
"99399": ["DJIBOUTI"],
|
|
||||||
"99301": ["EGYPTE"],
|
|
||||||
"99317": ["ERYTHREE"],
|
|
||||||
"99391": ["ESWATINI"],
|
|
||||||
"99315": ["ETHIOPIE"],
|
|
||||||
"99328": ["GABON"],
|
|
||||||
"99304": ["GAMBIE"],
|
|
||||||
"99329": ["GHANA"],
|
|
||||||
"99330": ["GUINEE"],
|
|
||||||
"99314": ["GUINEE EQUATORIALE"],
|
|
||||||
"99392": ["GUINEE-BISSAU"],
|
|
||||||
"99320": ["ILES PORTUGAISES DE L'OCEAN INDIEN"],
|
|
||||||
"99332": ["KENYA"],
|
|
||||||
"99348": ["LESOTHO"],
|
|
||||||
"99302": ["LIBERIA"],
|
|
||||||
"99316": ["LIBYE"],
|
|
||||||
"99333": ["MADAGASCAR"],
|
|
||||||
"99334": ["MALAWI"],
|
|
||||||
"99335": ["MALI"],
|
|
||||||
"99350": ["MAROC"],
|
|
||||||
"99390": ["MAURICE"],
|
|
||||||
"99336": ["MAURITANIE"],
|
|
||||||
"99393": ["MOZAMBIQUE"],
|
|
||||||
"99311": ["NAMIBIE"],
|
|
||||||
"99337": ["NIGER"],
|
|
||||||
"99338": ["NIGERIA"],
|
|
||||||
"99339": ["OUGANDA"],
|
|
||||||
"99313": ["PROVINCES ESPAGNOLES D'AFRIQUE", "PRESIDES", "CANARIES (ILES)"],
|
|
||||||
"99340": ["RWANDA"],
|
|
||||||
"99389": ["SAHARA OCCIDENTAL"],
|
|
||||||
"99306": ["SAINTE HELENE, ASCENSION ET TRISTAN DA CUNHA"],
|
|
||||||
"99394": ["SAO TOME-ET-PRINCIPE"],
|
|
||||||
"99341": ["SENEGAL"],
|
|
||||||
"99398": ["SEYCHELLES"],
|
|
||||||
"99342": ["SIERRA LEONE"],
|
|
||||||
"99318": ["SOMALIE"],
|
|
||||||
"99343": ["SOUDAN"],
|
|
||||||
"99307": ["SOUDAN ANGLO-EGYPTIEN, KENYA, OUGANDA"],
|
|
||||||
"99349": ["SOUDAN DU SUD"],
|
|
||||||
"99325": ["TANGER"],
|
|
||||||
"99309": ["TANZANIE"],
|
|
||||||
"99344": ["TCHAD"],
|
|
||||||
"99345": ["TOGO"],
|
|
||||||
"99351": ["TUNISIE"],
|
|
||||||
"99346": ["ZAMBIE"],
|
|
||||||
"99308": ["ZANZIBAR", "OCEAN INDIEN (TERRITOIRE BRITANNIQUE DE L')"],
|
|
||||||
"99310": ["ZIMBABWE"],
|
|
||||||
"99441": ["ANTIGUA-ET-BARBUDA"],
|
|
||||||
"99431": ["ANTILLES NEERLANDAISES"],
|
|
||||||
"99415": ["ARGENTINE"],
|
|
||||||
"99436": ["BAHAMAS"],
|
|
||||||
"99434": ["BARBADE"],
|
|
||||||
"99429": ["BELIZE"],
|
|
||||||
"99425": [
|
|
||||||
"BERMUDES",
|
|
||||||
"ANGUILLA",
|
|
||||||
"CAIMANES (ILES)",
|
|
||||||
"MONTSERRAT",
|
|
||||||
"TURKS ET CAIQUES (ILES)",
|
|
||||||
"VIERGES BRITANNIQUES (ILES)",
|
|
||||||
"TERRITOIRES DU ROYAUME-UNI AUX ANTILLES",
|
|
||||||
],
|
|
||||||
"99418": ["BOLIVIE"],
|
|
||||||
"99443": ["BONAIRE, SAINT EUSTACHE ET SABA"],
|
|
||||||
"99416": ["BRESIL"],
|
|
||||||
"99401": ["CANADA"],
|
|
||||||
"99417": ["CHILI"],
|
|
||||||
"99419": ["COLOMBIE"],
|
|
||||||
"99406": ["COSTA RICA"],
|
|
||||||
"99407": ["CUBA"],
|
|
||||||
"99444": ["CURAÇAO"],
|
|
||||||
"99408": ["DOMINICAINE (REPUBLIQUE)"],
|
|
||||||
"99438": ["DOMINIQUE"],
|
|
||||||
"99414": ["EL SALVADOR"],
|
|
||||||
"99420": ["EQUATEUR"],
|
|
||||||
"99404": ["ETATS-UNIS", "ALASKA"],
|
|
||||||
"99435": ["GRENADE"],
|
|
||||||
"99430": ["GROENLAND"],
|
|
||||||
"99409": ["GUATEMALA"],
|
|
||||||
"99428": ["GUYANA"],
|
|
||||||
"99410": ["HAITI"],
|
|
||||||
"99411": ["HONDURAS"],
|
|
||||||
"99426": ["JAMAIQUE"],
|
|
||||||
"99403": ["LABRADOR"],
|
|
||||||
"99427": [
|
|
||||||
"MALOUINES, OU FALKLAND (ILES)",
|
|
||||||
"GEORGIE DU SUD ET LES ILES SANDWICH DU SUD",
|
|
||||||
"TERR. DU ROYAUME-UNI DANS L'ATLANTIQUE SUD",
|
|
||||||
],
|
|
||||||
"99405": ["MEXIQUE"],
|
|
||||||
"99412": ["NICARAGUA"],
|
|
||||||
"99413": ["PANAMA"],
|
|
||||||
"99421": ["PARAGUAY"],
|
|
||||||
"99422": ["PEROU"],
|
|
||||||
"99432": [
|
|
||||||
"PORTO RICO",
|
|
||||||
"VIERGES DES ETATS-UNIS (ILES)",
|
|
||||||
"TERR. DES ETATS-UNIS D'AMERIQUE EN AMERIQUE",
|
|
||||||
],
|
|
||||||
"99442": ["SAINT-CHRISTOPHE-ET-NIEVES"],
|
|
||||||
"99439": ["SAINTE-LUCIE"],
|
|
||||||
"99445": ["SAINT-MARTIN (PARTIE NEERLANDAISE)"],
|
|
||||||
"99440": ["SAINT-VINCENT-ET-LES GRENADINES"],
|
|
||||||
"99437": ["SURINAME"],
|
|
||||||
"99402": ["TERRE-NEUVE"],
|
|
||||||
"99433": ["TRINITE-ET-TOBAGO"],
|
|
||||||
"99423": ["URUGUAY"],
|
|
||||||
"99424": ["VENEZUELA"],
|
|
||||||
"99501": [
|
|
||||||
"AUSTRALIE",
|
|
||||||
"CHRISTMAS (ILE)",
|
|
||||||
"COCOS ou KEELING (ILES)",
|
|
||||||
"HEARD ET MACDONALD (ILES)",
|
|
||||||
"NORFOLK (ILE)",
|
|
||||||
],
|
|
||||||
"99508": ["FIDJI"],
|
|
||||||
"99504": ["HAWAII (ILES)"],
|
|
||||||
"99513": ["KIRIBATI"],
|
|
||||||
"99515": ["MARSHALL (ILES)"],
|
|
||||||
"99516": ["MICRONESIE (ETATS FEDERES DE)"],
|
|
||||||
"99507": ["NAURU"],
|
|
||||||
"99502": ["NOUVELLE-ZELANDE", "COOK (ILES)", "NIUE", "TOKELAU"],
|
|
||||||
"99517": ["PALAOS (ILES)"],
|
|
||||||
"99510": ["PAPOUASIE-NOUVELLE-GUINEE"],
|
|
||||||
"99503": ["PITCAIRN (ILE)"],
|
|
||||||
"99512": ["SALOMON (ILES)"],
|
|
||||||
"99506": ["SAMOA OCCIDENTALES"],
|
|
||||||
"99505": [
|
|
||||||
"GUAM",
|
|
||||||
"SAMOA AMERICAINES",
|
|
||||||
"MARIANNES DU NORD (ILES)",
|
|
||||||
"TERR. DES ETATS-UNIS D'AMERIQUE EN OCEANIE",
|
|
||||||
],
|
|
||||||
"99509": ["TONGA"],
|
|
||||||
"99511": ["TUVALU"],
|
|
||||||
"99514": ["VANUATU"],
|
|
||||||
}
|
|
|
@ -1,111 +0,0 @@
|
||||||
DEPARTMENTS = {
|
|
||||||
"01": "Ain",
|
|
||||||
"02": "Aisne",
|
|
||||||
"03": "Allier",
|
|
||||||
"04": "Alpes-de-Haute-Provence",
|
|
||||||
"05": "Hautes-Alpes",
|
|
||||||
"06": "Alpes-Maritimes",
|
|
||||||
"07": "Ardèche",
|
|
||||||
"08": "Ardennes",
|
|
||||||
"09": "Ariège",
|
|
||||||
"10": "Aube",
|
|
||||||
"11": "Aude",
|
|
||||||
"12": "Aveyron",
|
|
||||||
"13": "Bouches-du-Rhône",
|
|
||||||
"14": "Calvados",
|
|
||||||
"15": "Cantal",
|
|
||||||
"16": "Charente",
|
|
||||||
"17": "Charente-Maritime",
|
|
||||||
"18": "Cher",
|
|
||||||
"19": "Corrèze",
|
|
||||||
"2A": "Corse-du-Sud",
|
|
||||||
"2B": "Haute-Corse",
|
|
||||||
"21": "Côte-d'Or",
|
|
||||||
"22": "Côtes-d'Armor",
|
|
||||||
"23": "Creuse",
|
|
||||||
"24": "Dordogne",
|
|
||||||
"25": "Doubs",
|
|
||||||
"26": "Drôme",
|
|
||||||
"27": "Eure",
|
|
||||||
"28": "Eure-et-Loir",
|
|
||||||
"29": "Finistère",
|
|
||||||
"30": "Gard",
|
|
||||||
"31": "Haute-Garonne",
|
|
||||||
"32": "Gers",
|
|
||||||
"33": "Gironde",
|
|
||||||
"34": "Hérault",
|
|
||||||
"35": "Ille-et-Vilaine",
|
|
||||||
"36": "Indre",
|
|
||||||
"37": "Indre-et-Loire",
|
|
||||||
"38": "Isère",
|
|
||||||
"39": "Jura",
|
|
||||||
"40": "Landes",
|
|
||||||
"41": "Loir-et-Cher",
|
|
||||||
"42": "Loire",
|
|
||||||
"43": "Haute-Loire",
|
|
||||||
"44": "Loire-Atlantique",
|
|
||||||
"45": "Loiret",
|
|
||||||
"46": "Lot",
|
|
||||||
"47": "Lot-et-Garonne",
|
|
||||||
"48": "Lozère",
|
|
||||||
"49": "Maine-et-Loire",
|
|
||||||
"50": "Manche",
|
|
||||||
"51": "Marne",
|
|
||||||
"52": "Haute-Marne",
|
|
||||||
"53": "Mayenne",
|
|
||||||
"54": "Meurthe-et-Moselle",
|
|
||||||
"55": "Meuse",
|
|
||||||
"56": "Morbihan",
|
|
||||||
"57": "Moselle",
|
|
||||||
"58": "Nièvre",
|
|
||||||
"59": "Nord",
|
|
||||||
"60": "Oise",
|
|
||||||
"61": "Orne",
|
|
||||||
"62": "Pas-de-Calais",
|
|
||||||
"63": "Puy-de-Dôme",
|
|
||||||
"64": "Pyrénées-Atlantiques",
|
|
||||||
"65": "Hautes-Pyrénées",
|
|
||||||
"66": "Pyrénées-Orientales",
|
|
||||||
"67": "Bas-Rhin",
|
|
||||||
"68": "Haut-Rhin",
|
|
||||||
"69": "Rhône",
|
|
||||||
"70": "Haute-Saône",
|
|
||||||
"71": "Saône-et-Loire",
|
|
||||||
"72": "Sarthe",
|
|
||||||
"73": "Savoie",
|
|
||||||
"74": "Haute-Savoie",
|
|
||||||
"75": "Paris",
|
|
||||||
"76": "Seine-Maritime",
|
|
||||||
"77": "Seine-et-Marne",
|
|
||||||
"78": "Yvelines",
|
|
||||||
"79": "Deux-Sèvres",
|
|
||||||
"80": "Somme",
|
|
||||||
"81": "Tarn",
|
|
||||||
"82": "Tarn-et-Garonne",
|
|
||||||
"83": "Var",
|
|
||||||
"84": "Vaucluse",
|
|
||||||
"85": "Vendée",
|
|
||||||
"86": "Vienne",
|
|
||||||
"87": "Haute-Vienne",
|
|
||||||
"88": "Vosges",
|
|
||||||
"89": "Yonne",
|
|
||||||
"90": "Territoire de Belfort",
|
|
||||||
"91": "Essonne",
|
|
||||||
"92": "Hauts-de-Seine",
|
|
||||||
"93": "Seine-Saint-Denis",
|
|
||||||
"94": "Val-de-Marne",
|
|
||||||
"95": "Val-d'Oise",
|
|
||||||
"971": "Guadeloupe",
|
|
||||||
"972": "Martinique",
|
|
||||||
"973": "Guyane",
|
|
||||||
"974": "La Réunion",
|
|
||||||
"975": "Saint-Pierre-et-Miquelon",
|
|
||||||
"976": "Mayotte",
|
|
||||||
"977": "Saint-Barthélemy",
|
|
||||||
"978": "Saint-Martin",
|
|
||||||
"984": "Terres australes et antarctiques françaises",
|
|
||||||
"986": "Wallis et Futuna",
|
|
||||||
"987": "Polynésie française",
|
|
||||||
"988": "Nouvelle-Calédonie",
|
|
||||||
"989": "Île de Clipperton",
|
|
||||||
}
|
|
|
@ -1,90 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
type InseeData struct {
|
|
||||||
inseeNumber string
|
|
||||||
gender string
|
|
||||||
year int
|
|
||||||
month int
|
|
||||||
department string
|
|
||||||
city string
|
|
||||||
foreign bool
|
|
||||||
country string
|
|
||||||
orderOfBirth int
|
|
||||||
controlKey int
|
|
||||||
}
|
|
||||||
|
|
||||||
func newInseeData(inseeNumber string) (*InseeData, error) {
|
|
||||||
num := inseeNumber
|
|
||||||
department := num[5:7]
|
|
||||||
city := num[7:10]
|
|
||||||
if department == "97" || department == "98" {
|
|
||||||
department = num[5:8]
|
|
||||||
city = num[8:10]
|
|
||||||
}
|
|
||||||
dep, err := strconv.Atoi(department)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
foreign := false
|
|
||||||
country := ""
|
|
||||||
if (dep >= 91 && dep <= 96) || dep == 99 {
|
|
||||||
foreign = true
|
|
||||||
country = city
|
|
||||||
city = ""
|
|
||||||
}
|
|
||||||
order, err := strconv.Atoi(num[10:13])
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
controlKey, err := strconv.Atoi(num[13:])
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
month, err := strconv.Atoi(num[3:5])
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
year, err := strconv.Atoi(num[1:3])
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
year += 2000
|
|
||||||
now := time.Now()
|
|
||||||
birthday := time.Date(year, time.Month(month), 1, 0, 0, 0, 0, nil)
|
|
||||||
if birthday.After(now) {
|
|
||||||
year -= 100
|
|
||||||
}
|
|
||||||
return &InseeData{
|
|
||||||
inseeNumber: num,
|
|
||||||
gender: num[0:1],
|
|
||||||
year: year,
|
|
||||||
month: month,
|
|
||||||
department: department,
|
|
||||||
city: city,
|
|
||||||
foreign: foreign,
|
|
||||||
country: country,
|
|
||||||
orderOfBirth: order,
|
|
||||||
controlKey: controlKey,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (insee InseeData) isValid() (bool, error) {
|
|
||||||
num := strings.Replace(insee.inseeNumber, "2A", "19", 1)
|
|
||||||
num = strings.Replace(num, "2B", "18", 1)[:len(num)-2]
|
|
||||||
numInt, err := strconv.Atoi(num)
|
|
||||||
if err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
code := 97 - (numInt % 97)
|
|
||||||
return code == insee.controlKey, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,167 +0,0 @@
|
||||||
import calendar
|
|
||||||
import datetime
|
|
||||||
import pprint
|
|
||||||
import sys
|
|
||||||
|
|
||||||
from insee_number_translator.data.cities import CITIES
|
|
||||||
from insee_number_translator.data.countries import CONTINENTS, COUNTRIES
|
|
||||||
from insee_number_translator.data.departments import DEPARTMENTS
|
|
||||||
|
|
||||||
|
|
||||||
class InseeData:
|
|
||||||
def __init__(self, insee_number: str):
|
|
||||||
self.insee_number = insee_number
|
|
||||||
if len(insee_number) != 15:
|
|
||||||
raise ValueError("insee number must be 15 characters")
|
|
||||||
self._gender = insee_number[0]
|
|
||||||
self._year = insee_number[1:3]
|
|
||||||
self.month = int(insee_number[3:5])
|
|
||||||
department = insee_number[5:7]
|
|
||||||
city = insee_number[7:10]
|
|
||||||
if department in ["97", "98"]:
|
|
||||||
department = insee_number[5:8]
|
|
||||||
city = insee_number[8:10]
|
|
||||||
|
|
||||||
self.foreign = False
|
|
||||||
if department in ["91", "92", "93", "94", "95", "96", "99"]:
|
|
||||||
self.foreign = True
|
|
||||||
self._country = city
|
|
||||||
else:
|
|
||||||
self._department = department
|
|
||||||
self._city = city
|
|
||||||
|
|
||||||
self.order_of_birth = int(insee_number[10:13])
|
|
||||||
self.control_key = int(insee_number[13:])
|
|
||||||
|
|
||||||
@property
|
|
||||||
def is_valid(self):
|
|
||||||
code = 97 - (
|
|
||||||
int(self.insee_number.replace("2A", "19").replace("2B", "18")[:-2]) % 97
|
|
||||||
)
|
|
||||||
|
|
||||||
return code == self.control_key
|
|
||||||
|
|
||||||
@property
|
|
||||||
def year(self):
|
|
||||||
year = int("20" + self._year)
|
|
||||||
date = datetime.date(year, self.month, 1)
|
|
||||||
if date < datetime.date.today():
|
|
||||||
return year
|
|
||||||
return year - 100
|
|
||||||
|
|
||||||
@property
|
|
||||||
def gender(self):
|
|
||||||
if self._gender == "1":
|
|
||||||
return "Male"
|
|
||||||
return "Female"
|
|
||||||
|
|
||||||
@property
|
|
||||||
def gender_short(self):
|
|
||||||
if self._gender == "1":
|
|
||||||
return "M"
|
|
||||||
return "F"
|
|
||||||
|
|
||||||
@property
|
|
||||||
def city(self):
|
|
||||||
if self.foreign:
|
|
||||||
return "unknown"
|
|
||||||
return self._city
|
|
||||||
|
|
||||||
@property
|
|
||||||
def country(self):
|
|
||||||
if self.foreign:
|
|
||||||
return self._country
|
|
||||||
return "FR"
|
|
||||||
|
|
||||||
@property
|
|
||||||
def department(self):
|
|
||||||
if self.foreign:
|
|
||||||
return "unknown"
|
|
||||||
return self._department
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
message = [self.insee_number]
|
|
||||||
|
|
||||||
if self.is_valid:
|
|
||||||
message.append("The number is valid.")
|
|
||||||
else:
|
|
||||||
message.append("The number is invalid.")
|
|
||||||
|
|
||||||
message.append(
|
|
||||||
f"You're a {self.gender}, born in {calendar.month_name[self.month]}, probably in {self.year}."
|
|
||||||
)
|
|
||||||
|
|
||||||
if self.foreign:
|
|
||||||
word = "country"
|
|
||||||
line = "You're born outside France, "
|
|
||||||
country = COUNTRIES.get("99" + self.country, [])
|
|
||||||
continent = CONTINENTS.get(self.country[0])
|
|
||||||
if len(country) > 1:
|
|
||||||
line += f"probably in one of these countries/territories: {', '.join(country)} ({continent})"
|
|
||||||
elif len(country) == 1:
|
|
||||||
line += f"in {country[0]} ({continent})"
|
|
||||||
else:
|
|
||||||
line += f"in an unknown country numbered {self.country}"
|
|
||||||
message.append(line)
|
|
||||||
else:
|
|
||||||
word = "city"
|
|
||||||
city = CITIES.get(self.department + self.city)
|
|
||||||
department_nice = DEPARTMENTS[self.department]
|
|
||||||
if city:
|
|
||||||
message.append(
|
|
||||||
f"You're born in {city['name']}, {city['zip_code']} ({department_nice}), France."
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
message.append(
|
|
||||||
f"You're born in a unknown city numbered {self.city}, which is located in {department_nice}, in France."
|
|
||||||
)
|
|
||||||
|
|
||||||
message.append(
|
|
||||||
f"You're the {self.order_of_birth}th to be born in this {word} on this month."
|
|
||||||
)
|
|
||||||
|
|
||||||
return "\n".join(message)
|
|
||||||
|
|
||||||
def to_dict(self):
|
|
||||||
data = {
|
|
||||||
"insee_number": self.insee_number,
|
|
||||||
"is_valid": self.is_valid,
|
|
||||||
"gender": self.gender_short,
|
|
||||||
"month": self.month,
|
|
||||||
"year": self.year,
|
|
||||||
"order_of_birth": self.order_of_birth,
|
|
||||||
}
|
|
||||||
|
|
||||||
if self.foreign:
|
|
||||||
data["foreigner"] = {
|
|
||||||
"countries_names": COUNTRIES.get("99" + self.country, []),
|
|
||||||
"country_code": self.country,
|
|
||||||
"continent": CONTINENTS.get(self.country[0]),
|
|
||||||
}
|
|
||||||
else:
|
|
||||||
city = CITIES.get(self.department + self.city, dict())
|
|
||||||
data["french"] = {
|
|
||||||
"department_name": DEPARTMENTS[self.department],
|
|
||||||
"city_insee_code": self.city,
|
|
||||||
"department_code": self.department,
|
|
||||||
"city_name": city.get("name"),
|
|
||||||
"zip_code": city.get("zip_code"),
|
|
||||||
}
|
|
||||||
|
|
||||||
return data
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
if len(sys.argv) > 1:
|
|
||||||
numbers = sys.argv[1:]
|
|
||||||
else:
|
|
||||||
print(f"Usage: {sys.argv[0]} insee_number_1 [insee_number_2 ...]")
|
|
||||||
sys.exit(1)
|
|
||||||
for number in numbers:
|
|
||||||
data = InseeData(number)
|
|
||||||
print(data)
|
|
||||||
pprint.pprint(data.to_dict())
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
21
main.go
Normal file
21
main.go
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"flag"
|
||||||
|
"fmt"
|
||||||
|
"insee_number_translator/data"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
flag.Parse()
|
||||||
|
numbers := flag.Args()
|
||||||
|
for _, number := range numbers {
|
||||||
|
insee, err := data.NewInseeData(number)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
} else {
|
||||||
|
fmt.Println(insee)
|
||||||
|
}
|
||||||
|
fmt.Println()
|
||||||
|
}
|
||||||
|
}
|
275
poetry.lock
generated
275
poetry.lock
generated
|
@ -1,275 +0,0 @@
|
||||||
[[package]]
|
|
||||||
name = "backports.entry-points-selectable"
|
|
||||||
version = "1.1.0"
|
|
||||||
description = "Compatibility shim providing selectable entry points for older implementations"
|
|
||||||
category = "dev"
|
|
||||||
optional = false
|
|
||||||
python-versions = ">=2.7"
|
|
||||||
|
|
||||||
[package.dependencies]
|
|
||||||
importlib-metadata = {version = "*", markers = "python_version < \"3.8\""}
|
|
||||||
|
|
||||||
[package.extras]
|
|
||||||
docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"]
|
|
||||||
testing = ["pytest (>=4.6)", "pytest-flake8", "pytest-cov", "pytest-black (>=0.3.7)", "pytest-mypy", "pytest-checkdocs (>=2.4)", "pytest-enabler (>=1.0.1)"]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cfgv"
|
|
||||||
version = "3.3.0"
|
|
||||||
description = "Validate configuration and produce human readable error messages."
|
|
||||||
category = "dev"
|
|
||||||
optional = false
|
|
||||||
python-versions = ">=3.6.1"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "distlib"
|
|
||||||
version = "0.3.2"
|
|
||||||
description = "Distribution utilities"
|
|
||||||
category = "dev"
|
|
||||||
optional = false
|
|
||||||
python-versions = "*"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "filelock"
|
|
||||||
version = "3.0.12"
|
|
||||||
description = "A platform independent file lock."
|
|
||||||
category = "dev"
|
|
||||||
optional = false
|
|
||||||
python-versions = "*"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "identify"
|
|
||||||
version = "2.2.12"
|
|
||||||
description = "File identification library for Python"
|
|
||||||
category = "dev"
|
|
||||||
optional = false
|
|
||||||
python-versions = ">=3.6.1"
|
|
||||||
|
|
||||||
[package.extras]
|
|
||||||
license = ["editdistance-s"]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "importlib-metadata"
|
|
||||||
version = "4.6.3"
|
|
||||||
description = "Read metadata from Python packages"
|
|
||||||
category = "dev"
|
|
||||||
optional = false
|
|
||||||
python-versions = ">=3.6"
|
|
||||||
|
|
||||||
[package.dependencies]
|
|
||||||
typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""}
|
|
||||||
zipp = ">=0.5"
|
|
||||||
|
|
||||||
[package.extras]
|
|
||||||
docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"]
|
|
||||||
perf = ["ipython"]
|
|
||||||
testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "packaging", "pep517", "pyfakefs", "flufl.flake8", "pytest-perf (>=0.9.2)", "pytest-black (>=0.3.7)", "pytest-mypy", "importlib-resources (>=1.3)"]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "invoke"
|
|
||||||
version = "1.6.0"
|
|
||||||
description = "Pythonic task execution"
|
|
||||||
category = "dev"
|
|
||||||
optional = false
|
|
||||||
python-versions = "*"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "nodeenv"
|
|
||||||
version = "1.6.0"
|
|
||||||
description = "Node.js virtual environment builder"
|
|
||||||
category = "dev"
|
|
||||||
optional = false
|
|
||||||
python-versions = "*"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "platformdirs"
|
|
||||||
version = "2.2.0"
|
|
||||||
description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
|
|
||||||
category = "dev"
|
|
||||||
optional = false
|
|
||||||
python-versions = ">=3.6"
|
|
||||||
|
|
||||||
[package.extras]
|
|
||||||
docs = ["Sphinx (>=4)", "furo (>=2021.7.5b38)", "proselint (>=0.10.2)", "sphinx-autodoc-typehints (>=1.12)"]
|
|
||||||
test = ["appdirs (==1.4.4)", "pytest (>=6)", "pytest-cov (>=2.7)", "pytest-mock (>=3.6)"]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "pre-commit"
|
|
||||||
version = "2.13.0"
|
|
||||||
description = "A framework for managing and maintaining multi-language pre-commit hooks."
|
|
||||||
category = "dev"
|
|
||||||
optional = false
|
|
||||||
python-versions = ">=3.6.1"
|
|
||||||
|
|
||||||
[package.dependencies]
|
|
||||||
cfgv = ">=2.0.0"
|
|
||||||
identify = ">=1.0.0"
|
|
||||||
importlib-metadata = {version = "*", markers = "python_version < \"3.8\""}
|
|
||||||
nodeenv = ">=0.11.1"
|
|
||||||
pyyaml = ">=5.1"
|
|
||||||
toml = "*"
|
|
||||||
virtualenv = ">=20.0.8"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "pyyaml"
|
|
||||||
version = "5.4.1"
|
|
||||||
description = "YAML parser and emitter for Python"
|
|
||||||
category = "dev"
|
|
||||||
optional = false
|
|
||||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "six"
|
|
||||||
version = "1.16.0"
|
|
||||||
description = "Python 2 and 3 compatibility utilities"
|
|
||||||
category = "dev"
|
|
||||||
optional = false
|
|
||||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "toml"
|
|
||||||
version = "0.10.2"
|
|
||||||
description = "Python Library for Tom's Obvious, Minimal Language"
|
|
||||||
category = "dev"
|
|
||||||
optional = false
|
|
||||||
python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "typing-extensions"
|
|
||||||
version = "3.10.0.0"
|
|
||||||
description = "Backported and Experimental Type Hints for Python 3.5+"
|
|
||||||
category = "dev"
|
|
||||||
optional = false
|
|
||||||
python-versions = "*"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "virtualenv"
|
|
||||||
version = "20.7.0"
|
|
||||||
description = "Virtual Python Environment builder"
|
|
||||||
category = "dev"
|
|
||||||
optional = false
|
|
||||||
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7"
|
|
||||||
|
|
||||||
[package.dependencies]
|
|
||||||
"backports.entry-points-selectable" = ">=1.0.4"
|
|
||||||
distlib = ">=0.3.1,<1"
|
|
||||||
filelock = ">=3.0.0,<4"
|
|
||||||
importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""}
|
|
||||||
platformdirs = ">=2,<3"
|
|
||||||
six = ">=1.9.0,<2"
|
|
||||||
|
|
||||||
[package.extras]
|
|
||||||
docs = ["proselint (>=0.10.2)", "sphinx (>=3)", "sphinx-argparse (>=0.2.5)", "sphinx-rtd-theme (>=0.4.3)", "towncrier (>=19.9.0rc1)"]
|
|
||||||
testing = ["coverage (>=4)", "coverage-enable-subprocess (>=1)", "flaky (>=3)", "pytest (>=4)", "pytest-env (>=0.6.2)", "pytest-freezegun (>=0.4.1)", "pytest-mock (>=2)", "pytest-randomly (>=1)", "pytest-timeout (>=1)", "packaging (>=20.0)"]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "zipp"
|
|
||||||
version = "3.5.0"
|
|
||||||
description = "Backport of pathlib-compatible object wrapper for zip files"
|
|
||||||
category = "dev"
|
|
||||||
optional = false
|
|
||||||
python-versions = ">=3.6"
|
|
||||||
|
|
||||||
[package.extras]
|
|
||||||
docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"]
|
|
||||||
testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy"]
|
|
||||||
|
|
||||||
[metadata]
|
|
||||||
lock-version = "1.1"
|
|
||||||
python-versions = "^3.7"
|
|
||||||
content-hash = "c50b8d6faabcfe4f4d1bd7a7d1661a1204db028ed75cabacf871b0df7f2e08a8"
|
|
||||||
|
|
||||||
[metadata.files]
|
|
||||||
"backports.entry-points-selectable" = [
|
|
||||||
{file = "backports.entry_points_selectable-1.1.0-py2.py3-none-any.whl", hash = "sha256:a6d9a871cde5e15b4c4a53e3d43ba890cc6861ec1332c9c2428c92f977192acc"},
|
|
||||||
{file = "backports.entry_points_selectable-1.1.0.tar.gz", hash = "sha256:988468260ec1c196dab6ae1149260e2f5472c9110334e5d51adcb77867361f6a"},
|
|
||||||
]
|
|
||||||
cfgv = [
|
|
||||||
{file = "cfgv-3.3.0-py2.py3-none-any.whl", hash = "sha256:b449c9c6118fe8cca7fa5e00b9ec60ba08145d281d52164230a69211c5d597a1"},
|
|
||||||
{file = "cfgv-3.3.0.tar.gz", hash = "sha256:9e600479b3b99e8af981ecdfc80a0296104ee610cab48a5ae4ffd0b668650eb1"},
|
|
||||||
]
|
|
||||||
distlib = [
|
|
||||||
{file = "distlib-0.3.2-py2.py3-none-any.whl", hash = "sha256:23e223426b28491b1ced97dc3bbe183027419dfc7982b4fa2f05d5f3ff10711c"},
|
|
||||||
{file = "distlib-0.3.2.zip", hash = "sha256:106fef6dc37dd8c0e2c0a60d3fca3e77460a48907f335fa28420463a6f799736"},
|
|
||||||
]
|
|
||||||
filelock = [
|
|
||||||
{file = "filelock-3.0.12-py3-none-any.whl", hash = "sha256:929b7d63ec5b7d6b71b0fa5ac14e030b3f70b75747cef1b10da9b879fef15836"},
|
|
||||||
{file = "filelock-3.0.12.tar.gz", hash = "sha256:18d82244ee114f543149c66a6e0c14e9c4f8a1044b5cdaadd0f82159d6a6ff59"},
|
|
||||||
]
|
|
||||||
identify = [
|
|
||||||
{file = "identify-2.2.12-py2.py3-none-any.whl", hash = "sha256:a510cbe155f39665625c8a4c4b4f9360cbce539f51f23f47836ab7dd852db541"},
|
|
||||||
{file = "identify-2.2.12.tar.gz", hash = "sha256:242332b3bdd45a8af1752d5d5a3afb12bee26f8e67c4be06e394f82d05ef1a4d"},
|
|
||||||
]
|
|
||||||
importlib-metadata = [
|
|
||||||
{file = "importlib_metadata-4.6.3-py3-none-any.whl", hash = "sha256:51c6635429c77cf1ae634c997ff9e53ca3438b495f10a55ba28594dd69764a8b"},
|
|
||||||
{file = "importlib_metadata-4.6.3.tar.gz", hash = "sha256:0645585859e9a6689c523927a5032f2ba5919f1f7d0e84bd4533312320de1ff9"},
|
|
||||||
]
|
|
||||||
invoke = [
|
|
||||||
{file = "invoke-1.6.0-py2-none-any.whl", hash = "sha256:e6c9917a1e3e73e7ea91fdf82d5f151ccfe85bf30cc65cdb892444c02dbb5f74"},
|
|
||||||
{file = "invoke-1.6.0-py3-none-any.whl", hash = "sha256:769e90caeb1bd07d484821732f931f1ad8916a38e3f3e618644687fc09cb6317"},
|
|
||||||
{file = "invoke-1.6.0.tar.gz", hash = "sha256:374d1e2ecf78981da94bfaf95366216aaec27c2d6a7b7d5818d92da55aa258d3"},
|
|
||||||
]
|
|
||||||
nodeenv = [
|
|
||||||
{file = "nodeenv-1.6.0-py2.py3-none-any.whl", hash = "sha256:621e6b7076565ddcacd2db0294c0381e01fd28945ab36bcf00f41c5daf63bef7"},
|
|
||||||
{file = "nodeenv-1.6.0.tar.gz", hash = "sha256:3ef13ff90291ba2a4a7a4ff9a979b63ffdd00a464dbe04acf0ea6471517a4c2b"},
|
|
||||||
]
|
|
||||||
platformdirs = [
|
|
||||||
{file = "platformdirs-2.2.0-py3-none-any.whl", hash = "sha256:4666d822218db6a262bdfdc9c39d21f23b4cfdb08af331a81e92751daf6c866c"},
|
|
||||||
{file = "platformdirs-2.2.0.tar.gz", hash = "sha256:632daad3ab546bd8e6af0537d09805cec458dce201bccfe23012df73332e181e"},
|
|
||||||
]
|
|
||||||
pre-commit = [
|
|
||||||
{file = "pre_commit-2.13.0-py2.py3-none-any.whl", hash = "sha256:b679d0fddd5b9d6d98783ae5f10fd0c4c59954f375b70a58cbe1ce9bcf9809a4"},
|
|
||||||
{file = "pre_commit-2.13.0.tar.gz", hash = "sha256:764972c60693dc668ba8e86eb29654ec3144501310f7198742a767bec385a378"},
|
|
||||||
]
|
|
||||||
pyyaml = [
|
|
||||||
{file = "PyYAML-5.4.1-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:3b2b1824fe7112845700f815ff6a489360226a5609b96ec2190a45e62a9fc922"},
|
|
||||||
{file = "PyYAML-5.4.1-cp27-cp27m-win32.whl", hash = "sha256:129def1b7c1bf22faffd67b8f3724645203b79d8f4cc81f674654d9902cb4393"},
|
|
||||||
{file = "PyYAML-5.4.1-cp27-cp27m-win_amd64.whl", hash = "sha256:4465124ef1b18d9ace298060f4eccc64b0850899ac4ac53294547536533800c8"},
|
|
||||||
{file = "PyYAML-5.4.1-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:bb4191dfc9306777bc594117aee052446b3fa88737cd13b7188d0e7aa8162185"},
|
|
||||||
{file = "PyYAML-5.4.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:6c78645d400265a062508ae399b60b8c167bf003db364ecb26dcab2bda048253"},
|
|
||||||
{file = "PyYAML-5.4.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:4e0583d24c881e14342eaf4ec5fbc97f934b999a6828693a99157fde912540cc"},
|
|
||||||
{file = "PyYAML-5.4.1-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:72a01f726a9c7851ca9bfad6fd09ca4e090a023c00945ea05ba1638c09dc3347"},
|
|
||||||
{file = "PyYAML-5.4.1-cp36-cp36m-manylinux2014_s390x.whl", hash = "sha256:895f61ef02e8fed38159bb70f7e100e00f471eae2bc838cd0f4ebb21e28f8541"},
|
|
||||||
{file = "PyYAML-5.4.1-cp36-cp36m-win32.whl", hash = "sha256:3bd0e463264cf257d1ffd2e40223b197271046d09dadf73a0fe82b9c1fc385a5"},
|
|
||||||
{file = "PyYAML-5.4.1-cp36-cp36m-win_amd64.whl", hash = "sha256:e4fac90784481d221a8e4b1162afa7c47ed953be40d31ab4629ae917510051df"},
|
|
||||||
{file = "PyYAML-5.4.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:5accb17103e43963b80e6f837831f38d314a0495500067cb25afab2e8d7a4018"},
|
|
||||||
{file = "PyYAML-5.4.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:e1d4970ea66be07ae37a3c2e48b5ec63f7ba6804bdddfdbd3cfd954d25a82e63"},
|
|
||||||
{file = "PyYAML-5.4.1-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:cb333c16912324fd5f769fff6bc5de372e9e7a202247b48870bc251ed40239aa"},
|
|
||||||
{file = "PyYAML-5.4.1-cp37-cp37m-manylinux2014_s390x.whl", hash = "sha256:fe69978f3f768926cfa37b867e3843918e012cf83f680806599ddce33c2c68b0"},
|
|
||||||
{file = "PyYAML-5.4.1-cp37-cp37m-win32.whl", hash = "sha256:dd5de0646207f053eb0d6c74ae45ba98c3395a571a2891858e87df7c9b9bd51b"},
|
|
||||||
{file = "PyYAML-5.4.1-cp37-cp37m-win_amd64.whl", hash = "sha256:08682f6b72c722394747bddaf0aa62277e02557c0fd1c42cb853016a38f8dedf"},
|
|
||||||
{file = "PyYAML-5.4.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:d2d9808ea7b4af864f35ea216be506ecec180628aced0704e34aca0b040ffe46"},
|
|
||||||
{file = "PyYAML-5.4.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:8c1be557ee92a20f184922c7b6424e8ab6691788e6d86137c5d93c1a6ec1b8fb"},
|
|
||||||
{file = "PyYAML-5.4.1-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:fd7f6999a8070df521b6384004ef42833b9bd62cfee11a09bda1079b4b704247"},
|
|
||||||
{file = "PyYAML-5.4.1-cp38-cp38-manylinux2014_s390x.whl", hash = "sha256:bfb51918d4ff3d77c1c856a9699f8492c612cde32fd3bcd344af9be34999bfdc"},
|
|
||||||
{file = "PyYAML-5.4.1-cp38-cp38-win32.whl", hash = "sha256:fa5ae20527d8e831e8230cbffd9f8fe952815b2b7dae6ffec25318803a7528fc"},
|
|
||||||
{file = "PyYAML-5.4.1-cp38-cp38-win_amd64.whl", hash = "sha256:0f5f5786c0e09baddcd8b4b45f20a7b5d61a7e7e99846e3c799b05c7c53fa696"},
|
|
||||||
{file = "PyYAML-5.4.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:294db365efa064d00b8d1ef65d8ea2c3426ac366c0c4368d930bf1c5fb497f77"},
|
|
||||||
{file = "PyYAML-5.4.1-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:74c1485f7707cf707a7aef42ef6322b8f97921bd89be2ab6317fd782c2d53183"},
|
|
||||||
{file = "PyYAML-5.4.1-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:d483ad4e639292c90170eb6f7783ad19490e7a8defb3e46f97dfe4bacae89122"},
|
|
||||||
{file = "PyYAML-5.4.1-cp39-cp39-manylinux2014_s390x.whl", hash = "sha256:fdc842473cd33f45ff6bce46aea678a54e3d21f1b61a7750ce3c498eedfe25d6"},
|
|
||||||
{file = "PyYAML-5.4.1-cp39-cp39-win32.whl", hash = "sha256:49d4cdd9065b9b6e206d0595fee27a96b5dd22618e7520c33204a4a3239d5b10"},
|
|
||||||
{file = "PyYAML-5.4.1-cp39-cp39-win_amd64.whl", hash = "sha256:c20cfa2d49991c8b4147af39859b167664f2ad4561704ee74c1de03318e898db"},
|
|
||||||
{file = "PyYAML-5.4.1.tar.gz", hash = "sha256:607774cbba28732bfa802b54baa7484215f530991055bb562efbed5b2f20a45e"},
|
|
||||||
]
|
|
||||||
six = [
|
|
||||||
{file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"},
|
|
||||||
{file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"},
|
|
||||||
]
|
|
||||||
toml = [
|
|
||||||
{file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"},
|
|
||||||
{file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"},
|
|
||||||
]
|
|
||||||
typing-extensions = [
|
|
||||||
{file = "typing_extensions-3.10.0.0-py2-none-any.whl", hash = "sha256:0ac0f89795dd19de6b97debb0c6af1c70987fd80a2d62d1958f7e56fcc31b497"},
|
|
||||||
{file = "typing_extensions-3.10.0.0-py3-none-any.whl", hash = "sha256:779383f6086d90c99ae41cf0ff39aac8a7937a9283ce0a414e5dd782f4c94a84"},
|
|
||||||
{file = "typing_extensions-3.10.0.0.tar.gz", hash = "sha256:50b6f157849174217d0656f99dc82fe932884fb250826c18350e159ec6cdf342"},
|
|
||||||
]
|
|
||||||
virtualenv = [
|
|
||||||
{file = "virtualenv-20.7.0-py2.py3-none-any.whl", hash = "sha256:fdfdaaf0979ac03ae7f76d5224a05b58165f3c804f8aa633f3dd6f22fbd435d5"},
|
|
||||||
{file = "virtualenv-20.7.0.tar.gz", hash = "sha256:97066a978431ec096d163e72771df5357c5c898ffdd587048f45e0aecc228094"},
|
|
||||||
]
|
|
||||||
zipp = [
|
|
||||||
{file = "zipp-3.5.0-py3-none-any.whl", hash = "sha256:957cfda87797e389580cb8b9e3870841ca991e2125350677b2ca83a0e99390a3"},
|
|
||||||
{file = "zipp-3.5.0.tar.gz", hash = "sha256:f5812b1e007e48cff63449a5e9f4e7ebea716b4111f9c4f9a645f91d579bf0c4"},
|
|
||||||
]
|
|
|
@ -1,29 +0,0 @@
|
||||||
[tool.poetry]
|
|
||||||
name = "insee_number_translator"
|
|
||||||
version = "0.3.1"
|
|
||||||
description = "Translate french INSEE number to meaningful data"
|
|
||||||
authors = ["Gabriel Augendre <gabriel@augendre.info>"]
|
|
||||||
license = "MIT"
|
|
||||||
homepage = "https://git.augendre.info/gaugendre/insee_number_translator"
|
|
||||||
repository = "https://git.augendre.info/gaugendre/insee_number_translator"
|
|
||||||
readme = "README.md"
|
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
|
||||||
python = "^3.7"
|
|
||||||
|
|
||||||
[tool.poetry.dev-dependencies]
|
|
||||||
pre-commit = "^2.13.0"
|
|
||||||
invoke = "^1.6.0"
|
|
||||||
|
|
||||||
[tool.poetry.scripts]
|
|
||||||
insee = 'insee_number_translator.main:main'
|
|
||||||
|
|
||||||
[build-system]
|
|
||||||
requires = ["poetry-core>=1.0.0"]
|
|
||||||
build-backend = "poetry.core.masonry.api"
|
|
||||||
|
|
||||||
[tool.black]
|
|
||||||
target-version = ['py37']
|
|
||||||
|
|
||||||
[tool.isort]
|
|
||||||
profile = "black"
|
|
Loading…
Reference in a new issue