From 0d608282dd33b23b2e243cdf3383771e6d6a4079 Mon Sep 17 00:00:00 2001 From: Saran Tunyasuvunakool Date: Tue, 6 Dec 2022 07:35:11 -0800 Subject: [PATCH] Fix `viewer.py` for Python 3.7 and 3.8. PiperOrigin-RevId: 493301329 Change-Id: I44ffe5b33595d2dec7cd1aefbdd77d535901d894 --- python/mujoco/viewer.py | 10 +++++----- python/setup.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/python/mujoco/viewer.py b/python/mujoco/viewer.py index fb745912..0d0aa942 100644 --- a/python/mujoco/viewer.py +++ b/python/mujoco/viewer.py @@ -21,7 +21,7 @@ import math import os import threading import time -from typing import Callable, Optional, Union +from typing import Callable, Optional, Tuple, Union import glfw import mujoco @@ -48,10 +48,10 @@ MAX_SYNC_MISALIGN = 0.1 SIM_REFRESH_FRACTION = 0.7 CallbackType = Callable[[mujoco.MjModel, mujoco.MjData], None] -LoaderType = Callable[[], tuple[mujoco.MjModel, mujoco.MjData]] +LoaderType = Callable[[], Tuple[mujoco.MjModel, mujoco.MjData]] # Loader function that also returns a file path for the GUI to display. -_LoaderWithPathType = Callable[[], tuple[mujoco.MjModel, mujoco.MjData, str]] +_LoaderWithPathType = Callable[[], Tuple[mujoco.MjModel, mujoco.MjData, str]] _InternalLoaderType = Union[LoaderType, _LoaderWithPathType] Simulate = _simulate.Simulate @@ -60,7 +60,7 @@ Simulate = _simulate.Simulate def _file_loader(path: str) -> _LoaderWithPathType: """Loads an MJCF model from file path.""" - def load(path=path) -> tuple[mujoco.MjModel, mujoco.MjData, str]: + def load(path=path) -> Tuple[mujoco.MjModel, mujoco.MjData, str]: m = mujoco.MjModel.from_xml_path(path) d = mujoco.MjData(m) return m, d, path @@ -219,7 +219,7 @@ def _launch_internal(model: Optional[mujoco.MjModel] = None, if loader is None and model is not None: - def _loader(m=model, d=data) -> tuple[mujoco.MjModel, mujoco.MjData]: + def _loader(m=model, d=data) -> Tuple[mujoco.MjModel, mujoco.MjData]: if d is None: d = mujoco.MjData(m) return m, d diff --git a/python/setup.py b/python/setup.py index 5675e7dc..0cccb764 100644 --- a/python/setup.py +++ b/python/setup.py @@ -30,7 +30,7 @@ from setuptools import find_packages from setuptools import setup from setuptools.command import build_ext -__version__ = '2.3.1' +__version__ = '2.3.1.post1' MUJOCO_CMAKE = 'MUJOCO_CMAKE' MUJOCO_CMAKE_ARGS = 'MUJOCO_CMAKE_ARGS'