def generate_method(method_name):
    """Generate a method for a given Thrift service.

    Uses the provided TChannelSyncClient's threadloop in order
    to convert RPC calls to concurrent.futures

    :param method_name: Method being called.
    :return: A method that invokes the RPC using TChannelSyncClient
    """

    def call(self, *args, **kwargs):
        """Forward RPC call to TChannelSyncClient

        :return concurrent.futures.Future:
        """
        if not self.threadloop.is_ready():
            self.threadloop.start()

        return self.threadloop.submit(
            getattr(self.async_thrift, method_name), *args, **kwargs
        )

    return call
def generate_method ( method_name ) : def call ( self , * args , ** kwargs ) : if not self . threadloop . is_ready ( ) : self . threadloop . start ( ) return self . threadloop . submit ( getattr ( self . async_thrift , method_name ) , * args , ** kwargs ) return call
Generate a method for a given Thrift service.

    Uses the provided TChannelSyncClient's threadloop in order
    to convert RPC calls to concurrent.futures

    :param method_name: Method being called.
    :return: A method that invokes the RPC using TChannelSyncClient