Created
October 21, 2013 21:14
-
-
Save cablehead/7091127 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class encoderdecoder(object): | |
| def __init__(self, encoding, decoding): | |
| self.encoding = encoding | |
| self.decoding = decoding | |
| def encode(self, message): | |
| return encode(self.encoding, message) | |
| def decode(self, message): | |
| return decode(self.decoding, message) | |
| room = protoslim.encoderdecoder(encoding.room, decoding.room) | |
| message = { | |
| 'room_id': 50, | |
| 'name': 'The Lads', | |
| 'users': [ | |
| {'user_id': 10}, | |
| {'user_id': 20}, | |
| ]} | |
| room.decode(room.encode(message)) == message |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment