rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
opts, args = getopt.getopt(sys.argv[1:], 'Rd:m:nqr:t:vx')
opts, args = getopt.getopt(sys.argv[1:], 'Rd:m:nqr:t:vxa')
def main(): checkext = CHECKEXT verbose = VERBOSE maxpage = MAXPAGE roundsize = ROUNDSIZE dumpfile = DUMPFILE restart = 0 norun = 0 try: # Begin SLB 2/24/99: Added -t option here. opts, args = getopt.getopt(sys.argv[1:], 'Rd:m:nqr:t:vx') # End SLB 2/24/99 except getopt.error, msg: sys.stdout = sys.stderr print msg print __doc__%globals() sys.exit(2) # Begin SLB 2/24/99: Added extra_roots variable to # collect extra roots. extra_roots = [] # End SLB 2/24/99 for o, a in opts: if o == '-R': restart = 1 if o == '-d': dumpfile = a if o == '-m': maxpage = string.atoi(a) if o == '-n': norun = 1 if o == '-q': verbose = 0 if o == '-r': roundsize = string.atoi(a) # Begin SLB 2/24/99: Added processing for # -t option. if o == '-t': extra_roots.append(a) # End SLB 2/24/99 if o == '-v': verbose = verbose + 1 if o == '-x': checkext = not checkext if verbose > 0: print AGENTNAME, "version", __version__ if restart: c = load_pickle(dumpfile=dumpfile, verbose=verbose) else: c = Checker() c.setflags(checkext=checkext, verbose=verbose, maxpage=maxpage, roundsize=roundsize) if not restart and not args: args.append(DEFROOT) for arg in args: c.addroot(arg) # Begin SLB 2/24/99. The -t flag is only needed if external # links are not to be checked. So -t values are ignored unless # -x was specified. if not checkext: for root in extra_roots: # Make sure it's terminated by a slash, # so that addroot doesn't discard the last # directory component. if root[-1] != "/": root = root + "/" c.addroot(root) # End SLB 2/24/99 try: if not norun: try: c.run() except KeyboardInterrupt: if verbose > 0: print "[run interrupted]" try: c.report() except KeyboardInterrupt: if verbose > 0: print "[report interrupted]" finally: if c.save_pickle(dumpfile): if dumpfile == DUMPFILE: print "Use ``%s -R'' to restart." % sys.argv[0] else: print "Use ``%s -R -d %s'' to restart." % (sys.argv[0], dumpfile)
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
if o == '-t': extra_roots.append(a)
if o == '-t': extra_roots.append(a) if o == '-a': nonames = not nonames
def main(): checkext = CHECKEXT verbose = VERBOSE maxpage = MAXPAGE roundsize = ROUNDSIZE dumpfile = DUMPFILE restart = 0 norun = 0 try: # Begin SLB 2/24/99: Added -t option here. opts, args = getopt.getopt(sys.argv[1:], 'Rd:m:nqr:t:vx') # End SLB 2/24/99 except getopt.error, msg: sys.stdout = sys.stderr print msg print __doc__%globals() sys.exit(2) # Begin SLB 2/24/99: Added extra_roots variable to # collect extra roots. extra_roots = [] # End SLB 2/24/99 for o, a in opts: if o == '-R': restart = 1 if o == '-d': dumpfile = a if o == '-m': maxpage = string.atoi(a) if o == '-n': norun = 1 if o == '-q': verbose = 0 if o == '-r': roundsize = string.atoi(a) # Begin SLB 2/24/99: Added processing for # -t option. if o == '-t': extra_roots.append(a) # End SLB 2/24/99 if o == '-v': verbose = verbose + 1 if o == '-x': checkext = not checkext if verbose > 0: print AGENTNAME, "version", __version__ if restart: c = load_pickle(dumpfile=dumpfile, verbose=verbose) else: c = Checker() c.setflags(checkext=checkext, verbose=verbose, maxpage=maxpage, roundsize=roundsize) if not restart and not args: args.append(DEFROOT) for arg in args: c.addroot(arg) # Begin SLB 2/24/99. The -t flag is only needed if external # links are not to be checked. So -t values are ignored unless # -x was specified. if not checkext: for root in extra_roots: # Make sure it's terminated by a slash, # so that addroot doesn't discard the last # directory component. if root[-1] != "/": root = root + "/" c.addroot(root) # End SLB 2/24/99 try: if not norun: try: c.run() except KeyboardInterrupt: if verbose > 0: print "[run interrupted]" try: c.report() except KeyboardInterrupt: if verbose > 0: print "[report interrupted]" finally: if c.save_pickle(dumpfile): if dumpfile == DUMPFILE: print "Use ``%s -R'' to restart." % sys.argv[0] else: print "Use ``%s -R -d %s'' to restart." % (sys.argv[0], dumpfile)
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
maxpage=maxpage, roundsize=roundsize)
maxpage=maxpage, roundsize=roundsize, nonames=nonames )
def main(): checkext = CHECKEXT verbose = VERBOSE maxpage = MAXPAGE roundsize = ROUNDSIZE dumpfile = DUMPFILE restart = 0 norun = 0 try: # Begin SLB 2/24/99: Added -t option here. opts, args = getopt.getopt(sys.argv[1:], 'Rd:m:nqr:t:vx') # End SLB 2/24/99 except getopt.error, msg: sys.stdout = sys.stderr print msg print __doc__%globals() sys.exit(2) # Begin SLB 2/24/99: Added extra_roots variable to # collect extra roots. extra_roots = [] # End SLB 2/24/99 for o, a in opts: if o == '-R': restart = 1 if o == '-d': dumpfile = a if o == '-m': maxpage = string.atoi(a) if o == '-n': norun = 1 if o == '-q': verbose = 0 if o == '-r': roundsize = string.atoi(a) # Begin SLB 2/24/99: Added processing for # -t option. if o == '-t': extra_roots.append(a) # End SLB 2/24/99 if o == '-v': verbose = verbose + 1 if o == '-x': checkext = not checkext if verbose > 0: print AGENTNAME, "version", __version__ if restart: c = load_pickle(dumpfile=dumpfile, verbose=verbose) else: c = Checker() c.setflags(checkext=checkext, verbose=verbose, maxpage=maxpage, roundsize=roundsize) if not restart and not args: args.append(DEFROOT) for arg in args: c.addroot(arg) # Begin SLB 2/24/99. The -t flag is only needed if external # links are not to be checked. So -t values are ignored unless # -x was specified. if not checkext: for root in extra_roots: # Make sure it's terminated by a slash, # so that addroot doesn't discard the last # directory component. if root[-1] != "/": root = root + "/" c.addroot(root) # End SLB 2/24/99 try: if not norun: try: c.run() except KeyboardInterrupt: if verbose > 0: print "[run interrupted]" try: c.report() except KeyboardInterrupt: if verbose > 0: print "[report interrupted]" finally: if c.save_pickle(dumpfile): if dumpfile == DUMPFILE: print "Use ``%s -R'' to restart." % sys.argv[0] else: print "Use ``%s -R -d %s'' to restart." % (sys.argv[0], dumpfile)
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
for root in extra_roots: if root[-1] != "/": root = root + "/" c.addroot(root)
for root in extra_roots: if root[-1] != "/": root = root + "/" c.addroot(root, add_to_do = 0)
def main(): checkext = CHECKEXT verbose = VERBOSE maxpage = MAXPAGE roundsize = ROUNDSIZE dumpfile = DUMPFILE restart = 0 norun = 0 try: # Begin SLB 2/24/99: Added -t option here. opts, args = getopt.getopt(sys.argv[1:], 'Rd:m:nqr:t:vx') # End SLB 2/24/99 except getopt.error, msg: sys.stdout = sys.stderr print msg print __doc__%globals() sys.exit(2) # Begin SLB 2/24/99: Added extra_roots variable to # collect extra roots. extra_roots = [] # End SLB 2/24/99 for o, a in opts: if o == '-R': restart = 1 if o == '-d': dumpfile = a if o == '-m': maxpage = string.atoi(a) if o == '-n': norun = 1 if o == '-q': verbose = 0 if o == '-r': roundsize = string.atoi(a) # Begin SLB 2/24/99: Added processing for # -t option. if o == '-t': extra_roots.append(a) # End SLB 2/24/99 if o == '-v': verbose = verbose + 1 if o == '-x': checkext = not checkext if verbose > 0: print AGENTNAME, "version", __version__ if restart: c = load_pickle(dumpfile=dumpfile, verbose=verbose) else: c = Checker() c.setflags(checkext=checkext, verbose=verbose, maxpage=maxpage, roundsize=roundsize) if not restart and not args: args.append(DEFROOT) for arg in args: c.addroot(arg) # Begin SLB 2/24/99. The -t flag is only needed if external # links are not to be checked. So -t values are ignored unless # -x was specified. if not checkext: for root in extra_roots: # Make sure it's terminated by a slash, # so that addroot doesn't discard the last # directory component. if root[-1] != "/": root = root + "/" c.addroot(root) # End SLB 2/24/99 try: if not norun: try: c.run() except KeyboardInterrupt: if verbose > 0: print "[run interrupted]" try: c.report() except KeyboardInterrupt: if verbose > 0: print "[report interrupted]" finally: if c.save_pickle(dumpfile): if dumpfile == DUMPFILE: print "Use ``%s -R'' to restart." % sys.argv[0] else: print "Use ``%s -R -d %s'' to restart." % (sys.argv[0], dumpfile)
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
self.name_table = {}
self.name_table = {}
def reset(self): self.roots = [] self.todo = {} self.done = {} self.bad = {}
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
def reset(self): self.roots = [] self.todo = {} self.done = {} self.bad = {}
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
def note(self, level, format, *args): if self.verbose > level: if args: format = format%args self.message(format)
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
def addroot(self, root):
def addroot(self, root, add_to_do = 1):
def addroot(self, root): if root not in self.roots: troot = root scheme, netloc, path, params, query, fragment = \ urlparse.urlparse(root) i = string.rfind(path, "/") + 1 if 0 < i < len(path): path = path[:i] troot = urlparse.urlunparse((scheme, netloc, path, params, query, fragment)) self.roots.append(troot) self.addrobot(root) # Begin SLB 2/24/99: Modified this call to respect # the fact that the "done" and "todo" dictionaries # are now (URL, fragment) pairs self.newlink((root, ""), ("<root>", root)) # End SLB 2/24/99
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
self.newlink((root, ""), ("<root>", root))
if add_to_do: self.newlink((root, ""), ("<root>", root))
def addroot(self, root): if root not in self.roots: troot = root scheme, netloc, path, params, query, fragment = \ urlparse.urlparse(root) i = string.rfind(path, "/") + 1 if 0 < i < len(path): path = path[:i] troot = urlparse.urlunparse((scheme, netloc, path, params, query, fragment)) self.roots.append(troot) self.addrobot(root) # Begin SLB 2/24/99: Modified this call to respect # the fact that the "done" and "todo" dictionaries # are now (URL, fragment) pairs self.newlink((root, ""), ("<root>", root)) # End SLB 2/24/99
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
for url, rawlink, msg in triples:
for url, rawlink, msg in triples:
def report_errors(self): if not self.bad: self.message("\nNo errors") return self.message("\nError Report:") sources = self.errors.keys() sources.sort() for source in sources: triples = self.errors[source] self.message("") if len(triples) > 1: self.message("%d Errors in %s", len(triples), source) else: self.message("Error in %s", source) # Begin SLB 2/24/99: Modified this loop to # call self.format_url() instead of referring # to the URL directly, since the URLs in these # triples is now a (URL, fragment) pair. The value # of the "source" variable comes from the list of # origins, and is a URL, not a pair. for url, rawlink, msg in triples: if rawlink != self.format_url(url): s = " (%s)" % rawlink else: s = "" self.message(" HREF %s%s\n msg %s", self.format_url(url), s, msg) # End SLB 2/24/99.
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
self.format_url(url), s, msg)
self.format_url(url), s, msg)
def report_errors(self): if not self.bad: self.message("\nNo errors") return self.message("\nError Report:") sources = self.errors.keys() sources.sort() for source in sources: triples = self.errors[source] self.message("") if len(triples) > 1: self.message("%d Errors in %s", len(triples), source) else: self.message("Error in %s", source) # Begin SLB 2/24/99: Modified this loop to # call self.format_url() instead of referring # to the URL directly, since the URLs in these # triples is now a (URL, fragment) pair. The value # of the "source" variable comes from the list of # origins, and is a URL, not a pair. for url, rawlink, msg in triples: if rawlink != self.format_url(url): s = " (%s)" % rawlink else: s = "" self.message(" HREF %s%s\n msg %s", self.format_url(url), s, msg) # End SLB 2/24/99.
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
def dopage(self, url_pair):
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
" from", self.todo[url_pair])
" from", self.todo[url_pair])
def dopage(self, url_pair):
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
url, local_fragment = url_pair self.name_table[url] = page if local_fragment and local_fragment not in page.getnames(): self.setbad(url_pair, ("Missing name anchor `%s'" % local_fragment)) for info in page.getlinkinfos():
self.name_table[url] = page if local_fragment and local_fragment not in page.getnames(): self.setbad(url_pair, ("Missing name anchor `%s'" % local_fragment)) for info in page.getlinkinfos():
def dopage(self, url_pair):
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
def dopage(self, url_pair):
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
else: self.name_table[url_pair[0]] = None
else: self.name_table[url_pair[0]] = None
def dopage(self, url_pair):
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
def dopage(self, url_pair):
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
self.done[url].append(origin)
if origin not in self.done[url]: self.done[url].append(origin)
def newdonelink(self, url, origin): self.done[url].append(origin)
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
if self.bad.has_key(url): source, rawlink = origin triple = url, rawlink, self.bad[url] self.seterror(source, triple)
def newdonelink(self, url, origin): self.done[url].append(origin)
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
def newtodolink(self, url, origin):
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
self.todo[url].append(origin)
if origin not in self.todo[url]: self.todo[url].append(origin)
def newtodolink(self, url, origin):
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
def newtodolink(self, url, origin):
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
def format_url(self, url): link, fragment = url if fragment: return link + " else: return link
def format_url(self, url): link, fragment = url if fragment: return link + " else: return link
def format_url(self, url):
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
def inroots(self, url): for root in self.roots: if url[:len(root)] == root: return self.isallowed(root, url) return 0
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
url, fragment = url_pair if self.name_table.has_key(url): return self.name_table[url]
url, fragment = url_pair if self.name_table.has_key(url): return self.name_table[url]
def getpage(self, url_pair):
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
def getpage(self, url_pair):
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
def getpage(self, url_pair):
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
url, fragment = url_pair
url, fragment = url_pair
def readhtml(self, url_pair):
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
url, fragment = url_pair
url, fragment = url_pair
def openhtml(self, url_pair):
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
url, fragment = url_pair
url, fragment = url_pair
def openpage(self, url_pair):
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
def setbad(self, url, msg): if self.bad.has_key(url) and self.bad[url] == msg: self.note(0, "(Seen this error before)") return self.bad[url] = msg self.changed = 1 self.markerror(url)
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
if triple not in self.errors[url]: self.errors[url].append(triple)
if triple not in self.errors[url]: self.errors[url].append(triple)
def seterror(self, url, triple): try: # Begin SLB 2/24/99: Because of the way the # URLs are now processed, I need to check to make # sure the URL hasn't been entered in the error list. # The first element of the triple here is a (URL, fragment) # pair, but the URL key is not, since it's from the # list of origins. if triple not in self.errors[url]:
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
size = len(self.text)
size = len(self.text)
def __init__(self, text, url, verbose=VERBOSE, maxpage=MAXPAGE, checker=None): self.text = text self.url = url self.verbose = verbose self.maxpage = maxpage self.checker = checker
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
return
return
def __init__(self, text, url, verbose=VERBOSE, maxpage=MAXPAGE, checker=None): self.text = text self.url = url self.verbose = verbose self.maxpage = maxpage self.checker = checker
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
checker=self.checker)
checker=self.checker)
def __init__(self, text, url, verbose=VERBOSE, maxpage=MAXPAGE, checker=None): self.text = text self.url = url self.verbose = verbose self.maxpage = maxpage self.checker = checker
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
def __init__(self, text, url, verbose=VERBOSE, maxpage=MAXPAGE, checker=None): self.text = text self.url = url self.verbose = verbose self.maxpage = maxpage self.checker = checker
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
return self.parser.names
return self.parser.names
def getnames(self):
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
if not self.parser: return []
if not self.parser: return []
def getlinkinfos(self):
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
fragment = t[-1]
fragment = t[-1]
def getlinkinfos(self):
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
infos.append((link, rawlink, fragment))
infos.append((link, rawlink, fragment))
def getlinkinfos(self):
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
if path[-1] != os.sep: url = url + '/'
def open_file(self, url): path = urllib.url2pathname(urllib.unquote(url)) if path[-1] != os.sep: url = url + '/' if os.path.isdir(path): indexpath = os.path.join(path, "index.html") if os.path.exists(indexpath): return self.open_file(url + "index.html") try: names = os.listdir(path) except os.error, msg: raise IOError, msg, sys.exc_traceback names.sort() s = MyStringIO("file:"+url, {'content-type': 'text/html'}) s.write('<BASE HREF="file:%s">\n' % urllib.quote(os.path.join(path, ""))) for name in names: q = urllib.quote(name) s.write('<A HREF="%s">%s</A>\n' % (q, q)) s.seek(0) return s return urllib.FancyURLopener.open_file(self, path)
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
return urllib.FancyURLopener.open_file(self, path)
return urllib.FancyURLopener.open_file(self, url)
def open_file(self, url): path = urllib.url2pathname(urllib.unquote(url)) if path[-1] != os.sep: url = url + '/' if os.path.isdir(path): indexpath = os.path.join(path, "index.html") if os.path.exists(indexpath): return self.open_file(url + "index.html") try: names = os.listdir(path) except os.error, msg: raise IOError, msg, sys.exc_traceback names.sort() s = MyStringIO("file:"+url, {'content-type': 'text/html'}) s.write('<BASE HREF="file:%s">\n' % urllib.quote(os.path.join(path, ""))) for name in names: q = urllib.quote(name) s.write('<A HREF="%s">%s</A>\n' % (q, q)) s.seek(0) return s return urllib.FancyURLopener.open_file(self, path)
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
self.names = [] self.url = url
self.names = [] self.url = url
def __init__(self, url, verbose=VERBOSE, checker=None): self.myverbose = verbose # now unused self.checker = checker self.base = None self.links = {}
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
for name, value in attributes: if name == "name": if value in self.names: self.checker.message("WARNING: duplicate name %s in %s", value, self.url) else: self.names.append(value) break
for name, value in attributes: if name == "name": if value in self.names: self.checker.message("WARNING: duplicate name %s in %s", value, self.url) else: self.names.append(value) break
def start_a(self, attributes): self.link_attr(attributes, 'href')
a870cf128cdb4a76dc17c103820d903325fd04fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a870cf128cdb4a76dc17c103820d903325fd04fb/wcnew.py
def __init__(self, files=[], dir=os.curdir, allfiles=None, warn=None, debug_print=None): # use standard warning and debug functions, if no other given if warn is None: warn = self.__warn if debug_print is None: debug_print = self.__debug_print self.warn = warn self.debug_print = debug_print self.files = files self.dir = dir self.allfiles = allfiles # if None, it will be filled, when used for first time
d8fffdf727fad2fc5a0ff492de610d256099f1af /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d8fffdf727fad2fc5a0ff492de610d256099f1af/filelist.py
sys.stderr.write ("warning: template: %s\n" % msg)
sys.stderr.write ("warning: %s\n" % msg)
def __warn (self, msg): sys.stderr.write ("warning: template: %s\n" % msg)
d8fffdf727fad2fc5a0ff492de610d256099f1af /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d8fffdf727fad2fc5a0ff492de610d256099f1af/filelist.py
def process_line(self, line): words = string.split (line) action = words[0] if action in ('include','exclude', 'global-include','global-exclude'): if len (words) < 2:
def process_line (self, line): words = string.split (line) action = words[0] if action in ('include','exclude', 'global-include','global-exclude'): if len (words) < 2: self.warn \ ("invalid template line: " + "'%s' expects <pattern1> <pattern2> ..." % action) return pattern_list = map(convert_path, words[1:]) elif action in ('recursive-include','recursive-exclude'): if len (words) < 3: self.warn \ ("invalid template line: " + "'%s' expects <dir> <pattern1> <pattern2> ..." % action) return dir = convert_path(words[1]) pattern_list = map (convert_path, words[2:]) elif action in ('graft','prune'): if len (words) != 2: self.warn \ ("invalid template line: " + "'%s' expects a single <dir_pattern>" % action) return dir_pattern = convert_path (words[1]) else: self.warn ("invalid template line: " + "unknown action '%s'" % action) return if action == 'include': self.debug_print("include " + string.join(pattern_list)) for pattern in pattern_list: if not self.select_pattern (pattern, anchor=1): self.warn ("no files found matching '%s'" % pattern) elif action == 'exclude': self.debug_print("exclude " + string.join(pattern_list)) for pattern in pattern_list: if not self.exclude_pattern (pattern, anchor=1): self.warn ( "no previously-included files found matching '%s'"% pattern) elif action == 'global-include': self.debug_print("global-include " + string.join(pattern_list)) for pattern in pattern_list: if not self.select_pattern (pattern, anchor=0): self.warn (("no files found matching '%s' " + "anywhere in distribution") % pattern) elif action == 'global-exclude': self.debug_print("global-exclude " + string.join(pattern_list)) for pattern in pattern_list: if not self.exclude_pattern (pattern, anchor=0):
def process_line(self, line):
d8fffdf727fad2fc5a0ff492de610d256099f1af /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d8fffdf727fad2fc5a0ff492de610d256099f1af/filelist.py
("invalid template line: " + "'%s' expects <pattern1> <pattern2> ..." % action) return pattern_list = map(convert_path, words[1:]) elif action in ('recursive-include','recursive-exclude'): if len (words) < 3:
(("no previously-included files matching '%s' " + "found anywhere in distribution") % pattern) elif action == 'recursive-include': self.debug_print("recursive-include %s %s" % (dir, string.join(pattern_list))) for pattern in pattern_list: if not self.select_pattern (pattern, prefix=dir): self.warn (("no files found matching '%s' " + "under directory '%s'") % (pattern, dir)) elif action == 'recursive-exclude': self.debug_print("recursive-exclude %s %s" % (dir, string.join(pattern_list))) for pattern in pattern_list: if not self.exclude_pattern(pattern, prefix=dir):
def process_line(self, line):
d8fffdf727fad2fc5a0ff492de610d256099f1af /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d8fffdf727fad2fc5a0ff492de610d256099f1af/filelist.py
("invalid template line: " + "'%s' expects <dir> <pattern1> <pattern2> ..." % action) return dir = convert_path(words[1]) pattern_list = map (convert_path, words[2:]) elif action in ('graft','prune'): if len (words) != 2: self.warn \ ("invalid template line: " + "'%s' expects a single <dir_pattern>" % action) return dir_pattern = convert_path (words[1]) else: self.warn ("invalid template line: " + "unknown action '%s'" % action) return if action == 'include': self.debug_print("include " + string.join(pattern_list)) for pattern in pattern_list: if not self.select_pattern (pattern, anchor=1): self.warn ("no files found matching '%s'" % pattern) elif action == 'exclude': self.debug_print("exclude " + string.join(pattern_list)) for pattern in pattern_list: if not self.exclude_pattern (pattern, anchor=1): self.warn ( "no previously-included files found matching '%s'"% pattern) elif action == 'global-include': self.debug_print("global-include " + string.join(pattern_list)) for pattern in pattern_list: if not self.select_pattern (pattern, anchor=0): self.warn (("no files found matching '%s' " + "anywhere in distribution") % pattern) elif action == 'global-exclude': self.debug_print("global-exclude " + string.join(pattern_list)) for pattern in pattern_list: if not self.exclude_pattern (pattern, anchor=0): self.warn \ (("no previously-included files matching '%s' " + "found anywhere in distribution") % pattern) elif action == 'recursive-include': self.debug_print("recursive-include %s %s" % (dir, string.join(pattern_list))) for pattern in pattern_list: if not self.select_pattern (pattern, prefix=dir): self.warn (("no files found matching '%s' " + "under directory '%s'") % (pattern, dir)) elif action == 'recursive-exclude': self.debug_print("recursive-exclude %s %s" % (dir, string.join(pattern_list))) for pattern in pattern_list: if not self.exclude_pattern(pattern, prefix=dir): self.warn \ (("no previously-included files matching '%s' " + "found under directory '%s'") % (pattern, dir)) elif action == 'graft': self.debug_print("graft " + dir_pattern) if not self.select_pattern(None, prefix=dir_pattern): self.warn ("no directories found matching '%s'" % dir_pattern) elif action == 'prune': self.debug_print("prune " + dir_pattern) if not self.exclude_pattern(None, prefix=dir_pattern): self.warn \ (("no previously-included directories found " + "matching '%s'") % dir_pattern) else: raise RuntimeError, \ "this cannot happen: invalid action '%s'" % action
(("no previously-included files matching '%s' " + "found under directory '%s'") % (pattern, dir)) elif action == 'graft': self.debug_print("graft " + dir_pattern) if not self.select_pattern(None, prefix=dir_pattern): self.warn ("no directories found matching '%s'" % dir_pattern) elif action == 'prune': self.debug_print("prune " + dir_pattern) if not self.exclude_pattern(None, prefix=dir_pattern): self.warn \ (("no previously-included directories found " + "matching '%s'") % dir_pattern) else: raise RuntimeError, \ "this cannot happen: invalid action '%s'" % action
def process_line(self, line):
d8fffdf727fad2fc5a0ff492de610d256099f1af /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d8fffdf727fad2fc5a0ff492de610d256099f1af/filelist.py
def process_line(self, line):
d8fffdf727fad2fc5a0ff492de610d256099f1af /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d8fffdf727fad2fc5a0ff492de610d256099f1af/filelist.py
if iconv_incs: if iconv_libs:
if platform not in ['darwin'] and iconv_incs is not None: if iconv_libs is not None:
def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
1aa2c1d873c94d1c1dc341da3d7870939bf8ec85 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1aa2c1d873c94d1c1dc341da3d7870939bf8ec85/setup.py
raise TypeError, 'string payload expected'
raise TypeError, 'string payload expected: %s' % type(payload)
def _handle_text(self, msg): payload = msg.get_payload() if not isinstance(payload, StringType): raise TypeError, 'string payload expected' if self._mangle_from_: payload = fcre.sub('>From ', payload) self._fp.write(payload)
ace87f9ad44cbb989e3962b99fa40a094a8c4c64 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ace87f9ad44cbb989e3962b99fa40a094a8c4c64/Generator.py
g = self.__class__(s)
g = self.__class__(s, self._mangle_from_, self.__maxheaderlen)
def _handle_multipart(self, msg, isdigest=0): # The trick here is to write out each part separately, merge them all # together, and then make sure that the boundary we've chosen isn't # present in the payload. msgtexts = [] for part in msg.get_payload(): s = StringIO() g = self.__class__(s) g(part, unixfrom=0) msgtexts.append(s.getvalue()) # Now make sure the boundary we've selected doesn't appear in any of # the message texts. alltext = NL.join(msgtexts) # BAW: What about boundaries that are wrapped in double-quotes? boundary = msg.get_boundary(failobj=_make_boundary(alltext)) # If we had to calculate a new boundary because the body text # contained that string, set the new boundary. We don't do it # unconditionally because, while set_boundary() preserves order, it # doesn't preserve newlines/continuations in headers. This is no big # deal in practice, but turns out to be inconvenient for the unittest # suite. if msg.get_boundary() <> boundary: msg.set_boundary(boundary) # Write out any preamble if msg.preamble is not None: self._fp.write(msg.preamble) # First boundary is a bit different; it doesn't have a leading extra # newline. print >> self._fp, '--' + boundary if isdigest: print >> self._fp # Join and write the individual parts joiner = '\n--' + boundary + '\n' if isdigest: # multipart/digest types effectively add an extra newline between # the boundary and the body part. joiner += '\n' self._fp.write(joiner.join(msgtexts)) print >> self._fp, '\n--' + boundary + '--', # Write out any epilogue if msg.epilogue is not None: self._fp.write(msg.epilogue)
ace87f9ad44cbb989e3962b99fa40a094a8c4c64 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ace87f9ad44cbb989e3962b99fa40a094a8c4c64/Generator.py
def _handle_message_rfc822(self, msg):
def _handle_message_delivery_status(self, msg): blocks = [] for part in msg.get_payload(): s = StringIO() g = self.__class__(s, self._mangle_from_, self.__maxheaderlen) g(part, unixfrom=0) text = s.getvalue() lines = text.split('\n') if lines and lines[-1] == '': blocks.append(NL.join(lines[:-1])) else: blocks.append(text) self._fp.write(NL.join(blocks)) def _handle_message(self, msg):
def _handle_message_rfc822(self, msg): s = StringIO() g = self.__class__(s) # A message/rfc822 should contain a scalar payload which is another # Message object. Extract that object, stringify it, and write that # out. g(msg.get_payload(), unixfrom=0) self._fp.write(s.getvalue())
ace87f9ad44cbb989e3962b99fa40a094a8c4c64 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ace87f9ad44cbb989e3962b99fa40a094a8c4c64/Generator.py
g = self.__class__(s)
g = self.__class__(s, self._mangle_from_, self.__maxheaderlen)
def _handle_message_rfc822(self, msg): s = StringIO() g = self.__class__(s) # A message/rfc822 should contain a scalar payload which is another # Message object. Extract that object, stringify it, and write that # out. g(msg.get_payload(), unixfrom=0) self._fp.write(s.getvalue())
ace87f9ad44cbb989e3962b99fa40a094a8c4c64 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ace87f9ad44cbb989e3962b99fa40a094a8c4c64/Generator.py
if part.get_main_type('text') == 'text':
maintype = part.get_main_type('text') if maintype == 'text':
def _dispatch(self, msg): for part in msg.walk(): if part.get_main_type('text') == 'text': print >> self, part.get_payload(decode=1) else: print >> self, self._fmt % { 'type' : part.get_type('[no MIME type]'), 'maintype' : part.get_main_type('[no main MIME type]'), 'subtype' : part.get_subtype('[no sub-MIME type]'), 'filename' : part.get_filename('[no filename]'), 'description': part.get('Content-Description', '[no description]'), 'encoding' : part.get('Content-Transfer-Encoding', '[no encoding]'), }
ace87f9ad44cbb989e3962b99fa40a094a8c4c64 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ace87f9ad44cbb989e3962b99fa40a094a8c4c64/Generator.py
except IOError, msg:
except (OSError, IOError), msg:
def addrobot(self, root): root = urlparse.urljoin(root, "/") if self.robots.has_key(root): return url = urlparse.urljoin(root, "/robots.txt") self.robots[root] = rp = robotparser.RobotFileParser() self.note(2, "Parsing %s", url) rp.debug = self.verbose > 3 rp.set_url(url) try: rp.read() except IOError, msg: self.note(1, "I/O error parsing %s: %s", url, msg)
679ea385e9bb7c44250d28eea8abc5da7bca7b27 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/679ea385e9bb7c44250d28eea8abc5da7bca7b27/webchecker.py
except IOError, msg:
except (OSError, IOError), msg:
def openpage(self, url_pair): url, fragment = url_pair try: return self.urlopener.open(url) except IOError, msg: msg = self.sanitize(msg) self.note(0, "Error %s", msg) if self.verbose > 0: self.show(" HREF ", url, " from", self.todo[url_pair]) self.setbad(url_pair, msg) return None
679ea385e9bb7c44250d28eea8abc5da7bca7b27 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/679ea385e9bb7c44250d28eea8abc5da7bca7b27/webchecker.py
z = zipfile.ZipFile (base_dir + ".zip", "wb", compression=zipfile.ZIP_DEFLATED)
z = zipfile.ZipFile (base_dir + ".zip", "wb", compression=zipfile.ZIP_DEFLATED)
def make_zipfile (self, base_dir):
c68d9e2a18864482ff569faf40b2ad7e34018812 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c68d9e2a18864482ff569faf40b2ad7e34018812/dist.py
self.addheaders = [('User-Agent', server_version)]
self.addheaders = [('User-agent', server_version)]
def __init__(self): server_version = "Python-urllib/%s" % __version__ self.addheaders = [('User-Agent', server_version)] # manage the individual handlers self.handlers = [] self.handle_open = {} self.handle_error = {}
097068a20bfbf07c00e3babb07c705119eba42ac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/097068a20bfbf07c00e3babb07c705119eba42ac/urllib2.py
req.add_header('Proxy-Authorization', 'Basic ' + user_pass)
req.add_header('Proxy-authorization', 'Basic ' + user_pass)
def proxy_open(self, req, proxy, type): orig_type = req.get_type() type, r_type = splittype(proxy) host, XXX = splithost(r_type) if '@' in host: user_pass, host = host.split('@', 1) if ':' in user_pass: user, password = user_pass.split(':', 1) user_pass = base64.encodestring('%s:%s' % (unquote(user), unquote(password))) req.add_header('Proxy-Authorization', 'Basic ' + user_pass) host = unquote(host) req.set_proxy(host, type) if orig_type == type: # let other handlers take care of it # XXX this only makes sense if the proxy is before the # other handlers return None else: # need to start over, because the other handlers don't # grok the proxy's URL type return self.parent.open(req)
097068a20bfbf07c00e3babb07c705119eba42ac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/097068a20bfbf07c00e3babb07c705119eba42ac/urllib2.py
auth_header = 'Proxy-Authorization'
auth_header = 'Proxy-authorization'
def http_error_401(self, req, fp, code, msg, headers): host = urlparse.urlparse(req.get_full_url())[1] return self.http_error_auth_reqed('www-authenticate', host, req, headers)
097068a20bfbf07c00e3babb07c705119eba42ac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/097068a20bfbf07c00e3babb07c705119eba42ac/urllib2.py
for args in self.parent.addheaders: name, value = args
for name, value in self.parent.addheaders: name = name.capitalize()
def do_open(self, http_class, req): host = req.get_host() if not host: raise URLError('no host given')
097068a20bfbf07c00e3babb07c705119eba42ac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/097068a20bfbf07c00e3babb07c705119eba42ac/urllib2.py
h.putheader(*args)
h.putheader(name, value)
def do_open(self, http_class, req): host = req.get_host() if not host: raise URLError('no host given')
097068a20bfbf07c00e3babb07c705119eba42ac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/097068a20bfbf07c00e3babb07c705119eba42ac/urllib2.py
'Content-Type: %s\nContent-Length: %d\nLast-modified: %s\n' %
'Content-type: %s\nContent-length: %d\nLast-modified: %s\n' %
def open_local_file(self, req): host = req.get_host() file = req.get_selector() localfile = url2pathname(file) stats = os.stat(localfile) size = stats.st_size modified = rfc822.formatdate(stats.st_mtime) mtype = mimetypes.guess_type(file)[0] headers = mimetools.Message(StringIO( 'Content-Type: %s\nContent-Length: %d\nLast-modified: %s\n' % (mtype or 'text/plain', size, modified))) if host: host, port = splitport(host) if not host or \ (not port and socket.gethostbyname(host) in self.get_names()): return addinfourl(open(localfile, 'rb'), headers, 'file:'+file) raise URLError('file not on local host')
097068a20bfbf07c00e3babb07c705119eba42ac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/097068a20bfbf07c00e3babb07c705119eba42ac/urllib2.py
headers += "Content-Type: %s\n" % mtype
headers += "Content-type: %s\n" % mtype
def ftp_open(self, req): host = req.get_host() if not host: raise IOError, ('ftp error', 'no host given') # XXX handle custom username & password try: host = socket.gethostbyname(host) except socket.error, msg: raise URLError(msg) host, port = splitport(host) if port is None: port = ftplib.FTP_PORT path, attrs = splitattr(req.get_selector()) path = unquote(path) dirs = path.split('/') dirs, file = dirs[:-1], dirs[-1] if dirs and not dirs[0]: dirs = dirs[1:] user = passwd = '' # XXX try: fw = self.connect_ftp(user, passwd, host, port, dirs) type = file and 'I' or 'D' for attr in attrs: attr, value = splitattr(attr) if attr.lower() == 'type' and \ value in ('a', 'A', 'i', 'I', 'd', 'D'): type = value.upper() fp, retrlen = fw.retrfile(file, type) headers = "" mtype = mimetypes.guess_type(req.get_full_url())[0] if mtype: headers += "Content-Type: %s\n" % mtype if retrlen is not None and retrlen >= 0: headers += "Content-Length: %d\n" % retrlen sf = StringIO(headers) headers = mimetools.Message(sf) return addinfourl(fp, headers, req.get_full_url()) except ftplib.all_errors, msg: raise IOError, ('ftp error', msg), sys.exc_info()[2]
097068a20bfbf07c00e3babb07c705119eba42ac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/097068a20bfbf07c00e3babb07c705119eba42ac/urllib2.py
headers += "Content-Length: %d\n" % retrlen
headers += "Content-length: %d\n" % retrlen
def ftp_open(self, req): host = req.get_host() if not host: raise IOError, ('ftp error', 'no host given') # XXX handle custom username & password try: host = socket.gethostbyname(host) except socket.error, msg: raise URLError(msg) host, port = splitport(host) if port is None: port = ftplib.FTP_PORT path, attrs = splitattr(req.get_selector()) path = unquote(path) dirs = path.split('/') dirs, file = dirs[:-1], dirs[-1] if dirs and not dirs[0]: dirs = dirs[1:] user = passwd = '' # XXX try: fw = self.connect_ftp(user, passwd, host, port, dirs) type = file and 'I' or 'D' for attr in attrs: attr, value = splitattr(attr) if attr.lower() == 'type' and \ value in ('a', 'A', 'i', 'I', 'd', 'D'): type = value.upper() fp, retrlen = fw.retrfile(file, type) headers = "" mtype = mimetypes.guess_type(req.get_full_url())[0] if mtype: headers += "Content-Type: %s\n" % mtype if retrlen is not None and retrlen >= 0: headers += "Content-Length: %d\n" % retrlen sf = StringIO(headers) headers = mimetools.Message(sf) return addinfourl(fp, headers, req.get_full_url()) except ftplib.all_errors, msg: raise IOError, ('ftp error', msg), sys.exc_info()[2]
097068a20bfbf07c00e3babb07c705119eba42ac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/097068a20bfbf07c00e3babb07c705119eba42ac/urllib2.py
y = _reconstruct(x, reductor(), 1)
y = _reconstruct(x, reductor(), 1, memo)
def deepcopy(x, memo = None): """Deep copy operation on arbitrary Python objects. See the module's __doc__ string for more info. """ if memo is None: memo = {} d = id(x) if memo.has_key(d): return memo[d] try: copierfunction = _deepcopy_dispatch[type(x)] except KeyError: try: copier = x.__deepcopy__ except AttributeError: try: reductor = x.__reduce__ except AttributeError: raise error, \ "un-deep-copyable object of type %s" % type(x) else: y = _reconstruct(x, reductor(), 1) else: y = copier(memo) else: y = copierfunction(x, memo) memo[d] = y return y
69aa394a60d56aaf0e00893137935bdc97e0d527 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/69aa394a60d56aaf0e00893137935bdc97e0d527/copy.py
def _reconstruct(x, info, deep):
def _reconstruct(x, info, deep, memo=None):
def _reconstruct(x, info, deep): if isinstance(info, str): return x assert isinstance(info, tuple) n = len(info) assert n in (2, 3) callable, args = info[:2] if n > 2: state = info[2] else: state = {} if deep: args = deepcopy(args) y = callable(*args) if state: if deep: state = deepcopy(state) y.__dict__.update(state) return y
69aa394a60d56aaf0e00893137935bdc97e0d527 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/69aa394a60d56aaf0e00893137935bdc97e0d527/copy.py
args = deepcopy(args)
args = deepcopy(args, memo)
def _reconstruct(x, info, deep): if isinstance(info, str): return x assert isinstance(info, tuple) n = len(info) assert n in (2, 3) callable, args = info[:2] if n > 2: state = info[2] else: state = {} if deep: args = deepcopy(args) y = callable(*args) if state: if deep: state = deepcopy(state) y.__dict__.update(state) return y
69aa394a60d56aaf0e00893137935bdc97e0d527 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/69aa394a60d56aaf0e00893137935bdc97e0d527/copy.py
state = deepcopy(state)
state = deepcopy(state, memo)
def _reconstruct(x, info, deep): if isinstance(info, str): return x assert isinstance(info, tuple) n = len(info) assert n in (2, 3) callable, args = info[:2] if n > 2: state = info[2] else: state = {} if deep: args = deepcopy(args) y = callable(*args) if state: if deep: state = deepcopy(state) y.__dict__.update(state) return y
69aa394a60d56aaf0e00893137935bdc97e0d527 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/69aa394a60d56aaf0e00893137935bdc97e0d527/copy.py
"""Base class for client errors."""
def _stringify(string): return string
89fac5392e1732557feb33809495efa89139b1f0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/89fac5392e1732557feb33809495efa89139b1f0/xmlrpclib.py
"""Indicates an HTTP protocol error."""
def _stringify(string): return string
89fac5392e1732557feb33809495efa89139b1f0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/89fac5392e1732557feb33809495efa89139b1f0/xmlrpclib.py
"""Indicates a broken response package"""
def __repr__(self): return ( "<ProtocolError for %s: %s %s>" % (self.url, self.errcode, self.errmsg) )
89fac5392e1732557feb33809495efa89139b1f0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/89fac5392e1732557feb33809495efa89139b1f0/xmlrpclib.py
"""indicates a XML-RPC fault package"""
def __repr__(self): return ( "<ProtocolError for %s: %s %s>" % (self.url, self.errcode, self.errmsg) )
89fac5392e1732557feb33809495efa89139b1f0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/89fac5392e1732557feb33809495efa89139b1f0/xmlrpclib.py
def __repr__(self): return ( "<Fault %s: %s>" % (self.faultCode, repr(self.faultString)) )
89fac5392e1732557feb33809495efa89139b1f0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/89fac5392e1732557feb33809495efa89139b1f0/xmlrpclib.py
"""Convert any Python value to XML-RPC boolean."""
def boolean(value, truefalse=(False, True)): # convert any Python value to XML-RPC boolean return truefalse[operator.truth(value)]
89fac5392e1732557feb33809495efa89139b1f0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/89fac5392e1732557feb33809495efa89139b1f0/xmlrpclib.py
def datetime(data): value = DateTime() value.decode(data) return value
89fac5392e1732557feb33809495efa89139b1f0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/89fac5392e1732557feb33809495efa89139b1f0/xmlrpclib.py
"""XML parser using xmllib.XMLParser. This is about 10 times slower than sgmlop on roundtrip testing. """
def close(self): self._parser.Parse("", 1) # end of data del self._target, self._parser # get rid of circular references
89fac5392e1732557feb33809495efa89139b1f0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/89fac5392e1732557feb33809495efa89139b1f0/xmlrpclib.py
"""Generate an XML-RPC params chunk from a Python data structure"""
"""Generate an XML-RPC params chunk from a Python data structure. Create a marshaller instance for each set of parameters, and use "dumps" method to convert your data (represented as a tuple) to a XML-RPC params chunk. to write a fault response, pass a Fault instance instead. You may prefer to use the "dumps" convenience function for this purpose (see below). """
def __init__(self, target): self.handle_xml = target.xml self.unknown_starttag = target.start self.handle_data = target.data self.unknown_endtag = target.end xmllib.XMLParser.__init__(self)
89fac5392e1732557feb33809495efa89139b1f0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/89fac5392e1732557feb33809495efa89139b1f0/xmlrpclib.py
"""Unmarshal an XML-RPC response, based on incoming XML event messages (start, data, end). Call close() to get the resulting data structure. Note that this reader is fairly tolerant, and gladly accepts bogus XML-RPC data without complaining (but not bogus XML). """
def dump_instance(self, value): # check for special wrappers if value.__class__ in WRAPPERS: value.encode(self) else: # store instance attributes as a struct (really?) self.dump_struct(value.__dict__)
89fac5392e1732557feb33809495efa89139b1f0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/89fac5392e1732557feb33809495efa89139b1f0/xmlrpclib.py
raise error, "illegal range"
raise error, "bad character range"
def _parse(source, state): # parse a simple pattern subpattern = SubPattern(state) while 1: if source.next in ("|", ")"): break # end of subpattern this = source.get() if this is None: break # end of pattern if state.flags & SRE_FLAG_VERBOSE: # skip whitespace and comments if this in WHITESPACE: continue if this == "#": while 1: this = source.get() if this in (None, "\n"): break continue if this and this[0] not in SPECIAL_CHARS: subpattern.append((LITERAL, ord(this))) elif this == "[": # character set set = []
9f35412d2de02eca39105b8e038352389fa2caa3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9f35412d2de02eca39105b8e038352389fa2caa3/sre_parse.py
raise error, "illegal range"
raise error, "bad character range"
def _parse(source, state): # parse a simple pattern subpattern = SubPattern(state) while 1: if source.next in ("|", ")"): break # end of subpattern this = source.get() if this is None: break # end of pattern if state.flags & SRE_FLAG_VERBOSE: # skip whitespace and comments if this in WHITESPACE: continue if this == "#": while 1: this = source.get() if this in (None, "\n"): break continue if this and this[0] not in SPECIAL_CHARS: subpattern.append((LITERAL, ord(this))) elif this == "[": # character set set = []
9f35412d2de02eca39105b8e038352389fa2caa3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9f35412d2de02eca39105b8e038352389fa2caa3/sre_parse.py
if max < min: raise error, "bad repeat interval"
def _parse(source, state): # parse a simple pattern subpattern = SubPattern(state) while 1: if source.next in ("|", ")"): break # end of subpattern this = source.get() if this is None: break # end of pattern if state.flags & SRE_FLAG_VERBOSE: # skip whitespace and comments if this in WHITESPACE: continue if this == "#": while 1: this = source.get() if this in (None, "\n"): break continue if this and this[0] not in SPECIAL_CHARS: subpattern.append((LITERAL, ord(this))) elif this == "[": # character set set = []
9f35412d2de02eca39105b8e038352389fa2caa3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9f35412d2de02eca39105b8e038352389fa2caa3/sre_parse.py
raise error, "illegal character in group name"
raise error, "bad character in group name"
def _parse(source, state): # parse a simple pattern subpattern = SubPattern(state) while 1: if source.next in ("|", ")"): break # end of subpattern this = source.get() if this is None: break # end of pattern if state.flags & SRE_FLAG_VERBOSE: # skip whitespace and comments if this in WHITESPACE: continue if this == "#": while 1: this = source.get() if this in (None, "\n"): break continue if this and this[0] not in SPECIAL_CHARS: subpattern.append((LITERAL, ord(this))) elif this == "[": # character set set = []
9f35412d2de02eca39105b8e038352389fa2caa3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9f35412d2de02eca39105b8e038352389fa2caa3/sre_parse.py
raise error, "illegal character in group name"
raise error, "bad character in group name"
def _parse(source, state): # parse a simple pattern subpattern = SubPattern(state) while 1: if source.next in ("|", ")"): break # end of subpattern this = source.get() if this is None: break # end of pattern if state.flags & SRE_FLAG_VERBOSE: # skip whitespace and comments if this in WHITESPACE: continue if this == "#": while 1: this = source.get() if this in (None, "\n"): break continue if this and this[0] not in SPECIAL_CHARS: subpattern.append((LITERAL, ord(this))) elif this == "[": # character set set = []
9f35412d2de02eca39105b8e038352389fa2caa3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9f35412d2de02eca39105b8e038352389fa2caa3/sre_parse.py
if char is None or char == ")":
if char is None: raise error, "unexpected end of pattern" if char == ")":
def _parse(source, state): # parse a simple pattern subpattern = SubPattern(state) while 1: if source.next in ("|", ")"): break # end of subpattern this = source.get() if this is None: break # end of pattern if state.flags & SRE_FLAG_VERBOSE: # skip whitespace and comments if this in WHITESPACE: continue if this == "#": while 1: this = source.get() if this in (None, "\n"): break continue if this and this[0] not in SPECIAL_CHARS: subpattern.append((LITERAL, ord(this))) elif this == "[": # character set set = []
9f35412d2de02eca39105b8e038352389fa2caa3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9f35412d2de02eca39105b8e038352389fa2caa3/sre_parse.py
raise error, "illegal character in group name"
raise error, "bad character in group name"
def parse_template(source, pattern): # parse 're' replacement string into list of literals and # group references s = Tokenizer(source) p = [] a = p.append while 1: this = s.get() if this is None: break # end of replacement string if this and this[0] == "\\": # group if this == "\\g": name = "" if s.match("<"): while 1: char = s.get() if char is None: raise error, "unterminated group name" if char == ">": break name = name + char if not name: raise error, "bad group name" try: index = int(name) except ValueError: if not isname(name): raise error, "illegal character in group name" try: index = pattern.groupindex[name] except KeyError: raise IndexError, "unknown group name" a((MARK, index)) elif len(this) > 1 and this[1] in DIGITS: code = None while 1: group = _group(this, pattern.groups+1) if group: if (s.next not in DIGITS or not _group(this + s.next, pattern.groups+1)): code = MARK, int(group) break elif s.next in OCTDIGITS: this = this + s.get() else: break if not code: this = this[1:] code = LITERAL, int(this[-6:], 8) & 0xff a(code) else: try: a(ESCAPES[this]) except KeyError: for c in this: a((LITERAL, ord(c))) else: a((LITERAL, ord(this))) return p
9f35412d2de02eca39105b8e038352389fa2caa3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9f35412d2de02eca39105b8e038352389fa2caa3/sre_parse.py
def __init__(self, master=None): """Construct a variable with an optional MASTER as master widget. The variable is named PY_VAR_number in Tcl.
def __init__(self, master=None, value=None, name=None): """Construct a variable MASTER can be given as master widget. VALUE is an optional value (defaults to "") NAME is an optional Tcl name (defaults to PY_VARnum). If NAME matches an existing variable and VALUE is omitted then the existing value is retained.
def __init__(self, master=None): """Construct a variable with an optional MASTER as master widget. The variable is named PY_VAR_number in Tcl. """ global _varnum if not master: master = _default_root self._master = master self._tk = master.tk self._name = 'PY_VAR' + repr(_varnum) _varnum = _varnum + 1 self.set(self._default)
d9565dc51f7ac24afa5838b531be5ac7f386c816 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9565dc51f7ac24afa5838b531be5ac7f386c816/Tkinter.py
self._name = 'PY_VAR' + repr(_varnum) _varnum = _varnum + 1 self.set(self._default)
if name: self._name = name else: self._name = 'PY_VAR' + `_varnum` _varnum += 1 if value != None: self.set(value) elif not self._tk.call("info", "exists", self._name): self.set(self._default)
def __init__(self, master=None): """Construct a variable with an optional MASTER as master widget. The variable is named PY_VAR_number in Tcl. """ global _varnum if not master: master = _default_root self._master = master self._tk = master.tk self._name = 'PY_VAR' + repr(_varnum) _varnum = _varnum + 1 self.set(self._default)
d9565dc51f7ac24afa5838b531be5ac7f386c816 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9565dc51f7ac24afa5838b531be5ac7f386c816/Tkinter.py
def __init__(self, master=None):
def __init__(self, master=None, value=None, name=None):
def __init__(self, master=None): """Construct a string variable.
d9565dc51f7ac24afa5838b531be5ac7f386c816 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9565dc51f7ac24afa5838b531be5ac7f386c816/Tkinter.py
MASTER can be given as master widget.""" Variable.__init__(self, master)
MASTER can be given as master widget. VALUE is an optional value (defaults to "") NAME is an optional Tcl name (defaults to PY_VARnum). If NAME matches an existing variable and VALUE is omitted then the existing value is retained. """ Variable.__init__(self, master, value, name)
def __init__(self, master=None): """Construct a string variable.
d9565dc51f7ac24afa5838b531be5ac7f386c816 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9565dc51f7ac24afa5838b531be5ac7f386c816/Tkinter.py
def __init__(self, master=None):
def __init__(self, master=None, value=None, name=None):
def __init__(self, master=None): """Construct an integer variable.
d9565dc51f7ac24afa5838b531be5ac7f386c816 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9565dc51f7ac24afa5838b531be5ac7f386c816/Tkinter.py
MASTER can be given as master widget.""" Variable.__init__(self, master)
MASTER can be given as master widget. VALUE is an optional value (defaults to 0) NAME is an optional Tcl name (defaults to PY_VARnum). If NAME matches an existing variable and VALUE is omitted then the existing value is retained. """ Variable.__init__(self, master, value, name)
def __init__(self, master=None): """Construct an integer variable.
d9565dc51f7ac24afa5838b531be5ac7f386c816 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9565dc51f7ac24afa5838b531be5ac7f386c816/Tkinter.py
def __init__(self, master=None):
def __init__(self, master=None, value=None, name=None):
def __init__(self, master=None): """Construct a float variable.
d9565dc51f7ac24afa5838b531be5ac7f386c816 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9565dc51f7ac24afa5838b531be5ac7f386c816/Tkinter.py
MASTER can be given as a master widget.""" Variable.__init__(self, master)
MASTER can be given as master widget. VALUE is an optional value (defaults to 0.0) NAME is an optional Tcl name (defaults to PY_VARnum). If NAME matches an existing variable and VALUE is omitted then the existing value is retained. """ Variable.__init__(self, master, value, name)
def __init__(self, master=None): """Construct a float variable.
d9565dc51f7ac24afa5838b531be5ac7f386c816 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9565dc51f7ac24afa5838b531be5ac7f386c816/Tkinter.py
_default = "false" def __init__(self, master=None):
_default = False def __init__(self, master=None, value=None, name=None):
def get(self): """Return the value of the variable as a float.""" return getdouble(self._tk.globalgetvar(self._name))
d9565dc51f7ac24afa5838b531be5ac7f386c816 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9565dc51f7ac24afa5838b531be5ac7f386c816/Tkinter.py
MASTER can be given as a master widget.""" Variable.__init__(self, master)
MASTER can be given as master widget. VALUE is an optional value (defaults to False) NAME is an optional Tcl name (defaults to PY_VARnum). If NAME matches an existing variable and VALUE is omitted then the existing value is retained. """ Variable.__init__(self, master, value, name)
def __init__(self, master=None): """Construct a boolean variable.
d9565dc51f7ac24afa5838b531be5ac7f386c816 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9565dc51f7ac24afa5838b531be5ac7f386c816/Tkinter.py
if hasattr(self.db, 'close'): self.db.close() self.db = None
if hasattr(self.dict, 'close'): self.dict.close() self.dict = None
def close(self): if hasattr(self.db, 'close'): self.db.close() self.db = None
845502b911d91a3218eca6094becdea4677a81b5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/845502b911d91a3218eca6094becdea4677a81b5/shelve.py
dict['prefixname'] = 'mwerks_plugin_config.h'
if hasattr(MacOS, 'runtimemodel') and MacOS.runtimemodel == "carbon": dict['prefixname'] = 'mwerks_carbonplugin_config.h' else: dict['prefixname'] = 'mwerks_plugin_config.h'
def __init__(self, dict, templatelist=TEMPLATELIST, templatename=None): if templatename == None: if hasattr(MacOS, 'runtimemodel'): templatename = 'template-%s'%MacOS.runtimemodel else: templatename = 'template' if os.sep in templatename: templatedir = templatename else: try: packagedir = os.path.split(__file__)[0] except NameError: packagedir = os.curdir templatedir = os.path.join(packagedir, templatename) if not os.path.exists(templatedir): raise Error, "Cannot find templatedir %s"%templatedir self.dict = dict if not dict.has_key('prefixname'): dict['prefixname'] = 'mwerks_plugin_config.h' self.templatelist = templatelist self.templatedir = templatedir
0d463d2352c5265c508b1addef0c08e46763949e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0d463d2352c5265c508b1addef0c08e46763949e/cwxmlgen.py