Spaces:
Sleeping
Sleeping
Download scratch/extract_sample.py from Nitishkumar-ai/commitguard-env: direct link, hf CLI and curl.
- Browser
- Download file 705 Bytes
-
https://huggingface.co/spaces/Nitishkumar-ai/commitguard-env/resolve/main/scratch/extract_sample.py
- Command line
-
hf download hf://spaces/Nitishkumar-ai/commitguard-env/scratch/extract_sample.py
-
curl -L -o extract_sample.py https://huggingface.co/spaces/Nitishkumar-ai/commitguard-env/resolve/main/scratch/extract_sample.py
705 Bytes
| import json | |
| import os | |
| target_id = "2bf3aa85f08186b8162b76e7e8efe5b5a44306a6" | |
| data_dir = r"c:\Users\DIVYANK BHARDWAJ\Desktop\hackathon project\commitguard\data" | |
| files = ["devign_test.jsonl", "devign_filtered.jsonl"] | |
| found = False | |
| for filename in files: | |
| path = os.path.join(data_dir, filename) | |
| if not os.path.exists(path): | |
| continue | |
| with open(path, "r", encoding="utf-8") as f: | |
| for line in f: | |
| data = json.loads(line) | |
| if data.get("sample_id") == target_id: | |
| print(json.dumps(data, indent=2)) | |
| found = True | |
| break | |
| if found: | |
| break | |
| if not found: | |
| print(f"Sample {target_id} not found in {files}") | |