Download tests/test_headers.py from bidulki-99/Aurora-reimpl: direct link, hf CLI and curl.
- Browser
- Download file 1.11 kB
-
https://huggingface.co/bidulki-99/Aurora-reimpl/resolve/main/tests/test_headers.py
- Command line
-
hf download hf://bidulki-99/Aurora-reimpl/tests/test_headers.py
-
curl -L -o test_headers.py https://huggingface.co/bidulki-99/Aurora-reimpl/resolve/main/tests/test_headers.py
1.11 kB
| """Copyright (c) Microsoft Corporation. Licensed under the MIT license.""" | |
| from pathlib import Path | |
| import pytest | |
| COPYRIGHT_NOTICE: str = '"""Copyright (c) Microsoft Corporation. Licensed under the MIT license.' | |
| """str: Every file must start with this notice.""" | |
| PYTHON_FILES: list[Path] = [] | |
| """list[Path]: Python files to scan for headers.""" | |
| _root = Path(__file__).parents[1] | |
| for path in _root.rglob("**/*.py"): | |
| relative_path = path.relative_to(_root) | |
| # Ignore a possible virtual environment. | |
| if len(relative_path.parents) >= 2 and str(relative_path.parents[-2]) in {"venv"}: | |
| continue | |
| # Ignore the automatically generated version file. | |
| if relative_path.name in {"_version.py"}: | |
| continue | |
| PYTHON_FILES.append(path) | |
| def test_presence_of_copyright_header(python_file: Path) -> None: | |
| with open(python_file) as f: | |
| lines = list(f.read().splitlines()) | |
| if not lines or not lines[0].startswith(COPYRIGHT_NOTICE): | |
| raise AssertionError(f"`{python_file}` must start with the copyright notice.") | |