forked from Olav63/outils_OSM
pylint sur requetes
This commit is contained in:
parent
af09edea2b
commit
b5ab062b3e
@ -1,7 +1,10 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
"""Module des requêtes"""
|
||||||
|
|
||||||
|
|
||||||
class requete:
|
class Requete:
|
||||||
|
"""Objet requête"""
|
||||||
|
|
||||||
nom: str
|
nom: str
|
||||||
critere: str
|
critere: str
|
||||||
champs: dict
|
champs: dict
|
||||||
@ -12,8 +15,8 @@ class requete:
|
|||||||
self.champs = champs
|
self.champs = champs
|
||||||
|
|
||||||
|
|
||||||
reqs = []
|
REQS = []
|
||||||
champs_stationnement = {
|
CHAMPS_STATIONNEMENT = {
|
||||||
"amenity": {"export_json": "Non", "FR": "aménagement"},
|
"amenity": {"export_json": "Non", "FR": "aménagement"},
|
||||||
"capacity": {"export_json": "Oui", "FR": "nombre d'emplacements"},
|
"capacity": {"export_json": "Oui", "FR": "nombre d'emplacements"},
|
||||||
"access": {"export_json": "Oui", "FR": "accès"},
|
"access": {"export_json": "Oui", "FR": "accès"},
|
||||||
@ -25,7 +28,7 @@ champs_stationnement = {
|
|||||||
"check_date:capacity": {"export_json": "Non", "FR": "date_vérification"},
|
"check_date:capacity": {"export_json": "Non", "FR": "date_vérification"},
|
||||||
"source": {"export_json": "Non", "FR": "source"},
|
"source": {"export_json": "Non", "FR": "source"},
|
||||||
}
|
}
|
||||||
champs_poi = {
|
CHAMPS_POI = {
|
||||||
"name": {"export_json": "Oui", "FR": ""},
|
"name": {"export_json": "Oui", "FR": ""},
|
||||||
"description": {"export_json": "Oui", "FR": ""},
|
"description": {"export_json": "Oui", "FR": ""},
|
||||||
"website": {"export_json": "Oui", "FR": ""},
|
"website": {"export_json": "Oui", "FR": ""},
|
||||||
@ -41,8 +44,7 @@ champs_poi = {
|
|||||||
"office": {"export_json": "Oui", "FR": "Bureau"},
|
"office": {"export_json": "Oui", "FR": "Bureau"},
|
||||||
"opening_hours": {"export_json": "Oui", "FR": "Horaires"},
|
"opening_hours": {"export_json": "Oui", "FR": "Horaires"},
|
||||||
}
|
}
|
||||||
# fields api_adresse (issus du géocodage inversé)
|
CHAMPS_ADRESSE = {
|
||||||
champs_adresse = {
|
|
||||||
"api_adresse:geometry:coordinates:lon": {
|
"api_adresse:geometry:coordinates:lon": {
|
||||||
"export_json": "Non",
|
"export_json": "Non",
|
||||||
"FR": "lon_adresse_etalab",
|
"FR": "lon_adresse_etalab",
|
||||||
@ -71,73 +73,72 @@ champs_adresse = {
|
|||||||
"api_adresse:properties:street": {"export_json": "Non", "FR": "rue_etalab"},
|
"api_adresse:properties:street": {"export_json": "Non", "FR": "rue_etalab"},
|
||||||
}
|
}
|
||||||
|
|
||||||
reqs.append(
|
REQS.append(
|
||||||
requete(
|
Requete(
|
||||||
"stationnements_velos_publics",
|
"stationnements_velos_publics",
|
||||||
r'nwr["amenity"="bicycle_parking"](area:aire_de_recherche); - nwr["amenity"="bicycle_parking"]["access"~"(no|permit|private|customers)"](area:aire_de_recherche);',
|
r'nwr["amenity"="bicycle_parking"](area:aire_de_recherche); - nwr["amenity"="bicycle_parking"]["access"~"(no|permit|private|customers)"](area:aire_de_recherche);',
|
||||||
dict(champs_stationnement, **champs_adresse),
|
dict(CHAMPS_STATIONNEMENT, **CHAMPS_ADRESSE),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
reqs.append(
|
REQS.append(
|
||||||
requete(
|
Requete(
|
||||||
"stationnements_velos_non_publics",
|
"stationnements_velos_non_publics",
|
||||||
r'nwr["amenity"="bicycle_parking"]["access"~"(no|permit|private|customers)"](area:aire_de_recherche);',
|
r'nwr["amenity"="bicycle_parking"]["access"~"(no|permit|private|customers)"](area:aire_de_recherche);',
|
||||||
dict(champs_stationnement, **champs_adresse),
|
dict(CHAMPS_STATIONNEMENT, **CHAMPS_ADRESSE),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
champ_local = {"service:bicycle:diy": {"export_json": "Non", "FR": ""}}
|
CHAMP_LOCAL = {"service:bicycle:diy": {"export_json": "Non", "FR": ""}}
|
||||||
reqs.append(
|
REQS.append(
|
||||||
requete(
|
Requete(
|
||||||
"ateliers_autoreparation",
|
"ateliers_autoreparation",
|
||||||
r'nwr["service:bicycle:diy"="yes"](area:aire_de_recherche);',
|
r'nwr["service:bicycle:diy"="yes"](area:aire_de_recherche);',
|
||||||
dict(champ_local, **champs_poi, **champs_adresse),
|
dict(CHAMP_LOCAL, **CHAMPS_POI, **CHAMPS_ADRESSE),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
champ_local = {"association": {"export_json": "Non", "FR": ""}}
|
CHAMP_LOCAL = {"association": {"export_json": "Non", "FR": ""}}
|
||||||
reqs.append(
|
REQS.append(
|
||||||
requete(
|
Requete(
|
||||||
"associations_velo",
|
"associations_velo",
|
||||||
r'nwr["association"="bicycle"](area:aire_de_recherche);',
|
r'nwr["association"="bicycle"](area:aire_de_recherche);',
|
||||||
dict(champ_local, **champs_poi, **champs_adresse),
|
dict(CHAMP_LOCAL, **CHAMPS_POI, **CHAMPS_ADRESSE),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
champ_local = {"craft": {"export_json": "Non", "FR": ""}}
|
CHAMP_LOCAL = {"craft": {"export_json": "Non", "FR": ""}}
|
||||||
reqs.append(
|
REQS.append(
|
||||||
requete(
|
Requete(
|
||||||
"fabriquants_velo",
|
"fabriquants_velo",
|
||||||
r'nwr["craft"="bicycle"](area:aire_de_recherche);',
|
r'nwr["craft"="bicycle"](area:aire_de_recherche);',
|
||||||
dict(champ_local, **champs_poi, **champs_adresse),
|
dict(CHAMP_LOCAL, **CHAMPS_POI, **CHAMPS_ADRESSE),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
champ_local = {"shop": {"export_json": "Non", "FR": ""}}
|
CHAMP_LOCAL = {"shop": {"export_json": "Non", "FR": ""}}
|
||||||
reqs.append(
|
REQS.append(
|
||||||
requete(
|
Requete(
|
||||||
"vendeurs_velo",
|
"vendeurs_velo",
|
||||||
r'nwr["shop"="bicycle"](area:aire_de_recherche); nwr["service:bicycle:retail"="yes"](area:aire_de_recherche);',
|
r'nwr["shop"="bicycle"](area:aire_de_recherche); nwr["service:bicycle:retail"="yes"](area:aire_de_recherche);',
|
||||||
dict(champ_local, **champs_poi, **champs_adresse),
|
dict(CHAMP_LOCAL, **CHAMPS_POI, **CHAMPS_ADRESSE),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
champ_local = {"amenity": {"export_json": "Non", "FR": ""}}
|
CHAMP_LOCAL = {"amenity": {"export_json": "Non", "FR": ""}}
|
||||||
reqs.append(
|
REQS.append(
|
||||||
requete(
|
Requete(
|
||||||
"velos_libre_service",
|
"velos_libre_service",
|
||||||
r'nwr["amenity"="bicycle_rental"](area:aire_de_recherche);',
|
r'nwr["amenity"="bicycle_rental"](area:aire_de_recherche);',
|
||||||
dict(champ_local, **champs_poi, **champs_adresse),
|
dict(CHAMP_LOCAL, **CHAMPS_POI, **CHAMPS_ADRESSE),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
champ_local = {"service:bicycle:rental": {"export_json": "Non", "FR": ""}}
|
CHAMP_LOCAL = {"service:bicycle:rental": {"export_json": "Non", "FR": ""}}
|
||||||
reqs.append(
|
REQS.append(
|
||||||
requete(
|
Requete(
|
||||||
"location_velo",
|
"location_velo",
|
||||||
r'nwr["service:bicycle:rental"="yes"](area:aire_de_recherche);',
|
r'nwr["service:bicycle:rental"="yes"](area:aire_de_recherche);',
|
||||||
dict(champ_local, **champs_poi, **champs_adresse),
|
dict(CHAMP_LOCAL, **CHAMPS_POI, **CHAMPS_ADRESSE),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ def executer_requete_et_exporter_resultats(
|
|||||||
def main():
|
def main():
|
||||||
"""Routine principale"""
|
"""Routine principale"""
|
||||||
|
|
||||||
for req in requetes.reqs:
|
for req in requetes.REQS:
|
||||||
for nb_essai in range(MAX_RETRY): # on tente max_retry fois
|
for nb_essai in range(MAX_RETRY): # on tente max_retry fois
|
||||||
try:
|
try:
|
||||||
executer_requete_et_exporter_resultats(
|
executer_requete_et_exporter_resultats(
|
||||||
|
Loading…
Reference in New Issue
Block a user