我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用future.utils.isbytes()。
def join(self, iterable_of_bytes): errmsg = 'sequence item {0}: expected bytes, {1} found' if isbytes(iterable_of_bytes) or istext(iterable_of_bytes): raise TypeError(errmsg.format(0, type(iterable_of_bytes))) for i, item in enumerate(iterable_of_bytes): if istext(item): raise TypeError(errmsg.format(i, type(item))) return newbytes(super(newbytes, self).join(iterable_of_bytes))
def __lt__(self, other): if not isbytes(other): raise TypeError(self.unorderable_err.format(type(other))) return super(newbytes, self).__lt__(other)
def __le__(self, other): if not isbytes(other): raise TypeError(self.unorderable_err.format(type(other))) return super(newbytes, self).__le__(other)
def __gt__(self, other): if not isbytes(other): raise TypeError(self.unorderable_err.format(type(other))) return super(newbytes, self).__gt__(other)
def __ge__(self, other): if not isbytes(other): raise TypeError(self.unorderable_err.format(type(other))) return super(newbytes, self).__ge__(other)