Python StringIO.StringIO.__init__() Examples
The following are 20
code examples of StringIO.StringIO.__init__().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
StringIO.StringIO
, or try the search function
.
Example #1
Source File: junit_xml.py From medicare-demo with Apache License 2.0 | 6 votes |
def __init__(self, xml_dir): unittest.TestResult.__init__(self) self.xml_dir = xml_dir # The module name of the first test ran self.module_name = None # All TestCases self.tests = [] # Start time self.start = None self.old_stdout = sys.stdout self.old_stderr = sys.stderr sys.stdout = self.stdout = Tee(sys.stdout) sys.stderr = self.stderr = Tee(sys.stderr)
Example #2
Source File: junit_xml.py From medicare-demo with Apache License 2.0 | 6 votes |
def __init__(self, name, took, type=None, exc_info=None): # The name of the test self.name = name # How long it took self.took = took # Type of test: 'error', 'failure' 'skipped', or None for a # success self.type = type if exc_info: self.exc_name = exc_name(exc_info) self.message = exc_message(exc_info) self.traceback = safe_str(''.join( traceback.format_exception(*exc_info))) else: self.exc_name = self.message = self.traceback = ''
Example #3
Source File: junit_xml.py From CTFCrackTools with GNU General Public License v3.0 | 6 votes |
def __init__(self, name, took, type=None, exc_info=None): # The name of the test self.name = name # How long it took self.took = took # Type of test: 'error', 'failure' 'skipped', or None for a # success self.type = type if exc_info: self.exc_name = exc_name(exc_info) self.message = exc_message(exc_info) self.traceback = safe_str(''.join( traceback.format_exception(*exc_info))) else: self.exc_name = self.message = self.traceback = ''
Example #4
Source File: junit_xml.py From CTFCrackTools with GNU General Public License v3.0 | 6 votes |
def __init__(self, xml_dir): unittest.TestResult.__init__(self) self.xml_dir = xml_dir # The module name of the first test ran self.module_name = None # All TestCases self.tests = [] # Start time self.start = None self.old_stdout = sys.stdout self.old_stderr = sys.stderr sys.stdout = self.stdout = Tee(sys.stdout) sys.stderr = self.stderr = Tee(sys.stderr)
Example #5
Source File: zurllib.py From BitTorrent with GNU General Public License v3.0 | 6 votes |
def __init__(self,fp): self.fp = fp # this is nasty and needs to be fixed at some point # copy everything into a StringIO (compressed) compressed = StringIO() r = fp.read() while r: compressed.write(r) r = fp.read() # now, unzip (gz) the StringIO to a string compressed.seek(0,0) gz = GzipFile(fileobj = compressed) str = '' r = gz.read() while r: str += r r = gz.read() # close our utility files compressed.close() gz.close() # init our stringio selves with the string StringIO.__init__(self, str) del str
Example #6
Source File: junit_xml.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 6 votes |
def __init__(self, name, took, type=None, exc_info=None): # The name of the test self.name = name # How long it took self.took = took # Type of test: 'error', 'failure' 'skipped', or None for a # success self.type = type if exc_info: self.exc_name = exc_name(exc_info) self.message = exc_message(exc_info) self.traceback = safe_str(''.join( traceback.format_exception(*exc_info))) else: self.exc_name = self.message = self.traceback = ''
Example #7
Source File: junit_xml.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 6 votes |
def __init__(self, xml_dir): unittest.TestResult.__init__(self) self.xml_dir = xml_dir # The module name of the first test ran self.module_name = None # All TestCases self.tests = [] # Start time self.start = None self.old_stdout = sys.stdout self.old_stderr = sys.stderr sys.stdout = self.stdout = Tee(sys.stdout) sys.stderr = self.stderr = Tee(sys.stderr)
Example #8
Source File: ImageFileIO.py From CNCGToolKit with MIT License | 5 votes |
def __init__(self, fp): data = fp.read() StringIO.__init__(self, data)
Example #9
Source File: ImageFileIO.py From keras-lambda with MIT License | 5 votes |
def __init__(self, fp): data = fp.read() StringIO.__init__(self, data)
Example #10
Source File: junit_xml.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def __init__(self, stream): StringIO.__init__(self) self.stream = stream
Example #11
Source File: junit_xml.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def __init__(self, xml_dir): self.xml_dir = xml_dir
Example #12
Source File: junit_xml.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def __init__(self, stream): StringIO.__init__(self) self.stream = stream
Example #13
Source File: junit_xml.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def __init__(self, xml_dir): self.xml_dir = xml_dir
Example #14
Source File: ImageFileIO.py From mxnet-lambda with Apache License 2.0 | 5 votes |
def __init__(self, fp): data = fp.read() StringIO.__init__(self, data)
Example #15
Source File: zurllib.py From BitTorrent with GNU General Public License v3.0 | 5 votes |
def __init__(self, fp, headers, url): # we need to do something more sophisticated here to deal with # multiple values? What about other weird crap like q-values? # basically this only works for the most simplistic case and will # break in some other cases, but for now we only care about making # this work with the BT tracker so.... if headers.has_key('content-encoding') and headers['content-encoding'] == 'gzip': if DEBUG: print "Contents of Content-encoding: " + headers['Content-encoding'] + "\n" self.gzip = 1 self.rawfp = fp fp = GzipStream(fp) else: self.gzip = 0 return addinfourl.__init__(self, fp, headers, url)
Example #16
Source File: zurllib.py From BitTorrent with GNU General Public License v3.0 | 5 votes |
def connect(self): """Connect to the host and port specified in __init__.""" ident = thread.get_ident() # never, ever, ever call urlopen from any of these threads assert ident not in unsafe_threads, "You may not use urllib from this thread!" msg = "getaddrinfo returns an empty list" for res in socket.getaddrinfo(self.host, self.port, 0, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res addr = sa[0] # the obvious multithreading problem is avoided by using locks. # the lock is only acquired during the function call, so there's # no danger of urllib blocking rawserver. rawserver.add_pending_connection(addr) try: self.sock = socket.socket(af, socktype, proto) self.sock.settimeout(url_socket_timeout) if http_bindaddr: self.sock.bind((http_bindaddr, 0)) if self.debuglevel > 0: print "connect: (%s, %s)" % (self.host, self.port) self.sock.connect(sa) except socket.error, msg: if self.debuglevel > 0: print 'connect fail:', (self.host, self.port) if self.sock: self.sock.close() self.sock = None rawserver.remove_pending_connection(addr) if self.sock: break
Example #17
Source File: zurllib.py From BitTorrent with GNU General Public License v3.0 | 5 votes |
def __init__(self): self.pending_sockets = {} self.pending_sockets_lock = threading.RLock()
Example #18
Source File: zurllib.py From BitTorrent with GNU General Public License v3.0 | 5 votes |
def __init__(self): OldOpenerDirector.__init__(self) self.addheaders = [('User-agent', user_agent)]
Example #19
Source File: junit_xml.py From medicare-demo with Apache License 2.0 | 5 votes |
def __init__(self, stream): StringIO.__init__(self) self.stream = stream
Example #20
Source File: junit_xml.py From medicare-demo with Apache License 2.0 | 5 votes |
def __init__(self, xml_dir): self.xml_dir = xml_dir