@@ -2048,8 +2048,7 @@ def _before_send_method(func):
20482048 def dec_function (self , * args , ** kwargs ):
20492049 if not self ._comm_iface .is_interface_open :
20502050 raise XBeeException ("XBee device's communication interface closed." )
2051- if (self ._operating_mode != OperatingMode .API_MODE
2052- and self ._operating_mode != OperatingMode .ESCAPED_API_MODE ):
2051+ if self ._operating_mode not in (OperatingMode .API_MODE , OperatingMode .ESCAPED_API_MODE ):
20532052 raise InvalidOperatingModeException (op_mode = self ._operating_mode )
20542053 return func (self , * args , ** kwargs )
20552054 return dec_function
@@ -2063,8 +2062,8 @@ def _after_send_method(func):
20632062 @wraps (func )
20642063 def dec_function (* args , ** kwargs ):
20652064 response = func (* args , ** kwargs )
2066- if ( response .transmit_status != TransmitStatus .SUCCESS
2067- and response . transmit_status != TransmitStatus .SELF_ADDRESSED ):
2065+ if response .transmit_status not in ( TransmitStatus .SUCCESS ,
2066+ TransmitStatus .SELF_ADDRESSED ):
20682067 raise TransmitException (transmit_status = response .transmit_status )
20692068 return response
20702069 return dec_function
@@ -7831,7 +7830,7 @@ def __get_signal_quality(wifi_version, signal_strength):
78317830 elif signal_strength >= - 50 :
78327831 quality = 100
78337832 else :
7834- quality = ( 2 * (signal_strength + 100 ) )
7833+ quality = 2 * (signal_strength + 100 )
78357834 else :
78367835 quality = 2 * signal_strength
78377836
@@ -10419,14 +10418,14 @@ def __discover_next_node_neighbors(self, nodes_queue, active_processes, node_tim
1041910418
1042010419 return code
1042110420
10422- def _check_not_discovered_nodes (self , devices_list , nodes_queue ):
10421+ def _check_not_discovered_nodes (self , devices_list , _nodes_queue ):
1042310422 """
1042410423 Checks not discovered nodes in the current scan, and add them to the
1042510424 FIFO if necessary.
1042610425
1042710426 Args:
1042810427 devices_list (List): List of nodes to check.
10429- nodes_queue (:class:`queue.Queue`): FIFO where the nodes to
10428+ _nodes_queue (:class:`queue.Queue`): FIFO where the nodes to
1043010429 discover their neighbors are stored.
1043110430 """
1043210431 # Check for nodes in the network not discovered in this scan and ensure
@@ -10451,16 +10450,16 @@ def _check_not_discovered_nodes(self, devices_list, nodes_queue):
1045110450 self ._log .debug (" - Reachable: %s (scan %d)" ,
1045210451 n_item ._reachable , self .__scan_counter )
1045310452
10454- def _discover_neighbors (self , requester , nodes_queue , active_processes , node_timeout ):
10453+ def _discover_neighbors (self , _requester , _nodes_queue , _active_processes , _node_timeout ):
1045510454 """
1045610455 Starts the process to discover the neighbors of the given node.
1045710456
1045810457 Args:
10459- requester (:class:`.AbstractXBeeDevice`): XBee to discover its neighbors.
10460- nodes_queue (:class:`queue.Queue`): FIFO where the nodes to
10458+ _requester (:class:`.AbstractXBeeDevice`): XBee to discover its neighbors.
10459+ _nodes_queue (:class:`queue.Queue`): FIFO where the nodes to
1046110460 discover their neighbors are stored.
10462- active_processes (List): List of active discovery processes.
10463- node_timeout (Float): Timeout to discover neighbors (seconds).
10461+ _active_processes (List): List of active discovery processes.
10462+ _node_timeout (Float): Timeout to discover neighbors (seconds).
1046410463
1046510464 Returns:
1046610465 :class:`.NetworkDiscoveryStatus`: Resulting status of the process.
@@ -11126,8 +11125,8 @@ def __purge_network_connections(self, force=False):
1112611125 connections_to_remove = []
1112711126 with self .__conn_lock :
1112811127 for conn in self .__connections :
11129- if ( conn . scan_counter_a2b != self . __scan_counter
11130- and conn . scan_counter_b2a != self . __scan_counter ):
11128+ if self . __scan_counter not in ( conn . scan_counter_a2b ,
11129+ conn . scan_counter_b2a ):
1113111130 conn .lq_a2b = LinkQuality .UNKNOWN
1113211131 conn .lq_b2a = LinkQuality .UNKNOWN
1113311132 connections_to_remove .append (conn )
@@ -11601,8 +11600,8 @@ def __process_discovered_neighbor_data(self, requester, routes, neighbor, nodes_
1160111600 connection = Connection (node , requester , lq_a2b = neighbor .lq ,
1160211601 lq_b2a = LinkQuality .UNKNOWN , status_a2b = RouteStatus .ACTIVE ,
1160311602 status_b2a = RouteStatus .UNKNOWN )
11604- elif ( neighbor .relationship == NeighborRelationship .CHILD
11605- or neighbor . relationship == NeighborRelationship .UNDETERMINED ):
11603+ elif neighbor .relationship in ( NeighborRelationship .CHILD ,
11604+ NeighborRelationship .UNDETERMINED ):
1160611605 connection = Connection (requester , node , lq_a2b = neighbor .lq ,
1160711606 lq_b2a = LinkQuality .UNKNOWN , status_a2b = RouteStatus .ACTIVE ,
1160811607 status_b2a = RouteStatus .UNKNOWN )
0 commit comments