def __init__(self, file, auto_flush=False, queue=None): #super(TeeFile, self).__init__() StringIO.__init__(self) self.file = file self.auto_flush = auto_flush self.length = 0 self.queue = queue self.queue_buffer = []
def __init__(self, uri, data='', filename='', mimeType='', format='', accept=''): self.uri = uri if data: self.data = data.decode() elif filename: if os.path.exists(filename): fh = open(filename) self.data = fh.read().decode() fh.close() else: # try to fetch uri try: req = urllib.request.Request(uri) if accept: # add custom accept header req.add_header('Accept', accept) else: # otherwise add default req.add_header('Accept', accept_header) fh = urllib.request.urlopen(req) self.data = fh.read().decode() self.info = fh.info().decode() mimeType = self.info.dict.get('content-type', mimeType) self.uri = fh.geturl().decode() fh.close() except: raise OreException( 'ReMDocument must either have data or filename') if not format: try: mt = conneg.parse(mimeType) if mt: mimeType = mt[0].mimetype1 + '/' + mt[0].mimetype2 except: pass mimeHash = { 'application/atom+xml': 'atom', 'application/xhtml+xml': 'rdfa', 'application/rdf+xml': 'xml', 'text/plain': 'nt', # yes, really 'text/rdf+n3': 'n3', 'application/x-turtle': 'turtle', 'application/rdf+nt': 'nt' } format = mimeHash.get(mimeType, '') self.mimeType = mimeType self.format = format StringIO.__init__(self, self.data)
def __init__(self, data): StringIO.__init__(self) self.buffer = Testcommandline.Mystdin.bufferemulator() if(sys.hexversion > 0x03000000): if(isinstance(data, bytearray)): self.buffer.bytedata = data else: self.buffer.bytedata = bytearray([ord(x) for x in data]) else: self.write(data) self.seek(0)
def __init__(self, buffer='', 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 StringIO instance is written to. """ StringIO.__init__(self, buffer) if cc is None: cc = [] elif hasattr(cc, 'write'): cc = [cc] self.cc = cc
def __init__(self, *args): try: self.code = args[1] except IndexError: self.code = 200 pass try: self.msg = args[2] except IndexError: self.msg = "OK" pass self.headers = {'content-type': 'text/plain; charset=utf-8'} StringIO.__init__(self, unicode(args[0]))
def __init__(self, filename): """ constructor @param filename filename """ StringIO.__init__(self) self.filename = filename if os.path.exists(filename): os.remove(filename) self.handle = None self.redirect = {} self.to = None
def __init__(self, buffer="", writers=None): """Init CCStringIO If ``writers`` is given and is a file-like object or an iterable of same, it/they will be written to whenever this StringIO instance is written to. """ StringIO.__init__(self, buffer) if writers is None: writers = [] elif hasattr(writers, "write"): writers = [writers] self.writers = writers
def __init__(self, *args, **kwargs): if 'dispStdout' in kwargs: self.dispStdout = kwargs['dispStdout'] del kwargs['dispStdout'] else: self.dispStdout = True StringIO.__init__(self, *args, **kwargs) self.matcher = ( (self.reAttached, 'attached', True), # ( self.reAttached, 'running', True ), # ( self.reNotRunning, 'running', False), (self.reDetached, 'attached', False), (self.reBreakonexitOn, 'breakonexit', True), (self.reBreakonexitOff, 'breakonexit', False), (self.reWaitingOnBp, 'waitingOnBp', True), (self.reNotWaitingOnBp, 'waitingOnBp', False), ) for m in self.matcher: setattr(self, m[1], False) self.lineCount = 0
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
def __init__(self, arg): StringIO.__init__(self, arg)
def __init__(self, stream): StringIO.__init__(self) self.stream = stream
def __init__(self, logger, log_level, fileno=0, *args, **kwargs): self.logger = logger self.log_level = log_level self.__fileno = fileno StringIO.__init__(self, *args, **kwargs)
def __init__(self, parent=None, buf=''): StringIO.__init__(self, buf) self.parent = parent self.dialog = None self.ignore = ['\x1b[?25l', '\x1b[?25h', ''] self.clearln = '\r\x1b[K'
def __init__(self, stdout): self.__stdout = stdout StringIO.__init__(self)
def __init__(self, filename, mode, encoding=None): self.filename = filename StringIO.__init__(self)
def __init__(self, out=None, buf=""): self._out=out StringIO.__init__(self,buf)
def __init__(self, filename=None, mode=None): StringIO.__init__(self, '')
def __init__(self, channel='stdout'): StringIO.__init__(self) self.channel = channel
def __init__(self, *args, **kwargs): StringIO.__init__(self, *args, **kwargs) self._indent = 0
def __init__(self, initial_data=None, encoding='utf-8', errors='strict'): StringIO.__init__(self) self._encoding_for_bytes = encoding self._errors = errors if initial_data is not None: self.write(initial_data)
def __init__(self, orig): StringIO.__init__(self) self.thread = threading.current_thread() self.orig = orig
def __init__(self): StringIO.__init__(self) self.buffer = Testcommandline.Mystdout.bufferemulator()
def __init__(self,stream): StringIO.__init__(self) self.stream = stream
def __init__(self, fp): data = fp.read() StringIO.__init__(self, data)
def __init__(self): StringIO.__init__(self) # can't use super() since StringIO is an old-style class self.last_sleep = 0
def __init__(self, pipeout): self.pipeout = pipeout StringIO.__init__(self, "", pipeout.encoding)
def __init__(self, buf=''): StringIO.__init__(self, universal_newlines(buf))
def __init__(self, buf=""): self.stop = False StringIO.__init__(self, buf)
def __init__(self, *args, **kwargs): StringIO.__init__(self, *args, **kwargs) def eof(self): return self.tell() >= self.len # return true if next read will cause EOFError
def __init__(self, string): StringIO.__init__(self, string)
def __init__(self) -> None: StringIO.__init__(self) self.stdout = sys.stdout self.logger = logging.getLogger("root") sys.stdout = self
def __init__(self, done): StringIO.__init__(self) self.done = done
def __init__(self): StringIO.__init__(self)
def __init__(self): self._init_params = None StringIO.__init__(self) self._closed = False
def __init__(self, buffer, bits=ELFCLASS.ELFCLASS32, endianness=ELFDATA.ELFDATA2LSB, addr_size=4): StringIO.__init__(self, buffer) self.set_bits(bits) self.set_endianness(endianness) DwarfStream.__init__(self, addr_size)
def __init__(self, *args, **kwargs): StringIO.__init__(self, *args, **kwargs) self._stack = [self.new_block()]
def __init__(self): StringIO.__init__(self) self.scope = 0
def __init__(self, val): StringIO.__init__(self, val) self.name = "image.png"
def __init__(self, buf, url): string_io.__init__(self, buf) self.url = url
def __init__(self, value=''): self.close_called = False StringIO.__init__(self, value)
def __init__(self): StringIO.__init__(self) self.buffer = Testformating.Mystdout.bufferemulator()
def __init__(self, filename, mode): self.filename = filename StringIO.__init__(self)
def __init__(self, parent, stderr): self._match = re.compile('\s*(\d*\.?\d*)') self.__stderr = stderr self._parent = parent self._line = "" StringIO.__init__(self)