rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
getattr(self, self.__testMethodName)()
getattr(self, self._testMethodName)()
def debug(self): """Run the test without collecting errors in a TestResult""" self.setUp() getattr(self, self.__testMethodName)() self.tearDown()
81cdb4ebe1e8062168f44f12c80e0426344add31 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/81cdb4ebe1e8062168f44f12c80e0426344add31/unittest.py
def __exc_info(self):
def _exc_info(self):
def __exc_info(self): """Return a version of sys.exc_info() with the traceback frame minimised; usually the top level of the traceback frame is not needed. """ exctype, excvalue, tb = sys.exc_info() if sys.platform[:4] == 'java': ## tracebacks look different in Jython return (exctype, excvalue, tb) return (exctype, excvalue, tb)
81cdb4ebe1e8062168f44f12c80e0426344add31 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/81cdb4ebe1e8062168f44f12c80e0426344add31/unittest.py
self.literal = 0
def parse_endtag(self, i): rawdata = self.rawdata end = endbracketfind.match(rawdata, i+1) if end is None: return -1 res = tagfind.match(rawdata, i+2) if res is None: if self.literal: self.handle_data(rawdata[i]) return i+1 if not self.__accept_missing_endtag_name: self.syntax_error('no name specified in end tag') tag = self.stack[-1][0] k = i+2 else: tag = res.group(0) if self.__map_case: tag = tag.lower() if self.literal: if not self.stack or tag != self.stack[-1][0]: self.handle_data(rawdata[i]) return i+1 self.literal = 0 k = res.end(0) if endbracket.match(rawdata, k) is None: self.syntax_error('garbage in end tag') self.finish_endtag(tag) return end.end(0)
538453e1554166053786d35329edd0000d24f10d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/538453e1554166053786d35329edd0000d24f10d/xmllib.py
main()
def testtype(type, example): a = array.array(type) a.append(example) if verbose: print 40*'*' print 'array after append: ', a a.typecode a.itemsize if a.typecode in ('i', 'b', 'h', 'l'): a.byteswap() if a.typecode == 'c': f = open(TESTFN, "w") f.write("The quick brown fox jumps over the lazy dog.\n") f.close() f = open(TESTFN, 'r') a.fromfile(f, 10) f.close() if verbose: print 'char array with 10 bytes of TESTFN appended: ', a a.fromlist(['a', 'b', 'c']) if verbose: print 'char array with list appended: ', a a.insert(0, example) if verbose: print 'array of %s after inserting another:' % a.typecode, a f = open(TESTFN, 'w') a.tofile(f) f.close() a.tolist() a.tostring() if verbose: print 'array of %s converted to a list: ' % a.typecode, a.tolist() if verbose: print 'array of %s converted to a string: ' \ % a.typecode, `a.tostring()` if type == 'c': a = array.array(type, "abcde") a[:-1] = a if a != array.array(type, "abcdee"): raise TestFailed, "array(%s) self-slice-assign (head)" % `type` a = array.array(type, "abcde") a[1:] = a if a != array.array(type, "aabcde"): raise TestFailed, "array(%s) self-slice-assign (tail)" % `type` a = array.array(type, "abcde") a[1:-1] = a if a != array.array(type, "aabcdee"): raise TestFailed, "array(%s) self-slice-assign (cntr)" % `type` else: a = array.array(type, [1, 2, 3, 4, 5]) a[:-1] = a if a != array.array(type, [1, 2, 3, 4, 5, 5]): raise TestFailed, "array(%s) self-slice-assign (head)" % `type` a = array.array(type, [1, 2, 3, 4, 5]) a[1:] = a if a != array.array(type, [1, 1, 2, 3, 4, 5]): raise TestFailed, "array(%s) self-slice-assign (tail)" % `type` a = array.array(type, [1, 2, 3, 4, 5]) a[1:-1] = a if a != array.array(type, [1, 1, 2, 3, 4, 5, 5]): raise TestFailed, "array(%s) self-slice-assign (cntr)" % `type`
7833447f8f41d09749796cfa5e96788bccbab7a0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7833447f8f41d09749796cfa5e96788bccbab7a0/test_array.py
if importer is None:
if importer in (None, True, False):
def get_importer(path_item): """Retrieve a PEP 302 importer for the given path item The returned importer is cached in sys.path_importer_cache if it was newly created by a path hook. If there is no importer, a wrapper around the basic import machinery is returned. This wrapper is never inserted into the importer cache (None is inserted instead). The cache (or part of it) can be cleared manually if a rescan of sys.path_hooks is necessary. """ try: importer = sys.path_importer_cache[path_item] except KeyError: for path_hook in sys.path_hooks: try: importer = path_hook(path_item) break except ImportError: pass else: importer = None sys.path_importer_cache.setdefault(path_item, importer) if importer is None: try: importer = ImpImporter(path_item) except ImportError: pass return importer
f4ef11659cda2ef0d56df499525818a132e6836a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f4ef11659cda2ef0d56df499525818a132e6836a/pkgutil.py
pass
importer = None
def get_importer(path_item): """Retrieve a PEP 302 importer for the given path item The returned importer is cached in sys.path_importer_cache if it was newly created by a path hook. If there is no importer, a wrapper around the basic import machinery is returned. This wrapper is never inserted into the importer cache (None is inserted instead). The cache (or part of it) can be cleared manually if a rescan of sys.path_hooks is necessary. """ try: importer = sys.path_importer_cache[path_item] except KeyError: for path_hook in sys.path_hooks: try: importer = path_hook(path_item) break except ImportError: pass else: importer = None sys.path_importer_cache.setdefault(path_item, importer) if importer is None: try: importer = ImpImporter(path_item) except ImportError: pass return importer
f4ef11659cda2ef0d56df499525818a132e6836a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f4ef11659cda2ef0d56df499525818a132e6836a/pkgutil.py
path = path + "index.html"
path = path + "index.html"
def savefilename(self, url): type, rest = urllib.splittype(url) host, path = urllib.splithost(rest) while path[:1] == "/": path = path[1:] user, host = urllib.splituser(host) host, port = urllib.splitnport(host) host = string.lower(host) if not path or path[-1] == "/": path = path + "index.html" if os.sep != "/": path = string.join(string.split(path, "/"), os.sep) path = os.path.join(host, path) return path
f3335e193bd783ee8a57655091ea44a8b8f28c59 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f3335e193bd783ee8a57655091ea44a8b8f28c59/websucker.py
return Utils.collapse_rfc2231_value(boundary).strip()
return Utils.collapse_rfc2231_value(boundary).rstrip()
def get_boundary(self, failobj=None): """Return the boundary associated with the payload if present.
93d9d5fb37cca015444e4579d260eac8eacad96f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/93d9d5fb37cca015444e4579d260eac8eacad96f/Message.py
str = '%s %s%s' % (cmd, args, CRLF)
if args == "": str = '%s%s' % (cmd, CRLF) else: str = '%s %s%s' % (cmd, args, CRLF)
def putcmd(self, cmd, args=""): """Send a command to the server.""" str = '%s %s%s' % (cmd, args, CRLF) self.send(str)
db23d3dbf73e3a1a0f9caa0e0a026aa933a61e9d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/db23d3dbf73e3a1a0f9caa0e0a026aa933a61e9d/smtplib.py
optionlist = string.join(options, ' ') self.putcmd("mail", "FROM:%s %s" % (quoteaddr(sender) ,optionlist))
optionlist = ' ' + string.join(options, ' ') self.putcmd("mail", "FROM:%s%s" % (quoteaddr(sender) ,optionlist))
def mail(self,sender,options=[]): """SMTP 'mail' command -- begins mail xfer session.""" optionlist = '' if options and self.does_esmtp: optionlist = string.join(options, ' ') self.putcmd("mail", "FROM:%s %s" % (quoteaddr(sender) ,optionlist)) return self.getreply()
db23d3dbf73e3a1a0f9caa0e0a026aa933a61e9d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/db23d3dbf73e3a1a0f9caa0e0a026aa933a61e9d/smtplib.py
def index(path, archivo, output):
def index(path, indexpage, output):
def index(path, archivo, output): f = formatter.AbstractFormatter(AlmostNullWriter()) parser = IdxHlpHtmlParser(f) parser.path = path parser.ft = output fil = path + '/' + archivo parser.feed(open(fil).read()) parser.close()
d9a10509ace3fc749d299bd5c117c745f72275d7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d9a10509ace3fc749d299bd5c117c745f72275d7/prechm.py
fil = path + '/' + archivo parser.feed(open(fil).read())
f = open(path + '/' + indexpage) parser.feed(f.read())
def index(path, archivo, output): f = formatter.AbstractFormatter(AlmostNullWriter()) parser = IdxHlpHtmlParser(f) parser.path = path parser.ft = output fil = path + '/' + archivo parser.feed(open(fil).read()) parser.close()
d9a10509ace3fc749d299bd5c117c745f72275d7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d9a10509ace3fc749d299bd5c117c745f72275d7/prechm.py
def content(path, archivo, output):
f.close() def content(path, contentpage, output):
def index(path, archivo, output): f = formatter.AbstractFormatter(AlmostNullWriter()) parser = IdxHlpHtmlParser(f) parser.path = path parser.ft = output fil = path + '/' + archivo parser.feed(open(fil).read()) parser.close()
d9a10509ace3fc749d299bd5c117c745f72275d7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d9a10509ace3fc749d299bd5c117c745f72275d7/prechm.py
fil = path + '/' + archivo parser.feed(open(fil).read())
f = open(path + '/' + contentpage) parser.feed(f.read())
def content(path, archivo, output): f = formatter.AbstractFormatter(AlmostNullWriter()) parser = TocHlpHtmlParser(f) parser.path = path parser.ft = output fil = path + '/' + archivo parser.feed(open(fil).read()) parser.close()
d9a10509ace3fc749d299bd5c117c745f72275d7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d9a10509ace3fc749d299bd5c117c745f72275d7/prechm.py
print '\t', book[2] if book[4]: index(book[0], book[4], output)
print '\t', book.title, '-', book.indexpage if book.indexpage: index(book.directory, book.indexpage, output)
def do_index(library, output): output.write('<UL>\n') for book in library: print '\t', book[2] if book[4]: index(book[0], book[4], output) output.write('</UL>\n')
d9a10509ace3fc749d299bd5c117c745f72275d7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d9a10509ace3fc749d299bd5c117c745f72275d7/prechm.py
print '\t', book[2] output.write(object_sitemap % (book[0]+"/"+book[2], book[1])) if book[3]: content(book[0], book[3], output)
print '\t', book.title, '-', book.firstpage output.write(object_sitemap % (book.directory + "/" + book.firstpage, book.title)) if book.contentpage: content(book.directory, book.contentpage, output)
def do_content(library, version, output): output.write(contents_header % version) for book in library: print '\t', book[2] output.write(object_sitemap % (book[0]+"/"+book[2], book[1])) if book[3]: content(book[0], book[3], output) output.write(contents_footer)
d9a10509ace3fc749d299bd5c117c745f72275d7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d9a10509ace3fc749d299bd5c117c745f72275d7/prechm.py
directory = book[0]
directory = book.directory
def do_project(library, output, arch, version): output.write(project_template % locals()) for book in library: directory = book[0] path = directory + '\\%s\n' for page in os.listdir(directory): if page.endswith('.html') or page.endswith('.css'): output.write(path % page)
d9a10509ace3fc749d299bd5c117c745f72275d7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d9a10509ace3fc749d299bd5c117c745f72275d7/prechm.py
library = supported_libraries[ version ]
library = supported_libraries[version]
def do_it(args = None): if not args: args = sys.argv[1:] if not args: usage() try: optlist, args = getopt.getopt(args, 'ckpv:') except getopt.error, msg: print msg usage() if not args or len(args) > 1: usage() arch = args[0] version = None for opt in optlist: if opt[0] == '-v': version = opt[1] break if not version: usage() library = supported_libraries[ version ] if not (('-p','') in optlist): fname = arch + '.stp' f = openfile(fname) print "Building stoplist", fname, "..." words = stop_list.split() words.sort() for word in words: print >> f, word f.close() f = openfile(arch + '.hhp') print "Building Project..." do_project(library, f, arch, version) if version == '2.0.0': for image in os.listdir('icons'): f.write('icons'+ '\\' + image + '\n') f.close() if not (('-c','') in optlist): f = openfile(arch + '.hhc') print "Building Table of Content..." do_content(library, version, f) f.close() if not (('-k','') in optlist): f = openfile(arch + '.hhk') print "Building Index..." do_index(library, f) f.close()
d9a10509ace3fc749d299bd5c117c745f72275d7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d9a10509ace3fc749d299bd5c117c745f72275d7/prechm.py
if not modname:
if not modname or '.' in modname:
def search_function(encoding): # Cache lookup entry = _cache.get(encoding, _unknown) if entry is not _unknown: return entry # Import the module: # # First try to find an alias for the normalized encoding # name and lookup the module using the aliased name, then try to # lookup the module using the standard import scheme, i.e. first # try in the encodings package, then at top-level. # norm_encoding = normalize_encoding(encoding) aliased_encoding = _aliases.get(norm_encoding) or \ _aliases.get(norm_encoding.replace('.', '_')) if aliased_encoding is not None: modnames = [aliased_encoding, norm_encoding] else: modnames = [norm_encoding] for modname in modnames: if not modname: continue try: mod = __import__('encodings.' + modname, globals(), locals(), _import_tail) except ImportError: pass else: break else: mod = None try: getregentry = mod.getregentry except AttributeError: # Not a codec module mod = None if mod is None: # Cache misses _cache[encoding] = None return None # Now ask the module for the registry entry entry = getregentry() if not isinstance(entry, codecs.CodecInfo): if not 4 <= len(entry) <= 7: raise CodecRegistryError,\ 'module "%s" (%s) failed to register' % \ (mod.__name__, mod.__file__) if not callable(entry[0]) or \ not callable(entry[1]) or \ (entry[2] is not None and not callable(entry[2])) or \ (entry[3] is not None and not callable(entry[3])) or \ (len(entry) > 4 and entry[4] is not None and not callable(entry[4])) or \ (len(entry) > 5 and entry[5] is not None and not callable(entry[5])): raise CodecRegistryError,\ 'incompatible codecs in module "%s" (%s)' % \ (mod.__name__, mod.__file__) if len(entry)<7 or entry[6] is None: entry += (None,)*(6-len(entry)) + (mod.__name__.split(".", 1)[1],) entry = codecs.CodecInfo(*entry) # Cache the codec registry entry _cache[encoding] = entry # Register its aliases (without overwriting previously registered # aliases) try: codecaliases = mod.getaliases() except AttributeError: pass else: for alias in codecaliases: if not _aliases.has_key(alias): _aliases[alias] = modname # Return the registry entry return entry
1206a933cc0f485cc8764daba5564bf9677d8e02 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1206a933cc0f485cc8764daba5564bf9677d8e02/__init__.py
def translate(self, table, deletechars=""): return self.__class__(self.data.translate(table, deletechars))
def translate(self, *args): return self.__class__(self.data.translate(*args))
def translate(self, table, deletechars=""): return self.__class__(self.data.translate(table, deletechars))
a893957c8e0a514bc62f6ea7fe91a0ecf073fe83 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a893957c8e0a514bc62f6ea7fe91a0ecf073fe83/UserString.py
class SMTPRecipientsRefused(SMTPResponseException):
class SMTPRecipientsRefused(SMTPException):
def __init__(self, code, msg, sender): self.smtp_code = code self.smtp_error = msg self.sender = sender self.args = (code, msg, sender)
20c92283ab670079096377775fbd997efcd1d84a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/20c92283ab670079096377775fbd997efcd1d84a/smtplib.py
self.send(quotedata(msg)) self.send("%s.%s" % (CRLF, CRLF))
q = quotedata(msg) if q[-2:] != CRLF: q = q + CRLF q = q + "." + CRLF self.send(q)
def data(self,msg): """SMTP 'DATA' command -- sends message data to server.
20c92283ab670079096377775fbd997efcd1d84a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/20c92283ab670079096377775fbd997efcd1d84a/smtplib.py
classmethod test.test_descrtut.C 1
classmethod <class 'test.test_descrtut.C'> 1
... def foo(cls, y):
28bc76897757ed614dfdccbea7902043221fe141 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/28bc76897757ed614dfdccbea7902043221fe141/test_descrtut.py
classmethod test.test_descrtut.C 1
classmethod <class 'test.test_descrtut.C'> 1
... def foo(cls, y):
28bc76897757ed614dfdccbea7902043221fe141 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/28bc76897757ed614dfdccbea7902043221fe141/test_descrtut.py
classmethod test.test_descrtut.D 1
classmethod <class 'test.test_descrtut.D'> 1
... def foo(cls, y):
28bc76897757ed614dfdccbea7902043221fe141 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/28bc76897757ed614dfdccbea7902043221fe141/test_descrtut.py
classmethod test.test_descrtut.D 1
classmethod <class 'test.test_descrtut.D'> 1
... def foo(cls, y):
28bc76897757ed614dfdccbea7902043221fe141 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/28bc76897757ed614dfdccbea7902043221fe141/test_descrtut.py
classmethod test.test_descrtut.C 1
classmethod <class 'test.test_descrtut.C'> 1
... def foo(cls, y): # override C.foo
28bc76897757ed614dfdccbea7902043221fe141 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/28bc76897757ed614dfdccbea7902043221fe141/test_descrtut.py
classmethod test.test_descrtut.C 1
classmethod <class 'test.test_descrtut.C'> 1
... def foo(cls, y): # override C.foo
28bc76897757ed614dfdccbea7902043221fe141 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/28bc76897757ed614dfdccbea7902043221fe141/test_descrtut.py
>>> class A:
>>> class A:
... def setx(self, x):
28bc76897757ed614dfdccbea7902043221fe141 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/28bc76897757ed614dfdccbea7902043221fe141/test_descrtut.py
called A.save() >>> class A(object):
called C.save() >>> class A(object):
... def save(self):
28bc76897757ed614dfdccbea7902043221fe141 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/28bc76897757ed614dfdccbea7902043221fe141/test_descrtut.py
self.fp.write("\n%s = %s\n"%(pname, othername))
self.fp.write("\n_Prop_%s = _Prop_%s\n"%(pname, othername))
def compileproperty(self, prop): [name, code, what] = prop if code == 'c@#!': # Something silly with plurals. Skip it. return pname = identify(name) if self.namemappers[0].hascode('property', code): # plural forms and such othername, dummy, dummy = self.namemappers[0].findcodename('property', code) if pname == othername: return if self.fp: self.fp.write("\n%s = %s\n"%(pname, othername)) else: if self.fp: self.fp.write("class %s(aetools.NProperty):\n" % pname) self.fp.write('\t"""%s - %s """\n' % (ascii(name), ascii(what[1]))) self.fp.write("\twhich = %s\n" % `code`) self.fp.write("\twant = %s\n" % `what[0]`) self.namemappers[0].addnamecode('property', pname, code)
bc956056d401f0137e687f878a487fa2a16199df /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/bc956056d401f0137e687f878a487fa2a16199df/gensuitemodule.py
self.fp.write("class %s(aetools.NProperty):\n" % pname)
self.fp.write("class _Prop_%s(aetools.NProperty):\n" % pname)
def compileproperty(self, prop): [name, code, what] = prop if code == 'c@#!': # Something silly with plurals. Skip it. return pname = identify(name) if self.namemappers[0].hascode('property', code): # plural forms and such othername, dummy, dummy = self.namemappers[0].findcodename('property', code) if pname == othername: return if self.fp: self.fp.write("\n%s = %s\n"%(pname, othername)) else: if self.fp: self.fp.write("class %s(aetools.NProperty):\n" % pname) self.fp.write('\t"""%s - %s """\n' % (ascii(name), ascii(what[1]))) self.fp.write("\twhich = %s\n" % `code`) self.fp.write("\twant = %s\n" % `what[0]`) self.namemappers[0].addnamecode('property', pname, code)
bc956056d401f0137e687f878a487fa2a16199df /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/bc956056d401f0137e687f878a487fa2a16199df/gensuitemodule.py
self.fp.write("\t'%s' : %s,\n"%(n, n))
self.fp.write("\t'%s' : _Prop_%s,\n"%(n, n))
def fillclasspropsandelems(self, cls): [name, code, desc, properties, elements] = cls cname = identify(name) if self.namemappers[0].hascode('class', code) and \ self.namemappers[0].findcodename('class', code)[0] != cname: # This is an other name (plural or so) for something else. Skip. if self.fp and (elements or len(properties) > 1 or (len(properties) == 1 and properties[0][1] != 'c@#!')): if self.verbose: print >>self.verbose, '** Skip multiple %s of %s (code %s)' % (cname, self.namemappers[0].findcodename('class', code)[0], `code`) raise RuntimeError, "About to skip non-empty class" return plist = [] elist = [] superclasses = [] for prop in properties: [pname, pcode, what] = prop if pcode == "c@#^": superclasses.append(what) if pcode == 'c@#!': continue pname = identify(pname) plist.append(pname)
bc956056d401f0137e687f878a487fa2a16199df /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/bc956056d401f0137e687f878a487fa2a16199df/gensuitemodule.py
self.fp.write("\n_propdeclarations = {\n") proplist = self.namemappers[0].getall('property') proplist.sort() for k, v in proplist: self.fp.write("\t%s : %s,\n" % (`k`, v)) self.fp.write("}\n") self.fp.write("\n_compdeclarations = {\n") complist = self.namemappers[0].getall('comparison') complist.sort() for k, v in complist: self.fp.write("\t%s : %s,\n" % (`k`, v)) self.fp.write("}\n") self.fp.write("\n_enumdeclarations = {\n") enumlist = self.namemappers[0].getall('enum') enumlist.sort() for k, v in enumlist: self.fp.write("\t%s : %s,\n" % (`k`, v)) self.fp.write("}\n")
def dumpindex(self): if not self.fp: return self.fp.write("\n#\n# Indices of types declared in this module\n#\n") self.fp.write("_classdeclarations = {\n") classlist = self.namemappers[0].getall('class') classlist.sort() for k, v in classlist: self.fp.write("\t%s : %s,\n" % (`k`, v)) self.fp.write("}\n") self.fp.write("\n_propdeclarations = {\n") proplist = self.namemappers[0].getall('property') proplist.sort() for k, v in proplist: self.fp.write("\t%s : %s,\n" % (`k`, v)) self.fp.write("}\n") self.fp.write("\n_compdeclarations = {\n") complist = self.namemappers[0].getall('comparison') complist.sort() for k, v in complist: self.fp.write("\t%s : %s,\n" % (`k`, v)) self.fp.write("}\n") self.fp.write("\n_enumdeclarations = {\n") enumlist = self.namemappers[0].getall('enum') enumlist.sort() for k, v in enumlist: self.fp.write("\t%s : %s,\n" % (`k`, v)) self.fp.write("}\n")
bc956056d401f0137e687f878a487fa2a16199df /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/bc956056d401f0137e687f878a487fa2a16199df/gensuitemodule.py
attrs.getQNames() == [] and \
(attrs.getQNames() == [] or attrs.getQNames() == ["ns:attr"]) and \
def test_expat_nsattrs_wattr(): parser = create_parser(1) gather = AttrGatherer() parser.setContentHandler(gather) parser.feed("<doc xmlns:ns='%s' ns:attr='val'/>" % ns_uri) parser.close() attrs = gather._attrs return attrs.getLength() == 1 and \ attrs.getNames() == [(ns_uri, "attr")] and \ attrs.getQNames() == [] and \ len(attrs) == 1 and \ attrs.has_key((ns_uri, "attr")) and \ attrs.keys() == [(ns_uri, "attr")] and \ attrs.get((ns_uri, "attr")) == "val" and \ attrs.get((ns_uri, "attr"), 25) == "val" and \ attrs.items() == [((ns_uri, "attr"), "val")] and \ attrs.values() == ["val"] and \ attrs.getValue((ns_uri, "attr")) == "val" and \ attrs[(ns_uri, "attr")] == "val"
d2909c901e194bd504f65e18b37cafcec43bfcd9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d2909c901e194bd504f65e18b37cafcec43bfcd9/test_sax.py
return eval("self.%s" % attr.lower())
return getattr(self, attr.lower())
def __getattr__(self, attr): # Allow UPPERCASE variants of IMAP4 command methods. if Commands.has_key(attr): return eval("self.%s" % attr.lower()) raise AttributeError("Unknown IMAP4 command: '%s'" % attr)
15e5d5344d572e78397473e5fbba38e9d25d7b0f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/15e5d5344d572e78397473e5fbba38e9d25d7b0f/imaplib.py
def __getattr__(self, attr): # Allow UPPERCASE variants of IMAP4 command methods. if Commands.has_key(attr): return eval("self.%s" % attr.lower()) raise AttributeError("Unknown IMAP4 command: '%s'" % attr)
15e5d5344d572e78397473e5fbba38e9d25d7b0f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/15e5d5344d572e78397473e5fbba38e9d25d7b0f/imaplib.py
"""Setup 'self.sock' and 'self.file'."""
"""Setup connection to remote server on "host:port". This connection will be used by the routines: read, readline, send, shutdown. """
def open(self, host, port): """Setup 'self.sock' and 'self.file'.""" self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.connect((self.host, self.port)) self.file = self.sock.makefile('r')
15e5d5344d572e78397473e5fbba38e9d25d7b0f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/15e5d5344d572e78397473e5fbba38e9d25d7b0f/imaplib.py
def socket(self): """Return socket instance used to connect to IMAP4 server. socket = <instance>.socket() """ return self.sock
def response(self, code): """Return data for response 'code' if received, or None.
15e5d5344d572e78397473e5fbba38e9d25d7b0f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/15e5d5344d572e78397473e5fbba38e9d25d7b0f/imaplib.py
self.file.close() self.sock.close()
self.shutdown()
def logout(self): """Shutdown connection to server.
15e5d5344d572e78397473e5fbba38e9d25d7b0f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/15e5d5344d572e78397473e5fbba38e9d25d7b0f/imaplib.py
charset = 'CHARSET ' + charset typ, dat = apply(self._simple_command, (name, charset) + criteria)
typ, dat = apply(self._simple_command, (name, 'CHARSET', charset) + criteria) else: typ, dat = apply(self._simple_command, (name,) + criteria)
def search(self, charset, *criteria): """Search mailbox for matching messages.
15e5d5344d572e78397473e5fbba38e9d25d7b0f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/15e5d5344d572e78397473e5fbba38e9d25d7b0f/imaplib.py
if self.PROTOCOL_VERSION == 'IMAP4': raise self.error('%s unimplemented in IMAP4 (obtain IMAP4rev1 server, or re-code)' % name)
def status(self, mailbox, names): """Request named status conditions for mailbox.
15e5d5344d572e78397473e5fbba38e9d25d7b0f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/15e5d5344d572e78397473e5fbba38e9d25d7b0f/imaplib.py
if command == 'SEARCH': name = 'SEARCH'
if command in ('SEARCH', 'SORT'): name = command
def uid(self, command, *args): """Execute "command arg ..." with messages identified by UID, rather than message number.
15e5d5344d572e78397473e5fbba38e9d25d7b0f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/15e5d5344d572e78397473e5fbba38e9d25d7b0f/imaplib.py
""" if name[0] != 'X' or not name in self.capabilities: raise self.error('unknown extension command: %s' % name)
Returns response appropriate to extension command `name'. """ name = name.upper() if not Commands.has_key(name): Commands[name] = (self.state,)
def xatom(self, name, *args): """Allow simple extension commands notified by server in CAPABILITY response.
15e5d5344d572e78397473e5fbba38e9d25d7b0f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/15e5d5344d572e78397473e5fbba38e9d25d7b0f/imaplib.py
def namespace(self): """ Returns IMAP namespaces ala rfc2342 """ name = 'NAMESPACE' typ, dat = self._simple_command(name) return self._untagged_response(typ, dat, name)
def namespace(self): """ Returns IMAP namespaces ala rfc2342 """ name = 'NAMESPACE' typ, dat = self._simple_command(name) return self._untagged_response(typ, dat, name)
15e5d5344d572e78397473e5fbba38e9d25d7b0f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/15e5d5344d572e78397473e5fbba38e9d25d7b0f/imaplib.py
self.sock.send('%s%s' % (data, CRLF)) except socket.error, val:
self.send('%s%s' % (data, CRLF)) except (socket.error, OSError), val:
def _command(self, name, *args):
15e5d5344d572e78397473e5fbba38e9d25d7b0f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/15e5d5344d572e78397473e5fbba38e9d25d7b0f/imaplib.py
self.sock.send(literal) self.sock.send(CRLF) except socket.error, val:
self.send(literal) self.send(CRLF) except (socket.error, OSError), val:
def _command(self, name, *args):
15e5d5344d572e78397473e5fbba38e9d25d7b0f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/15e5d5344d572e78397473e5fbba38e9d25d7b0f/imaplib.py
data = self.file.read(size)
data = self.read(size)
def _get_response(self):
15e5d5344d572e78397473e5fbba38e9d25d7b0f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/15e5d5344d572e78397473e5fbba38e9d25d7b0f/imaplib.py
line = self.file.readline()
line = self.readline()
def _get_line(self):
15e5d5344d572e78397473e5fbba38e9d25d7b0f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/15e5d5344d572e78397473e5fbba38e9d25d7b0f/imaplib.py
PASSWD = getpass.getpass("IMAP password for %s on %s:" % (USER, host or "localhost"))
PASSWD = getpass.getpass("IMAP password for %s on %s: " % (USER, host or "localhost"))
def print_log(): _mesg('last %d IMAP4 interactions:' % len(_cmd_log)) for secs,line in _cmd_log: _mesg(line, secs)
15e5d5344d572e78397473e5fbba38e9d25d7b0f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/15e5d5344d572e78397473e5fbba38e9d25d7b0f/imaplib.py
typ, dat = apply(eval('M.%s' % cmd), args)
typ, dat = apply(getattr(M, cmd), args)
def run(cmd, args): _mesg('%s %s' % (cmd, args)) typ, dat = apply(eval('M.%s' % cmd), args) _mesg('%s => %s %s' % (cmd, typ, dat)) return dat
15e5d5344d572e78397473e5fbba38e9d25d7b0f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/15e5d5344d572e78397473e5fbba38e9d25d7b0f/imaplib.py
"""Container for the properties of an event.
"""Container for the properties of an event.
def _cnfmerge(cnfs): """Internal function.""" if type(cnfs) is DictionaryType: return cnfs elif type(cnfs) in (NoneType, StringType): return cnfs else: cnf = {} for c in _flatten(cnfs): try: cnf.update(c) except (AttributeError, TypeError), msg: print "_cnfmerge: fallback due to:", msg for k, v in c.items(): cnf[k] = v return cnf
0a3f7978c40742672a01f3a5ea537e9f45b8b59f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0a3f7978c40742672a01f3a5ea537e9f45b8b59f/Tkinter.py
"""Return a tupel of x and y coordinates of the pointer on the root window."""
"""Return a tuple of x and y coordinates of the pointer on the root window."""
def winfo_pointerxy(self): """Return a tupel of x and y coordinates of the pointer on the root window.""" return self._getints( self.tk.call('winfo', 'pointerxy', self._w))
0a3f7978c40742672a01f3a5ea537e9f45b8b59f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0a3f7978c40742672a01f3a5ea537e9f45b8b59f/Tkinter.py
return getint(
return getint(
def winfo_pointery(self): """Return the y coordinate of the pointer on the root window.""" return getint( self.tk.call('winfo', 'pointery', self._w))
0a3f7978c40742672a01f3a5ea537e9f45b8b59f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0a3f7978c40742672a01f3a5ea537e9f45b8b59f/Tkinter.py
"""Return tupel of decimal values for red, green, blue for
"""Return tuple of decimal values for red, green, blue for
def winfo_rgb(self, color): """Return tupel of decimal values for red, green, blue for COLOR in this widget.""" return self._getints( self.tk.call('winfo', 'rgb', self._w, color))
0a3f7978c40742672a01f3a5ea537e9f45b8b59f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0a3f7978c40742672a01f3a5ea537e9f45b8b59f/Tkinter.py
if type(iterable) not in (list, tuple, dict, file, xrange, str): iterable = tuple(iterable) it = iter(iterable)
def _update(self, iterable): # The main loop for update() and the subclass __init__() methods. data = self._data
7cd83ca9adefadee172f252f4f89f24dc10cd715 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7cd83ca9adefadee172f252f4f89f24dc10cd715/sets.py
while True: try: for element in it:
if type(iterable) in (list, tuple, xrange): it = iter(iterable) while True: try: for element in it: data[element] = value return except TypeError: transform = getattr(element, "_as_immutable", None) if transform is None: raise data[transform()] = value else: for element in iterable: try:
def _update(self, iterable): # The main loop for update() and the subclass __init__() methods. data = self._data
7cd83ca9adefadee172f252f4f89f24dc10cd715 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7cd83ca9adefadee172f252f4f89f24dc10cd715/sets.py
return except TypeError: transform = getattr(element, "_as_immutable", None) if transform is None: raise data[transform()] = value
except TypeError: transform = getattr(element, "_as_immutable", None) if transform is None: raise data[transform()] = value
def _update(self, iterable): # The main loop for update() and the subclass __init__() methods. data = self._data
7cd83ca9adefadee172f252f4f89f24dc10cd715 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7cd83ca9adefadee172f252f4f89f24dc10cd715/sets.py
for (func, cmd) in self.sub_commands:
for (func, cmd_name) in self.sub_commands:
def run (self):
ba38d12063919288d6593593493cd37057d0ba67 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ba38d12063919288d6593593493cd37057d0ba67/install.py
self.run_peer (cmd)
self.run_peer (cmd_name)
def run (self):
ba38d12063919288d6593593493cd37057d0ba67 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ba38d12063919288d6593593493cd37057d0ba67/install.py
for (func, cmd) in self.sub_commands:
for (func, cmd_name) in self.sub_commands:
def get_outputs (self): # This command doesn't have any outputs of its own, so just # get the outputs of all its sub-commands. outputs = [] for (func, cmd) in self.sub_commands: if func is None or func(): outputs.extend (self.run_peer (cmd))
ba38d12063919288d6593593493cd37057d0ba67 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ba38d12063919288d6593593493cd37057d0ba67/install.py
outputs.extend (self.run_peer (cmd))
cmd = self.find_peer (cmd_name) outputs.extend (cmd.get_outputs())
def get_outputs (self): # This command doesn't have any outputs of its own, so just # get the outputs of all its sub-commands. outputs = [] for (func, cmd) in self.sub_commands: if func is None or func(): outputs.extend (self.run_peer (cmd))
ba38d12063919288d6593593493cd37057d0ba67 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ba38d12063919288d6593593493cd37057d0ba67/install.py
def _import_hook(self, fqname, globals=None, locals=None, fromlist=None): """Python calls this hook to locate and import a module."""
61d168a55ed08de951c69213a47896f637306908 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/61d168a55ed08de951c69213a47896f637306908/imputil.py
return top_module
if fromlist: return getattr(top_module, parts[1]) else: return top_module
def _import_hook(self, fqname, globals=None, locals=None, fromlist=None): """Python calls this hook to locate and import a module."""
61d168a55ed08de951c69213a47896f637306908 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/61d168a55ed08de951c69213a47896f637306908/imputil.py
self.buf = self.buf + string.joinfields(self.buflist, '')
self.buf += EMPTYSTRING.join(self.buflist)
def seek(self, pos, mode = 0): if self.closed: raise ValueError, "I/O operation on closed file" if self.buflist: self.buf = self.buf + string.joinfields(self.buflist, '') self.buflist = [] if mode == 1: pos = pos + self.pos elif mode == 2: pos = pos + self.len self.pos = max(0, pos)
c7ed0e3c1301fd27122e336eef7fd233526ccfc1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c7ed0e3c1301fd27122e336eef7fd233526ccfc1/StringIO.py
pos = pos + self.pos
pos += self.pos
def seek(self, pos, mode = 0): if self.closed: raise ValueError, "I/O operation on closed file" if self.buflist: self.buf = self.buf + string.joinfields(self.buflist, '') self.buflist = [] if mode == 1: pos = pos + self.pos elif mode == 2: pos = pos + self.len self.pos = max(0, pos)
c7ed0e3c1301fd27122e336eef7fd233526ccfc1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c7ed0e3c1301fd27122e336eef7fd233526ccfc1/StringIO.py
pos = pos + self.len
pos += self.len
def seek(self, pos, mode = 0): if self.closed: raise ValueError, "I/O operation on closed file" if self.buflist: self.buf = self.buf + string.joinfields(self.buflist, '') self.buflist = [] if mode == 1: pos = pos + self.pos elif mode == 2: pos = pos + self.len self.pos = max(0, pos)
c7ed0e3c1301fd27122e336eef7fd233526ccfc1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c7ed0e3c1301fd27122e336eef7fd233526ccfc1/StringIO.py
self.buf = self.buf + string.joinfields(self.buflist, '')
self.buf += EMPTYSTRING.join(self.buflist)
def read(self, n = -1): if self.closed: raise ValueError, "I/O operation on closed file" if self.buflist: self.buf = self.buf + string.joinfields(self.buflist, '') self.buflist = [] if n < 0: newpos = self.len else: newpos = min(self.pos+n, self.len) r = self.buf[self.pos:newpos] self.pos = newpos return r
c7ed0e3c1301fd27122e336eef7fd233526ccfc1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c7ed0e3c1301fd27122e336eef7fd233526ccfc1/StringIO.py
self.buf = self.buf + string.joinfields(self.buflist, '')
self.buf += EMPTYSTRING.join(self.buflist)
def readline(self, length=None): if self.closed: raise ValueError, "I/O operation on closed file" if self.buflist: self.buf = self.buf + string.joinfields(self.buflist, '') self.buflist = [] i = string.find(self.buf, '\n', self.pos) if i < 0: newpos = self.len else: newpos = i+1 if length is not None: if self.pos + length < newpos: newpos = self.pos + length r = self.buf[self.pos:newpos] self.pos = newpos return r
c7ed0e3c1301fd27122e336eef7fd233526ccfc1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c7ed0e3c1301fd27122e336eef7fd233526ccfc1/StringIO.py
i = string.find(self.buf, '\n', self.pos)
i = self.buf.find('\n', self.pos)
def readline(self, length=None): if self.closed: raise ValueError, "I/O operation on closed file" if self.buflist: self.buf = self.buf + string.joinfields(self.buflist, '') self.buflist = [] i = string.find(self.buf, '\n', self.pos) if i < 0: newpos = self.len else: newpos = i+1 if length is not None: if self.pos + length < newpos: newpos = self.pos + length r = self.buf[self.pos:newpos] self.pos = newpos return r
c7ed0e3c1301fd27122e336eef7fd233526ccfc1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c7ed0e3c1301fd27122e336eef7fd233526ccfc1/StringIO.py
raise IOError(errno.EINVAL, "Negative size not allowed")
raise IOError(EINVAL, "Negative size not allowed")
def truncate(self, size=None): if self.closed: raise ValueError, "I/O operation on closed file" if size is None: size = self.pos elif size < 0: raise IOError(errno.EINVAL, "Negative size not allowed") elif size < self.pos: self.pos = size self.buf = self.getvalue()[:size]
c7ed0e3c1301fd27122e336eef7fd233526ccfc1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c7ed0e3c1301fd27122e336eef7fd233526ccfc1/StringIO.py
self.buf = self.buf + string.joinfields(self.buflist, '')
self.buf += EMPTYSTRING.join(self.buflist)
def write(self, s): if self.closed: raise ValueError, "I/O operation on closed file" if not s: return if self.pos > self.len: self.buflist.append('\0'*(self.pos - self.len)) self.len = self.pos newpos = self.pos + len(s) if self.pos < self.len: if self.buflist: self.buf = self.buf + string.joinfields(self.buflist, '') self.buflist = [] self.buflist = [self.buf[:self.pos], s, self.buf[newpos:]] self.buf = '' if newpos > self.len: self.len = newpos else: self.buflist.append(s) self.len = newpos self.pos = newpos
c7ed0e3c1301fd27122e336eef7fd233526ccfc1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c7ed0e3c1301fd27122e336eef7fd233526ccfc1/StringIO.py
self.write(string.joinfields(list, ''))
self.write(EMPTYSTRING.join(list))
def writelines(self, list): self.write(string.joinfields(list, ''))
c7ed0e3c1301fd27122e336eef7fd233526ccfc1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c7ed0e3c1301fd27122e336eef7fd233526ccfc1/StringIO.py
self.buf = self.buf + string.joinfields(self.buflist, '')
self.buf += EMPTYSTRING.join(self.buflist)
def getvalue(self): if self.buflist: self.buf = self.buf + string.joinfields(self.buflist, '') self.buflist = [] return self.buf
c7ed0e3c1301fd27122e336eef7fd233526ccfc1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c7ed0e3c1301fd27122e336eef7fd233526ccfc1/StringIO.py
def triplet_to_pmwrgb(rgbtuple):
def triplet_to_fractional_rgb(rgbtuple):
def triplet_to_pmwrgb(rgbtuple): return map(operator.__div__, rgbtuple, _maxtuple)
a5a018fbd49b29da3726905388e68c2e56b49cfd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a5a018fbd49b29da3726905388e68c2e56b49cfd/ColorDB.py
target = 'snow' red, green, blue = colordb.find_byname(target) print target, ':', red, green, blue, hex(rrggbb) name, aliases = colordb.find_byrgb((red, green, blue))
red, green, blue = rgbtuple = colordb.find_byname(target) print target, ':', red, green, blue, triplet_to_rrggbb(rgbtuple) name, aliases = colordb.find_byrgb(rgbtuple)
def triplet_to_pmwrgb(rgbtuple): return map(operator.__div__, rgbtuple, _maxtuple)
a5a018fbd49b29da3726905388e68c2e56b49cfd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a5a018fbd49b29da3726905388e68c2e56b49cfd/ColorDB.py
nearest = apply(colordb.nearest, target)
nearest = colordb.nearest(target)
def triplet_to_pmwrgb(rgbtuple): return map(operator.__div__, rgbtuple, _maxtuple)
a5a018fbd49b29da3726905388e68c2e56b49cfd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a5a018fbd49b29da3726905388e68c2e56b49cfd/ColorDB.py
streamservers = [UnixStreamServer, ThreadingUnixStreamServer, ForkingUnixStreamServer]
streamservers = [UnixStreamServer, ThreadingUnixStreamServer] if hasattr(os, 'fork') and os.name not in ('os2',): streamservers.append(ForkingUnixStreamServer)
def testloop(proto, servers, hdlrcls, testfunc): for svrcls in servers: addr = pickaddr(proto) if verbose: print "ADDR =", addr print "CLASS =", svrcls t = ServerThread(addr, svrcls, hdlrcls) if verbose: print "server created" t.start() if verbose: print "server running" for i in range(NREQ): time.sleep(DELAY) if verbose: print "test client", i testfunc(proto, addr) if verbose: print "waiting for server" t.join() if verbose: print "done"
daedf218524e1c96c289f1785c8f5092642b79ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/daedf218524e1c96c289f1785c8f5092642b79ea/test_socketserver.py
dgramservers = [UnixDatagramServer, ThreadingUnixDatagramServer, ForkingUnixDatagramServer]
dgramservers = [UnixDatagramServer, ThreadingUnixDatagramServer] if hasattr(os, 'fork') and os.name not in ('os2',): dgramservers.append(ForkingUnixDatagramServer)
def testloop(proto, servers, hdlrcls, testfunc): for svrcls in servers: addr = pickaddr(proto) if verbose: print "ADDR =", addr print "CLASS =", svrcls t = ServerThread(addr, svrcls, hdlrcls) if verbose: print "server created" t.start() if verbose: print "server running" for i in range(NREQ): time.sleep(DELAY) if verbose: print "test client", i testfunc(proto, addr) if verbose: print "waiting for server" t.join() if verbose: print "done"
daedf218524e1c96c289f1785c8f5092642b79ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/daedf218524e1c96c289f1785c8f5092642b79ea/test_socketserver.py
try: execv(tempfile.mktemp(), ())
try: execv(tempfile.mktemp(), ('blah',))
def _execvpe(file, args, env=None): if env is not None: func = execve argrest = (args, env) else: func = execv argrest = (args,) env = environ global _notfound head, tail = path.split(file) if head: apply(func, (file,) + argrest) return if env.has_key('PATH'): envpath = env['PATH'] else: envpath = defpath PATH = envpath.split(pathsep) if not _notfound: import tempfile # Exec a file that is guaranteed not to exist try: execv(tempfile.mktemp(), ()) except error, _notfound: pass exc, arg = error, _notfound for dir in PATH: fullname = path.join(dir, file) try: apply(func, (fullname,) + argrest) except error, (errno, msg): if errno != arg[0]: exc, arg = error, (errno, msg) raise exc, arg
868b50af1710442a8f92b266ff507259bc09e7de /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/868b50af1710442a8f92b266ff507259bc09e7de/os.py
g['BINLIBDEST']=os.path.join(sys.exec_prefix, "Lib")
g['BINLIBDEST']= os.path.join(sys.exec_prefix, "Lib")
def _init_nt(): """Initialize the module as appropriate for NT""" g=globals() # load config.h, though I don't know how useful this is parse_config_h(open( os.path.join(sys.exec_prefix, "include", "config.h")), g) # set basic install directories g['LIBDEST']=os.path.join(sys.exec_prefix, "Lib") g['BINLIBDEST']=os.path.join(sys.exec_prefix, "Lib")
32162e832ee0dc2b82783ccc897f6d7c8233e1cd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/32162e832ee0dc2b82783ccc897f6d7c8233e1cd/sysconfig.py
def tearDown(self): GettextBaseTest.tearDown(self)
def setUp(self): GettextBaseTest.setUp(self) self.localedir = os.curdir self.mofile = MOFILE gettext.install('gettext', self.localedir)
e960e22579838419541357712bbbc3317c219071 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e960e22579838419541357712bbbc3317c219071/test_gettext.py
def tearDown(self): GettextBaseTest.tearDown(self)
def tearDown(self): GettextBaseTest.tearDown(self)
e960e22579838419541357712bbbc3317c219071 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e960e22579838419541357712bbbc3317c219071/test_gettext.py
def tearDown(self): GettextBaseTest.tearDown(self)
def tearDown(self): GettextBaseTest.tearDown(self)
e960e22579838419541357712bbbc3317c219071 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e960e22579838419541357712bbbc3317c219071/test_gettext.py
def tearDown(self): GettextBaseTest.tearDown(self)
def tearDown(self): GettextBaseTest.tearDown(self)
e960e22579838419541357712bbbc3317c219071 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e960e22579838419541357712bbbc3317c219071/test_gettext.py
def get_outputs (self): # This command doesn't have any outputs of its own, so just # get the outputs of all its sub-commands. outputs = [] for cmd_name in self.get_sub_commands(): cmd = self.get_finalized_command(cmd_name) # Add the contents of cmd.get_outputs(), ensuring # that outputs doesn't contain duplicate entries for filename in cmd.get_outputs(): if filename not in outputs: outputs.append(filename)
a8ea5ba8a9c2e0674a22fd1629f8fee0cf4cb282 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a8ea5ba8a9c2e0674a22fd1629f8fee0cf4cb282/install.py
raise IOError(errno.EBADF, "write() on read-only GzipFile object")
raise IOError(errno.EBADF, "read() on write-only GzipFile object")
def read(self, size=-1): if self.mode != READ: import errno raise IOError(errno.EBADF, "write() on read-only GzipFile object")
edfb30258ea262cb67c1e48e4b122bf7e1b8b674 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/edfb30258ea262cb67c1e48e4b122bf7e1b8b674/gzip.py
self.copy_file(name, outfile, preserve_mode = 0)
self.copy_file(os.path.join(package_dir, name), outfile, preserve_mode = 0)
def run(self): # Copies all .py files, then also copies the txt and gif files build_py.run(self) assert self.packages == [idlelib] for name in txt_files: outfile = self.get_plain_outfile(self.build_lib, [idlelib], name) dir = os.path.dirname(outfile) self.mkpath(dir) self.copy_file(name, outfile, preserve_mode = 0) for name in Icons: outfile = self.get_plain_outfile(self.build_lib, [idlelib,"Icons"], name) dir = os.path.dirname(outfile) self.mkpath(dir) self.copy_file(os.path.join("Icons",name), outfile, preserve_mode = 0)
3e0edbf4d8cc7728fb75cb23602ca18c0282c192 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3e0edbf4d8cc7728fb75cb23602ca18c0282c192/setup.py
icons = [os.path.join("Icons",name) for name in Icons]
icons = [os.path.join(package_dir, "Icons",name) for name in Icons] txts = [os.path.join(package_dir, name) for name in txt_files]
def get_source_files(self): # returns the .py files, the .txt files, and the icons icons = [os.path.join("Icons",name) for name in Icons] return build_py.get_source_files(self)+txt_files+icons
3e0edbf4d8cc7728fb75cb23602ca18c0282c192 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3e0edbf4d8cc7728fb75cb23602ca18c0282c192/setup.py
package_dir = {idlelib:'.'},
package_dir = {idlelib: package_dir},
def _bytecode_filenames(self, files): files = [n for n in files if n.endswith('.py')] return install_lib._bytecode_filenames(self,files)
3e0edbf4d8cc7728fb75cb23602ca18c0282c192 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3e0edbf4d8cc7728fb75cb23602ca18c0282c192/setup.py
scripts = ['idle']
scripts = [os.path.join(package_dir, 'idle')]
def _bytecode_filenames(self, files): files = [n for n in files if n.endswith('.py')] return install_lib._bytecode_filenames(self,files)
3e0edbf4d8cc7728fb75cb23602ca18c0282c192 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3e0edbf4d8cc7728fb75cb23602ca18c0282c192/setup.py
Assume y1 <= y2 and no funny (non-leap century) years.""" return (y2+3)/4 - (y1+3)/4
Assume y1 <= y2.""" y1 -= 1 y2 -= 1 return (y2/4 - y1/4) - (y2/100 - y1/100) + (y2/400 - y1/400)
def leapdays(y1, y2): """Return number of leap years in range [y1, y2). Assume y1 <= y2 and no funny (non-leap century) years.""" return (y2+3)/4 - (y1+3)/4
46735add5fd292d1c0141aefa23f92814b15cac3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/46735add5fd292d1c0141aefa23f92814b15cac3/calendar.py
fileobj = open(self.name, self.mode)
fileobj = _open(self.name, self.mode)
def __init__(self, name=None, mode="r", fileobj=None): """Open an (uncompressed) tar archive `name'. `mode' is either 'r' to read from an existing archive, 'a' to append data to an existing file or 'w' to create a new file overwriting an existing one. `mode' defaults to 'r'. If `fileobj' is given, it is used for reading or writing data. If it can be determined, `mode' is overridden by `fileobj's mode. `fileobj' is not closed, when TarFile is closed. """ self.name = name
8f78fe9a10c24706b04d07be9149d84aa6016db7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8f78fe9a10c24706b04d07be9149d84aa6016db7/tarfile.py
fileobj = open(name, mode + "b")
fileobj = _open(name, mode + "b")
def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9): """Open gzip compressed tar archive name for reading or writing. Appending is not allowed. """ if len(mode) > 1 or mode not in "rw": raise ValueError("mode must be 'r' or 'w'")
8f78fe9a10c24706b04d07be9149d84aa6016db7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8f78fe9a10c24706b04d07be9149d84aa6016db7/tarfile.py
f = open(name, "rb")
f = _open(name, "rb")
def add(self, name, arcname=None, recursive=True): """Add the file `name' to the archive. `name' may be any type of file (directory, fifo, symbolic link, etc.). If given, `arcname' specifies an alternative name for the file in the archive. Directories are added recursively by default. This can be avoided by setting `recursive' to False. """ self._check("aw")
8f78fe9a10c24706b04d07be9149d84aa6016db7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8f78fe9a10c24706b04d07be9149d84aa6016db7/tarfile.py
target = open(targetpath, "wb")
target = _open(targetpath, "wb")
def makefile(self, tarinfo, targetpath): """Make a file called targetpath. """ source = self.extractfile(tarinfo) target = open(targetpath, "wb") copyfileobj(source, target) source.close() target.close()
8f78fe9a10c24706b04d07be9149d84aa6016db7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8f78fe9a10c24706b04d07be9149d84aa6016db7/tarfile.py
f="&xxx;" g='&
f="&xxx;" g='& i='x?a=b&c=d;' j='&amp;
def test_attr_values_entities(self): """Substitution of entities and charrefs in attribute values""" # SF bug #1452246 self.check_events("""<a b=&lt; c=&lt;&gt; d=&lt-&gt; e='&lt; ' f="&xxx;" g='&#32;&#33;' h='&#500;' i='x?a=b&c=d;'>""", [("starttag", "a", [("b", "<"), ("c", "<>"), ("d", "&lt->"), ("e", "< "), ("f", "&xxx;"), ("g", " !"), ("h", "&#500;"), ("i", "x?a=b&c=d;"), ])])
a16393efb779b62f9114c06852947e92dd9d155f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a16393efb779b62f9114c06852947e92dd9d155f/test_sgmllib.py
("i", "x?a=b&c=d;"), ])])
("i", "x?a=b&c=d;"), ("j", "& ("k", "& ])])
def test_attr_values_entities(self): """Substitution of entities and charrefs in attribute values""" # SF bug #1452246 self.check_events("""<a b=&lt; c=&lt;&gt; d=&lt-&gt; e='&lt; ' f="&xxx;" g='&#32;&#33;' h='&#500;' i='x?a=b&c=d;'>""", [("starttag", "a", [("b", "<"), ("c", "<>"), ("d", "&lt->"), ("e", "< "), ("f", "&xxx;"), ("g", " !"), ("h", "&#500;"), ("i", "x?a=b&c=d;"), ])])
a16393efb779b62f9114c06852947e92dd9d155f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a16393efb779b62f9114c06852947e92dd9d155f/test_sgmllib.py
def d22v(a, b, c=1, d=2, *rest): pass
7e3e1c1ece9173b10b2e89848f814d0c346a869d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7e3e1c1ece9173b10b2e89848f814d0c346a869d/test_grammar.py
to_convert = to_convert[:] to_convert.sort(key=len, reverse=True)
def __seqToRE(self, to_convert, directive): """Convert a list to a regex string for matching a directive.
ffa5cf9eae5fff1e46e8962cd957fd2ffe5a77cb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ffa5cf9eae5fff1e46e8962cd957fd2ffe5a77cb/_strptime.py