Download modules/relative_imports.py from Guinnessgshep/Funtime: direct link, hf CLI and curl.
- Browser
- Download file 308 Bytes
-
https://huggingface.co/Guinnessgshep/Funtime/resolve/main/modules/relative_imports.py
- Command line
-
hf download hf://Guinnessgshep/Funtime/modules/relative_imports.py
-
curl -L -o relative_imports.py https://huggingface.co/Guinnessgshep/Funtime/resolve/main/modules/relative_imports.py
308 Bytes
| import sys | |
| from pathlib import Path | |
| class RelativeImport: | |
| def __init__(self, path): | |
| self.import_path = Path(path) | |
| def __enter__(self): | |
| sys.path.insert(0, str(self.import_path)) | |
| def __exit__(self, exc_type, exc_value, traceback): | |
| sys.path.remove(str(self.import_path)) | |