| """Patch chromadb 0.5.3 untuk kompatibilitas numpy 2.x.""" | |
| import pathlib, sys | |
| p = pathlib.Path('/usr/local/lib/python3.10/site-packages/chromadb/api/types.py') | |
| if not p.exists(): | |
| print("[patch] chromadb/api/types.py tidak ditemukan, skip") | |
| sys.exit(0) | |
| txt = p.read_text() | |
| if 'np.float64' in txt and 'np.float_' not in txt: | |
| print("[patch] sudah di-patch, skip") | |
| sys.exit(0) | |
| txt = txt.replace( | |
| 'np.uint, np.int_, np.float_', | |
| 'np.unsignedinteger, np.signedinteger, np.float64' | |
| ) | |
| p.write_text(txt) | |
| print(f"[patch] chromadb/api/types.py patched for numpy 2.x: {p}") | |