--- a/RefactoringRope/JsonClient.py Mon Sep 18 20:05:28 2017 +0200 +++ b/RefactoringRope/JsonClient.py Tue Sep 19 18:59:14 2017 +0200 @@ -146,18 +146,18 @@ self.__connection.shutdown(socket.SHUT_RDWR) self.__connection.close() - def poll(self, wait=False): + def poll(self, waitMethod=""): """ Public method to check and receive one message (if available). - @param wait flag indicating to wait until something has been received + @param waitMethod name of a method to wait for + @type str @type bool - @return tuple containing the received command and a dictionary - containing the associated data - @rtype tuple of (str, dict) + @return dictionary containing the data of the waited for method + @rtype dict """ try: - if wait: + if waitMethod: rrdy, wrdy, xrdy = select.select( [self.__connection], [], []) else: @@ -169,13 +169,10 @@ if method is not None: if method == "Exit": self.__exitClient = True + elif method == waitMethod: + return params else: - if wait: - # wait means to return the data to the caller - return method, params - else: - # no wait means to pass on to the handler method - self.handleCall(method, params) + self.handleCall(method, params) except (select.error, KeyboardInterrupt, socket.error): # just ignore these @@ -194,4 +191,4 @@ "Traceback": tbinfo, }) - return None, None + return None