equal
deleted
inserted
replaced
78 return int(eid) |
78 return int(eid) |
79 |
79 |
80 |
80 |
81 class Binary(BytesIO): |
81 class Binary(BytesIO): |
82 """class to hold binary data. Use BytesIO to prevent use of unicode data""" |
82 """class to hold binary data. Use BytesIO to prevent use of unicode data""" |
83 _allowed_types = (binary_type, bytearray, buffer if PY2 else memoryview) |
83 _allowed_types = (binary_type, bytearray, buffer if PY2 else memoryview) # noqa: F405 |
84 |
84 |
85 def __init__(self, buf=b''): |
85 def __init__(self, buf=b''): |
86 assert isinstance(buf, self._allowed_types), \ |
86 assert isinstance(buf, self._allowed_types), \ |
87 "Binary objects must use bytes/buffer objects, not %s" % buf.__class__ |
87 "Binary objects must use bytes/buffer objects, not %s" % buf.__class__ |
88 # don't call super, BytesIO may be an old-style class (on python < 2.7.4) |
88 # don't call super, BytesIO may be an old-style class (on python < 2.7.4) |