From 64fb05a2a4be7ad3b822fd138902e6c9c82e4ce4 Mon Sep 17 00:00:00 2001 From: "coderabbitai[bot]" <136622811+coderabbitai[bot]@users.noreply.github.com> Date: Fri, 17 Jul 2026 00:46:00 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Add=20docstrings=20to=20`moonsho?= =?UTF-8?q?t`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Docstrings generation was requested by @Haruko386. * https://github.com/Haruko386/ApDepth/pull/32#issuecomment-4997833584 The following files were modified: * `infer.py` --- infer.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) mode change 100755 => 100644 infer.py diff --git a/infer.py b/infer.py old mode 100755 new mode 100644 index 99c21dd..5499472 --- a/infer.py +++ b/infer.py @@ -81,7 +81,13 @@ def get_pending_indices(dataset, output_dir): def save_prediction_atomic(save_to, depth_pred): - """Save without exposing a partially written final NPY file.""" + """ + Save a depth prediction to the destination without exposing a partially written file. + + Parameters: + save_to: Final path for the prediction file. + depth_pred: Prediction array to save. + """ temporary_path = f"{save_to}.tmp" with open(temporary_path, "wb") as temporary_file: np.save(temporary_file, depth_pred) @@ -204,6 +210,12 @@ def save_prediction_atomic(save_to, depth_pred): seed_all(seed) def check_directory(directory): + """ + Prompt for confirmation before continuing when the specified directory already exists. + + Parameters: + directory (str): Path to the directory whose existence requires confirmation. + """ if os.path.exists(directory): response = ( input(