@@ -93,7 +93,6 @@ def set_socket(sock, iface=None):
9393 global _the_interface # pylint: disable=invalid-name, global-statement
9494 _the_interface = iface
9595 _the_sock .set_interface (iface )
96- print (_the_sock )
9796
9897def unpretty_ip (ip ): # pylint: disable=no-self-use, invalid-name
9998 """Converts a dotted-quad string to a bytearray IP address"""
@@ -200,7 +199,7 @@ def last_will(self, topic=None, message=None, qos=0, retain=False):
200199 self ._lw_msg = message
201200 self ._lw_retain = retain
202201
203- # pylint: disable=too-many-branches, too-many-statements
202+ # pylint: disable=too-many-branches, too-many-statements, too-many-locals
204203 def connect (self , clean_session = True ):
205204 """Initiates connection with the MQTT Broker.
206205 :param bool clean_session: Establishes a persistent session.
@@ -380,7 +379,7 @@ def publish(self, topic, msg, retain=False, qos=0):
380379 # check msg/qos kwargs
381380 if msg is None :
382381 raise MMQTTException ('Message can not be None.' )
383- elif isinstance (msg , (int , float )):
382+ if isinstance (msg , (int , float )):
384383 msg = str (msg ).encode ('ascii' )
385384 elif isinstance (msg , str ):
386385 msg = str (msg ).encode ('utf-8' )
@@ -588,7 +587,7 @@ def loop_forever(self):
588587 """Starts a blocking message loop. Use this
589588 method if you want to run a program forever.
590589 Code below a call to this method will NOT execute.
591-
590+
592591 NOTE: Network reconnection is not handled within this call and
593592 must be handled by your code for each interface.
594593
@@ -608,7 +607,8 @@ def loop(self):
608607 if current_time - self ._timestamp >= self .keep_alive :
609608 # Handle KeepAlive by expecting a PINGREQ/PINGRESP from the server
610609 if self .logger is not None :
611- self .logger .debug ('KeepAlive period elapsed - requesting a PINGRESP from the server...' )
610+ self .logger .debug ('KeepAlive period elapsed - \
611+ requesting a PINGRESP from the server...' )
612612 self .ping ()
613613 self ._timestamp = 0
614614 self ._sock .settimeout (0.1 )
@@ -677,7 +677,7 @@ def _check_topic(topic):
677677 if topic is None :
678678 raise MMQTTException ('Topic may not be NoneType' )
679679 # [MQTT-4.7.3-1]
680- elif not topic :
680+ if not topic :
681681 raise MMQTTException ('Topic may not be empty.' )
682682 # [MQTT-4.7.3-3]
683683 elif len (topic .encode ('utf-8' )) > MQTT_TOPIC_LENGTH_LIMIT :
0 commit comments