From 8d896529f0a17c8bf203497eeb1494690f662f41 Mon Sep 17 00:00:00 2001 From: Yuval Tassa Date: Tue, 7 May 2024 07:15:24 -0700 Subject: [PATCH] Replace `.copy()` with `list()` in `minimize.py` PiperOrigin-RevId: 631413376 Change-Id: I06dd3e3897078b57b0a0668b2182fa62dcd4a74e --- python/mujoco/minimize.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/mujoco/minimize.py b/python/mujoco/minimize.py index 377733f6..60ffae98 100644 --- a/python/mujoco/minimize.py +++ b/python/mujoco/minimize.py @@ -18,7 +18,7 @@ import abc import dataclasses import enum import time -from typing import Callable, List, Optional, TextIO, Tuple, Union +from typing import Callable, List, Optional, Sequence, TextIO, Tuple, Union import mujoco import numpy as np @@ -138,7 +138,7 @@ class Quadratic(Norm): def least_squares( x0: np.ndarray, residual: Callable[[np.ndarray], np.ndarray], - bounds: Optional[List[np.ndarray]] = None, + bounds: Optional[Sequence[np.ndarray]] = None, jacobian: Optional[Callable[[np.ndarray, np.ndarray], np.ndarray]] = None, norm: Norm = Quadratic(), eps: float = 1e-6, @@ -221,7 +221,7 @@ def least_squares( return mu, n_reduc # Make local copy of bounds to avoid reshaping user input. - bounds = None if bounds is None else bounds.copy() + bounds = None if bounds is None else list(bounds) if bounds is not None: # Checks bounds. if len(bounds) != 2: