@@ -816,6 +816,9 @@ def wait(self, cond, hold_for=100, timeout=None):
816816 milliseconds. The condition is checked when there is an I/O event
817817 related to the ``state`` attribute. Exits early when ``timeout`` (in
818818 milliseconds) is reached.
819+
820+ Returns ``True`` if the condition is met, and ``False`` if the timeout
821+ is reached.
819822 """
820823
821824 tic = time .time ()
@@ -830,14 +833,14 @@ def wait(self, cond, hold_for=100, timeout=None):
830833 self ._poll .poll (None if timeout is None else timeout )
831834
832835 if timeout is not None and time .time () >= tic + timeout / 1000 :
833- return
836+ return False
834837
835838 if cond (self .state ):
836839 if hold_for is None :
837- return
840+ return True
838841 else :
839842 time .sleep (hold_for / 1000 )
840- if cond (self .state ): return
843+ if cond (self .state ): return True
841844
842845
843846 def wait_until (self , s , hold_for = 100 , timeout = None ):
@@ -847,11 +850,14 @@ def wait_until(self, s, hold_for=100, timeout=None):
847850 related to the ``state`` attribute. Exits early when ``timeout`` (in
848851 milliseconds) is reached.
849852
853+ Returns ``True`` if the condition is met, and ``False`` if the timeout
854+ is reached.
855+
850856 Example::
851857
852858 m.wait_until('stalled')
853859 """
854- self .wait (lambda state : s in state , hold_for , timeout )
860+ return self .wait (lambda state : s in state , hold_for , timeout )
855861
856862 def wait_while (self , s , hold_for = 100 , timeout = None ):
857863 """
@@ -860,11 +866,14 @@ def wait_while(self, s, hold_for=100, timeout=None):
860866 related to the ``state`` attribute. Exits early when ``timeout`` (in
861867 milliseconds) is reached.
862868
869+ Returns ``True`` if the condition is met, and ``False`` if the timeout
870+ is reached.
871+
863872 Example::
864873
865874 m.wait_while('running')
866875 """
867- self .wait (lambda state : s not in state , hold_for , timeout )
876+ return self .wait (lambda state : s not in state , hold_for , timeout )
868877
869878def list_motors (name_pattern = Motor .SYSTEM_DEVICE_NAME_CONVENTION , ** kwargs ):
870879 """
0 commit comments