瀏覽代碼

added a warning, when a type was not found and a default value was returned

Dimitri Korsch 4 年之前
父節點
當前提交
5ef14f4055
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      cvargparse/utils/enumerations.py

+ 3 - 0
cvargparse/utils/enumerations.py

@@ -1,3 +1,5 @@
+import warnings
+
 from enum import Enum
 from enum import EnumMeta
 
@@ -42,6 +44,7 @@ class BaseChoiceType(Enum, metaclass=MetaBaseType):
 		if isinstance(key, cls):
 			return key
 
+		warnings.warn(f"\"{key}\" not found in choices. Returning default value!")
 		return cls.Default
 
 	@classmethod