generate: container: Fix maybe_or()
isinstance() sadly can not get the type itself, so type() needs to be called on _or first. Signed-off-by: Enno Tensing <tenno@suij.in>
This commit is contained in:
parent
93245d5bc6
commit
1cd43e0c95
1 changed files with 1 additions and 1 deletions
|
@ -40,7 +40,7 @@ def maybe(json: dict, key: str) -> ConfigValue:
|
||||||
def maybe_or(json: dict, key: str, _or: ConfigValue) -> ConfigValue:
|
def maybe_or(json: dict, key: str, _or: ConfigValue) -> ConfigValue:
|
||||||
"""Maybe get a value, but return _or if it is None."""
|
"""Maybe get a value, but return _or if it is None."""
|
||||||
val = maybe(json, key)
|
val = maybe(json, key)
|
||||||
if val is None or not isinstance(val, _or):
|
if val is None or not isinstance(val, type(_or)):
|
||||||
return _or
|
return _or
|
||||||
return val
|
return val
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue