eric6/Cooperation/CooperationClient.py

changeset 8221
0572a215bd2f
parent 8218
7c09585bd960
--- a/eric6/Cooperation/CooperationClient.py	Sun Apr 11 12:38:16 2021 +0200
+++ b/eric6/Cooperation/CooperationClient.py	Sun Apr 11 16:53:48 2021 +0200
@@ -136,11 +136,8 @@
         if senderIp not in self.__peers:
             return False
         
-        for connection in self.__peers[senderIp]:
-            if connection.peerPort() == senderPort:
-                return True
-        
-        return False
+        return any(connection.peerPort() == senderPort
+                   for connection in self.__peers[senderIp])
     
     def hasConnections(self):
         """
@@ -148,11 +145,8 @@
         
         @return flag indicating the presence of connections (boolean)
         """
-        for connectionList in self.__peers.values():
-            if connectionList:
-                return True
-        
-        return False
+        return any(bool(connectionList)
+                   for connectionList in self.__peers.values())
     
     def removeConnection(self, connection):
         """

eric ide

mercurial