anon-iclr-submission/benchname-bug-localization huggingface dataset:
Repository: globus/globus-cli
Issue: Allow the Transfer service to figure out what the default path should be when `ls`ing

Instead of having the `globus transfer ls` command default to `/~/`, don't send any `path` to the Transfer service and let the Transfer service figure out what the default path is supposed to be.

Fixes S3 endpoints (which don't support `/~/`), shared endpoints (which should usually default to `/`), and any kind of endpoint that has had a `default_directory` configured.


Changed files:
globus_cli/services/transfer/ls.py

diff --git a/globus_cli/services/transfer/ls.py b/globus_cli/services/transfer/ls.py
index 43f5501..996efa4 100644
--- a/globus_cli/services/transfer/ls.py
+++ b/globus_cli/services/transfer/ls.py
@@ -34,9 +34,13 @@ def _get_ls_res(client, path, endpoint_id, recursive, depth):
     Note about paths: because the "path" key always has a trailing slash, and
     item names never have leading slashes, we can just string concat.
     """
+    ls_kwargs = {}
+    if path is not None:
+        ls_kwargs = {'path': path}
+
     # non-recursive ls is simple -- just make the call and return the result
     if not recursive:
-        return client.operation_ls(endpoint_id, path=path)
+        return client.operation_ls(endpoint_id, **ls_kwargs)
 
     # the rest of this is the recursive case
 
@@ -46,7 +50,7 @@ def _get_ls_res(client, path, endpoint_id, recursive, depth):
 
     if depth >= 0:
         # do an `ls` call against current path, use it to seed the result_doc
-        res = client.operation_ls(endpoint_id, path=path)
+        res = client.operation_ls(endpoint_id, **ls_kwargs)
         result_doc['DATA'] = [item for item in res]
         # set path in order to get trailing slash, if necessary
         result_doc['path'] = res['path']
@@ -82,8 +86,8 @@ def _get_ls_res(client, path, endpoint_id, recursive, depth):
               help=('Limit to number of directories to traverse in '
                     '`--recursive` listings. A value of 0 indicates that '
                     'this should behave like a non-recursive `ls`'))
-@click.option('--path', default='/~/', show_default=True,
-              help='Path on the remote endpoint to list.')
+@click.option('--path', help=("Path on the remote endpoint to list. "
+                              "Defaults to the endpoint's default_directory"))
 def ls_command(path, recursive_depth_limit, recursive, long, endpoint_id):
     """
     Executor for `globus transfer ls`
@@ -94,6 +98,7 @@ def ls_command(path, recursive_depth_limit, recursive, long, endpoint_id):
     autoactivate(client, endpoint_id, if_expires_in=60)
 
     # get the `ls` result
+    # note that `path` can be None
     res = _get_ls_res(client, path, endpoint_id, recursive,
                       recursive_depth_limit)
Repository: haddocking/haddock3
Issue: correct pdb relative paths analysis subfolders

Pdb relative paths in analysis subfolders (`capri_ss.tsv` files) are not correct because of the logic needed to build the analysis folder (first run caprieval and then copy the folder into the analysis folder).

Changed files:
src/haddock/clis/cli_analyse.py

diff --git a/src/haddock/clis/cli_analyse.py b/src/haddock/clis/cli_analyse.py
index 633f1b83..46e564bc 100644
--- a/src/haddock/clis/cli_analyse.py
+++ b/src/haddock/clis/cli_analyse.py
@@ -67,6 +67,31 @@ def get_cluster_ranking(capri_clt_filename, top_cluster):
     return cl_ranking
 
 
+def update_paths(capri_ss_filename, toch="../", toadd="../../"):
+    """
+    Update paths in capri_ss_filename.
+
+    Parameters
+    ----------
+    capri_ss_filename : str or Path
+        capri ss filename
+    toch : str
+        string to be replaced
+    toadd : str
+        string to be added
+    """
+    new_lines = []
+    with open(capri_ss_filename, "r") as rfile:
+        for ln in rfile:
+            new_ln = ln.replace(toch, toadd)
+            new_lines.append(new_ln)
+
+    with open(capri_ss_filename, "w") as wfile:
+        for ln in new_lines:
+            wfile.write(ln)
+    return
+
+
 # Command line interface parser
 ap = argparse.ArgumentParser(
     prog="haddock3-analyse",
@@ -395,6 +420,13 @@ def main(run_dir, modules, top_cluster, format, scale, **kwargs):
             if directory.exists():
                 shutil.rmtree(directory)
 
+    # substituting the correct paths in the capri_ss files
+    for directory in good_folder_paths:
+        ss_file = Path(outdir, directory, "capri_ss.tsv")
+        if ss_file.exists():
+            log.info(f"updating paths in {ss_file}")
+            update_paths(ss_file, "../", "../../")
+
     os.chdir(ori_cwd)
     return