#!/usr/bin/env python """README/manifest/checksums + upload for CodeSearchNet Python permissive-only.""" import hashlib import json from datetime import datetime, timezone from pathlib import Path import pyarrow.parquet as pq from huggingface_hub import HfApi HERE = Path(__file__).resolve().parent RID = "PiotrSty/code-search-net-python-permissive" PARQUET = HERE / "code_search_net_python.parquet" BUILD = HERE / "code_search_net_python_permissive.build.json" README = HERE / "README.md" FILES = [ "code_search_net_python.parquet", "code_search_net_python_permissive.sample.jsonl", "code_search_net_python_permissive.build.json", "README.md", "datasheet.md", "build_csn.py", "audit_python.py", "join_python.py", "finalize_python.py", "make_datasheet.py", "repos.txt", "repo_licenses.jsonl", "repo_cap.json", "license_summary.json", "sample_licenses.json", ] def sha(b): return hashlib.sha256(b).hexdigest() def readme(b): cap = json.loads((HERE / "repo_cap.json").read_text(encoding="utf-8")) rows = b["kept"] lic = sorted(b["licenses"].items(), key=lambda x: -x[1]) table = "\n".join(f"| `{k}` | {v:,} | {100*v/rows:.1f}% |" for k, v in lic) splits = " · ".join(f"{k} {v:,}" for k, v in b["splits"].items()) return f"""--- license: other language: - en tags: - code - python - code-search-net - permissive - function-documentation pretty_name: CodeSearchNet Python (permissive licences only) size_categories: - 100K