Update doc/mjwarp/update_types.py

PiperOrigin-RevId: 903289569
Change-Id: I7e05736c54fa72dc0c89152f49cf3d9ee6e5492d
This commit is contained in:
Taylor Howell
2026-04-21 10:02:57 -07:00
committed by Copybara-Service
parent ba149aa043
commit c3fddf5dc1
+5 -5
View File
@@ -29,7 +29,7 @@ This script updates such instances with valid types
@dataclasses.dataclass
class Option:
...
timestep: wp.array(dtype=float)
timestep: wp.array[float]
...
"""
@@ -48,13 +48,13 @@ def replace_array_calls(match):
dtype = args[-1]
if n_args == 2:
return f'wp.array(dtype={dtype})'
return f'wp.array[{dtype}]'
elif n_args == 3:
return f'wp.array2d(dtype={dtype})'
return f'wp.array2d[{dtype}]'
elif n_args == 4:
return f'wp.array3d(dtype={dtype})'
return f'wp.array3d[{dtype}]'
elif n_args == 5:
return f'wp.array4d(dtype={dtype})'
return f'wp.array4d[{dtype}]'
else:
return match.group(0)