我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用StringIO.StringIO.__init__()。
def __init__(self, output=None, indent=2, linebreak=False, bold=False, disabled=not SUPPORTS_ANSI): self._indentation_factor = indent self._indent = 0 self._linebreak = linebreak self._bold = bold self._in_format = False self._disabled = disabled self.output = output or sys.stdout if disabled: self._backcolors = empty() self._forecolors = empty() self._modifiers = empty() else: self._backcolors = backcolors() self._forecolors = forecolors() self._modifiers = modifiers()
def __init__(self, delimiter=delimiters.DEFAULT): self.delimiter = delimiter StringIO.__init__(self)
def __init__(self, output, delimiter=delimiters.DEFAULT): self.old_write = output.write self.delimiter = delimiter if output is sys.__stdout__: output = StdOutMocker(delimiter) elif output is sys.__stderr__: output = StdErrMocker(delimiter) self.output = output
def __init__(self, fp): data = fp.read() StringIO.__init__(self, data)
def __init__(self, obj, method): StringIO.__init__(self) self.func = getattr(obj, method)