bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def _generate_toc(self): """Generate key-to-(start, stop) table of contents.""" starts, stops = [], [] self._file.seek(0) next_pos = 0 label_lists = [] while True: line_pos = next_pos line = self._file.readline() next_pos = self._file.tell() if line == '\037\014' + os.linesep: if len(stops) < len(starts): stops.append(...
defself._file.seek(0, 2) self._file_length = self._file.tell() _generate_toc(self):self._file.seek(0, 2) self._file_length = self._file.tell() """Generateself._file.seek(0, 2) self._file_length = self._file.tell() key-to-(start,self._file.seek(0, 2) self._file_length = self._file.tell() stop)self._file.seek(0, 2) s...
12,100
exec("""def __%(method)s__(self, *args): print "__%(method)s__:", args
exec """def __%(method)s__(self, *args): print "__%(method)s__:", args
12,101
exec("""def __%(method)s__(self, *args): print "__%(method)s__:", args
exec("""def __%(method)s__(self, *args): print "__%(method)s__:", args
12,102
def test_truncate(self): eq = self.assertEqual f = self.MODULE.StringIO() f.write(self._lines) f.seek(10) f.truncate() eq(f.getvalue(), 'abcdefghij') f.seek(0) f.truncate(5) eq(f.getvalue(), 'abcde') f.close() self.assertRaises(ValueError, f.write, 'frobnitz')
def test_truncate(self): eq = self.assertEqual f = self.MODULE.StringIO() f.write(self._lines) f.seek(10) f.truncate() eq(f.getvalue(), 'abcdefghij') f.truncate(5) eq(f.getvalue(), 'abcde') f.close() self.assertRaises(ValueError, f.write, 'frobnitz')
12,103
def testMultiply(self); self.assertEquals((0 * 10), 0) self.assertEquals((5 * 8), 40)
def testMultiply(self): self.assertEquals((0 * 10), 0) self.assertEquals((5 * 8), 40)
12,104
def testMultiply(self); self.assertEquals((0 * 10), 0) self.assertEquals((5 * 8), 40)
def testMultiply(self); self.assertEquals((0 * 10), 0) self.assertEquals((5 * 8), 40)
12,105
def addError(self, test, err): "Called when an error has occurred" self.errors.append((test, err))
def addError(self, test, err): "Called when an error has occurred" self.errors.append((test, err))
12,106
def addFailure(self, test, err): "Called when a failure has occurred" self.failures.append((test, err))
def addFailure(self, test, err): "Called when a failure has occurred" self.failures.append((test, err))
12,107
def printErrorList(self, flavour, errors): for test, err in errors: self.stream.writeln(self.separator1) self.stream.writeln("%s: %s" % (flavour,self.getDescription(test))) self.stream.writeln(self.separator2) for line in apply(traceback.format_exception, err): for l in string.split(line,"\n")[:-1]: self.stream.writeln...
def printErrorList(self, flavour, errors): for test, err in errors: self.stream.writeln(self.separator1) self.stream.writeln("%s: %s" % (flavour,self.getDescription(test))) self.stream.writeln(self.separator2) for line in apply(traceback.format_exception, err): for l in string.split(line,"\n")[:-1]: self.stream.writeln...
12,108
def _make_spec_file(self): """Generate the text of an RPM spec file and return it as a list of strings (one per line). """ # definitions and headers spec_file = [ '%define name ' + self.distribution.get_name(), '%define version ' + self.distribution.get_version().replace('-','_'), '%define release ' + self.release.repl...
def _make_spec_file(self): """Generate the text of an RPM spec file and return it as a list of strings (one per line). """ # definitions and headers spec_file = [ '%define name ' + self.distribution.get_name(), '%define version ' + self.distribution.get_version().replace('-','_'), '%define release ' + self.release.repl...
12,109
def _make_spec_file(self): """Generate the text of an RPM spec file and return it as a list of strings (one per line). """ # definitions and headers spec_file = [ '%define name ' + self.distribution.get_name(), '%define version ' + self.distribution.get_version().replace('-','_'), '%define release ' + self.release.repl...
def _make_spec_file(self): """Generate the text of an RPM spec file and return it as a list of strings (one per line). """ # definitions and headers spec_file = [ '%define name ' + self.distribution.get_name(), '%define version ' + self.distribution.get_version().replace('-','_'), '%define release ' + self.release.repl...
12,110
def _make_spec_file(self): """Generate the text of an RPM spec file and return it as a list of strings (one per line). """ # definitions and headers spec_file = [ '%define name ' + self.distribution.get_name(), '%define version ' + self.distribution.get_version().replace('-','_'), '%define release ' + self.release.repl...
def _make_spec_file(self): """Generate the text of an RPM spec file and return it as a list of strings (one per line). """ # definitions and headers spec_file = [ '%define name ' + self.distribution.get_name(), '%define version ' + self.distribution.get_version().replace('-','_'), '%define release ' + self.release.repl...
12,111
def __init__(self, url, data=None, headers={}, origin_req_host=None, unverifiable=False): # unwrap('<URL:type://host/path>') --> 'type://host/path' self.__original = unwrap(url) self.type = None # self.__r_type is what's left after doing the splittype self.host = None self.port = None self.data = data self.headers = {}...
def __init__(self, url, data=None, headers={}, origin_req_host=None, unverifiable=False): # unwrap('<URL:type://host/path>') --> 'type://host/path' self.__original = unwrap(url) self.type = None # self.__r_type is what's left after doing the splittype self.host = None self.port = None self.data = data self.headers = {}...
12,112
def build_opener(*handlers): """Create an opener object from a list of handlers. The opener will use several default handlers, including support for HTTP and FTP. If any of the handlers passed as arguments are subclasses of the default handlers, the default handlers will not be used. """ opener = OpenerDirector() de...
def build_opener(*handlers): """Create an opener object from a list of handlers. The opener will use several default handlers, including support for HTTP and FTP. If any of the handlers passed as arguments are subclasses of the default handlers, the default handlers will not be used. """ opener = OpenerDirector() de...
12,113
def build_opener(*handlers): """Create an opener object from a list of handlers. The opener will use several default handlers, including support for HTTP and FTP. If any of the handlers passed as arguments are subclasses of the default handlers, the default handlers will not be used. """ opener = OpenerDirector() de...
def build_opener(*handlers): """Create an opener object from a list of handlers. The opener will use several default handlers, including support for HTTP and FTP. If any of the handlers passed as arguments are subclasses of the default handlers, the default handlers will not be used. """ opener = OpenerDirector() de...
12,114
def __init__(self, counts=None, calledfuncs=None, infile=None, outfile=None): self.counts = counts if self.counts is None: self.counts = {} self.counter = self.counts.copy() # map (filename, lineno) to count self.calledfuncs = calledfuncs if self.calledfuncs is None: self.calledfuncs = {} self.calledfuncs = self.called...
def __init__(self, counts=None, calledfuncs=None, infile=None, outfile=None): self.counts = counts if self.counts is None: self.counts = {} self.counter = self.counts.copy() # map (filename, lineno) to count self.calledfuncs = calledfuncs if self.calledfuncs is None: self.calledfuncs = {} self.calledfuncs = self.called...
12,115
def __init__(self, counts=None, calledfuncs=None, infile=None, outfile=None): self.counts = counts if self.counts is None: self.counts = {} self.counter = self.counts.copy() # map (filename, lineno) to count self.calledfuncs = calledfuncs if self.calledfuncs is None: self.calledfuncs = {} self.calledfuncs = self.called...
def __init__(self, counts=None, calledfuncs=None, infile=None, outfile=None): self.counts = counts if self.counts is None: self.counts = {} self.counter = self.counts.copy() # map (filename, lineno) to count self.calledfuncs = calledfuncs if self.calledfuncs is None: self.calledfuncs = {} self.calledfuncs = self.called...
12,116
def update(self): self.w.browser.update()
def update(self): self.w.browser.update()
12,117
def unpack_sequence(seq, indent = 0): items = map(None, range(len(seq)), seq) items = map(lambda (k, v), type = type, simp = SIMPLE_TYPES, indent = indent: (k, v, not type(v) in simp, indent), items) return items
def unpack_sequence(seq, indent = 0): return [(i, v, not isinstance(v, SIMPLE_TYPES), indent) for i, v in enumerate(seq)]
12,118
def buildappbundle(executable, output=None, copyfunc=None, creator=None, plist=None, nib=None, resources=None): if not output: output = os.path.split(executable)[1] + '.app' if not copyfunc: copyfunc = shutil.copy2 if not creator: creator='????' if not resources: resources = [] if nib: resources = resources + [nib] # #...
def buildappbundle(executable, output=None, copyfunc=None, creator=None, plist=None, nib=None, resources=None): if not output: output = os.path.split(executable)[1] + '.app' if not copyfunc: copyfunc = shutil.copy2 if not creator: creator='????' if not resources: resources = [] if nib: resources = resources + [nib] # #...
12,119
def usage(): print "buildappbundle creates an application bundle" print "Usage:" print " buildappbundle [options] executable" print "Options:" print " --output o Output file; default executable with .app appended, short -o" print " --link Symlink the executable (default: copy), short -l" print " --plist f...
def usage(): print __doc__ sys.exit(1)
12,120
def main(): output=None copyfunc=None creator=None plist=None nib=None resources=[] SHORTOPTS = "o:ln:r:p:c:?" LONGOPTS=("output=", "link", "nib=", "resource=", "plist=", "creator=", "help") try: options, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS) except getopt.error: usage() if len(args) != 1: usage() for...
def main(): output = None symlink = 0 creator = "????" plist = None nib = None resources = [] verbosity = 0 SHORTOPTS = "o:ln:r:p:c:v?h" LONGOPTS=("output=", "link", "nib=", "resource=", "plist=", "creator=", "help", "verbose") try: options, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS) except getopt.error: u...
12,121
def main(): output=None copyfunc=None creator=None plist=None nib=None resources=[] SHORTOPTS = "o:ln:r:p:c:?" LONGOPTS=("output=", "link", "nib=", "resource=", "plist=", "creator=", "help") try: options, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS) except getopt.error: usage() if len(args) != 1: usage() for...
def main(): output=None copyfunc=None creator=None plist=None nib=None resources=[] SHORTOPTS = "o:ln:r:p:c:?" LONGOPTS=("output=", "link", "nib=", "resource=", "plist=", "creator=", "help") try: options, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS) except getopt.error: usage() if len(args) != 1: usage() for...
12,122
def main(): output=None copyfunc=None creator=None plist=None nib=None resources=[] SHORTOPTS = "o:ln:r:p:c:?" LONGOPTS=("output=", "link", "nib=", "resource=", "plist=", "creator=", "help") try: options, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS) except getopt.error: usage() if len(args) != 1: usage() for...
def main(): output=None copyfunc=None creator=None plist=None nib=None resources=[] SHORTOPTS = "o:ln:r:p:c:?" LONGOPTS=("output=", "link", "nib=", "resource=", "plist=", "creator=", "help") try: options, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS) except getopt.error: usage() if len(args) != 1: usage() for...
12,123
def main(): output=None copyfunc=None creator=None plist=None nib=None resources=[] SHORTOPTS = "o:ln:r:p:c:?" LONGOPTS=("output=", "link", "nib=", "resource=", "plist=", "creator=", "help") try: options, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS) except getopt.error: usage() if len(args) != 1: usage() for...
def main(): output=None copyfunc=None creator=None plist=None nib=None resources=[] SHORTOPTS = "o:ln:r:p:c:?" LONGOPTS=("output=", "link", "nib=", "resource=", "plist=", "creator=", "help") try: options, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS) except getopt.error: usage() if len(args) != 1: usage() for...
12,124
def main(): output=None copyfunc=None creator=None plist=None nib=None resources=[] SHORTOPTS = "o:ln:r:p:c:?" LONGOPTS=("output=", "link", "nib=", "resource=", "plist=", "creator=", "help") try: options, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS) except getopt.error: usage() if len(args) != 1: usage() for...
defmain():output=Nonecopyfunc=Nonecreator=Noneplist=Nonenib=Noneresources=[]SHORTOPTS="o:ln:r:p:c:?"LONGOPTS=("output=","link","nib=","resource=","plist=","creator=","help")try:options,args=getopt.getopt(sys.argv[1:],SHORTOPTS,LONGOPTS)exceptgetopt.error:usage()iflen(args)!=1:usage()foropt,arginoptions:ifoptin('-o','--...
12,125
def updatecache(filename): """Update a cache entry and return its list of lines. If something's wrong, print a message, discard the cache entry, and return an empty list.""" if cache.has_key(filename): del cache[filename] if not filename or filename[0] + filename[-1] == '<>': return [] fullname = filename try: stat = ...
def updatecache(filename): """Update a cache entry and return its list of lines. If something's wrong, print a message, discard the cache entry, and return an empty list.""" if cache.has_key(filename): del cache[filename] if not filename or filename[0] + filename[-1] == '<>': return [] fullname = filename try: stat = ...
12,126
def updatecache(filename): """Update a cache entry and return its list of lines. If something's wrong, print a message, discard the cache entry, and return an empty list.""" if cache.has_key(filename): del cache[filename] if not filename or filename[0] + filename[-1] == '<>': return [] fullname = filename try: stat = ...
def updatecache(filename): """Update a cache entry and return its list of lines. If something's wrong, print a message, discard the cache entry, and return an empty list.""" if cache.has_key(filename): del cache[filename] if not filename or filename[0] + filename[-1] == '<>': return [] fullname = filename try: stat = ...
12,127
def updatecache(filename): """Update a cache entry and return its list of lines. If something's wrong, print a message, discard the cache entry, and return an empty list.""" if cache.has_key(filename): del cache[filename] if not filename or filename[0] + filename[-1] == '<>': return [] fullname = filename try: stat = ...
def updatecache(filename): """Update a cache entry and return its list of lines. If something's wrong, print a message, discard the cache entry, and return an empty list.""" if cache.has_key(filename): del cache[filename] if not filename or filename[0] + filename[-1] == '<>': return [] fullname = filename try: stat = ...
12,128
def _run_with_cl_interpreter(self): import Terminal interp_path = os.path.join(sys.exec_prefix, "bin", "python") file_path = self.path if not os.path.exists(interp_path): # This "can happen" if we are running IDE under MacPython-OS9. raise W.AlertError, "Can't find command-line Python" cmd = '"%s" "%s" ; exit' % (inter...
def _run_with_cl_interpreter(self): import Terminal interp_path = os.path.join(sys.exec_prefix, "Resources", "Python.app", "Contents", "MacOS", "Python") if not os.path.exists(interp_path): interp_path = os.path.join(sys.exec_prefix, "bin", "python") file_path = self.path if not os.path.exists(interp_path): # This "can...
12,129
def _run_with_cl_interpreter(self): import Terminal interp_path = os.path.join(sys.exec_prefix, "bin", "python") file_path = self.path if not os.path.exists(interp_path): # This "can happen" if we are running IDE under MacPython-OS9. raise W.AlertError, "Can't find command-line Python" cmd = '"%s" "%s" ; exit' % (inter...
def _run_with_cl_interpreter(self): import Terminal interp_path = os.path.join(sys.exec_prefix, "bin", "python") file_path = self.path if not os.path.exists(interp_path): # This "can happen" if we are running IDE under MacPython-OS9. raise W.AlertError, "Can't find command-line Python" cmd = '"%s" "%s" ; exit' % (inter...
12,130
def __calc_date_time(self): # Set self.date_time, self.date, & self.time by using # time.strftime().
def __calc_date_time(self): # Set self.date_time, self.date, & self.time by using # time.strftime().
12,131
def format_exception_only(etype, value): """Format the exception part of a traceback. The arguments are the exception type and value such as given by sys.last_type and sys.last_value. The return value is a list of strings, each ending in a newline. Normally, the list contains a single string; however, for SyntaxError...
def format_exception_only(etype, value): """Format the exception part of a traceback. The arguments are the exception type and value such as given by sys.last_type and sys.last_value. The return value is a list of strings, each ending in a newline. Normally, the list contains a single string; however, for SyntaxError...
12,132
def loop(timeout=30.0, use_poll=0, map=None): if map is None: map = socket_map if use_poll and hasattr(select, 'poll'): poll_fun = poll2 else: poll_fun = poll while map: poll_fun(timeout, map)
def loop(timeout=30.0, use_poll=False, map=None): if map is None: map = socket_map if use_poll and hasattr(select, 'poll'): poll_fun = poll2 else: poll_fun = poll while map: poll_fun(timeout, map)
12,133
def loop(timeout=30.0, use_poll=0, map=None): if map is None: map = socket_map if use_poll and hasattr(select, 'poll'): poll_fun = poll2 else: poll_fun = poll while map: poll_fun(timeout, map)
def loop(timeout=30.0, use_poll=0, map=None): if map is None: map = socket_map if use_poll and hasattr(select, 'poll'): poll_fun = poll2 else: poll_fun = poll while map: poll_fun(timeout, map)
12,134
def __init__(self, sock=None, map=None): if map is None: self._map = socket_map else: self._map = map
def __init__(self, sock=None, map=None): if map is None: self._map = socket_map else: self._map = map
12,135
def listen(self, num): self.accepting = 1 if os.name == 'nt' and num > 5: num = 1 return self.socket.listen(num)
def listen(self, num): self.accepting = True if os.name == 'nt' and num > 5: num = 1 return self.socket.listen(num)
12,136
def connect(self, address): self.connected = 0 err = self.socket.connect_ex(address) # XXX Should interpret Winsock return values if err in (EINPROGRESS, EALREADY, EWOULDBLOCK): return if err in (0, EISCONN): self.addr = address self.connected = 1 self.handle_connect() else: raise socket.error, err
def connect(self, address): self.connected = False err = self.socket.connect_ex(address) # XXX Should interpret Winsock return values if err in (EINPROGRESS, EALREADY, EWOULDBLOCK): return if err in (0, EISCONN): self.addr = address self.connected = 1 self.handle_connect() else: raise socket.error, err
12,137
def connect(self, address): self.connected = 0 err = self.socket.connect_ex(address) # XXX Should interpret Winsock return values if err in (EINPROGRESS, EALREADY, EWOULDBLOCK): return if err in (0, EISCONN): self.addr = address self.connected = 1 self.handle_connect() else: raise socket.error, err
def connect(self, address): self.connected = 0 err = self.socket.connect_ex(address) # XXX Should interpret Winsock return values if err in (EINPROGRESS, EALREADY, EWOULDBLOCK): return if err in (0, EISCONN): self.addr = address self.connected = True self.handle_connect() else: raise socket.error, err
12,138
def handle_read_event(self): if self.accepting: # for an accepting socket, getting a read implies # that we are connected if not self.connected: self.connected = 1 self.handle_accept() elif not self.connected: self.handle_connect() self.connected = 1 self.handle_read() else: self.handle_read()
def handle_read_event(self): if self.accepting: # for an accepting socket, getting a read implies # that we are connected if not self.connected: self.connected = True self.handle_accept() elif not self.connected: self.handle_connect() self.connected = True self.handle_read() else: self.handle_read()
12,139
def handle_read_event(self): if self.accepting: # for an accepting socket, getting a read implies # that we are connected if not self.connected: self.connected = 1 self.handle_accept() elif not self.connected: self.handle_connect() self.connected = 1 self.handle_read() else: self.handle_read()
def handle_read_event(self): if self.accepting: # for an accepting socket, getting a read implies # that we are connected if not self.connected: self.connected = True self.handle_accept() elif not self.connected: self.handle_connect() self.connected = True self.handle_read() else: self.handle_read()
12,140
def handle_write_event(self): # getting a write implies that we are connected if not self.connected: self.handle_connect() self.connected = 1 self.handle_write()
def handle_write_event(self): # getting a write implies that we are connected if not self.connected: self.handle_connect() self.connected = True self.handle_write()
12,141
def __init__(self, fd): dispatcher.__init__(self) self.connected = 1 # set it to non-blocking mode flags = fcntl.fcntl(fd, fcntl.F_GETFL, 0) flags = flags | os.O_NONBLOCK fcntl.fcntl(fd, fcntl.F_SETFL, flags) self.set_file(fd)
def __init__(self, fd): dispatcher.__init__(self) self.connected = True # set it to non-blocking mode flags = fcntl.fcntl(fd, fcntl.F_GETFL, 0) flags = flags | os.O_NONBLOCK fcntl.fcntl(fd, fcntl.F_SETFL, flags) self.set_file(fd)
12,142
def get_devstudio_versions (): """Get list of devstudio versions from the Windows registry. Return a list of strings containing version numbers; the list will be empty if we were unable to access the registry (eg. couldn't import a registry-access module) or the appropriate registry keys weren't found.""" try: import...
def get_devstudio_versions (): """Get list of devstudio versions from the Windows registry. Return a list of strings containing version numbers; the list will be empty if we were unable to access the registry (eg. couldn't import a registry-access module) or the appropriate registry keys weren't found.""" if not _can...
12,143
def get_devstudio_versions (): """Get list of devstudio versions from the Windows registry. Return a list of strings containing version numbers; the list will be empty if we were unable to access the registry (eg. couldn't import a registry-access module) or the appropriate registry keys weren't found.""" try: import...
def get_devstudio_versions (): """Get list of devstudio versions from the Windows registry. Return a list of strings containing version numbers; the list will be empty if we were unable to access the registry (eg. couldn't import a registry-access module) or the appropriate registry keys weren't found.""" try: import...
12,144
def get_devstudio_versions (): """Get list of devstudio versions from the Windows registry. Return a list of strings containing version numbers; the list will be empty if we were unable to access the registry (eg. couldn't import a registry-access module) or the appropriate registry keys weren't found.""" try: import...
def get_devstudio_versions (): """Get list of devstudio versions from the Windows registry. Return a list of strings containing version numbers; the list will be empty if we were unable to access the registry (eg. couldn't import a registry-access module) or the appropriate registry keys weren't found.""" try: import...
12,145
def get_devstudio_versions (): """Get list of devstudio versions from the Windows registry. Return a list of strings containing version numbers; the list will be empty if we were unable to access the registry (eg. couldn't import a registry-access module) or the appropriate registry keys weren't found.""" try: import...
def get_devstudio_versions (): """Get list of devstudio versions from the Windows registry. Return a list of strings containing version numbers; the list will be empty if we were unable to access the registry (eg. couldn't import a registry-access module) or the appropriate registry keys weren't found.""" try: import...
12,146
def get_devstudio_versions (): """Get list of devstudio versions from the Windows registry. Return a list of strings containing version numbers; the list will be empty if we were unable to access the registry (eg. couldn't import a registry-access module) or the appropriate registry keys weren't found.""" try: import...
def get_devstudio_versions (): """Get list of devstudio versions from the Windows registry. Return a list of strings containing version numbers; the list will be empty if we were unable to access the registry (eg. couldn't import a registry-access module) or the appropriate registry keys weren't found.""" try: import...
12,147
def get_devstudio_versions (): """Get list of devstudio versions from the Windows registry. Return a list of strings containing version numbers; the list will be empty if we were unable to access the registry (eg. couldn't import a registry-access module) or the appropriate registry keys weren't found.""" try: import...
def get_devstudio_versions (): """Get list of devstudio versions from the Windows registry. Return a list of strings containing version numbers; the list will be empty if we were unable to access the registry (eg. couldn't import a registry-access module) or the appropriate registry keys weren't found.""" try: import...
12,148
def get_msvc_paths (path, version='6.0', platform='x86'): """Get a list of devstudio directories (include, lib or path). Return a list of strings; will be empty list if unable to access the registry or appropriate registry keys not found.""" try: import win32api import win32con except ImportError: return [] L = [] i...
def get_msvc_paths (path, version='6.0', platform='x86'): """Get a list of devstudio directories (include, lib or path). Return a list of strings; will be empty list if unable to access the registry or appropriate registry keys not found.""" if not _can_read_reg: return [] L = [] if path=='lib': path= 'Library' path...
12,149
def get_msvc_paths (path, version='6.0', platform='x86'): """Get a list of devstudio directories (include, lib or path). Return a list of strings; will be empty list if unable to access the registry or appropriate registry keys not found.""" try: import win32api import win32con except ImportError: return [] L = [] i...
def get_msvc_paths (path, version='6.0', platform='x86'): """Get a list of devstudio directories (include, lib or path). Return a list of strings; will be empty list if unable to access the registry or appropriate registry keys not found.""" try: import win32api import win32con except ImportError: return [] L = [] i...
12,150
def get_msvc_paths (path, version='6.0', platform='x86'): """Get a list of devstudio directories (include, lib or path). Return a list of strings; will be empty list if unable to access the registry or appropriate registry keys not found.""" try: import win32api import win32con except ImportError: return [] L = [] i...
def get_msvc_paths (path, version='6.0', platform='x86'): """Get a list of devstudio directories (include, lib or path). Return a list of strings; will be empty list if unable to access the registry or appropriate registry keys not found.""" try: import win32api import win32con except ImportError: return [] L = [] i...
12,151
def get_msvc_paths (path, version='6.0', platform='x86'): """Get a list of devstudio directories (include, lib or path). Return a list of strings; will be empty list if unable to access the registry or appropriate registry keys not found.""" try: import win32api import win32con except ImportError: return [] L = [] i...
def get_msvc_paths (path, version='6.0', platform='x86'): """Get a list of devstudio directories (include, lib or path). Return a list of strings; will be empty list if unable to access the registry or appropriate registry keys not found.""" try: import win32api import win32con except ImportError: return [] L = [] i...
12,152
def get_msvc_paths (path, version='6.0', platform='x86'): """Get a list of devstudio directories (include, lib or path). Return a list of strings; will be empty list if unable to access the registry or appropriate registry keys not found.""" try: import win32api import win32con except ImportError: return [] L = [] i...
def get_msvc_paths (path, version='6.0', platform='x86'): """Get a list of devstudio directories (include, lib or path). Return a list of strings; will be empty list if unable to access the registry or appropriate registry keys not found.""" try: import win32api import win32con except ImportError: return [] L = [] i...
12,153
def get_msvc_paths (path, version='6.0', platform='x86'): """Get a list of devstudio directories (include, lib or path). Return a list of strings; will be empty list if unable to access the registry or appropriate registry keys not found.""" try: import win32api import win32con except ImportError: return [] L = [] i...
def get_msvc_paths (path, version='6.0', platform='x86'): """Get a list of devstudio directories (include, lib or path). Return a list of strings; will be empty list if unable to access the registry or appropriate registry keys not found.""" try: import win32api import win32con except ImportError: return [] L = [] i...
12,154
def setuppimp(self, url): self.pimpprefs = pimp.PimpPreferences() self.pimpdb = pimp.PimpDatabase(self.pimpprefs) self.pimpinstaller = pimp.PimpInstaller(self.pimpdb) if not url: url = self.pimpprefs.pimpDatabase try: self.pimpdb.appendURL(url) except IOError, arg: return "Cannot open %s: %s" % (url, arg) return None
def setuppimp(self, url): self.pimpprefs = pimp.PimpPreferences() self.pimpdb = pimp.PimpDatabase(self.pimpprefs) self.pimpinstaller = pimp.PimpInstaller(self.pimpdb) if not url: url = self.pimpprefs.pimpDatabase try: self.pimpdb.appendURL(url) except IOError, arg: return "Cannot open %s: %s" % (url, arg) return self.p...
12,155
def choose_boundary(): """Return a random string usable as a multipart boundary. The method used is so that it is *very* unlikely that the same string of characters will every occur again in the Universe, so the caller needn't check the data it is packing for the occurrence of the boundary. The boundary contains dots ...
def choose_boundary(): """Return a string usable as a multipart boundary. The string chosen is unique within a single program run, and incorporates the user id (if available), process id (if available), and current time. So it's very unlikely the returned string appears in message text, but there's no guarantee. The...
12,156
def choose_boundary(): """Return a random string usable as a multipart boundary. The method used is so that it is *very* unlikely that the same string of characters will every occur again in the Universe, so the caller needn't check the data it is packing for the occurrence of the boundary. The boundary contains dots ...
def choose_boundary(): """Return a random string usable as a multipart boundary. The method used is so that it is *very* unlikely that the same string of characters will every occur again in the Universe, so the caller needn't check the data it is packing for the occurrence of the boundary. The boundary contains dots ...
12,157
def replaceall(self): editor = findeditor(self) if not editor: return if self.visible: self.getparmsfromwindow() W.SetCursor("watch") find = self.parms["find"] if not find: return findlen = len(find) replace = self.parms["replace"] replacelen = len(replace) Text = editor.get() if not self.parms["casesens"]: find = stri...
def replaceall(self): editor = findeditor(self) if not editor: return if self.visible: self.getparmsfromwindow() W.SetCursor("watch") find = self.parms["find"] if not find: return findlen = len(find) replace = self.parms["replace"] replacelen = len(replace) Text = editor.get() if not self.parms["casesens"]: find = stri...
12,158
def test_cwd(self): tmpdir = os.getenv("TEMP", "/tmp") tmpdir = os.path.realpath(tmpdir) p = subprocess.Popen([sys.executable, "-c", 'import sys,os;' \ 'sys.stdout.write(os.getcwd())'], stdout=subprocess.PIPE, cwd=tmpdir) normcase = os.path.normcase self.assertEqual(normcase(p.stdout.read()), normcase(tmpdir))
def test_cwd(self): tmpdir = os.getenv("TEMP", "/tmp") cwd = os.getcwd() os.chdir(tmpdir) tmpdir = os.getcwd() os.chdir(cwd) p = subprocess.Popen([sys.executable, "-c", 'import sys,os;' \ 'sys.stdout.write(os.getcwd())'], stdout=subprocess.PIPE, cwd=tmpdir) normcase = os.path.normcase self.assertEqual(normcase(p.stdo...
12,159
def _test(): import doctest import sys verbose = "-v" in sys.argv for mod in modules: doctest.testmod(mod, verbose=verbose, report=0) doctest.master.summarize()
def _test(): import doctest import sys verbose = "-v" in sys.argv for mod in modules: doctest.testmod(mod, verbose=verbose, report=0) doctest.master.summarize()
12,160
def tabnanny(self, filename): import tabnanny import tokenize tabnanny.reset_globals() f = open(filename, 'r') try: tokenize.tokenize(f.readline, tabnanny.tokeneater) except tokenize.TokenError, msg: self.errorbox("Token error", "Token error:\n%s" % str(msg)) return 0 except tabnanny.NannyNag, nag: # The error messages...
def tabnanny(self, filename): import tabnanny import tokenize f = open(filename, 'r') try: tokenize.tokenize(f.readline, tabnanny.tokeneater) except tokenize.TokenError, msg: self.errorbox("Token error", "Token error:\n%s" % str(msg)) return 0 except tabnanny.NannyNag, nag: # The error messages from tabnanny are too co...
12,161
def tabnanny(self, filename): import tabnanny import tokenize tabnanny.reset_globals() f = open(filename, 'r') try: tokenize.tokenize(f.readline, tabnanny.tokeneater) except tokenize.TokenError, msg: self.errorbox("Token error", "Token error:\n%s" % str(msg)) return 0 except tabnanny.NannyNag, nag: # The error messages...
def tabnanny(self, filename): import tabnanny import tokenize tabnanny.reset_globals() f = open(filename, 'r') try: tabnanny.process_tokens(tokenize.generate_tokens(f.readline)) except tokenize.TokenError, msg: self.errorbox("Token error", "Token error:\n%s" % str(msg)) return 0 except tabnanny.NannyNag, nag: # The err...
12,162
def __init__(self, sock, debuglevel=0): self.fp = sock.makefile('rb', 0) self.debuglevel = debuglevel
def __init__(self, sock, debuglevel=0, strict=0): self.fp = sock.makefile('rb', 0) self.debuglevel = debuglevel
12,163
def _read_status(self): line = self.fp.readline() if self.debuglevel > 0: print "reply:", repr(line) try: [version, status, reason] = line.split(None, 2) except ValueError: try: [version, status] = line.split(None, 1) reason = "" except ValueError: version = "HTTP/0.9" status = "200" reason = "" if version[:5] != 'HTTP...
def _read_status(self): line = self.fp.readline() if self.debuglevel > 0: print "reply:", repr(line) try: [version, status, reason] = line.split(None, 2) except ValueError: try: [version, status] = line.split(None, 1) reason = "" except ValueError: version = "HTTP/0.9" status = "200" reason = "" if version[:5] != 'HTTP...
12,164
def getheader(self, name, default=None): if self.msg is None: raise ResponseNotReady() return self.msg.getheader(name, default)
def getheader(self, name, default=None): if self.msg is None: raise ResponseNotReady() return self.msg.getheader(name, default)
12,165
def __init__(self, host, port=None): self.sock = None self.__response = None self.__state = _CS_IDLE
def __init__(self, host, port=None): self.sock = None self.__response = None self.__state = _CS_IDLE
12,166
def getresponse(self): "Get the response from the server."
def getresponse(self): "Get the response from the server."
12,167
def __init__(self, host, port=None, key_file=None, cert_file=None): HTTPConnection.__init__(self, host, port) self.key_file = key_file self.cert_file = cert_file
def __init__(self, host, port=None, key_file=None, cert_file=None, strict=None): HTTPConnection.__init__(self, host, port, strict) self.key_file = key_file self.cert_file = cert_file
12,168
def __init__(self, host='', port=None): "Provide a default host, since the superclass requires one."
def __init__(self, host='', port=None, strict=None): "Provide a default host, since the superclass requires one."
12,169
def __init__(self, host='', port=None): "Provide a default host, since the superclass requires one."
def __init__(self, host='', port=None): "Provide a default host, since the superclass requires one."
12,170
def __init__(self, host='', port=None, **x509): # provide a default host, pass the X509 cert info
def __init__(self, host='', port=None, key_file=None, cert_file=None, strict=None): # provide a default host, pass the X509 cert info
12,171
def __init__(self, host='', port=None, **x509): # provide a default host, pass the X509 cert info
def __init__(self, host='', port=None, **x509): # provide a default host, pass the X509 cert info
12,172
def __init__(self, host='', port=None, **x509): # provide a default host, pass the X509 cert info
def __init__(self, host='', port=None, **x509): # provide a default host, pass the X509 cert info
12,173
def dist(distname='',version='',id='', supported_dists=('SuSE','debian','redhat','mandrake')): """ Tries to determine the name of the Linux OS distribution name. The function first looks for a distribution release file in /etc and then reverts to _dist_try_harder() in case no suitable files are found. Returns a tup...
def dist(distname='',version='',id='', supported_dists=('SuSE', 'debian', 'fedora', 'redhat', 'mandrake')): """ Tries to determine the name of the Linux OS distribution name. The function first looks for a distribution release file in /etc and then reverts to _dist_try_harder() in case no suitable files are found. ...
12,174
def run (self):
def run (self):
12,175
def create_inifile (self): # Create an inifile containing data describing the installation. # This could be done without creating a real file, but # a file is (at least) useful for debugging bdist_wininst.
def create_inifile (self): # Create an inifile containing data describing the installation. # This could be done without creating a real file, but # a file is (at least) useful for debugging bdist_wininst.
12,176
def create_inifile (self): # Create an inifile containing data describing the installation. # This could be done without creating a real file, but # a file is (at least) useful for debugging bdist_wininst.
def create_inifile (self): # Create an inifile containing data describing the installation. # This could be done without creating a real file, but # a file is (at least) useful for debugging bdist_wininst.
12,177
def create_inifile (self): # Create an inifile containing data describing the installation. # This could be done without creating a real file, but # a file is (at least) useful for debugging bdist_wininst.
def create_inifile (self): # Create an inifile containing data describing the installation. # This could be done without creating a real file, but # a file is (at least) useful for debugging bdist_wininst.
12,178
def create_exe (self, arcname, fullname): import struct, zlib
def create_exe (self, arcname, fullname): import struct, zlib
12,179
def create_exe (self, arcname, fullname): import struct, zlib
def create_exe (self, arcname, fullname): import struct, zlib
12,180
def create_exe (self, arcname, fullname): import struct, zlib
def create_exe (self, arcname, fullname): import struct, zlib
12,181
def get_exe_bytes (self): import zlib, base64 return zlib.decompress (base64.decodestring (EXEDATA))
def get_exe_bytes (self): import zlib, base64 return zlib.decompress (base64.decodestring (EXEDATA))
12,182
def get_exe_bytes (self): import zlib, base64 return zlib.decompress (base64.decodestring (EXEDATA))
def get_exe_bytes (self): import zlib, base64 return zlib.decompress (base64.decodestring (EXEDATA))
12,183
def get_exe_bytes (self): import zlib, base64 return zlib.decompress (base64.decodestring (EXEDATA))
def get_exe_bytes (self): import zlib, base64 return zlib.decompress (base64.decodestring (EXEDATA))
12,184
def get_exe_bytes (self): import zlib, base64 return zlib.decompress (base64.decodestring (EXEDATA))
def get_exe_bytes (self): import zlib, base64 return zlib.decompress (base64.decodestring (EXEDATA))
12,185
def testboth(formatstr, *args): testformat(formatstr, *args) testformat(unicode(formatstr), *args)
def testboth(formatstr, *args): testformat(formatstr, *args) testformat(unicode(formatstr), *args)
12,186
def test_getstatus(self): # This pattern should match 'ls -ld /bin/ls' on any posix # system, however perversely configured. pat = r'''[l-]..x..x..x # It is executable. (May be a symlink.) \s+\d+ # It has some number of links. \s+\w+\s+\w+ # It has a user and group, which may # be named anything. [^/]* ...
def test_getstatus(self): # This pattern should match 'ls -ld /bin/ls' on any posix # system, however perversely configured. pat = r'''[l-]..x..x..x # It is executable. (May be a symlink.) \s+\d+ # It has some number of links. \s+\w+\s+\w+ # It has a user and group, which may # be named anything. [^/]* ...
12,187
def test_getstatus(self): # This pattern should match 'ls -ld /bin/ls' on any posix # system, however perversely configured. pat = r'''[l-]..x..x..x # It is executable. (May be a symlink.) \s+\d+ # It has some number of links. \s+\w+\s+\w+ # It has a user and group, which may # be named anything. [^/]* ...
def test_getstatus(self): # This pattern should match 'ls -ld /bin/ls' on any posix # system, however perversely configured. pat = r'''d......... # It is executable. (May be a symlink.) \s+\d+ # It has some number of links. \s+\w+\s+\w+ # It has a user and group, which may # be named anything. [^/]* # ...
12,188
def test_getstatus(self): # This pattern should match 'ls -ld /bin/ls' on any posix # system, however perversely configured. pat = r'''[l-]..x..x..x # It is executable. (May be a symlink.) \s+\d+ # It has some number of links. \s+\w+\s+\w+ # It has a user and group, which may # be named anything. [^/]* ...
def test_getstatus(self): # This pattern should match 'ls -ld /bin/ls' on any posix # system, however perversely configured. pat = r'''[l-]..x..x..x # It is executable. (May be a symlink.) \s+\d+ # It has some number of links. \s+\w+\s+\w+ # It has a user and group, which may # be named anything. [^/]* ...
12,189
def test_getstatus(self): # This pattern should match 'ls -ld /bin/ls' on any posix # system, however perversely configured. pat = r'''[l-]..x..x..x # It is executable. (May be a symlink.) \s+\d+ # It has some number of links. \s+\w+\s+\w+ # It has a user and group, which may # be named anything. [^/]* ...
def test_getstatus(self): # This pattern should match 'ls -ld /bin/ls' on any posix # system, however perversely configured. pat = r'''[l-]..x..x..x # It is executable. (May be a symlink.) \s+\d+ # It has some number of links. \s+\w+\s+\w+ # It has a user and group, which may # be named anything. [^/]* ...
12,190
def __getitem__(self, i): if i >= 0 and i < 3: return i raise IndexError
def __getitem__(self, i): if i >= 0 and i < 3: return i raise IndexError
12,191
def __getitem__(self, i): if i >= 0 and i < 3: return i raise IndexError
def __getitem__(self, i): if i >= 0 and i < 3: return i raise IndexError
12,192
def __getitem__(self, i): if i >= 0 and i < 3: return i raise IndexError
def __getitem__(self, i): if i >= 0 and i < 3: return i raise IndexError
12,193
def __getitem__(self, i): if i >= 0 and i < 3: return i raise IndexError
def __getitem__(self, i): if i >= 0 and i < 3: return i raise IndexError
12,194
def __getitem__(self, i): if i >= 0 and i < 3: return i raise IndexError
def __getitem__(self, i): if i >= 0 and i < 3: return i raise IndexError
12,195
def __getitem__(self, i): if i >= 0 and i < 3: return i raise IndexError
def __getitem__(self, i): if i >= 0 and i < 3: return i raise IndexError
12,196
def __getitem__(self, i): if i >= 0 and i < 3: return i raise IndexError
def __getitem__(self, i): if i >= 0 and i < 3: return i raise IndexError
12,197
def __getitem__(self, i): if i >= 0 and i < 3: return i raise IndexError
def>>> class Seq: ... def __getitem__(self, i): ... if i >= 0 and i < 3: return i ... raise IndexError ... >>> a, b, c = Seq() >>> a == 0 and b == 1 and c == 2 True __getitem__(self,>>> class Seq: ... def __getitem__(self, i): ... if i >= 0 and i < 3: return i ... raise IndexErro...
12,198
def __getitem__(self, i): if i >= 0 and i < 3: return i raise IndexError
def __getitem__(self, i): if i >= 0 and i < 3: return i raise IndexError
12,199