Files
aigc-home/docs/hel-892/flux2-daxiong-document-evidence/index_sources.py
T

57 lines
2.1 KiB
Python

"Index reused exact bytes and independently fetched core text; no upstream execution."
import datetime
import hashlib
import json
from pathlib import Path
OUT = Path(__file__).resolve().parent.parent / "flux2-daxiong-reference"
OLD = OUT.parent / "flux2-img-reference"
def main():
rows = json.loads((OUT / "sources.json").read_bytes())["sources"]
rows = [e for e in rows if e["id"] == "impact"]
old = json.loads((OLD / "sources.json").read_bytes())["sources"]
for e in old:
if e["id"] in ["tt", "kj"]:
continue
rows.append(
dict(
e,
local_file="../flux2-img-reference/" + e["local_file"],
license_file="../flux2-img-reference/" + e["license_file"],
applicability="本大雄图独立绑定准确声明;目标环境/恢复未知",
)
)
p = "comfy_extras/nodes_post_processing.py"
name = "core__" + p.replace("/", "__")
raw = (OUT / name).read_bytes()
e = next(e for e in old if e["id"] == "core")
blob = hashlib.sha1(b"blob " + str(len(raw)).encode() + b"\0" + raw).hexdigest()
tree = json.loads((OLD / "core-tree.json").read_bytes())
assert next(x["sha"] for x in tree["tree"] if x["path"] == p) == blob
rows.append(
dict(
e,
file=p,
local_file=name,
license_file="../flux2-img-reference/core__LICENSE",
url=f"https://raw.githubusercontent.com/{e['repo']}/{e['commit']}/{p}",
sha256=hashlib.sha256(raw).hexdigest(),
git_blob_sha1=blob,
acquisition_time=datetime.datetime.fromtimestamp(
(OUT / name).stat().st_mtime, datetime.timezone.utc
).isoformat(),
transport=("HTTPS pinned raw text; matched existing exact Git tree/commit/tag bytes"),
applicability="本图112准确core0.8.2 schema/公式/注册",
)
)
(OUT / "sources.json").write_text(
json.dumps(dict(sources=rows), ensure_ascii=False, indent=2) + "\n"
)
if __name__ == "__main__":
main()