File size: 589 Bytes
5da7941
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
"""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}")