caa6264e5fcfd54dab6fc7ac10bb39c4ac42b574,service/client.py,BertClient,encode,#BertClient#Any#,23

Before Change


    def encode(self, texts):
        if self.is_valid_input(texts):
            self.socket.send_pyobj(texts)
            return self.formatter(self.socket.recv_pyobj())
        else:
            raise AttributeError(""texts" must be "List[str]"!")

    @staticmethod

After Change


            self.socket.send_pyobj(texts)
            response = self.socket.recv_multipart()
            arr_info, arr_val = jsonapi.loads(response[4]), response[7]
            X = np.frombuffer(memoryview(arr_val), dtype=arr_info["dtype"])
            return self.formatter(X.reshape(arr_info["shape"]))
        else:
            raise AttributeError(""texts" must be "List[str]"!")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: hanxiao/bert-as-service
Commit Name: caa6264e5fcfd54dab6fc7ac10bb39c4ac42b574
Time: 2018-11-14
Author: hanhxiao@tencent.com
File Name: service/client.py
Class Name: BertClient
Method Name: encode


Project Name: dmlc/gluon-nlp
Commit Name: 2c5f22199b46837b9801378ce172dcd13f125769
Time: 2018-07-17
Author: leonard@lausen.nl
File Name: gluonnlp/vocab/subwords.py
Class Name: NGramHashes
Method Name: _word_to_hashes


Project Name: dask/distributed
Commit Name: c67705f3f513de5bc09b897c400011b543ff0f7c
Time: 2020-07-17
Author: jakirkham@gmail.com
File Name: distributed/protocol/utils.py
Class Name:
Method Name: merge_frames