removes ok_exp

This commit is contained in:
onyx-and-iris 2023-08-29 10:47:09 +01:00
parent a04b7c5fcf
commit 2de1b379f5

View File

@ -8,20 +8,17 @@ class CBindings:
bind_cancel_speech = libc.nvdaController_cancelSpeech
bind_braille_message = libc.nvdaController_brailleMessage
def call(self, fn, *args, ok=(0,), ok_exp=None):
def call(self, fn, *args, ok=(0,)):
retval = fn(*args)
if ok_exp is None:
if retval not in ok:
raise NVDAVMCAPIError(fn.__name__, retval)
elif not ok_exp(retval):
raise NVDAVMCAPIError(fn.__name__, retval)
return retval
class Nvda(CBindings):
@property
def is_running(self):
return self.call(self.bind_test_if_running, ok_exp=lambda x: x >= 0) == 0
return self.call(self.bind_test_if_running) == 0
def speak(self, text):
self.call(self.bind_speak_text, text)