Séparation des modes debug et verbose
This commit is contained in:
@ -9,7 +9,7 @@ from nupes.cache import get_file
|
||||
from nupes.models.geographie import BureauVote, Circonscription, Commune, Departement, Region
|
||||
|
||||
|
||||
def importer_regions(engine: Engine, debug: bool = False) -> None:
|
||||
def importer_regions(engine: Engine, verbose: bool = False) -> None:
|
||||
etag = requests.get(
|
||||
"https://public.opendatasoft.com/api/explore/v2.1/catalog/datasets"
|
||||
"/georef-france-region?select=data_processed").json()['data_processed']
|
||||
@ -36,7 +36,7 @@ def importer_regions(engine: Engine, debug: bool = False) -> None:
|
||||
session.commit()
|
||||
|
||||
|
||||
def importer_departements(engine: Engine, debug: bool = False) -> None:
|
||||
def importer_departements(engine: Engine, verbose: bool = False) -> None:
|
||||
etag = requests.get(
|
||||
"https://public.opendatasoft.com/api/explore/v2.1/catalog/datasets"
|
||||
"/georef-france-departement?select=data_processed").json()['data_processed']
|
||||
@ -66,7 +66,7 @@ def importer_departements(engine: Engine, debug: bool = False) -> None:
|
||||
session.commit()
|
||||
|
||||
|
||||
def importer_communes(engine: Engine, debug: bool = False) -> None:
|
||||
def importer_communes(engine: Engine, verbose: bool = False) -> None:
|
||||
etag = requests.get(
|
||||
"https://public.opendatasoft.com/api/explore/v2.1/catalog/datasets"
|
||||
"/georef-france-commune-arrondissement-municipal?select=data_processed").json()['data_processed']
|
||||
@ -95,7 +95,7 @@ def importer_communes(engine: Engine, debug: bool = False) -> None:
|
||||
session.commit()
|
||||
|
||||
|
||||
def importer_bureaux_vote(engine: Engine, debug: bool = False) -> None:
|
||||
def importer_bureaux_vote(engine: Engine, verbose: bool = False) -> None:
|
||||
etag = requests.get(
|
||||
"https://public.opendatasoft.com/api/explore/v2.1/catalog/datasets"
|
||||
"/elections-france-bureau-vote-2022?select=data_processed").json()['data_processed']
|
||||
@ -146,7 +146,7 @@ def importer_bureaux_vote(engine: Engine, debug: bool = False) -> None:
|
||||
session.commit()
|
||||
|
||||
|
||||
def importer_contours_bureaux_vote(engine: Engine, debug: bool = False) -> None:
|
||||
def importer_contours_bureaux_vote(engine: Engine, verbose: bool = False) -> None:
|
||||
file = get_file("https://www.data.gouv.fr/fr/datasets/r/f98165a7-7c37-4705-a181-bcfc943edc73",
|
||||
"contours-bureaux-vote.geojson")
|
||||
|
||||
@ -177,9 +177,9 @@ def importer_contours_bureaux_vote(engine: Engine, debug: bool = False) -> None:
|
||||
session.commit()
|
||||
|
||||
|
||||
def run(engine: Engine, debug: bool = False) -> None:
|
||||
importer_regions(engine, debug)
|
||||
importer_departements(engine, debug)
|
||||
importer_communes(engine, debug)
|
||||
importer_bureaux_vote(engine, debug)
|
||||
importer_contours_bureaux_vote(engine, debug)
|
||||
def run(engine: Engine, verbose: bool = False) -> None:
|
||||
importer_regions(engine, verbose)
|
||||
importer_departements(engine, verbose)
|
||||
importer_communes(engine, verbose)
|
||||
importer_bureaux_vote(engine, verbose)
|
||||
importer_contours_bureaux_vote(engine, verbose)
|
||||
|
Reference in New Issue
Block a user