本文整理汇总了Python中six.BytesIO.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python BytesIO.__init__方法的具体用法?Python BytesIO.__init__怎么用?Python BytesIO.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类six.BytesIO
的用法示例。
在下文中一共展示了BytesIO.__init__方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from six import BytesIO [as 别名]
# 或者: from six.BytesIO import __init__ [as 别名]
def __init__(self, stream, status=200, headers=None):
self.status = status
self.headers = headers or {}
self.reason = requests.status_codes._codes.get(
status, ['']
)[0].upper().replace('_', ' ')
BytesIO.__init__(self, stream)
示例2: result
# 需要导入模块: from six import BytesIO [as 别名]
# 或者: from six.BytesIO import __init__ [as 别名]
def result(found):
self.status, content_type, self._path = found
self.reason = reason(self.status)
self.headers = {"Content-Type": content_type or ""}
BytesIO.__init__(
self,
_io_read_file(self.status, self._path)
)
示例3: __init__
# 需要导入模块: from six import BytesIO [as 别名]
# 或者: from six.BytesIO import __init__ [as 别名]
def __init__(self, buffer=b'', cc=None):
"""
If ``cc`` is given and is a file-like object or an iterable of same,
it/they will be written to whenever this instance is written to.
"""
IO.__init__(self, buffer)
if cc is None:
cc = []
elif hasattr(cc, 'write'):
cc = [cc]
self.cc = cc
示例4: __init__
# 需要导入模块: from six import BytesIO [as 别名]
# 或者: from six.BytesIO import __init__ [as 别名]
def __init__(self, *args, **kwargs):
"""Initialize."""
self.called = False
if PY2:
return BytesIO.__init__(self, *args, **kwargs)
else:
return super(BadBytesIO, self).__init__(*args, **kwargs)
示例5: __init__
# 需要导入模块: from six import BytesIO [as 别名]
# 或者: from six.BytesIO import __init__ [as 别名]
def __init__(self, *args, **kwargs):
BytesIO.__init__(self, *args, **kwargs)
self.headers = self.Headers()