Implement '==' and '!=' for ynbool
'ynbool(True) == "yes"', 'ynbool(True) == True' and 'ynbool(True) == ynbool(True)' were not working.
This commit is contained in:
parent
c42fe539ab
commit
ac30a66ed4
1 changed files with 3 additions and 0 deletions
3
mpv.py
3
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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue