mirror of
https://github.com/huggingface/lerobot.git
synced 2026-07-24 18:26:11 +00:00
fix(unitree_g1): silence bandit findings in SONIC example/pipeline
This commit is contained in:
@@ -43,14 +43,14 @@ def load_pkl(path: str) -> dict:
|
|||||||
except Exception:
|
except Exception:
|
||||||
# joblib clips are zlib-compressed pickles; fall back to manual inflate.
|
# joblib clips are zlib-compressed pickles; fall back to manual inflate.
|
||||||
import contextlib
|
import contextlib
|
||||||
import pickle
|
import pickle # nosec B403 - loads trusted local SMPL clips authored by the user
|
||||||
import zlib
|
import zlib
|
||||||
|
|
||||||
with open(path, "rb") as f:
|
with open(path, "rb") as f:
|
||||||
raw = f.read()
|
raw = f.read()
|
||||||
with contextlib.suppress(zlib.error):
|
with contextlib.suppress(zlib.error):
|
||||||
raw = zlib.decompress(raw)
|
raw = zlib.decompress(raw)
|
||||||
return pickle.loads(raw)
|
return pickle.loads(raw) # nosec B301 - local, user-provided motion files only
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
@@ -28,7 +28,9 @@ import argparse
|
|||||||
import contextlib
|
import contextlib
|
||||||
import faulthandler
|
import faulthandler
|
||||||
import gc
|
import gc
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import tempfile
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@@ -164,7 +166,7 @@ def main():
|
|||||||
did_blend = False
|
did_blend = False
|
||||||
t_start = time.time()
|
t_start = time.time()
|
||||||
|
|
||||||
log_path = "/tmp/sonic_pose_log.csv"
|
log_path = os.path.join(tempfile.gettempdir(), "sonic_pose_log.csv")
|
||||||
jnames = [m.name for m in G1_29_JointIndex]
|
jnames = [m.name for m in G1_29_JointIndex]
|
||||||
log_ctx = open(log_path, "w") if args.log_csv else None # noqa: SIM115
|
log_ctx = open(log_path, "w") if args.log_csv else None # noqa: SIM115
|
||||||
if log_ctx:
|
if log_ctx:
|
||||||
|
|||||||
@@ -766,7 +766,7 @@ def _planner_worker(path, req_q, res_q, stop_evt, version, seed, use_gpu):
|
|||||||
while not stop_evt.is_set():
|
while not stop_evt.is_set():
|
||||||
try:
|
try:
|
||||||
ctx, gf, ms_dict = req_q.get(timeout=0.05)
|
ctx, gf, ms_dict = req_q.get(timeout=0.05)
|
||||||
except Exception:
|
except queue.Empty: # nosec B112 - idle poll, nothing queued this tick
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
inp = _build_planner_inputs(ctx, ms_dict, version, seed)
|
inp = _build_planner_inputs(ctx, ms_dict, version, seed)
|
||||||
|
|||||||
Reference in New Issue
Block a user