cubicweb/__init__.py
changeset 12355 c703dc95c82e
parent 11955 f85ec84355db
child 12508 a8c1ea390400
equal deleted inserted replaced
12353:e814f2e1059c 12355:c703dc95c82e
    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)