Skip to content

Commit

Permalink
allow registering a callable
Browse files Browse the repository at this point in the history
  • Loading branch information
joschu committed Sep 18, 2017
1 parent afe0c42 commit 5af5b79
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions gym/envs/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,11 @@ def make(self):
if self._entry_point is None:
raise error.Error('Attempting to make deprecated env {}. (HINT: is there a newer registered version of this env?)'.format(self.id))

cls = load(self._entry_point)
env = cls(**self._kwargs)
elif callable(self._entry_point):
env = self._entry_point()
else:
cls = load(self._entry_point)
env = cls(**self._kwargs)

# Make the enviroment aware of which spec it came from.
env.unwrapped._spec = self
Expand Down

0 comments on commit 5af5b79

Please sign in to comment.