Datasets:
CrossSWE-Bench / instances /observability-opentelemetry-python-5266 /tests /files /anyvalue_runtime.py
Download instances/observability-opentelemetry-python-5266/tests/files/anyvalue_runtime.py from CrossSWE/CrossSWE-Bench: direct link, hf CLI and curl.
- Browser
- Download file 1.24 kB
-
https://huggingface.co/datasets/CrossSWE/CrossSWE-Bench/resolve/main/instances/observability-opentelemetry-python-5266/tests/files/anyvalue_runtime.py
- Command line
-
hf download hf://datasets/CrossSWE/CrossSWE-Bench/instances/observability-opentelemetry-python-5266/tests/files/anyvalue_runtime.py
-
curl -L -o anyvalue_runtime.py https://huggingface.co/datasets/CrossSWE/CrossSWE-Bench/resolve/main/instances/observability-opentelemetry-python-5266/tests/files/anyvalue_runtime.py
1.24 kB
| import base64,hashlib,json,pathlib,subprocess,sys,zipfile,io,importlib.metadata | |
| B=pathlib.Path('/crossrepo-patches') | |
| if sys.argv[1]=='setup': | |
| expected=json.loads((B/'runtime-wheels.json').read_text());blob=base64.b64decode((B/'runtime-wheels.zip.b64').read_text());assert hashlib.sha256(blob).hexdigest()==expected['bundle_sha256'] | |
| target=pathlib.Path('/tmp/crossrepo-anyvalue-wheels');target.mkdir(exist_ok=True);paths=[] | |
| with zipfile.ZipFile(io.BytesIO(blob)) as z: | |
| assert set(z.namelist())=={x['name'] for x in expected['wheels']} | |
| for item in expected['wheels']: | |
| data=z.read(item['name']);assert hashlib.sha256(data).hexdigest()==item['sha256'];p=target/item['name'];p.write_bytes(data);paths.append(str(p)) | |
| subprocess.run([sys.executable,'-m','pip','install','--no-index','--no-deps',*paths],check=True) | |
| print('CROSSREPO_OFFLINE_DEPENDENCIES '+json.dumps({'bundle_sha256':expected['bundle_sha256'],'installed':{name:importlib.metadata.version(name) for name in ['packaging','protobuf','wrapt','typing_extensions']},'otel_implementation':'paired local source imports, no registry OpenTelemetry wheel'}),flush=True) | |
| else: | |
| raise SystemExit(subprocess.run([sys.executable,str(B/'anyvalue_tests.py'),sys.argv[1]]).returncode) | |