summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrechdachs <Frechdachs@users.noreply.github.com>2016-02-19 08:30:53 +0100
committerFrechdachs <Frechdachs@users.noreply.github.com>2016-02-19 08:30:53 +0100
commitac30a66ed493d03b5358fda3945aae0ca2b5b7c9 (patch)
tree522ef49544962c446e78d865fbfa180db2e961e6
parentc42fe539ab50ce1c3f783b4d0b74ae0f99d5ab73 (diff)
downloadpython-mpv-ac30a66ed493d03b5358fda3945aae0ca2b5b7c9.tar.gz
python-mpv-ac30a66ed493d03b5358fda3945aae0ca2b5b7c9.tar.bz2
python-mpv-ac30a66ed493d03b5358fda3945aae0ca2b5b7c9.zip
Implement '==' and '!=' for ynbool
'ynbool(True) == "yes"', 'ynbool(True) == True' and 'ynbool(True) == ynbool(True)' were not working.
-rw-r--r--mpv.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/mpv.py b/mpv.py
index fc03f7c..d3ed1a1 100644
--- a/mpv.py
+++ b/mpv.py
@@ -259,6 +259,9 @@ class ynbool:
def __repr__(self):
return str(self.val)
+ def __eq__(self, other):
+ return str(self) == other or bool(self) == other
+
def _ensure_encoding(possibly_bytes):
return possibly_bytes.decode() if type(possibly_bytes) is bytes else possibly_bytes