diff options
author | 2015-08-24 10:51:13 +0300 | |
---|---|---|
committer | 2015-08-24 10:51:13 +0300 | |
commit | d3f26ece7d4383df0b22fe9c3cb3e695381ec737 (patch) | |
tree | ba42ddb547d363e92b1846df8a8712433981ddac /src/console/zmq/backend/cffi/message.py | |
parent | 651a7d779551e193bd9dbadbe8b2a02bdab231b4 (diff) |
Initial push to external_lib migration
Diffstat (limited to 'src/console/zmq/backend/cffi/message.py')
-rwxr-xr-x | src/console/zmq/backend/cffi/message.py | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/src/console/zmq/backend/cffi/message.py b/src/console/zmq/backend/cffi/message.py deleted file mode 100755 index c35decb6..00000000 --- a/src/console/zmq/backend/cffi/message.py +++ /dev/null @@ -1,69 +0,0 @@ -"""Dummy Frame object""" - -# Copyright (C) PyZMQ Developers -# Distributed under the terms of the Modified BSD License. - -from ._cffi import ffi, C - -import zmq -from zmq.utils.strtypes import unicode - -try: - view = memoryview -except NameError: - view = buffer - -_content = lambda x: x.tobytes() if type(x) == memoryview else x - -class Frame(object): - _data = None - tracker = None - closed = False - more = False - buffer = None - - - def __init__(self, data, track=False): - try: - view(data) - except TypeError: - raise - - self._data = data - - if isinstance(data, unicode): - raise TypeError("Unicode objects not allowed. Only: str/bytes, " + - "buffer interfaces.") - - self.more = False - self.tracker = None - self.closed = False - if track: - self.tracker = zmq.MessageTracker() - - self.buffer = view(self.bytes) - - @property - def bytes(self): - data = _content(self._data) - return data - - def __len__(self): - return len(self.bytes) - - def __eq__(self, other): - return self.bytes == _content(other) - - def __str__(self): - if str is unicode: - return self.bytes.decode() - else: - return self.bytes - - @property - def done(self): - return True - -Message = Frame - -__all__ = ['Frame', 'Message'] |