Skip to content

Commit

Permalink
Dont raise exception on dict input
Browse files Browse the repository at this point in the history
  • Loading branch information
devarndt committed May 20, 2024
1 parent 4ee85c4 commit 4ffb096
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/gym_electric_motor/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@
import numpy as np


# This hacky function stays for now because, all envs use it and refectoring would be a pain TODO: fix this
# This hacky function stays for now because all envs uses it and refectoring would be a pain
def initialize(base_class, arg, default_class, default_args):
if arg is None:
return default_class(**default_args)
if isinstance(arg, type):
raise Exception("Need init")
raise Exception("Need initialization value")
elif isinstance(arg, base_class):
return arg
elif isinstance(arg, str):
raise Exception
elif isinstance(arg, dict):
raise Exception
elif type(arg) is str:
raise Exception("Deprecated in version 2.0")
elif type(arg) is dict:
default_args.update(arg)
return default_class(**default_args)

Expand Down

0 comments on commit 4ffb096

Please sign in to comment.