From 38801412124e7a3226c57471f7a96ff1d119d356 Mon Sep 17 00:00:00 2001 From: lshaw8317 Date: Mon, 17 Nov 2025 08:34:00 +0100 Subject: [PATCH 1/2] Rename path_to_url variable --- caterva2/api_utils.py | 4 ++-- caterva2/client.py | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/caterva2/api_utils.py b/caterva2/api_utils.py index b049b0db..1c3ce4a5 100644 --- a/caterva2/api_utils.py +++ b/caterva2/api_utils.py @@ -163,12 +163,12 @@ def upload_file(localpath, remotepath, urlbase, auth_cookie=None): return pathlib.PurePosixPath(response.json()) -def load_from_url(path_to_url, remotepath, urlbase, auth_cookie=None): +def load_from_url(urlpath, remotepath, urlbase, auth_cookie=None): client = get_client() url = f"{urlbase}/api/load_from_url/{remotepath}" headers = {"Cookie": auth_cookie} if auth_cookie else None - response = client.post(url, data={"remote_url": path_to_url}, headers=headers) + response = client.post(url, data={"remote_url": urlpath}, headers=headers) response.raise_for_status() return pathlib.PurePosixPath(response.json()) diff --git a/caterva2/client.py b/caterva2/client.py index deefd08c..a074f9db 100644 --- a/caterva2/client.py +++ b/caterva2/client.py @@ -239,13 +239,13 @@ def upload(self, localpath, remotepath=None): # Remove the first component of the upload path (the root name) and return a new File/Dataset return self[str(uploadpath.relative_to(self.name))] - def load_from_url(self, path_to_url, remotepath=None): + def load_from_url(self, urlpath, remotepath=None): """ Loads a third party file via url to this root. Parameters ---------- - path_to_url : str + urlpath : str Url path of the file to get. remotepath : Path, optional Remote path where the file will be placed. If not provided, the @@ -258,10 +258,10 @@ def load_from_url(self, path_to_url, remotepath=None): """ if remotepath is None: - remotepath = pathlib.PurePosixPath(self.name) / path_to_url + remotepath = pathlib.PurePosixPath(self.name) / urlpath else: remotepath = pathlib.PurePosixPath(self.name) / pathlib.PurePosixPath(remotepath) - uploadpath = self.client.load_from_url(path_to_url, remotepath) + uploadpath = self.client.load_from_url(urlpath, remotepath) # Remove the first component of the upload path (the root name) and return a new File/Dataset return self[str(uploadpath.relative_to(self.name))] @@ -1144,13 +1144,13 @@ def upload(self, localpath, dataset): auth_cookie=self.cookie, ) - def load_from_url(self, path_to_url, dataset): + def load_from_url(self, urlpath, dataset): """ Loads a remote dataset to a remote repository. Parameters ---------- - path_to_url : Path + urlpath : Path Url to the remote third party dataset. dataset : Path Remote path to place the dataset into. @@ -1162,7 +1162,7 @@ def load_from_url(self, path_to_url, dataset): """ urlbase, _ = _format_paths(self.urlbase) return api_utils.load_from_url( - path_to_url, + urlpath, dataset, urlbase, auth_cookie=self.cookie, From 363be8553655ce1d22289adec1a09de366af6f93 Mon Sep 17 00:00:00 2001 From: lshaw8317 Date: Mon, 17 Nov 2025 08:46:06 +0100 Subject: [PATCH 2/2] Rename path_to_url variable --- caterva2/client.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/caterva2/client.py b/caterva2/client.py index 163bbd40..ee5483fa 100644 --- a/caterva2/client.py +++ b/caterva2/client.py @@ -1241,16 +1241,16 @@ def upload(self, localpath, dataset): auth_cookie=self.cookie, ) - def _load_from_url(self, path_to_url, remotepath, urlbase, auth_cookie=None): + def _load_from_url(self, urlpath, remotepath, urlbase, auth_cookie=None): client = self.httpx_client url = f"{urlbase}/api/load_from_url/{remotepath}" headers = {"Cookie": auth_cookie} if auth_cookie else None - response = client.post(url, data={"remote_url": path_to_url}, headers=headers) + response = client.post(url, data={"remote_url": urlpath}, headers=headers) response.raise_for_status() return pathlib.PurePosixPath(response.json()) - def load_from_url(self, path_to_url, dataset): + def load_from_url(self, urlpath, dataset): """ Loads a remote dataset to a remote repository. @@ -1268,7 +1268,7 @@ def load_from_url(self, path_to_url, dataset): """ urlbase, _ = _format_paths(self.urlbase) return self._load_from_url( - path_to_url, + urlpath, dataset, urlbase, auth_cookie=self.cookie,