mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-10-15 01:43:57 +08:00
method() persistent_load
This commit is contained in:
committed by
GitHub
parent
5acb9d2c8e
commit
0414843e2f
@@ -23,8 +23,7 @@ def load_oob(f, chestnut=False):
|
||||
opcodes = f.read(struct.unpack('<q', f.read(8))[0])
|
||||
buffers = Tensor(np.frombuffer(f.read(), np.uint8)).realize().uop.buffer
|
||||
unpickler = pickle.Unpickler(io.BytesIO(opcodes))
|
||||
unpickler.persistent_load = lambda pid: buffers.view(*pid)
|
||||
return unpickler.load()
|
||||
return type("_Unpickler", (pickle.Unpickler,), {"persistent_load": lambda self, pid: buffers.view(*pid)})(io.BytesIO(opcodes)).load()
|
||||
|
||||
def chestnut_present() -> bool:
|
||||
for d in USB_DEVICES_PATH.glob("*"):
|
||||
|
||||
Reference in New Issue
Block a user