mirror of
https://git.yoctoproject.org/poky
synced 2026-04-22 15:32:14 +02:00
oe/types: Allow boolean to accept an existing boolean
Exception: TypeError: boolean accepts a string, not '<class 'bool'> is a bit annoying if you pass in True/False. Tweak the function to make it forgive that situation. (From OE-Core rev: 147f5a665fe5073027d92e4acac631f15f08f79f) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -105,6 +105,8 @@ def boolean(value):
|
||||
Valid values for true: 'yes', 'y', 'true', 't', '1'
|
||||
Valid values for false: 'no', 'n', 'false', 'f', '0'
|
||||
"""
|
||||
if isinstance(value, bool):
|
||||
return value
|
||||
|
||||
if not isinstance(value, str):
|
||||
raise TypeError("boolean accepts a string, not '%s'" % type(value))
|
||||
|
||||
Reference in New Issue
Block a user