[oe-commits] [openembedded-core] 16/17: oe/types: Allow boolean to accept an existing boolean

git at git.openembedded.org git at git.openembedded.org
Wed Jun 20 23:17:48 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 147f5a665fe5073027d92e4acac631f15f08f79f
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Thu Jun 21 00:14:31 2018 +0100

    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.
    
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/lib/oe/types.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meta/lib/oe/types.py b/meta/lib/oe/types.py
index 4ae58ac..f778c1d 100644
--- a/meta/lib/oe/types.py
+++ b/meta/lib/oe/types.py
@@ -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))

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list