Download PSIVG/run/sitecustomize.py from AIGeeksGroup/PhysicalWM: direct link, hf CLI and curl.
- Browser
- Download file 1.26 kB
-
https://huggingface.co/datasets/AIGeeksGroup/PhysicalWM/resolve/main/PSIVG/run/sitecustomize.py
- Command line
-
hf download hf://datasets/AIGeeksGroup/PhysicalWM/PSIVG/run/sitecustomize.py
-
curl -L -o sitecustomize.py https://huggingface.co/datasets/AIGeeksGroup/PhysicalWM/resolve/main/PSIVG/run/sitecustomize.py
1.26 kB
| """sitecustomize: neutralize the broken /tmp/six.py (left by another user in | |
| the shared /tmp). It shadows the real six package. Python auto-imports | |
| `sitecustomize` at startup; we simply preload the REAL six from site-packages | |
| and pin it in sys.modules so /tmp/six.py is never consulted. | |
| """ | |
| import importlib.util | |
| import site | |
| def _load_real_six(): | |
| candidates = list(site.getsitepackages()) + [site.getusersitepackages()] | |
| for sp in candidates: | |
| if not sp: | |
| continue | |
| p = sp.rstrip("/") + "/six.py" | |
| try: | |
| with open(p, "r", encoding="utf-8") as f: | |
| if "with_metaclass" not in f.read(): | |
| continue | |
| except OSError: | |
| continue | |
| spec = importlib.util.spec_from_file_location("six", p) | |
| mod = importlib.util.module_from_spec(spec) | |
| spec.loader.exec_module(mod) | |
| import sys | |
| sys.modules["six"] = mod | |
| return True | |
| return False | |
| try: | |
| import sys | |
| already_ok = False | |
| try: | |
| import six # noqa | |
| already_ok = "with_metaclass" in dir(six) or hasattr(six, "with_metaclass") | |
| except ImportError: | |
| already_ok = False | |
| if not already_ok: | |
| _load_real_six() | |
| except Exception: | |
| pass | |