本文整理汇总了Python中six.StringIO.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python StringIO.__init__方法的具体用法?Python StringIO.__init__怎么用?Python StringIO.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类six.StringIO
的用法示例。
在下文中一共展示了StringIO.__init__方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from six import StringIO [as 别名]
# 或者: from six.StringIO import __init__ [as 别名]
def __init__(self, listener):
"""
:type self: StringIO
"""
StringIO.__init__(self)
self.listener = listener
示例2: __init__
# 需要导入模块: from six import StringIO [as 别名]
# 或者: from six.StringIO 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
示例3: __init__
# 需要导入模块: from six import StringIO [as 别名]
# 或者: from six.StringIO import __init__ [as 别名]
def __init__(self, windows):
StringIO.__init__(self)
self.windows = windows
self.autoscroll = {}
self.pos = {}
self.lines = {}
self.maxsize = {}
self.stdout = None
self.logfile = None
self.wrapper = TextWrapper(width=80, initial_indent="",
subsequent_indent=" ",
replace_whitespace=False)
if NCURSES:
for windex in windows:
h, w = windows[windex][0].getmaxyx()
self.maxsize[windex] = (h, w)
self.pos[windex] = [0, 0]
self.autoscroll[windex] = True
self.lines[windex] = 0
示例4: __init__
# 需要导入模块: from six import StringIO [as 别名]
# 或者: from six.StringIO import __init__ [as 别名]
def __init__(self, value=None, path=None):
init = lambda x: StringIO.__init__(self, x)
if value is None:
init("")
ftype = 'dir'
size = 4096
else:
init(value)
ftype = 'file'
size = len(value)
attr = ssh.SFTPAttributes()
attr.st_mode = {'file': stat.S_IFREG, 'dir': stat.S_IFDIR}[ftype]
attr.st_size = size
attr.filename = os.path.basename(path)
self.attributes = attr
示例5: __init__
# 需要导入模块: from six import StringIO [as 别名]
# 或者: from six.StringIO import __init__ [as 别名]
def __init__(self, filename, data):
# pylint: disable=W0233
StringIO.__init__(self, data)
self.mode = 'r'
self.name = filename
示例6: __init__
# 需要导入模块: from six import StringIO [as 别名]
# 或者: from six.StringIO import __init__ [as 别名]
def __init__(self, data=""):
StringIO.__init__(self, data)
示例7: __init__
# 需要导入模块: from six import StringIO [as 别名]
# 或者: from six.StringIO import __init__ [as 别名]
def __init__(self, queue, prefix=None):
StringIO.__init__(self)
self.queue = queue
self.prefix = prefix
示例8: __init__
# 需要导入模块: from six import StringIO [as 别名]
# 或者: from six.StringIO import __init__ [as 别名]
def __init__(self,stdout):
self.__stdout = stdout
StringIO.__init__(self)