/
githubmirror
/
the-algorithm
Обзор
Документация
Войти
/
githubmirror
/
the-algorithm
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
twml/twml_common/serialize.py
16 строк
398 B
twitter-team
Twitter Recommendation Algorithm
01 апр 2023, 01:36
01 апр 2023, 01:36
ef4c5eb
Код
Авторство
О чём код?
from thrift.protocol import TBinaryProtocol from thrift.transport import TTransport def serialize(obj): tbuf = TTransport.TMemoryBuffer() iproto = TBinaryProtocol.TBinaryProtocol(tbuf) obj.write(iproto) return tbuf.getvalue() def deserialize(record, bytes): tbuf = TTransport.TMemoryBuffer(bytes) iproto = TBinaryProtocol.TBinaryProtocol(tbuf) record.read(iproto) return record