Skip to content

Conversation

@lgourdin
Copy link
Contributor

No description provided.

lgourdin and others added 30 commits July 28, 2025 16:11
@codacy-production
Copy link

codacy-production bot commented Dec 10, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
-2.54% 31.42%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (ff024b9) 20391 18884 92.61%
Head commit (c32e727) 21261 (+870) 19149 (+265) 90.07% (-2.54%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#2100) 888 279 31.42%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Copy link
Contributor

@Nayor Nayor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello !

Merci pour le travail !

Quelques petites remarques concernant quelques commentaire en français qui traînent, des noqa et codes HTTP incorrect

Ma plus grosse interrogation concerne la réplication des filtres elastics, destinés à évoluer pour faire des recherches améliorées. Comment cela sera-t-il compatible avec ce système ?

Est-ce possible de rajouter des tests ? ☺

api_key = os.getenv("NAVITIA_API_KEY")
max_duration = int(max_distance_waypoint_to_stoparea / walking_speed)

# Augmenter le nombre d'arrêts récupérés pour avoir plus de choix (comme dans le bash) # noqa: E501
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Les commentaires devraient être en anglais, comme pour le reste du code


if "places_nearby" not in places_data or not places_data["places_nearby"]:
log.warning(f"No Navitia stops found for the waypoint {waypoint_id}")
log.warning(f"No Navitia stops found for the waypoint {waypoint_id}; deleting previously registered stops") # noqa: E501
Copy link
Contributor

@Nayor Nayor Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Préférer l'utilisation de %s ou .format pour une meilleure homogénéité du code (les f-string ne sont utilisés nulle part ailleurs)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Est-ce vraiment un warning ? C'est plutôt un comportement normal qui ne nécessite pas d'attention particulière ? (dans ce cas, préférer un .info)

delete_waypoint_stopareas(connection, waypoint_id)
return

# --- NOUVEAU : Filtrage par diversité de transport (comme dans bash) ---
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

traduire en anglias

},
)

log.warning(f"Selected {selected_count} stops out of {len(places_data['places_nearby'])} for waypoint {waypoint_id}") # noqa: E501
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem: format + # noqa: E501


log.warning(f"Selected {selected_count} stops out of {len(places_data['places_nearby'])} for waypoint {waypoint_id}") # noqa: E501

log.warning("Deleting previously registered stops")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem -> log.info

response = {}

if (source_coverage):
# Appel à l'API Navitia Journey with coverage
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem

# no_origin -> public transport not reachable from origin
# these do not count as proper errors,
# more like the wp is just not reachable
raise HTTPInternalServerError(response.json()['error'])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem qu'au dessus ; mettre la gestion des erreurs dans une fonction commune ?

elif not response.ok:
raise HTTPInternalServerError(f'Navitia API error: {response.status_code}') # noqa: E501
else:
# Retour des données JSON
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commentaire inutile, et en français

'Timeout when calling the Navitia API')
except requests.exceptions.RequestException as e:
raise HTTPInternalServerError(f'{str(e)}')
except Exception as e:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem


try:
# Récupération de la clé API depuis les variables d'environnement
api_key = os.getenv('NAVITIA_API_KEY')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

c'est le seul endroit du code où on récupère un paramètre comme ça ; pourquoi ne pas avoir fait comme ailleurs ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants