Implement '==' and '!=' for ynbool

'ynbool(True) == "yes"', 'ynbool(True) == True' and 'ynbool(True) == ynbool(True)' were not working.
This commit is contained in:
Frechdachs 2016-02-19 08:30:53 +01:00
parent c42fe539ab
commit ac30a66ed4
1 changed files with 3 additions and 0 deletions

3
mpv.py
View File

@ -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