From 4ffb09645a36c0b40d9480ee43336001601a6022 Mon Sep 17 00:00:00 2001 From: devandt <8891249+devandt@users.noreply.github.com> Date: Mon, 20 May 2024 23:09:42 +0200 Subject: [PATCH] Dont raise exception on dict input --- src/gym_electric_motor/utils.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/gym_electric_motor/utils.py b/src/gym_electric_motor/utils.py index 49ffeca0..56a10865 100644 --- a/src/gym_electric_motor/utils.py +++ b/src/gym_electric_motor/utils.py @@ -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)