Spaces:
Sleeping
Sleeping
| """Make src/ importable and stub the heavy native deps when absent. | |
| src/store.py imports torch + FlagEmbedding at module load purely to fix native-lib | |
| load order on Windows; the pure functions under test never call into them. Stubbing | |
| them when missing lets this suite run on a CI box without the CUDA wheels. | |
| """ | |
| import sys | |
| import types | |
| from pathlib import Path | |
| ROOT = Path(__file__).resolve().parent.parent | |
| sys.path.insert(0, str(ROOT)) | |
| for name in ("torch", "FlagEmbedding"): | |
| try: | |
| __import__(name) | |
| except ImportError: | |
| sys.modules[name] = types.ModuleType(name) | |