You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Function get_duration() from GPXTrackSegment must return float | None and returns int.
importgpxpyimportgpxpy.gpxgpx_content="""<?xml version="1.0" encoding="UTF-8"?> <gpx version="1.1"> <trk> <name>Test Track</name> <trkseg> </trkseg> </trk> </gpx> """gpx=gpxpy.parse(gpx_content)
# Take the first segment of the first routesegment=gpx.tracks[0].segments[0]
print(type(segment.get_duration())) # int instead of float
Actual code:
defget_duration(self) ->Optional[float]:
""" Calculates duration or track segment Returns ------- duration: float Duration in seconds """ifnotself.pointsorlen(self.points) <2:
return0
...
Suggested:
defget_duration(self) ->Optional[float]:
""" Calculates duration or track segment Returns ------- duration: float Duration in seconds """ifnotself.pointsorlen(self.points) <2:
return0.0# instead of 0
...
The text was updated successfully, but these errors were encountered:
Function get_duration() from GPXTrackSegment must return
float | None
and returnsint
.Actual code:
Suggested:
The text was updated successfully, but these errors were encountered: