From 4d900186a74ea8de144adeda32e71941b159d2a4 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Mon, 17 Apr 2023 22:39:10 +0200 Subject: use gpx.walk() instead of manually implementing it --- fietsboek/transformers/__init__.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/fietsboek/transformers/__init__.py b/fietsboek/transformers/__init__.py index f6318d7..82f2a48 100644 --- a/fietsboek/transformers/__init__.py +++ b/fietsboek/transformers/__init__.py @@ -157,14 +157,11 @@ class FixNullElevation(Transformer): def execute(self, gpx: GPX): def all_points(): - return ( - point - for track in gpx.tracks - for segment in track.segments - for point in segment.points - ) + return gpx.walk(only_points=True) def rev_points(): + # We cannot use reversed(gpx.walk(...)) since that is not a + # generator, so we do it manually. return ( point for track in reversed(gpx.tracks) -- cgit v1.2.3