143f9fb83bfe3afef48ddaa70a5005dfc74234a4,deeppavlov/utils/socket/socket.py,,handle_connection,#Any#Any#Any#Any#Any#,21

Before Change



async def handle_connection(conn: socket.socket, addr, model: Chainer, params_names: List[str], bufsize: int):
    conn.setblocking(False)
    incoming_data = b""
    recv_data = conn.recv(bufsize)
    incoming_data += recv_data
    try:
        data = json.loads(incoming_data)
    except ValueError:
        log.error("request type is not json")

After Change


    if len(model.out_params) == 1:
        prediction = [prediction]
    prediction = list(zip(*prediction))
    result = json.dumps({"status": "OK", "payload": prediction})
    dialog_logger.log_out(result)
    await loop.sock_sendall(conn, result.encode("utf-8"))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: deepmipt/DeepPavlov
Commit Name: 143f9fb83bfe3afef48ddaa70a5005dfc74234a4
Time: 2019-08-02
Author: ignatov.fedor@gmail.com
File Name: deeppavlov/utils/socket/socket.py
Class Name:
Method Name: handle_connection


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


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