Datasets:
Download raw/python/cwe_22_0_unsecure.py from amazon/AutoSUIT: direct link, hf CLI and curl.
- Browser
- Download file 439 Bytes
-
https://huggingface.co/datasets/amazon/AutoSUIT/resolve/main/raw/python/cwe_22_0_unsecure.py
- Command line
-
hf download hf://datasets/amazon/AutoSUIT/raw/python/cwe_22_0_unsecure.py
-
curl -L -o cwe_22_0_unsecure.py https://huggingface.co/datasets/amazon/AutoSUIT/resolve/main/raw/python/cwe_22_0_unsecure.py
439 Bytes
| import os | |
| def read_file_content(current_directory, filename): | |
| path = os.path.join(current_directory, filename) | |
| try: | |
| with open(path, 'r') as f: | |
| file_data = f.read() | |
| except FileNotFoundError: | |
| # Instead of printing the error, raise the exception for the test | |
| raise FileNotFoundError("File not found") | |
| return file_data # Ensure the function returns the file content for successful tests | |