projects
/
tools
/
git-buildpackage.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2b7e580
)
tristate: implement __nonzero__() method
author
Markus Lehtonen
<markus.lehtonen@linux.intel.com>
Mon, 2 Jun 2014 07:14:52 +0000
(10:14 +0300)
committer
Markus Lehtonen
<markus.lehtonen@linux.intel.com>
Thu, 5 Jun 2014 13:15:53 +0000
(16:15 +0300)
Returns False if tristate is 'off', otherwise True ('on' or 'auto').
Change-Id: I6ade27fc85c6d05ed69dc694495b70725070d9c5
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
gbp/tristate.py
patch
|
blob
|
history
diff --git
a/gbp/tristate.py
b/gbp/tristate.py
index
9361060
..
0a800ec
100644
(file)
--- a/
gbp/tristate.py
+++ b/
gbp/tristate.py
@@
-66,6
+66,17
@@
class Tristate(object):
else:
return 'off'
+ def __nonzero__(self):
+ """
+ >>> Tristate('on').__nonzero__()
+ True
+ >>> Tristate('auto').__nonzero__()
+ True
+ >>> Tristate('off').__nonzero__()
+ False
+ """
+ return self._state is not self.OFF
+
@property
def state(self):
"""Get current state"""