mirror of https://github.com/tqdm/tqdm.git
ignore unknown env overrides
This commit is contained in:
parent
52d78121b1
commit
783bd6e070
|
@ -75,13 +75,14 @@ def envwrap(prefix, case_sensitive=False, literal_eval=False, is_method=False):
|
||||||
# use `func` signature to infer env override `type` (fallback to `str`)
|
# use `func` signature to infer env override `type` (fallback to `str`)
|
||||||
params = signature(func).parameters
|
params = signature(func).parameters
|
||||||
for k in overrides:
|
for k in overrides:
|
||||||
param = params[k]
|
param = params.get(k, None)
|
||||||
if param.annotation is not param.empty:
|
if param is not None:
|
||||||
typ = param.annotation
|
if param.annotation is not param.empty:
|
||||||
# TODO: parse type in {Union, Any, Optional, ...}
|
typ = param.annotation
|
||||||
else:
|
# TODO: parse type in {Union, Any, Optional, ...}
|
||||||
typ = str if param.default is None else type(param.default)
|
else:
|
||||||
overrides[k] = typ(overrides[k])
|
typ = str if param.default is None else type(param.default)
|
||||||
|
overrides[k] = typ(overrides[k])
|
||||||
return part(func, **overrides)
|
return part(func, **overrides)
|
||||||
return wrap
|
return wrap
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue