@@ -835,13 +835,15 @@ def reconnect(self, resub_topics=True):
835
835
self .subscribe (feed )
836
836
837
837
def loop (self , timeout = 0 ):
838
+ # pylint: disable = too-many-return-statements
838
839
"""Non-blocking message loop. Use this method to
839
840
check incoming subscription messages.
840
841
Returns response codes of any messages received.
841
842
842
843
:param int timeout: Socket timeout, in seconds.
843
844
844
845
"""
846
+
845
847
if self ._timestamp == 0 :
846
848
self ._timestamp = time .monotonic ()
847
849
current_time = time .monotonic ()
@@ -857,22 +859,25 @@ def loop(self, timeout=0):
857
859
858
860
stamp = time .monotonic ()
859
861
self ._sock .settimeout (timeout )
860
- responses = []
862
+ rcs = []
863
+
861
864
while True :
862
865
rc = self ._wait_for_msg ()
863
- if rc is None :
866
+ if rc is None :
864
867
break
865
868
if time .monotonic () - stamp > self ._recv_timeout :
866
869
if self .logger is not None :
867
870
self .logger .debug (
868
871
f"Loop timed out, message queue not empty after { self ._recv_timeout } s"
869
872
)
870
873
break
871
- responses .append (rc )
874
+ rcs .append (rc )
872
875
873
- return responses if responses else None
876
+ return rcs if rcs else None
874
877
875
878
def _wait_for_msg (self , timeout = 0.1 ):
879
+ # pylint: disable = too-many-return-statements
880
+
876
881
"""Reads and processes network events."""
877
882
# CPython socket module contains a timeout attribute
878
883
if hasattr (self ._socket_pool , "timeout" ):
0 commit comments