Tianshou/tianshou/env/utils.py
n+e c91def6cbc
code format and update function signatures (#213)
Cherry-pick from #200 

- update the function signature
- format code-style
- move _compile into separate functions
- fix a bug in to_torch and to_numpy (Batch)
- remove None in action_range

In short, the code-format only contains function-signature style and `'` -> `"`. (pick up from [black](https://github.com/psf/black))
2020-09-12 15:39:01 +08:00

16 lines
377 B
Python

import cloudpickle
from typing import Any
class CloudpickleWrapper(object):
"""A cloudpickle wrapper used in SubprocVectorEnv."""
def __init__(self, data: Any) -> None:
self.data = data
def __getstate__(self) -> str:
return cloudpickle.dumps(self.data)
def __setstate__(self, data: str) -> None:
self.data = cloudpickle.loads(data)