Fix viewer.py for Python 3.7 and 3.8.

PiperOrigin-RevId: 493301329
Change-Id: I44ffe5b33595d2dec7cd1aefbdd77d535901d894
This commit is contained in:
Saran Tunyasuvunakool
2022-12-06 07:35:11 -08:00
committed by Copybara-Service
parent 36641cdb2c
commit 0d608282dd
2 changed files with 6 additions and 6 deletions
+5 -5
View File
@@ -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
+1 -1
View File
@@ -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'