From b1ce67cc895b196bf4c5df2ee0deaf0f9c737845 Mon Sep 17 00:00:00 2001 From: Tomas Janousek Date: Thu, 2 Nov 2023 16:42:28 +0000 Subject: [PATCH] Use Path.hardlink_to to avoid warnings about link_to deprecation src/strava_offline/gpx.py:38: DeprecationWarning: pathlib.Path.link_to() is deprecated and is scheduled for removal in Python 3.12. Use pathlib.Path.hardlink_to() instead. --- src/strava_offline/gpx.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/strava_offline/gpx.py b/src/strava_offline/gpx.py index 9acf1ec..559b220 100644 --- a/src/strava_offline/gpx.py +++ b/src/strava_offline/gpx.py @@ -32,10 +32,10 @@ def link_backup_activities( backup = find_gpx(dir_activities_backup, activity_id) or find_gpx(dir_activities_backup, upload_id) if backup: link = Path(dir_activities, str(activity_id) + "".join(backup.suffixes)) - if hasattr(backup, 'link_to'): - backup.link_to(link) # type: ignore [attr-defined] + if hasattr(backup, 'hardlink_to'): + link.hardlink_to(backup) # type: ignore [attr-defined] else: - os.link(backup, link) # python 3.7 compat + os.link(backup, link) # python 3.9 compat def download_gpx(strava: StravaWeb, activity_id: int, path: Path) -> None: