208146e25347b8fe3fe57cd813b5e3880bbe4f9a,server/bert_serving/server/helper.py,BertRequestHandler,do_POST,#BertRequestHandler#,193

Before Change


            print("%d:%s" % (data["id"], data["texts"]))
        else:
            self.server.logger.warning(""Content-Length" or "Content-Type" are wrong")
        self.wfile.write(b"OK")

    def log_message(self, format, *args):
        self.server.logger.info("%s - - [%s] %s" % (self.address_string(),

After Change


            if content_len and content_type == "application/json":
                post_body = self.rfile.read(content_len)
                data = json.loads(post_body)
                result = self.server.bc.encode(data["texts"])
                self.wfile.write(json.dumps({"id": data["id"], "result": result}, ensure_ascii=False).encode("utf-8"))
            else:
                raise TypeError(""Content-Length" or "Content-Type" are wrong")
        except Exception as e:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: hanxiao/bert-as-service
Commit Name: 208146e25347b8fe3fe57cd813b5e3880bbe4f9a
Time: 2019-01-16
Author: hanhxiao@tencent.com
File Name: server/bert_serving/server/helper.py
Class Name: BertRequestHandler
Method Name: do_POST


Project Name: OpenMined/PySyft
Commit Name: 01a8518cc2e2f58f88612efad844b6085c149d51
Time: 2020-08-19
Author: me@madhavajay.com
File Name: tests/syft/core/io/location/specific_test.py
Class Name:
Method Name: test_binary_deserialization


Project Name: OpenMined/PySyft
Commit Name: 01a8518cc2e2f58f88612efad844b6085c149d51
Time: 2020-08-19
Author: me@madhavajay.com
File Name: tests/syft/core/io/location/specific_test.py
Class Name:
Method Name: test_binary_serialization