5454 get_unaliased_type ,
5555 is_dataclass_like ,
5656 is_subclass ,
57+ lenient_check ,
5758 nested_links ,
5859 parent_parser ,
5960 parser_context ,
@@ -524,7 +525,7 @@ def __call__(self, *args, **kwargs):
524525 if "nargs" in kwargs and kwargs ["nargs" ] == 0 :
525526 raise ValueError ("ActionTypeHint does not allow nargs=0." )
526527 return ActionTypeHint (** kwargs )
527- cfg , val , opt_str = args [ 1 :]
528+ parser , cfg , val , opt_str = args
528529 if not (self .nargs == "?" and val is None ):
529530 if isinstance (opt_str , str ) and opt_str .startswith (f"--{ self .dest } ." ):
530531 if opt_str .startswith (f"--{ self .dest } .init_args." ):
@@ -533,7 +534,7 @@ def __call__(self, *args, **kwargs):
533534 sub_opt = opt_str [len (f"--{ self .dest } ." ) :]
534535 val = NestedArg (key = sub_opt , val = val )
535536 append = opt_str == f"--{ self .dest } +"
536- val = self ._check_type_ (val , append = append , cfg = cfg )
537+ val = self ._check_type_ (val , append = append , cfg = cfg , mode = parser . parser_mode )
537538 if is_subclass_spec (val ):
538539 prev_val = cfg .get (self .dest )
539540 if is_subclass_spec (prev_val ) and "init_args" in prev_val :
@@ -545,7 +546,7 @@ def __call__(self, *args, **kwargs):
545546 cfg .update (val , self .dest )
546547 return None
547548
548- def _check_type (self , value , append = False , cfg = None ):
549+ def _check_type (self , value , append = False , cfg = None , mode = None ):
549550 islist = _is_action_value_list (self )
550551 if not islist :
551552 value = [value ]
@@ -584,7 +585,14 @@ def _check_type(self, value, append=False, cfg=None):
584585 val = adapt_typehints (orig_val , self ._typehint , default = self .default , ** kwargs )
585586 ex = None
586587 except ValueError :
587- if self ._enable_path and config_path is None and isinstance (orig_val , str ):
588+ if (
589+ lenient_check .get ()
590+ and mode == "omegaconf+"
591+ and isinstance (orig_val , str )
592+ and "${" in orig_val
593+ ):
594+ ex = None
595+ elif self ._enable_path and config_path is None and isinstance (orig_val , str ):
588596 msg = f"\n - Expected a config path but { orig_val } either not accessible or invalid\n - "
589597 raise type (ex )(msg + str (ex )) from ex
590598 if ex :
0 commit comments