Spaces:
Runtime error
Runtime error
Update mine_diffs.py
Browse files- mine_diffs.py +15 -15
mine_diffs.py
CHANGED
|
@@ -33,22 +33,21 @@ def get_functions_from_source(source_code):
|
|
| 33 |
def format_for_model(diff_text, old_doc, new_doc):
|
| 34 |
return {
|
| 35 |
"text": f"""### INSTRUCTION:
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
|
| 50 |
def main():
|
| 51 |
-
# All code inside this function must be indented.
|
| 52 |
dataset = []
|
| 53 |
base_repo_dir = tempfile.mkdtemp()
|
| 54 |
print(f"Using temporary directory for clones: {base_repo_dir}")
|
|
@@ -103,5 +102,6 @@ def main():
|
|
| 103 |
print(f"Dataset successfully saved to '{OUTPUT_FILE}'.")
|
| 104 |
except Exception as e:
|
| 105 |
print(f"FATAL: Could not write final dataset file to {OUTPUT_FILE}. Error: {e}")
|
| 106 |
-
|
|
|
|
| 107 |
main()
|
|
|
|
| 33 |
def format_for_model(diff_text, old_doc, new_doc):
|
| 34 |
return {
|
| 35 |
"text": f"""### INSTRUCTION:
|
| 36 |
+
A Python function's code was changed. Based on the `git diff` provided, update the function's documentation.
|
| 37 |
+
|
| 38 |
+
### GIT DIFF:
|
| 39 |
+
```diff
|
| 40 |
+
{diff_text}
|
| 41 |
+
OLD DOCUMENTATION:
|
| 42 |
+
|
| 43 |
+
{old_doc.strip()}
|
| 44 |
+
UPDATED DOCUMENTATION:
|
| 45 |
+
|
| 46 |
+
{new_doc.strip()}
|
| 47 |
+
"""
|
| 48 |
+
}
|
| 49 |
|
| 50 |
def main():
|
|
|
|
| 51 |
dataset = []
|
| 52 |
base_repo_dir = tempfile.mkdtemp()
|
| 53 |
print(f"Using temporary directory for clones: {base_repo_dir}")
|
|
|
|
| 102 |
print(f"Dataset successfully saved to '{OUTPUT_FILE}'.")
|
| 103 |
except Exception as e:
|
| 104 |
print(f"FATAL: Could not write final dataset file to {OUTPUT_FILE}. Error: {e}")
|
| 105 |
+
|
| 106 |
+
if name == "main":
|
| 107 |
main()
|