rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
_debug("Checking robot.txt allowance for:\n user agent: %s\n url: %s" %
_debug("Checking robots.txt allowance for:\n user agent: %s\n url: %s" %
def can_fetch(self, useragent, url): """using the parsed robots.txt decide if useragent can fetch url""" _debug("Checking robot.txt allowance for:\n user agent: %s\n url: %s" % (useragent, url)) if self.disallow_all: return False if self.allow_all: return True # search for given user agent matches # the first match counts url = urllib.quote(urlparse.urlparse(urllib.unquote(url))[2]) or "/" for entry in self.entries: if entry.applies_to(useragent): return entry.allowance(url) # try the default entry last if self.default_entry: return self.default_entry.allowance(url) # agent not found ==> access granted return True
fd0d5de268892dc86a9d8bb6eb4cc8e68ce75af5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fd0d5de268892dc86a9d8bb6eb4cc8e68ce75af5/robotparser.py
for m in Pack.__dict__.keys():
methods = Pack.__dict__.keys() methods = methods + Grid.__dict__.keys() methods = methods + Place.__dict__.keys() for m in methods:
def __init__(self, master=None, cnf=None, **kw): if cnf is None: cnf = {} if kw: cnf = _cnfmerge((cnf, kw)) fcnf = {} for k in cnf.keys(): if type(k) == ClassType or k == 'name': fcnf[k] = cnf[k] del cnf[k] self.frame = apply(Frame, (master,), fcnf) self.vbar = Scrollbar(self.frame, name='vbar') self.vbar.pack(side=RIGHT, fill=Y) cnf['name'] = 'text' apply(Text.__init__, (self, self.frame), cnf) self.pack(side=LEFT, fill=BOTH, expand=1) self['yscrollcommand'] = self.vbar.set self.vbar['command'] = self.yview
cd7cb81a4343ba236bd6d9ee0d6e9be0792abb71 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/cd7cb81a4343ba236bd6d9ee0d6e9be0792abb71/ScrolledText.py
self.pred=[]
self.pred = []
def __init__(self, versionPredicateStr): """Parse a version predicate string. """ # Fields: # name: package name # pred: list of (comparison string, StrictVersion)
e5a596f9c3ee7eb9f236a91b47387e74fad4bb54 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e5a596f9c3ee7eb9f236a91b47387e74fad4bb54/versionpredicate.py
wordlist.sort(lambda a, b: len(b[1])-len(a[1]))
def cmpwords((aword, alist),(bword, blist)): r = -cmp(len(alist),len(blist)) if r: return r return cmp(aword, bword) wordlist.sort(cmpwords)
def makeunicodename(unicode, trace): FILE = "Modules/unicodename_db.h" print "--- Preparing", FILE, "..." # collect names names = [None] * len(unicode.chars) for char in unicode.chars: record = unicode.table[char] if record: name = record[1].strip() if name and name[0] != "<": names[char] = name + chr(0) print len(filter(lambda n: n is not None, names)), "distinct names" # collect unique words from names (note that we differ between # words inside a sentence, and words ending a sentence. the # latter includes the trailing null byte. words = {} n = b = 0 for char in unicode.chars: name = names[char] if name: w = name.split() b = b + len(name) n = n + len(w) for w in w: l = words.get(w) if l: l.append(None) else: words[w] = [len(words)] print n, "words in text;", b, "bytes" wordlist = words.items() # sort on falling frequency # XXX: different Python versions produce a different order # for words with equal frequency wordlist.sort(lambda a, b: len(b[1])-len(a[1])) # figure out how many phrasebook escapes we need escapes = 0 while escapes * 256 < len(wordlist): escapes = escapes + 1 print escapes, "escapes" short = 256 - escapes assert short > 0 print short, "short indexes in lexicon" # statistics n = 0 for i in range(short): n = n + len(wordlist[i][1]) print n, "short indexes in phrasebook" # pick the most commonly used words, and sort the rest on falling # length (to maximize overlap) wordlist, wordtail = wordlist[:short], wordlist[short:] wordtail.sort(lambda a, b: len(b[0])-len(a[0])) wordlist.extend(wordtail) # generate lexicon from words lexicon_offset = [0] lexicon = "" words = {} # build a lexicon string offset = 0 for w, x in wordlist: # encoding: bit 7 indicates last character in word (chr(128) # indicates the last character in an entire string) ww = w[:-1] + chr(ord(w[-1])+128) # reuse string tails, when possible o = lexicon.find(ww) if o < 0: o = offset lexicon = lexicon + ww offset = offset + len(w) words[w] = len(lexicon_offset) lexicon_offset.append(o) lexicon = map(ord, lexicon) # generate phrasebook from names and lexicon phrasebook = [0] phrasebook_offset = [0] * len(unicode.chars) for char in unicode.chars: name = names[char] if name: w = name.split() phrasebook_offset[char] = len(phrasebook) for w in w: i = words[w] if i < short: phrasebook.append(i) else: # store as two bytes phrasebook.append((i>>8) + short) phrasebook.append(i&255) assert getsize(phrasebook) == 1 # # unicode name hash table # extract names data = [] for char in unicode.chars: record = unicode.table[char] if record: name = record[1].strip() if name and name[0] != "<": data.append((name, char)) # the magic number 47 was chosen to minimize the number of # collisions on the current data set. if you like, change it # and see what happens... codehash = Hash("code", data, 47) print "--- Writing", FILE, "..." fp = open(FILE, "w") print >>fp, "/* this file was generated by %s %s */" % (SCRIPT, VERSION) print >>fp print >>fp, "#define NAME_MAXLEN", 256 print >>fp print >>fp, "/* lexicon */" Array("lexicon", lexicon).dump(fp, trace) Array("lexicon_offset", lexicon_offset).dump(fp, trace) # split decomposition index table offset1, offset2, shift = splitbins(phrasebook_offset, trace) print >>fp, "/* code->name phrasebook */" print >>fp, "#define phrasebook_shift", shift print >>fp, "#define phrasebook_short", short Array("phrasebook", phrasebook).dump(fp, trace) Array("phrasebook_offset1", offset1).dump(fp, trace) Array("phrasebook_offset2", offset2).dump(fp, trace) print >>fp, "/* name->code dictionary */" codehash.dump(fp, trace) fp.close()
d21783b97c6d562ecf0946155432d9bc2f5fd341 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d21783b97c6d562ecf0946155432d9bc2f5fd341/makeunicodedata.py
def __init__(self, filename, exclusions, expand=1): file = open(filename) table = [None] * 0x110000 while 1: s = file.readline() if not s: break s = s.strip().split(";") char = int(s[0], 16) table[char] = s
d21783b97c6d562ecf0946155432d9bc2f5fd341 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d21783b97c6d562ecf0946155432d9bc2f5fd341/makeunicodedata.py
for i in range(0, 0xD800):
for i in range(0, 0x110000):
def __init__(self, filename, exclusions, expand=1): file = open(filename) table = [None] * 0x110000 while 1: s = file.readline() if not s: break s = s.strip().split(";") char = int(s[0], 16) table[char] = s
d21783b97c6d562ecf0946155432d9bc2f5fd341 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d21783b97c6d562ecf0946155432d9bc2f5fd341/makeunicodedata.py
ix = h & 0xff000000
ix = h & 0xff000000L
def myhash(s, magic): h = 0 for c in map(ord, s.upper()): h = (h * magic) + c ix = h & 0xff000000 if ix: h = (h ^ ((ix>>24) & 0xff)) & 0x00ffffff return h
d21783b97c6d562ecf0946155432d9bc2f5fd341 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d21783b97c6d562ecf0946155432d9bc2f5fd341/makeunicodedata.py
'unixware5':
'unixware7':
def printlist(x, width=70, indent=4): """Print the elements of iterable x to stdout. Optional arg width (default 70) is the maximum line length. Optional arg indent (default 4) is the number of blanks with which to begin each line. """ from textwrap import fill blanks = ' ' * indent print fill(' '.join(map(str, x)), width, initial_indent=blanks, subsequent_indent=blanks)
2f85b46e802663f3f42868abd5f70863be7d86e1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2f85b46e802663f3f42868abd5f70863be7d86e1/regrtest.py
fp.write("\tif hasattr(v, '_superclassnames') and v._superclassnames:\n")
fp.write("\tif hasattr(v, '_superclassnames') and not hasattr(v, '_propdict'):\n")
fp.write("def getbaseclasses(v):\n")
9471ae92061183246569ab16f263f0b84f9720a2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9471ae92061183246569ab16f263f0b84f9720a2/gensuitemodule.py
fp.write("\t\tv._superclassnames = None\n")
fp.write("def getbaseclasses(v):\n")
9471ae92061183246569ab16f263f0b84f9720a2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9471ae92061183246569ab16f263f0b84f9720a2/gensuitemodule.py
f_month -- full weekday names (14-item list; dummy value in [0], which
f_month -- full month names (13-item list; dummy value in [0], which
def _getlang(): # Figure out what the current language is set to. return locale.getlocale(locale.LC_TIME)
df1ab7634a5d33a2f4ec592acef2b17dc6d6430c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/df1ab7634a5d33a2f4ec592acef2b17dc6d6430c/_strptime.py
a_month -- abbreviated weekday names (13-item list, dummy value in
a_month -- abbreviated month names (13-item list, dummy value in
def _getlang(): # Figure out what the current language is set to. return locale.getlocale(locale.LC_TIME)
df1ab7634a5d33a2f4ec592acef2b17dc6d6430c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/df1ab7634a5d33a2f4ec592acef2b17dc6d6430c/_strptime.py
* any RCS or CVS directories
* any RCS, CVS and .svn directories
def prune_file_list (self): """Prune off branches that might slip into the file list as created by 'read_template()', but really don't belong there: * the build tree (typically "build") * the release tree itself (only an issue if we ran "sdist" previously with --keep-temp, or it aborted) * any RCS or CVS directories """ build = self.get_finalized_command('build') base_dir = self.distribution.get_fullname()
a58c541822b7012cf55a3a0c4c747f33e3ec7a00 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a58c541822b7012cf55a3a0c4c747f33e3ec7a00/sdist.py
self.filelist.exclude_pattern(r'/(RCS|CVS)/.*', is_regex=1)
self.filelist.exclude_pattern(r'/(RCS|CVS|\.svn)/.*', is_regex=1)
def prune_file_list (self): """Prune off branches that might slip into the file list as created by 'read_template()', but really don't belong there: * the build tree (typically "build") * the release tree itself (only an issue if we ran "sdist" previously with --keep-temp, or it aborted) * any RCS or CVS directories """ build = self.get_finalized_command('build') base_dir = self.distribution.get_fullname()
a58c541822b7012cf55a3a0c4c747f33e3ec7a00 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a58c541822b7012cf55a3a0c4c747f33e3ec7a00/sdist.py
SetDialogItemText(h, string.joinfields(list, '\r'))
h.data = string.joinfields(list, '\r') d.SelectDialogItemText(TEXT_ITEM, 0, 32767) d.SelectDialogItemText(TEXT_ITEM, 0, 0)
def interact(list, pythondir, options, title): """Let the user interact with the dialog""" opythondir = pythondir try: # Try to go to the "correct" dir for GetDirectory os.chdir(pythondir.as_pathname()) except os.error: pass d = GetNewDialog(DIALOG_ID, -1) tp, h, rect = d.GetDialogItem(TITLE_ITEM) SetDialogItemText(h, title) tp, h, rect = d.GetDialogItem(TEXT_ITEM) SetDialogItemText(h, string.joinfields(list, '\r'))
021c70b2b6c9dba3dd083c5bc204417353adb997 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/021c70b2b6c9dba3dd083c5bc204417353adb997/EditPythonPrefs.py
tmp = string.splitfields(GetDialogItemText(h), '\r')
tmp = string.splitfields(h.data, '\r')
def interact(list, pythondir, options, title): """Let the user interact with the dialog""" opythondir = pythondir try: # Try to go to the "correct" dir for GetDirectory os.chdir(pythondir.as_pathname()) except os.error: pass d = GetNewDialog(DIALOG_ID, -1) tp, h, rect = d.GetDialogItem(TITLE_ITEM) SetDialogItemText(h, title) tp, h, rect = d.GetDialogItem(TEXT_ITEM) SetDialogItemText(h, string.joinfields(list, '\r'))
021c70b2b6c9dba3dd083c5bc204417353adb997 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/021c70b2b6c9dba3dd083c5bc204417353adb997/EditPythonPrefs.py
s = string.rjust(`vin.packfactor`, 2) if vin.packfactor and vin.format not in ('rgb', 'jpeg') and \ (vin.width/vin.packfactor) % 4 <> 0: s = s + '!'
if type(vin.packfactor) == type(()): xpf, ypf = vin.packfactor s = string.rjust(`xpf`, 2) + ',' + \ string.rjust(`ypf`, 2)
def process(filename): try: vin = VFile.RandomVinFile().init(filename) except IOError, msg: sys.stderr.write(filename + ': I/O error: ' + `msg` + '\n') return 1 except VFile.Error, msg: sys.stderr.write(msg + '\n') return 1 except EOFError: sys.stderr.write(filename + ': EOF in video file\n') return 1 if terse: print string.ljust(filename, maxwidth), kbytes = (VFile.getfilesize(filename) + 1023) / 1024 print string.rjust(`kbytes`, 5) + 'K', print ' ', string.ljust(`vin.version`, 5), print string.ljust(vin.format, 8), print string.rjust(`vin.width`, 4), print string.rjust(`vin.height`, 4), s = string.rjust(`vin.packfactor`, 2) if vin.packfactor and vin.format not in ('rgb', 'jpeg') and \ (vin.width/vin.packfactor) % 4 <> 0: s = s + '!' else: s = s + ' ' print s, sys.stdout.flush() else: vin.printinfo() if quick: if terse: print vin.close() return 0 try: vin.readcache() if not terse: print '[Using cached index]' except VFile.Error: if not terse: print '[Constructing index on the fly]' if not short: if delta: print 'Frame time deltas:', else: print 'Frame times:', n = 0 t = 0 told = 0 datasize = 0 while 1: try: t, ds, cs = vin.getnextframeheader() vin.skipnextframedata(ds, cs) except EOFError: break datasize = datasize + ds if cs: datasize = datasize + cs if not short: if n%8 == 0: sys.stdout.write('\n') if delta: sys.stdout.write('\t' + `t - told`) told = t else: sys.stdout.write('\t' + `t`) n = n+1 if not short: print if terse: print string.rjust(`n`, 6), print string.rjust(`int(n*10000.0/t)*0.1`, 5) else: print 'Total', n, 'frames in', t*0.001, 'sec.', if t: print '-- average', int(n*10000.0/t)*0.1, 'frames/sec', print print 'Total data', 0.1 * int(datasize / 102.4), 'Kbytes', if t: print '-- average', print 0.1 * int(datasize / 0.1024 / t), 'Kbytes/sec', print vin.close() return 0
61f722b0451ce1226126dc6b90492dbb90b414ca /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/61f722b0451ce1226126dc6b90492dbb90b414ca/Vinfo.py
s = s + ' '
s = string.rjust(`vin.packfactor`, 2) if type(vin.packfactor) == type(0) and \ vin.format not in ('rgb', 'jpeg') and \ (vin.width/vin.packfactor) % 4 <> 0: s = s + '! ' else: s = s + ' '
def process(filename): try: vin = VFile.RandomVinFile().init(filename) except IOError, msg: sys.stderr.write(filename + ': I/O error: ' + `msg` + '\n') return 1 except VFile.Error, msg: sys.stderr.write(msg + '\n') return 1 except EOFError: sys.stderr.write(filename + ': EOF in video file\n') return 1 if terse: print string.ljust(filename, maxwidth), kbytes = (VFile.getfilesize(filename) + 1023) / 1024 print string.rjust(`kbytes`, 5) + 'K', print ' ', string.ljust(`vin.version`, 5), print string.ljust(vin.format, 8), print string.rjust(`vin.width`, 4), print string.rjust(`vin.height`, 4), s = string.rjust(`vin.packfactor`, 2) if vin.packfactor and vin.format not in ('rgb', 'jpeg') and \ (vin.width/vin.packfactor) % 4 <> 0: s = s + '!' else: s = s + ' ' print s, sys.stdout.flush() else: vin.printinfo() if quick: if terse: print vin.close() return 0 try: vin.readcache() if not terse: print '[Using cached index]' except VFile.Error: if not terse: print '[Constructing index on the fly]' if not short: if delta: print 'Frame time deltas:', else: print 'Frame times:', n = 0 t = 0 told = 0 datasize = 0 while 1: try: t, ds, cs = vin.getnextframeheader() vin.skipnextframedata(ds, cs) except EOFError: break datasize = datasize + ds if cs: datasize = datasize + cs if not short: if n%8 == 0: sys.stdout.write('\n') if delta: sys.stdout.write('\t' + `t - told`) told = t else: sys.stdout.write('\t' + `t`) n = n+1 if not short: print if terse: print string.rjust(`n`, 6), print string.rjust(`int(n*10000.0/t)*0.1`, 5) else: print 'Total', n, 'frames in', t*0.001, 'sec.', if t: print '-- average', int(n*10000.0/t)*0.1, 'frames/sec', print print 'Total data', 0.1 * int(datasize / 102.4), 'Kbytes', if t: print '-- average', print 0.1 * int(datasize / 0.1024 / t), 'Kbytes/sec', print vin.close() return 0
61f722b0451ce1226126dc6b90492dbb90b414ca /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/61f722b0451ce1226126dc6b90492dbb90b414ca/Vinfo.py
print string.rjust(`int(n*10000.0/t)*0.1`, 5)
if t: print string.rjust(`int(n*10000.0/t)*0.1`, 5), print
def process(filename): try: vin = VFile.RandomVinFile().init(filename) except IOError, msg: sys.stderr.write(filename + ': I/O error: ' + `msg` + '\n') return 1 except VFile.Error, msg: sys.stderr.write(msg + '\n') return 1 except EOFError: sys.stderr.write(filename + ': EOF in video file\n') return 1 if terse: print string.ljust(filename, maxwidth), kbytes = (VFile.getfilesize(filename) + 1023) / 1024 print string.rjust(`kbytes`, 5) + 'K', print ' ', string.ljust(`vin.version`, 5), print string.ljust(vin.format, 8), print string.rjust(`vin.width`, 4), print string.rjust(`vin.height`, 4), s = string.rjust(`vin.packfactor`, 2) if vin.packfactor and vin.format not in ('rgb', 'jpeg') and \ (vin.width/vin.packfactor) % 4 <> 0: s = s + '!' else: s = s + ' ' print s, sys.stdout.flush() else: vin.printinfo() if quick: if terse: print vin.close() return 0 try: vin.readcache() if not terse: print '[Using cached index]' except VFile.Error: if not terse: print '[Constructing index on the fly]' if not short: if delta: print 'Frame time deltas:', else: print 'Frame times:', n = 0 t = 0 told = 0 datasize = 0 while 1: try: t, ds, cs = vin.getnextframeheader() vin.skipnextframedata(ds, cs) except EOFError: break datasize = datasize + ds if cs: datasize = datasize + cs if not short: if n%8 == 0: sys.stdout.write('\n') if delta: sys.stdout.write('\t' + `t - told`) told = t else: sys.stdout.write('\t' + `t`) n = n+1 if not short: print if terse: print string.rjust(`n`, 6), print string.rjust(`int(n*10000.0/t)*0.1`, 5) else: print 'Total', n, 'frames in', t*0.001, 'sec.', if t: print '-- average', int(n*10000.0/t)*0.1, 'frames/sec', print print 'Total data', 0.1 * int(datasize / 102.4), 'Kbytes', if t: print '-- average', print 0.1 * int(datasize / 0.1024 / t), 'Kbytes/sec', print vin.close() return 0
61f722b0451ce1226126dc6b90492dbb90b414ca /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/61f722b0451ce1226126dc6b90492dbb90b414ca/Vinfo.py
USE_FROZEN = hasattr(imp, "set_frozenmodules")
USE_ZIPIMPORT = "zipimport" in sys.builtin_module_names
def report(self): # XXX something decent pass
678abc68f61ae57565c4683c846e9cb003cf9e86 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/678abc68f61ae57565c4683c846e9cb003cf9e86/bundlebuilder.py
if USE_FROZEN: FROZEN_ARCHIVE = "FrozenModules.marshal" SITE_PY += """\ import imp, marshal f = open(sys.path[0] + "/%s", "rb") imp.set_frozenmodules(marshal.load(f)) f.close() """ % FROZEN_ARCHIVE
if USE_ZIPIMPORT: ZIP_ARCHIVE = "Modules.zip" SITE_PY += "sys.path.append(sys.path[0] + '/%s')\n" % ZIP_ARCHIVE def getPycData(fullname, code, ispkg): if ispkg: fullname += ".__init__" path = fullname.replace(".", os.sep) + PYC_EXT return path, MAGIC + '\0\0\0\0' + marshal.dumps(code)
def report(self): # XXX something decent pass
678abc68f61ae57565c4683c846e9cb003cf9e86 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/678abc68f61ae57565c4683c846e9cb003cf9e86/bundlebuilder.py
import imp, sys, os for p in sys.path: path = os.path.join(p, "%(filename)s") if os.path.exists(path): break else: assert 0, "file not found: %(filename)s" mod = imp.load_dynamic("%(name)s", path) sys.modules["%(name)s"] = mod
def __load(): import imp, sys, os for p in sys.path: path = os.path.join(p, "%(filename)s") if os.path.exists(path): break else: assert 0, "file not found: %(filename)s" mod = imp.load_dynamic("%(name)s", path) __load() del __load
def report(self): # XXX something decent pass
678abc68f61ae57565c4683c846e9cb003cf9e86 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/678abc68f61ae57565c4683c846e9cb003cf9e86/bundlebuilder.py
if USE_FROZEN: frozenmodules = []
if USE_ZIPIMPORT: import zipfile relpath = pathjoin("Contents", "Resources", ZIP_ARCHIVE) abspath = pathjoin(self.bundlepath, relpath) zf = zipfile.ZipFile(abspath, "w", zipfile.ZIP_DEFLATED)
def addPythonModules(self): self.message("Adding Python modules", 1)
678abc68f61ae57565c4683c846e9cb003cf9e86 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/678abc68f61ae57565c4683c846e9cb003cf9e86/bundlebuilder.py
if ispkg: self.message("Adding Python package %s" % name, 2) else: self.message("Adding Python module %s" % name, 2) frozenmodules.append((name, marshal.dumps(code), ispkg)) frozenmodules = tuple(frozenmodules) relpath = pathjoin("Contents", "Resources", FROZEN_ARCHIVE) abspath = pathjoin(self.bundlepath, relpath) f = open(abspath, "wb") marshal.dump(frozenmodules, f) f.close()
self.message("Adding Python module %s" % name, 2) path, pyc = getPycData(name, code, ispkg) zf.writestr(path, pyc) zf.close()
def addPythonModules(self): self.message("Adding Python modules", 1)
678abc68f61ae57565c4683c846e9cb003cf9e86 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/678abc68f61ae57565c4683c846e9cb003cf9e86/bundlebuilder.py
if USE_FROZEN:
if USE_ZIPIMPORT:
def findDependencies(self): self.message("Finding module dependencies", 1) import modulefinder mf = modulefinder.ModuleFinder(excludes=self.excludeModules) # manually add our own site.py site = mf.add_module("site") site.__code__ = SITE_CO mf.scan_code(SITE_CO, site)
678abc68f61ae57565c4683c846e9cb003cf9e86 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/678abc68f61ae57565c4683c846e9cb003cf9e86/bundlebuilder.py
if not USE_FROZEN or name != "site":
if not USE_ZIPIMPORT or name != "site":
def findDependencies(self): self.message("Finding module dependencies", 1) import modulefinder mf = modulefinder.ModuleFinder(excludes=self.excludeModules) # manually add our own site.py site = mf.add_module("site") site.__code__ = SITE_CO mf.scan_code(SITE_CO, site)
678abc68f61ae57565c4683c846e9cb003cf9e86 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/678abc68f61ae57565c4683c846e9cb003cf9e86/bundlebuilder.py
def findDependencies(self): self.message("Finding module dependencies", 1) import modulefinder mf = modulefinder.ModuleFinder(excludes=self.excludeModules) # manually add our own site.py site = mf.add_module("site") site.__code__ = SITE_CO mf.scan_code(SITE_CO, site)
678abc68f61ae57565c4683c846e9cb003cf9e86 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/678abc68f61ae57565c4683c846e9cb003cf9e86/bundlebuilder.py
f.write("\0" * 8)
f.write(MAGIC) f.write("\0" * 4)
def writePyc(code, path): f = open(path, "wb") f.write("\0" * 8) # don't bother about a time stamp marshal.dump(code, f) f.seek(0, 0) f.write(MAGIC) f.close()
678abc68f61ae57565c4683c846e9cb003cf9e86 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/678abc68f61ae57565c4683c846e9cb003cf9e86/bundlebuilder.py
f.seek(0, 0) f.write(MAGIC)
def writePyc(code, path): f = open(path, "wb") f.write("\0" * 8) # don't bother about a time stamp marshal.dump(code, f) f.seek(0, 0) f.write(MAGIC) f.close()
678abc68f61ae57565c4683c846e9cb003cf9e86 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/678abc68f61ae57565c4683c846e9cb003cf9e86/bundlebuilder.py
print "link_shared_object():" print " output_filename =", output_filename print " mkpath'ing:", os.path.dirname (output_filename)
def link_shared_object (self, objects, output_filename, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=0, extra_preargs=None, extra_postargs=None, build_temp=None):
f20a8d6292ce58a4192c660ead89baaa98b2c523 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f20a8d6292ce58a4192c660ead89baaa98b2c523/msvccompiler.py
else: if __debug__: self.fail("AssertionError not raised by assert 0")
def testAssert(self): # assert_stmt: 'assert' test [',' test] assert 1 assert 1, 1 assert lambda x:x assert 1, lambda x:x+1 try: assert 0, "msg" except AssertionError, e: self.assertEquals(e.args[0], "msg") # we can not expect an assertion error to be raised # if the tests are run in an optimized python #else: # self.fail("AssertionError not raised by assert 0")
ccca02b0b189b132db07fbd53e8d3fa1c5954cac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ccca02b0b189b132db07fbd53e8d3fa1c5954cac/test_grammar.py
self.badmodules[fqname][parent.__name__] = None
if parent: self.badmodules[fqname][parent.__name__] = None
def import_module(self, partname, fqname, parent): self.msgin(3, "import_module", partname, fqname, parent) try: m = self.modules[fqname] except KeyError: pass else: self.msgout(3, "import_module ->", m) return m if self.badmodules.has_key(fqname): self.msgout(3, "import_module -> None") self.badmodules[fqname][parent.__name__] = None return None try: fp, pathname, stuff = self.find_module(partname, parent and parent.__path__) except ImportError: self.msgout(3, "import_module ->", None) return None try: m = self.load_module(fqname, fp, pathname, stuff) finally: if fp: fp.close() if parent: setattr(parent, partname, m) self.msgout(3, "import_module ->", m) return m
af30c9033cec13ac7e42267f98408d0bbc870661 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/af30c9033cec13ac7e42267f98408d0bbc870661/modulefinder.py
self.d.DragWindow(where, screenbounds)
self.w.DragWindow(where, screenbounds)
def _update(self, value): maxval = self.maxval if maxval == 0: # XXXX Quick fix. Should probably display an unknown duration value = 0 maxval = 1 if maxval > 32767: value = int(value/(maxval/32767.0)) maxval = 32767 progbar = self.d.GetDialogItemAsControl(3) progbar.SetControlMaximum(maxval) progbar.SetControlValue(value) # Test for cancel button ready, ev = Evt.WaitNextEvent( Events.mDownMask, 1 ) if ready : what,msg,when,where,mod = ev part = Win.FindWindow(where)[0] if Dlg.IsDialogEvent(ev): ds = Dlg.DialogSelect(ev) if ds[0] and ds[1] == self.d and ds[-1] == 1: self.w.HideWindow() self.w = None self.d = None raise KeyboardInterrupt, ev else: if part == 4: # inDrag self.d.DragWindow(where, screenbounds) else: MacOS.HandleEvent(ev)
811a55cb0afb5b54edbbaa9e2a71761e991f6b6b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/811a55cb0afb5b54edbbaa9e2a71761e991f6b6b/EasyDialogs.py
write32(self.fileobj, int(time.time()))
write32u(self.fileobj, long(time.time()))
def _write_gzip_header(self): self.fileobj.write('\037\213') # magic header self.fileobj.write('\010') # compression method fname = self.filename[:-3] flags = 0 if fname: flags = FNAME self.fileobj.write(chr(flags)) write32(self.fileobj, int(time.time())) self.fileobj.write('\002') self.fileobj.write('\377') if fname: self.fileobj.write(fname + '\000')
7b7df8339e977a224362dad23e00d5181c1fb269 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7b7df8339e977a224362dad23e00d5181c1fb269/gzip.py
if crc32 != self.crc:
if crc32%0x100000000L != self.crc%0x100000000L:
def _read_eof(self): # We've read to the end of the file, so we have to rewind in order # to reread the 8 bytes containing the CRC and the file size. # We check the that the computed CRC and size of the # uncompressed data matches the stored values. self.fileobj.seek(-8, 1) crc32 = read32(self.fileobj) isize = read32(self.fileobj) if crc32 != self.crc: raise ValueError, "CRC check failed" elif isize != self.size: raise ValueError, "Incorrect length of data produced"
7b7df8339e977a224362dad23e00d5181c1fb269 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7b7df8339e977a224362dad23e00d5181c1fb269/gzip.py
def do_event(self, (dev, val)):
def do_event(self, dev, val):
def do_event(self, (dev, val)): if dev == DEVICE.REDRAW: if self.vin: self.vin.redraw(val) if self.vout: self.vout.redraw(val)
89a8f9532953b87e4128e8ce87609893e92d59eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/89a8f9532953b87e4128e8ce87609893e92d59eb/Vedit.py
def cb_in_new(self, args):
def cb_in_new(self, *args):
def cb_in_new(self, args): self.msg('') hd, tl = os.path.split(self.ifile) filename = fl.file_selector('Input video file', hd, '', tl) if not filename: return self.open_input(filename)
89a8f9532953b87e4128e8ce87609893e92d59eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/89a8f9532953b87e4128e8ce87609893e92d59eb/Vedit.py
def cb_in_close(self, args):
def cb_in_close(self, *args):
def cb_in_close(self, args): self.msg('') self.close_input()
89a8f9532953b87e4128e8ce87609893e92d59eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/89a8f9532953b87e4128e8ce87609893e92d59eb/Vedit.py
def cb_in_skip(self, args):
def cb_in_skip(self, *args):
def cb_in_skip(self, args): if not self.icheck(): return if not self.vin.get(): self.err('End of input file') self.ishow()
89a8f9532953b87e4128e8ce87609893e92d59eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/89a8f9532953b87e4128e8ce87609893e92d59eb/Vedit.py
def cb_in_back(self, args):
def cb_in_back(self, *args):
def cb_in_back(self, args): if not self.icheck(): return if not self.vin.backup(): self.err('Input buffer exhausted') self.ishow()
89a8f9532953b87e4128e8ce87609893e92d59eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/89a8f9532953b87e4128e8ce87609893e92d59eb/Vedit.py
def cb_in_rewind(self, args):
def cb_in_rewind(self, *args):
def cb_in_rewind(self, args): if not self.icheck(): return self.vin.rewind() self.ishow()
89a8f9532953b87e4128e8ce87609893e92d59eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/89a8f9532953b87e4128e8ce87609893e92d59eb/Vedit.py
def cb_copy(self, args):
def cb_copy(self, *args):
def cb_copy(self, args): if not self.iocheck(): return data = self.vin.get() if not data: self.err('End of input file') self.ishow() return if self.vout.getinfo() <> self.vin.getinfo(): print 'Copying info...' self.vout.setinfo(self.vin.getinfo()) self.vout.put(data) self.oshow() self.ishow()
89a8f9532953b87e4128e8ce87609893e92d59eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/89a8f9532953b87e4128e8ce87609893e92d59eb/Vedit.py
def cb_uncopy(self, args):
def cb_uncopy(self, *args):
def cb_uncopy(self, args): if not self.iocheck(): return if not self.vout.backup(): self.err('Output buffer exhausted') return self.oshow() if not self.vin.backup(): self.err('Input buffer exhausted') return self.ishow()
89a8f9532953b87e4128e8ce87609893e92d59eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/89a8f9532953b87e4128e8ce87609893e92d59eb/Vedit.py
def cb_out_new(self, args):
def cb_out_new(self, *args):
def cb_out_new(self, args): self.msg('') hd, tl = os.path.split(self.ofile) filename = fl.file_selector('Output video file', hd, '', tl) if not filename: return self.open_output(filename)
89a8f9532953b87e4128e8ce87609893e92d59eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/89a8f9532953b87e4128e8ce87609893e92d59eb/Vedit.py
def cb_out_close(self, args):
def cb_out_close(self, *args):
def cb_out_close(self, args): self.msg('') self.close_output()
89a8f9532953b87e4128e8ce87609893e92d59eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/89a8f9532953b87e4128e8ce87609893e92d59eb/Vedit.py
def cb_out_skip(self, arg):
def cb_out_skip(self, *args):
def cb_out_skip(self, arg): if not self.ocheck(): return if not self.vout.forward(): self.err('Output buffer exhausted') self.oshow()
89a8f9532953b87e4128e8ce87609893e92d59eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/89a8f9532953b87e4128e8ce87609893e92d59eb/Vedit.py
def cb_out_back(self, args):
def cb_out_back(self, *args):
def cb_out_back(self, args): if not self.ocheck(): return if not self.vout.backup(): self.err('Output buffer exhausted') self.oshow()
89a8f9532953b87e4128e8ce87609893e92d59eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/89a8f9532953b87e4128e8ce87609893e92d59eb/Vedit.py
def cb_out_rewind(self, args):
def cb_out_rewind(self, *args):
def cb_out_rewind(self, args): if not self.ocheck(): return self.vout.rewind() self.oshow()
89a8f9532953b87e4128e8ce87609893e92d59eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/89a8f9532953b87e4128e8ce87609893e92d59eb/Vedit.py
def cb_quit(self, args):
def cb_quit(self, *args):
def cb_quit(self, args): self.close_input() self.close_output() sys.exit(0)
89a8f9532953b87e4128e8ce87609893e92d59eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/89a8f9532953b87e4128e8ce87609893e92d59eb/Vedit.py
self.para.words.append(self.nextfont, text, \ self.d.textwidth(text), space, space, \ self.ascent, self.descent)
self.para.words.append((self.nextfont, text, self.d.textwidth(text), space, space, self.ascent, self.descent))
def addword(self, text, space): if self.nospace and not text: return self.nospace = 0 self.blanklines = 0 if not self.para: self.para = self.newpara() self.para.indent_left = self.leftindent self.para.just = self.just self.nextfont = self.font space = int(space * self.space) self.para.words.append(self.nextfont, text, \ self.d.textwidth(text), space, space, \ self.ascent, self.descent) self.nextfont = None
8a6aa25357d1ec1b4d7ddd1c0cbfafd711ea28af /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8a6aa25357d1ec1b4d7ddd1c0cbfafd711ea28af/fmt.py
self.window.show( \
self.window.show(
def showanchor(self, id): for i in range(len(self.paralist)): p = self.paralist[i] if p.hasanchor(id): long1 = i, 0 long2 = i, len(p.extract()) hit = long1, long2 self.setselection(hit) self.window.show( \ (p.left, p.top), (p.right, p.bottom)) break
8a6aa25357d1ec1b4d7ddd1c0cbfafd711ea28af /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8a6aa25357d1ec1b4d7ddd1c0cbfafd711ea28af/fmt.py
it = iter(self._fp)
eq(iter(self._fp), self._fp)
def test_iterator(self): eq = self.assertEqual unless = self.failUnless it = iter(self._fp) # Does this object support the iteration protocol? unless(hasattr(it, '__iter__')) unless(hasattr(it, 'next')) i = 0 for line in self._fp: eq(line, self._line + '\n') i += 1 eq(i, 5)
a6eca6d97632ddd0c92404c0f7b68ec6bd6ce35f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a6eca6d97632ddd0c92404c0f7b68ec6bd6ce35f/test_StringIO.py
unless(hasattr(it, '__iter__')) unless(hasattr(it, 'next'))
unless(hasattr(self._fp, '__iter__')) unless(hasattr(self._fp, 'next'))
def test_iterator(self): eq = self.assertEqual unless = self.failUnless it = iter(self._fp) # Does this object support the iteration protocol? unless(hasattr(it, '__iter__')) unless(hasattr(it, 'next')) i = 0 for line in self._fp: eq(line, self._line + '\n') i += 1 eq(i, 5)
a6eca6d97632ddd0c92404c0f7b68ec6bd6ce35f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a6eca6d97632ddd0c92404c0f7b68ec6bd6ce35f/test_StringIO.py
'member', 'sectcode', 'verb'):
'member', 'sectcode', 'verb', 'cfunction', 'cdata', 'ctype', ):
def startchange(): global hist, out hist.chaptertype = "chapter" hist.inenv = [] hist.nodenames = [] hist.cindex = [] hist.inargs = 0 hist.enumeratenesting, hist.itemizenesting = 0, 0 out.doublenodes = [] out.doublecindeces = []
8155ca150930842112da9c64dcc64f9241c80817 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8155ca150930842112da9c64dcc64f9241c80817/partparse.py
command = '' cat_class = '' if idxsi and idxsi[-1] in ('method', 'protocol', 'attribute'): command = 'defmethod' cat_class = string.join(idxsi[:-1]) elif len(idxsi) == 2 and idxsi[1] == 'function': command = 'deffn' cat_class = string.join(idxsi) elif len(idxsi) == 3 and idxsi[:2] == ['in', 'module']: command = 'deffn' cat_class = 'function of ' + string.join(idxsi[1:]) elif len(idxsi) > 3 and idxsi[:2] == ['in', 'modules']: command = 'deffn' cat_class = 'function of ' + string.join(idxsi[1:]) if not command: raise error, 'don\'t know what to do with indexsubitem ' + `idxsi`
command = 'deffn' if hist.this_module: cat_class = 'function of ' + hist.this_module else: cat_class = 'built-in function'
def do_funcdesc(length, buf, pp, i, index=1): startpoint = i-1 ch = pp[startpoint] wh = ch.where length, newi = getnextarg(length, buf, pp, i) funcname = chunk(GROUP, wh, pp[i:newi]) del pp[i:newi] length = length - (newi-i) save = hist.inargs hist.inargs = 1 length, newi = getnextarg(length, buf, pp, i) hist.inargs = save del save the_args = [chunk(PLAIN, wh, '()'[0])] + pp[i:newi] + \ [chunk(PLAIN, wh, '()'[1])] del pp[i:newi] length = length - (newi-i) idxsi = hist.indexsubitem # words command = '' cat_class = '' if idxsi and idxsi[-1] in ('method', 'protocol', 'attribute'): command = 'defmethod' cat_class = string.join(idxsi[:-1]) elif len(idxsi) == 2 and idxsi[1] == 'function': command = 'deffn' cat_class = string.join(idxsi) elif len(idxsi) == 3 and idxsi[:2] == ['in', 'module']: command = 'deffn' cat_class = 'function of ' + string.join(idxsi[1:]) elif len(idxsi) > 3 and idxsi[:2] == ['in', 'modules']: command = 'deffn' cat_class = 'function of ' + string.join(idxsi[1:]) if not command: raise error, 'don\'t know what to do with indexsubitem ' + `idxsi` ch.chtype = chunk_type[CSLINE] ch.data = command cslinearg = [chunk(GROUP, wh, [chunk(PLAIN, wh, cat_class)])] cslinearg.append(chunk(PLAIN, wh, ' ')) cslinearg.append(funcname) cslinearg.append(chunk(PLAIN, wh, ' ')) l = len(cslinearg) cslinearg[l:l] = the_args pp.insert(i, chunk(GROUP, wh, cslinearg)) i, length = i+1, length+1 hist.command = command return length, i
8155ca150930842112da9c64dcc64f9241c80817 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8155ca150930842112da9c64dcc64f9241c80817/partparse.py
if len(idxsi) == 2 and idxsi[1] == 'exception': command = 'defvr' cat_class = string.join(idxsi) elif len(idxsi) == 3 and idxsi[:2] == ['in', 'module']: command = 'defcv' cat_class = 'exception' class_class = string.join(idxsi[1:]) elif len(idxsi) == 4 and idxsi[:3] == ['exception', 'in', 'module']: command = 'defcv' cat_class = 'exception' class_class = string.join(idxsi[2:]) elif idxsi == ['built-in', 'exception', 'base', 'class']:
if idxsi == ['built-in', 'exception', 'base', 'class']:
def do_excdesc(length, buf, pp, i): startpoint = i-1 ch = pp[startpoint] wh = ch.where length, newi = getnextarg(length, buf, pp, i) excname = chunk(GROUP, wh, pp[i:newi]) del pp[i:newi] length = length - (newi-i) idxsi = hist.indexsubitem # words command = '' cat_class = '' class_class = '' if len(idxsi) == 2 and idxsi[1] == 'exception': command = 'defvr' cat_class = string.join(idxsi) elif len(idxsi) == 3 and idxsi[:2] == ['in', 'module']: command = 'defcv' cat_class = 'exception' class_class = string.join(idxsi[1:]) elif len(idxsi) == 4 and idxsi[:3] == ['exception', 'in', 'module']: command = 'defcv' cat_class = 'exception' class_class = string.join(idxsi[2:]) elif idxsi == ['built-in', 'exception', 'base', 'class']: command = 'defvr' cat_class = 'exception base class' else: raise error, 'don\'t know what to do with indexsubitem ' + `idxsi` ch.chtype = chunk_type[CSLINE] ch.data = command cslinearg = [chunk(GROUP, wh, [chunk(PLAIN, wh, cat_class)])] cslinearg.append(chunk(PLAIN, wh, ' ')) if class_class: cslinearg.append(chunk(GROUP, wh, [chunk(PLAIN, wh, class_class)])) cslinearg.append(chunk(PLAIN, wh, ' ')) cslinearg.append(excname) pp.insert(i, chunk(GROUP, wh, cslinearg)) i, length = i+1, length+1 hist.command = command return length, i
8155ca150930842112da9c64dcc64f9241c80817 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8155ca150930842112da9c64dcc64f9241c80817/partparse.py
raise error, 'don\'t know what to do with indexsubitem ' + `idxsi`
command = 'defcv' cat_class = 'exception'
def do_excdesc(length, buf, pp, i): startpoint = i-1 ch = pp[startpoint] wh = ch.where length, newi = getnextarg(length, buf, pp, i) excname = chunk(GROUP, wh, pp[i:newi]) del pp[i:newi] length = length - (newi-i) idxsi = hist.indexsubitem # words command = '' cat_class = '' class_class = '' if len(idxsi) == 2 and idxsi[1] == 'exception': command = 'defvr' cat_class = string.join(idxsi) elif len(idxsi) == 3 and idxsi[:2] == ['in', 'module']: command = 'defcv' cat_class = 'exception' class_class = string.join(idxsi[1:]) elif len(idxsi) == 4 and idxsi[:3] == ['exception', 'in', 'module']: command = 'defcv' cat_class = 'exception' class_class = string.join(idxsi[2:]) elif idxsi == ['built-in', 'exception', 'base', 'class']: command = 'defvr' cat_class = 'exception base class' else: raise error, 'don\'t know what to do with indexsubitem ' + `idxsi` ch.chtype = chunk_type[CSLINE] ch.data = command cslinearg = [chunk(GROUP, wh, [chunk(PLAIN, wh, cat_class)])] cslinearg.append(chunk(PLAIN, wh, ' ')) if class_class: cslinearg.append(chunk(GROUP, wh, [chunk(PLAIN, wh, class_class)])) cslinearg.append(chunk(PLAIN, wh, ' ')) cslinearg.append(excname) pp.insert(i, chunk(GROUP, wh, cslinearg)) i, length = i+1, length+1 hist.command = command return length, i
8155ca150930842112da9c64dcc64f9241c80817 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8155ca150930842112da9c64dcc64f9241c80817/partparse.py
'funcdescni', 'datadescni'):
'funcdescni', 'datadescni', 'methoddesc', 'memberdesc', 'methoddescni', 'memberdescni', ):
def changeit(buf, pp): global onlylatexspecial, hist, out i, length = 0, len(pp) while 1: # sanity check: length should always equal len(pp) if len(pp) != length: print i, pp[i] raise 'FATAL', 'inconsistent length. thought ' + `length` + ', but should really be ' + `len(pp)` if i >= length: break ch = pp[i] i = i + 1 if type(ch) is StringType: #normally, only chunks are present in pp, # but in some cases, some extra info # has been inserted, e.g., the \end{...} clauses raise 'FATAL', 'got string, probably too many ' + `end` if ch.chtype == chunk_type[GROUP]: # check for {\em ...} constructs data = ch.data if data and \ data[0].chtype == chunk_type[CSNAME] and \ fontchanges.has_key(s(buf, data[0].data)): k = s(buf, data[0].data) del data[0] pp.insert(i-1, chunk(CSNAME, ch.where, fontchanges[k])) length, i = length+1, i+1 elif data: if len(data) \ and data[0].chtype == chunk_type[GROUP] \ and len(data[0].data) \ and data[0].data[0].chtype == chunk_type[CSNAME] \ and s(buf, data[0].data[0].data) == 'e': data[0] = data[0].data[0] print "invoking \\e magic group transform..." else:
8155ca150930842112da9c64dcc64f9241c80817 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8155ca150930842112da9c64dcc64f9241c80817/partparse.py
stuff = pp[i].data if len(stuff) != 1: raise error, "parameter to \\setindexsubitem{} too long" if pp[i].chtype != chunk_type[GROUP]: raise error, "bad chunk type following \\setindexsubitem" \ "\nexpected GROUP, got " + str(ch.chtype) text = s(buf, stuff[0].data) if text[:1] != '(' or text[-1:] != ')': raise error, \ 'expected indexsubitem enclosed in parenteses' hist.indexsubitem = string.split(text[1:-1]) del stuff, text del pp[i-1:i+1] i = i - 1 length = length - 2
length, i = yank_indexsubitem(pp, length, i, buf, ch, 'setindexsubitem') elif s_buf_data == 'withsubitem': oldsubitem = hist.indexsubitem try: length, i = yank_indexsubitem(pp, length, i, buf, ch, 'withsubitem') stuff = pp[i].data del pp[i] length = length - 1 changeit(buf, stuff) stuff = None finally: hist.indexsubitem = oldsubitem elif s_buf_data in ('textrm', 'pytype'): stuff = pp[i].data pp[i-1:i+1] = stuff length = length - 2 + len(stuff) stuff = None i = i - 1
def changeit(buf, pp): global onlylatexspecial, hist, out i, length = 0, len(pp) while 1: # sanity check: length should always equal len(pp) if len(pp) != length: print i, pp[i] raise 'FATAL', 'inconsistent length. thought ' + `length` + ', but should really be ' + `len(pp)` if i >= length: break ch = pp[i] i = i + 1 if type(ch) is StringType: #normally, only chunks are present in pp, # but in some cases, some extra info # has been inserted, e.g., the \end{...} clauses raise 'FATAL', 'got string, probably too many ' + `end` if ch.chtype == chunk_type[GROUP]: # check for {\em ...} constructs data = ch.data if data and \ data[0].chtype == chunk_type[CSNAME] and \ fontchanges.has_key(s(buf, data[0].data)): k = s(buf, data[0].data) del data[0] pp.insert(i-1, chunk(CSNAME, ch.where, fontchanges[k])) length, i = length+1, i+1 elif data: if len(data) \ and data[0].chtype == chunk_type[GROUP] \ and len(data[0].data) \ and data[0].data[0].chtype == chunk_type[CSNAME] \ and s(buf, data[0].data[0].data) == 'e': data[0] = data[0].data[0] print "invoking \\e magic group transform..." else:
8155ca150930842112da9c64dcc64f9241c80817 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8155ca150930842112da9c64dcc64f9241c80817/partparse.py
cat_class = '('+string.join(idxsi)+')'
cat_class = '(%s)' % string.join(idxsi)
def changeit(buf, pp): global onlylatexspecial, hist, out i, length = 0, len(pp) while 1: # sanity check: length should always equal len(pp) if len(pp) != length: print i, pp[i] raise 'FATAL', 'inconsistent length. thought ' + `length` + ', but should really be ' + `len(pp)` if i >= length: break ch = pp[i] i = i + 1 if type(ch) is StringType: #normally, only chunks are present in pp, # but in some cases, some extra info # has been inserted, e.g., the \end{...} clauses raise 'FATAL', 'got string, probably too many ' + `end` if ch.chtype == chunk_type[GROUP]: # check for {\em ...} constructs data = ch.data if data and \ data[0].chtype == chunk_type[CSNAME] and \ fontchanges.has_key(s(buf, data[0].data)): k = s(buf, data[0].data) del data[0] pp.insert(i-1, chunk(CSNAME, ch.where, fontchanges[k])) length, i = length+1, i+1 elif data: if len(data) \ and data[0].chtype == chunk_type[GROUP] \ and len(data[0].data) \ and data[0].data[0].chtype == chunk_type[CSNAME] \ and s(buf, data[0].data[0].data) == 'e': data[0] = data[0].data[0] print "invoking \\e magic group transform..." else:
8155ca150930842112da9c64dcc64f9241c80817 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8155ca150930842112da9c64dcc64f9241c80817/partparse.py
def changeit(buf, pp): global onlylatexspecial, hist, out i, length = 0, len(pp) while 1: # sanity check: length should always equal len(pp) if len(pp) != length: print i, pp[i] raise 'FATAL', 'inconsistent length. thought ' + `length` + ', but should really be ' + `len(pp)` if i >= length: break ch = pp[i] i = i + 1 if type(ch) is StringType: #normally, only chunks are present in pp, # but in some cases, some extra info # has been inserted, e.g., the \end{...} clauses raise 'FATAL', 'got string, probably too many ' + `end` if ch.chtype == chunk_type[GROUP]: # check for {\em ...} constructs data = ch.data if data and \ data[0].chtype == chunk_type[CSNAME] and \ fontchanges.has_key(s(buf, data[0].data)): k = s(buf, data[0].data) del data[0] pp.insert(i-1, chunk(CSNAME, ch.where, fontchanges[k])) length, i = length+1, i+1 elif data: if len(data) \ and data[0].chtype == chunk_type[GROUP] \ and len(data[0].data) \ and data[0].data[0].chtype == chunk_type[CSNAME] \ and s(buf, data[0].data[0].data) == 'e': data[0] = data[0].data[0] print "invoking \\e magic group transform..." else:
8155ca150930842112da9c64dcc64f9241c80817 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8155ca150930842112da9c64dcc64f9241c80817/partparse.py
ch.chtype = chunk_type[CSLINE] ch.data = 'pindex' length, newi = getnextarg(length, buf, pp, i) ingroupch = pp[i:newi] del pp[i:newi] length = length - (newi-i) ingroupch.append(chunk(PLAIN, ch.where, ' ')) ingroupch.append(chunk(CSNAME, ch.where, 'r')) ingroupch.append(chunk(GROUP, ch.where, [ chunk(PLAIN, ch.where, '(built-in)')])) pp.insert(i, chunk(GROUP, ch.where, ingroupch)) length, i = length+1, i+1 elif s_buf_data == 'refmodindex': ch.chtype = chunk_type[CSLINE] ch.data = 'pindex' length, newi = getnextarg(length, buf, pp, i) ingroupch = pp[i:newi] del pp[i:newi] length = length - (newi-i) pp.insert(i, chunk(GROUP, ch.where, ingroupch)) length, i = length+1, i+1
length, i = add_module_index( pp, length, i, buf, ch, '(built-in)', (s_buf_data[:3] == 'ref')) elif s_buf_data in ('modindex', 'refmodindex'): length, i = add_module_index( pp, length, i, buf, ch, '', (s_buf_data[:3] == 'ref'))
def changeit(buf, pp): global onlylatexspecial, hist, out i, length = 0, len(pp) while 1: # sanity check: length should always equal len(pp) if len(pp) != length: print i, pp[i] raise 'FATAL', 'inconsistent length. thought ' + `length` + ', but should really be ' + `len(pp)` if i >= length: break ch = pp[i] i = i + 1 if type(ch) is StringType: #normally, only chunks are present in pp, # but in some cases, some extra info # has been inserted, e.g., the \end{...} clauses raise 'FATAL', 'got string, probably too many ' + `end` if ch.chtype == chunk_type[GROUP]: # check for {\em ...} constructs data = ch.data if data and \ data[0].chtype == chunk_type[CSNAME] and \ fontchanges.has_key(s(buf, data[0].data)): k = s(buf, data[0].data) del data[0] pp.insert(i-1, chunk(CSNAME, ch.where, fontchanges[k])) length, i = length+1, i+1 elif data: if len(data) \ and data[0].chtype == chunk_type[GROUP] \ and len(data[0].data) \ and data[0].data[0].chtype == chunk_type[CSNAME] \ and s(buf, data[0].data[0].data) == 'e': data[0] = data[0].data[0] print "invoking \\e magic group transform..." else:
8155ca150930842112da9c64dcc64f9241c80817 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8155ca150930842112da9c64dcc64f9241c80817/partparse.py
ch.chtype = chunk_type[CSLINE] ch.data = 'pindex' length, newi = getnextarg(length, buf, pp, i) ingroupch = pp[i:newi] del pp[i:newi] length = length - (newi-i) ingroupch.append(chunk(PLAIN, ch.where, ' ')) ingroupch.append(chunk(CSNAME, ch.where, 'r')) ingroupch.append(chunk(GROUP, ch.where, [ chunk(PLAIN, ch.where, '(standard)')])) pp.insert(i, chunk(GROUP, ch.where, ingroupch)) length, i = length+1, i+1 elif s_buf_data in ('stmodindex', 'refstmodindex'): ch.chtype = chunk_type[CSLINE] ch.data = 'pindex' length, newi = getnextarg(length, buf, pp, i) ingroupch = pp[i:newi] del pp[i:newi] length = length - (newi-i) ingroupch.append(chunk(PLAIN, ch.where, ' ')) ingroupch.append(chunk(CSNAME, ch.where, 'r')) ingroupch.append(chunk(GROUP, ch.where, [ chunk(PLAIN, ch.where, '(standard)')])) pp.insert(i, chunk(GROUP, ch.where, ingroupch)) length, i = length+1, i+1
length, i = add_module_index( pp, length, i, buf, ch, '(standard)', (s_buf_data[:3] == 'ref')) elif s_buf_data in ('exmodindex', 'refexmodindex'): length, i = add_module_index( pp, length, i, buf, ch, '(extension)', (s_buf_data[:3] == 'ref'))
def changeit(buf, pp): global onlylatexspecial, hist, out i, length = 0, len(pp) while 1: # sanity check: length should always equal len(pp) if len(pp) != length: print i, pp[i] raise 'FATAL', 'inconsistent length. thought ' + `length` + ', but should really be ' + `len(pp)` if i >= length: break ch = pp[i] i = i + 1 if type(ch) is StringType: #normally, only chunks are present in pp, # but in some cases, some extra info # has been inserted, e.g., the \end{...} clauses raise 'FATAL', 'got string, probably too many ' + `end` if ch.chtype == chunk_type[GROUP]: # check for {\em ...} constructs data = ch.data if data and \ data[0].chtype == chunk_type[CSNAME] and \ fontchanges.has_key(s(buf, data[0].data)): k = s(buf, data[0].data) del data[0] pp.insert(i-1, chunk(CSNAME, ch.where, fontchanges[k])) length, i = length+1, i+1 elif data: if len(data) \ and data[0].chtype == chunk_type[GROUP] \ and len(data[0].data) \ and data[0].data[0].chtype == chunk_type[CSNAME] \ and s(buf, data[0].data[0].data) == 'e': data[0] = data[0].data[0] print "invoking \\e magic group transform..." else:
8155ca150930842112da9c64dcc64f9241c80817 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8155ca150930842112da9c64dcc64f9241c80817/partparse.py
while pp[i+1].chtype == chunk_type[COMMENT]: i = i + 1
def changeit(buf, pp): global onlylatexspecial, hist, out i, length = 0, len(pp) while 1: # sanity check: length should always equal len(pp) if len(pp) != length: print i, pp[i] raise 'FATAL', 'inconsistent length. thought ' + `length` + ', but should really be ' + `len(pp)` if i >= length: break ch = pp[i] i = i + 1 if type(ch) is StringType: #normally, only chunks are present in pp, # but in some cases, some extra info # has been inserted, e.g., the \end{...} clauses raise 'FATAL', 'got string, probably too many ' + `end` if ch.chtype == chunk_type[GROUP]: # check for {\em ...} constructs data = ch.data if data and \ data[0].chtype == chunk_type[CSNAME] and \ fontchanges.has_key(s(buf, data[0].data)): k = s(buf, data[0].data) del data[0] pp.insert(i-1, chunk(CSNAME, ch.where, fontchanges[k])) length, i = length+1, i+1 elif data: if len(data) \ and data[0].chtype == chunk_type[GROUP] \ and len(data[0].data) \ and data[0].data[0].chtype == chunk_type[CSNAME] \ and s(buf, data[0].data[0].data) == 'e': data[0] = data[0].data[0] print "invoking \\e magic group transform..." else:
8155ca150930842112da9c64dcc64f9241c80817 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8155ca150930842112da9c64dcc64f9241c80817/partparse.py
oparen = chunk(PLAIN, ch.where, " (") data.insert(0, oparen)
data.insert(0, chunk(PLAIN, ch.where, " ("))
def changeit(buf, pp): global onlylatexspecial, hist, out i, length = 0, len(pp) while 1: # sanity check: length should always equal len(pp) if len(pp) != length: print i, pp[i] raise 'FATAL', 'inconsistent length. thought ' + `length` + ', but should really be ' + `len(pp)` if i >= length: break ch = pp[i] i = i + 1 if type(ch) is StringType: #normally, only chunks are present in pp, # but in some cases, some extra info # has been inserted, e.g., the \end{...} clauses raise 'FATAL', 'got string, probably too many ' + `end` if ch.chtype == chunk_type[GROUP]: # check for {\em ...} constructs data = ch.data if data and \ data[0].chtype == chunk_type[CSNAME] and \ fontchanges.has_key(s(buf, data[0].data)): k = s(buf, data[0].data) del data[0] pp.insert(i-1, chunk(CSNAME, ch.where, fontchanges[k])) length, i = length+1, i+1 elif data: if len(data) \ and data[0].chtype == chunk_type[GROUP] \ and len(data[0].data) \ and data[0].data[0].chtype == chunk_type[CSNAME] \ and s(buf, data[0].data[0].data) == 'e': data[0] = data[0].data[0] print "invoking \\e magic group transform..." else:
8155ca150930842112da9c64dcc64f9241c80817 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8155ca150930842112da9c64dcc64f9241c80817/partparse.py
print 'WARNING: found newline in csline arg'
def dumpit(buf, wm, pp): global out i, length = 0, len(pp) addspace = 0 while 1: if len(pp) != length: raise 'FATAL', 'inconsistent length' if i == length: break ch = pp[i] i = i + 1 dospace = addspace addspace = 0 if ch.chtype == chunk_type[CSNAME]: s_buf_data = s(buf, ch.data)
8155ca150930842112da9c64dcc64f9241c80817 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8155ca150930842112da9c64dcc64f9241c80817/partparse.py
if hasattr(sys, "gettotalrefcount"):
if hasattr(set, "test_c_api"):
def test_weakref(self): s = self.thetype('gallahad') p = proxy(s) self.assertEqual(str(p), str(s)) s = None self.assertRaises(ReferenceError, str, p)
cc79ed095a01f1fefd8c4ceab4cf550f27b41cba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/cc79ed095a01f1fefd8c4ceab4cf550f27b41cba/test_set.py
_tryorder = os.environ["BROWSER"].split(":")
_tryorder = os.environ["BROWSER"].split(os.pathsep)
def open_new(self, url): self.open(url)
385672311bc6e93887a6ffdfae3423342ca22ab9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/385672311bc6e93887a6ffdfae3423342ca22ab9/webbrowser.py
day = int(mo.group(day)) year = int(mo.group(year)) hour = int(mo.group(hour)) min = int(mo.group(min)) sec = int(mo.group(sec)) zoneh = int(mo.group(zoneh)) zonem = int(mo.group(zonem))
day = int(mo.group('day')) year = int(mo.group('year')) hour = int(mo.group('hour')) min = int(mo.group('min')) sec = int(mo.group('sec')) zoneh = int(mo.group('zoneh')) zonem = int(mo.group('zonem'))
def Internaldate2tuple(resp): """Convert IMAP4 INTERNALDATE to UT. Returns Python time module tuple. """ mo = InternalDate.match(resp) if not mo: return None mon = Mon2num[mo.group('mon')] zonen = mo.group('zonen') day = int(mo.group(day)) year = int(mo.group(year)) hour = int(mo.group(hour)) min = int(mo.group(min)) sec = int(mo.group(sec)) zoneh = int(mo.group(zoneh)) zonem = int(mo.group(zonem)) # INTERNALDATE timezone must be subtracted to get UT zone = (zoneh*60 + zonem)*60 if zonen == '-': zone = -zone tt = (year, mon, day, hour, min, sec, -1, -1, -1) utc = time.mktime(tt) # Following is necessary because the time module has no 'mkgmtime'. # 'mktime' assumes arg in local timezone, so adds timezone/altzone. lt = time.localtime(utc) if time.daylight and lt[-1]: zone = zone + time.altzone else: zone = zone + time.timezone return time.localtime(utc - zone)
4e3df4a70e13b2e14affc5edf6019371f0c6033d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4e3df4a70e13b2e14affc5edf6019371f0c6033d/imaplib.py
if __debug__: print "colorizing already scheduled"
if DEBUG: print "colorizing already scheduled"
def notify_range(self, index1, index2=None): self.tag_add("TODO", index1, index2) if self.after_id: if __debug__: print "colorizing already scheduled" return if self.colorizing: self.stop_colorizing = 1 if __debug__: print "stop colorizing" if self.allow_colorizing: if __debug__: print "schedule colorizing" self.after_id = self.after(1, self.recolorize)
4fe2a7039a545a4d36f56a714ca7de67724d5db9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4fe2a7039a545a4d36f56a714ca7de67724d5db9/ColorDelegator.py
if __debug__: print "stop colorizing"
if DEBUG: print "stop colorizing"
def notify_range(self, index1, index2=None): self.tag_add("TODO", index1, index2) if self.after_id: if __debug__: print "colorizing already scheduled" return if self.colorizing: self.stop_colorizing = 1 if __debug__: print "stop colorizing" if self.allow_colorizing: if __debug__: print "schedule colorizing" self.after_id = self.after(1, self.recolorize)
4fe2a7039a545a4d36f56a714ca7de67724d5db9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4fe2a7039a545a4d36f56a714ca7de67724d5db9/ColorDelegator.py
if __debug__: print "schedule colorizing"
if DEBUG: print "schedule colorizing"
def notify_range(self, index1, index2=None): self.tag_add("TODO", index1, index2) if self.after_id: if __debug__: print "colorizing already scheduled" return if self.colorizing: self.stop_colorizing = 1 if __debug__: print "stop colorizing" if self.allow_colorizing: if __debug__: print "schedule colorizing" self.after_id = self.after(1, self.recolorize)
4fe2a7039a545a4d36f56a714ca7de67724d5db9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4fe2a7039a545a4d36f56a714ca7de67724d5db9/ColorDelegator.py
if __debug__: print "cancel scheduled recolorizer"
if DEBUG: print "cancel scheduled recolorizer"
def close(self, close_when_done=None): if self.after_id: after_id = self.after_id self.after_id = None if __debug__: print "cancel scheduled recolorizer" self.after_cancel(after_id) self.allow_colorizing = 0 self.stop_colorizing = 1 if close_when_done: if not self.colorizing: close_when_done.destroy() else: self.close_when_done = close_when_done
4fe2a7039a545a4d36f56a714ca7de67724d5db9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4fe2a7039a545a4d36f56a714ca7de67724d5db9/ColorDelegator.py
if __debug__: print "cancel scheduled recolorizer"
if DEBUG: print "cancel scheduled recolorizer"
def toggle_colorize_event(self, event): if self.after_id: after_id = self.after_id self.after_id = None if __debug__: print "cancel scheduled recolorizer" self.after_cancel(after_id) if self.allow_colorizing and self.colorizing: if __debug__: print "stop colorizing" self.stop_colorizing = 1 self.allow_colorizing = not self.allow_colorizing if self.allow_colorizing and not self.colorizing: self.after_id = self.after(1, self.recolorize) if __debug__: print "auto colorizing turned", self.allow_colorizing and "on" or "off" return "break"
4fe2a7039a545a4d36f56a714ca7de67724d5db9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4fe2a7039a545a4d36f56a714ca7de67724d5db9/ColorDelegator.py
if __debug__: print "stop colorizing"
if DEBUG: print "stop colorizing"
def toggle_colorize_event(self, event): if self.after_id: after_id = self.after_id self.after_id = None if __debug__: print "cancel scheduled recolorizer" self.after_cancel(after_id) if self.allow_colorizing and self.colorizing: if __debug__: print "stop colorizing" self.stop_colorizing = 1 self.allow_colorizing = not self.allow_colorizing if self.allow_colorizing and not self.colorizing: self.after_id = self.after(1, self.recolorize) if __debug__: print "auto colorizing turned", self.allow_colorizing and "on" or "off" return "break"
4fe2a7039a545a4d36f56a714ca7de67724d5db9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4fe2a7039a545a4d36f56a714ca7de67724d5db9/ColorDelegator.py
if __debug__:
if DEBUG:
def toggle_colorize_event(self, event): if self.after_id: after_id = self.after_id self.after_id = None if __debug__: print "cancel scheduled recolorizer" self.after_cancel(after_id) if self.allow_colorizing and self.colorizing: if __debug__: print "stop colorizing" self.stop_colorizing = 1 self.allow_colorizing = not self.allow_colorizing if self.allow_colorizing and not self.colorizing: self.after_id = self.after(1, self.recolorize) if __debug__: print "auto colorizing turned", self.allow_colorizing and "on" or "off" return "break"
4fe2a7039a545a4d36f56a714ca7de67724d5db9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4fe2a7039a545a4d36f56a714ca7de67724d5db9/ColorDelegator.py
if __debug__: print "no delegate"
if DEBUG: print "no delegate"
def recolorize(self): self.after_id = None if not self.delegate: if __debug__: print "no delegate" return if not self.allow_colorizing: if __debug__: print "auto colorizing is off" return if self.colorizing: if __debug__: print "already colorizing" return try: self.stop_colorizing = 0 self.colorizing = 1 if __debug__: print "colorizing..." t0 = time.clock() self.recolorize_main() t1 = time.clock() if __debug__: print "%.3f seconds" % (t1-t0) finally: self.colorizing = 0 if self.allow_colorizing and self.tag_nextrange("TODO", "1.0"): if __debug__: print "reschedule colorizing" self.after_id = self.after(1, self.recolorize) if self.close_when_done: top = self.close_when_done self.close_when_done = None top.destroy()
4fe2a7039a545a4d36f56a714ca7de67724d5db9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4fe2a7039a545a4d36f56a714ca7de67724d5db9/ColorDelegator.py
if __debug__: print "auto colorizing is off"
if DEBUG: print "auto colorizing is off"
def recolorize(self): self.after_id = None if not self.delegate: if __debug__: print "no delegate" return if not self.allow_colorizing: if __debug__: print "auto colorizing is off" return if self.colorizing: if __debug__: print "already colorizing" return try: self.stop_colorizing = 0 self.colorizing = 1 if __debug__: print "colorizing..." t0 = time.clock() self.recolorize_main() t1 = time.clock() if __debug__: print "%.3f seconds" % (t1-t0) finally: self.colorizing = 0 if self.allow_colorizing and self.tag_nextrange("TODO", "1.0"): if __debug__: print "reschedule colorizing" self.after_id = self.after(1, self.recolorize) if self.close_when_done: top = self.close_when_done self.close_when_done = None top.destroy()
4fe2a7039a545a4d36f56a714ca7de67724d5db9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4fe2a7039a545a4d36f56a714ca7de67724d5db9/ColorDelegator.py
if __debug__: print "already colorizing"
if DEBUG: print "already colorizing"
def recolorize(self): self.after_id = None if not self.delegate: if __debug__: print "no delegate" return if not self.allow_colorizing: if __debug__: print "auto colorizing is off" return if self.colorizing: if __debug__: print "already colorizing" return try: self.stop_colorizing = 0 self.colorizing = 1 if __debug__: print "colorizing..." t0 = time.clock() self.recolorize_main() t1 = time.clock() if __debug__: print "%.3f seconds" % (t1-t0) finally: self.colorizing = 0 if self.allow_colorizing and self.tag_nextrange("TODO", "1.0"): if __debug__: print "reschedule colorizing" self.after_id = self.after(1, self.recolorize) if self.close_when_done: top = self.close_when_done self.close_when_done = None top.destroy()
4fe2a7039a545a4d36f56a714ca7de67724d5db9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4fe2a7039a545a4d36f56a714ca7de67724d5db9/ColorDelegator.py
if __debug__: print "colorizing..."
if DEBUG: print "colorizing..."
def recolorize(self): self.after_id = None if not self.delegate: if __debug__: print "no delegate" return if not self.allow_colorizing: if __debug__: print "auto colorizing is off" return if self.colorizing: if __debug__: print "already colorizing" return try: self.stop_colorizing = 0 self.colorizing = 1 if __debug__: print "colorizing..." t0 = time.clock() self.recolorize_main() t1 = time.clock() if __debug__: print "%.3f seconds" % (t1-t0) finally: self.colorizing = 0 if self.allow_colorizing and self.tag_nextrange("TODO", "1.0"): if __debug__: print "reschedule colorizing" self.after_id = self.after(1, self.recolorize) if self.close_when_done: top = self.close_when_done self.close_when_done = None top.destroy()
4fe2a7039a545a4d36f56a714ca7de67724d5db9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4fe2a7039a545a4d36f56a714ca7de67724d5db9/ColorDelegator.py
if __debug__: print "%.3f seconds" % (t1-t0)
if DEBUG: print "%.3f seconds" % (t1-t0)
def recolorize(self): self.after_id = None if not self.delegate: if __debug__: print "no delegate" return if not self.allow_colorizing: if __debug__: print "auto colorizing is off" return if self.colorizing: if __debug__: print "already colorizing" return try: self.stop_colorizing = 0 self.colorizing = 1 if __debug__: print "colorizing..." t0 = time.clock() self.recolorize_main() t1 = time.clock() if __debug__: print "%.3f seconds" % (t1-t0) finally: self.colorizing = 0 if self.allow_colorizing and self.tag_nextrange("TODO", "1.0"): if __debug__: print "reschedule colorizing" self.after_id = self.after(1, self.recolorize) if self.close_when_done: top = self.close_when_done self.close_when_done = None top.destroy()
4fe2a7039a545a4d36f56a714ca7de67724d5db9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4fe2a7039a545a4d36f56a714ca7de67724d5db9/ColorDelegator.py
if __debug__: print "reschedule colorizing"
if DEBUG: print "reschedule colorizing"
def recolorize(self): self.after_id = None if not self.delegate: if __debug__: print "no delegate" return if not self.allow_colorizing: if __debug__: print "auto colorizing is off" return if self.colorizing: if __debug__: print "already colorizing" return try: self.stop_colorizing = 0 self.colorizing = 1 if __debug__: print "colorizing..." t0 = time.clock() self.recolorize_main() t1 = time.clock() if __debug__: print "%.3f seconds" % (t1-t0) finally: self.colorizing = 0 if self.allow_colorizing and self.tag_nextrange("TODO", "1.0"): if __debug__: print "reschedule colorizing" self.after_id = self.after(1, self.recolorize) if self.close_when_done: top = self.close_when_done self.close_when_done = None top.destroy()
4fe2a7039a545a4d36f56a714ca7de67724d5db9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4fe2a7039a545a4d36f56a714ca7de67724d5db9/ColorDelegator.py
if __debug__: print "colorizing stopped"
if DEBUG: print "colorizing stopped"
def recolorize_main(self): next = "1.0" while 1: item = self.tag_nextrange("TODO", next) if not item: break head, tail = item self.tag_remove("SYNC", head, tail) item = self.tag_prevrange("SYNC", head) if item: head = item[1] else: head = "1.0"
4fe2a7039a545a4d36f56a714ca7de67724d5db9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4fe2a7039a545a4d36f56a714ca7de67724d5db9/ColorDelegator.py
def compile_dir(dir, maxlevels=10, ddir=None, force=0, rx=None):
def compile_dir(dir, maxlevels=10, ddir=None, force=0, rx=None, quiet=0):
def compile_dir(dir, maxlevels=10, ddir=None, force=0, rx=None): """Byte-compile all modules in the given directory tree. Arguments (only dir is required): dir: the directory to byte-compile maxlevels: maximum recursion level (default 10) ddir: if given, purported directory name (this is the directory name that will show up in error messages) force: if 1, force compilation, even if timestamps are up-to-date """ print 'Listing', dir, '...' try: names = os.listdir(dir) except os.error: print "Can't list", dir names = [] names.sort() success = 1 for name in names: fullname = os.path.join(dir, name) if ddir: dfile = os.path.join(ddir, name) else: dfile = None if rx: mo = rx.search(fullname) if mo: continue if os.path.isfile(fullname): head, tail = name[:-3], name[-3:] if tail == '.py': cfile = fullname + (__debug__ and 'c' or 'o') ftime = os.stat(fullname)[stat.ST_MTIME] try: ctime = os.stat(cfile)[stat.ST_MTIME] except os.error: ctime = 0 if (ctime > ftime) and not force: continue print 'Compiling', fullname, '...' try: ok = py_compile.compile(fullname, None, dfile) except KeyboardInterrupt: raise KeyboardInterrupt except: # XXX py_compile catches SyntaxErrors if type(sys.exc_type) == type(''): exc_type_name = sys.exc_type else: exc_type_name = sys.exc_type.__name__ print 'Sorry:', exc_type_name + ':', print sys.exc_value success = 0 else: if ok == 0: success = 0 elif maxlevels > 0 and \ name != os.curdir and name != os.pardir and \ os.path.isdir(fullname) and \ not os.path.islink(fullname): if not compile_dir(fullname, maxlevels - 1, dfile, force, rx): success = 0 return success
83a4dbbe38faea87784738af8d69e340d796bf47 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/83a4dbbe38faea87784738af8d69e340d796bf47/compileall.py
print 'Listing', dir, '...'
if not quiet: print 'Listing', dir, '...'
def compile_dir(dir, maxlevels=10, ddir=None, force=0, rx=None): """Byte-compile all modules in the given directory tree. Arguments (only dir is required): dir: the directory to byte-compile maxlevels: maximum recursion level (default 10) ddir: if given, purported directory name (this is the directory name that will show up in error messages) force: if 1, force compilation, even if timestamps are up-to-date """ print 'Listing', dir, '...' try: names = os.listdir(dir) except os.error: print "Can't list", dir names = [] names.sort() success = 1 for name in names: fullname = os.path.join(dir, name) if ddir: dfile = os.path.join(ddir, name) else: dfile = None if rx: mo = rx.search(fullname) if mo: continue if os.path.isfile(fullname): head, tail = name[:-3], name[-3:] if tail == '.py': cfile = fullname + (__debug__ and 'c' or 'o') ftime = os.stat(fullname)[stat.ST_MTIME] try: ctime = os.stat(cfile)[stat.ST_MTIME] except os.error: ctime = 0 if (ctime > ftime) and not force: continue print 'Compiling', fullname, '...' try: ok = py_compile.compile(fullname, None, dfile) except KeyboardInterrupt: raise KeyboardInterrupt except: # XXX py_compile catches SyntaxErrors if type(sys.exc_type) == type(''): exc_type_name = sys.exc_type else: exc_type_name = sys.exc_type.__name__ print 'Sorry:', exc_type_name + ':', print sys.exc_value success = 0 else: if ok == 0: success = 0 elif maxlevels > 0 and \ name != os.curdir and name != os.pardir and \ os.path.isdir(fullname) and \ not os.path.islink(fullname): if not compile_dir(fullname, maxlevels - 1, dfile, force, rx): success = 0 return success
83a4dbbe38faea87784738af8d69e340d796bf47 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/83a4dbbe38faea87784738af8d69e340d796bf47/compileall.py
print 'Compiling', fullname, '...'
if not quiet: print 'Compiling', fullname, '...'
def compile_dir(dir, maxlevels=10, ddir=None, force=0, rx=None): """Byte-compile all modules in the given directory tree. Arguments (only dir is required): dir: the directory to byte-compile maxlevels: maximum recursion level (default 10) ddir: if given, purported directory name (this is the directory name that will show up in error messages) force: if 1, force compilation, even if timestamps are up-to-date """ print 'Listing', dir, '...' try: names = os.listdir(dir) except os.error: print "Can't list", dir names = [] names.sort() success = 1 for name in names: fullname = os.path.join(dir, name) if ddir: dfile = os.path.join(ddir, name) else: dfile = None if rx: mo = rx.search(fullname) if mo: continue if os.path.isfile(fullname): head, tail = name[:-3], name[-3:] if tail == '.py': cfile = fullname + (__debug__ and 'c' or 'o') ftime = os.stat(fullname)[stat.ST_MTIME] try: ctime = os.stat(cfile)[stat.ST_MTIME] except os.error: ctime = 0 if (ctime > ftime) and not force: continue print 'Compiling', fullname, '...' try: ok = py_compile.compile(fullname, None, dfile) except KeyboardInterrupt: raise KeyboardInterrupt except: # XXX py_compile catches SyntaxErrors if type(sys.exc_type) == type(''): exc_type_name = sys.exc_type else: exc_type_name = sys.exc_type.__name__ print 'Sorry:', exc_type_name + ':', print sys.exc_value success = 0 else: if ok == 0: success = 0 elif maxlevels > 0 and \ name != os.curdir and name != os.pardir and \ os.path.isdir(fullname) and \ not os.path.islink(fullname): if not compile_dir(fullname, maxlevels - 1, dfile, force, rx): success = 0 return success
83a4dbbe38faea87784738af8d69e340d796bf47 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/83a4dbbe38faea87784738af8d69e340d796bf47/compileall.py
if not compile_dir(fullname, maxlevels - 1, dfile, force, rx):
if not compile_dir(fullname, maxlevels - 1, dfile, force, rx, quiet):
def compile_dir(dir, maxlevels=10, ddir=None, force=0, rx=None): """Byte-compile all modules in the given directory tree. Arguments (only dir is required): dir: the directory to byte-compile maxlevels: maximum recursion level (default 10) ddir: if given, purported directory name (this is the directory name that will show up in error messages) force: if 1, force compilation, even if timestamps are up-to-date """ print 'Listing', dir, '...' try: names = os.listdir(dir) except os.error: print "Can't list", dir names = [] names.sort() success = 1 for name in names: fullname = os.path.join(dir, name) if ddir: dfile = os.path.join(ddir, name) else: dfile = None if rx: mo = rx.search(fullname) if mo: continue if os.path.isfile(fullname): head, tail = name[:-3], name[-3:] if tail == '.py': cfile = fullname + (__debug__ and 'c' or 'o') ftime = os.stat(fullname)[stat.ST_MTIME] try: ctime = os.stat(cfile)[stat.ST_MTIME] except os.error: ctime = 0 if (ctime > ftime) and not force: continue print 'Compiling', fullname, '...' try: ok = py_compile.compile(fullname, None, dfile) except KeyboardInterrupt: raise KeyboardInterrupt except: # XXX py_compile catches SyntaxErrors if type(sys.exc_type) == type(''): exc_type_name = sys.exc_type else: exc_type_name = sys.exc_type.__name__ print 'Sorry:', exc_type_name + ':', print sys.exc_value success = 0 else: if ok == 0: success = 0 elif maxlevels > 0 and \ name != os.curdir and name != os.pardir and \ os.path.isdir(fullname) and \ not os.path.islink(fullname): if not compile_dir(fullname, maxlevels - 1, dfile, force, rx): success = 0 return success
83a4dbbe38faea87784738af8d69e340d796bf47 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/83a4dbbe38faea87784738af8d69e340d796bf47/compileall.py
def compile_path(skip_curdir=1, maxlevels=0, force=0):
def compile_path(skip_curdir=1, maxlevels=0, force=0, quiet=0):
def compile_path(skip_curdir=1, maxlevels=0, force=0): """Byte-compile all module on sys.path. Arguments (all optional): skip_curdir: if true, skip current directory (default true) maxlevels: max recursion level (default 0) force: as for compile_dir() (default 0) """ success = 1 for dir in sys.path: if (not dir or dir == os.curdir) and skip_curdir: print 'Skipping current directory' else: success = success and compile_dir(dir, maxlevels, None, force) return success
83a4dbbe38faea87784738af8d69e340d796bf47 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/83a4dbbe38faea87784738af8d69e340d796bf47/compileall.py
success = success and compile_dir(dir, maxlevels, None, force)
success = success and compile_dir(dir, maxlevels, None, force, quiet=quiet)
def compile_path(skip_curdir=1, maxlevels=0, force=0): """Byte-compile all module on sys.path. Arguments (all optional): skip_curdir: if true, skip current directory (default true) maxlevels: max recursion level (default 0) force: as for compile_dir() (default 0) """ success = 1 for dir in sys.path: if (not dir or dir == os.curdir) and skip_curdir: print 'Skipping current directory' else: success = success and compile_dir(dir, maxlevels, None, force) return success
83a4dbbe38faea87784738af8d69e340d796bf47 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/83a4dbbe38faea87784738af8d69e340d796bf47/compileall.py
opts, args = getopt.getopt(sys.argv[1:], 'lfd:x:')
opts, args = getopt.getopt(sys.argv[1:], 'lfqd:x:')
def main(): """Script main program.""" import getopt try: opts, args = getopt.getopt(sys.argv[1:], 'lfd:x:') except getopt.error, msg: print msg print "usage: python compileall.py [-l] [-f] [-d destdir] " \ "[-s regexp] [directory ...]" print "-l: don't recurse down" print "-f: force rebuild even if timestamps are up-to-date" print "-d destdir: purported directory name for error messages" print " if no directory arguments, -l sys.path is assumed" print "-x regexp: skip files matching the regular expression regexp" print " the regexp is search for in the full path of the file" sys.exit(2) maxlevels = 10 ddir = None force = 0 rx = None for o, a in opts: if o == '-l': maxlevels = 0 if o == '-d': ddir = a if o == '-f': force = 1 if o == '-x': import re rx = re.compile(a) if ddir: if len(args) != 1: print "-d destdir require exactly one directory argument" sys.exit(2) success = 1 try: if args: for dir in args: if not compile_dir(dir, maxlevels, ddir, force, rx): success = 0 else: success = compile_path() except KeyboardInterrupt: print "\n[interrupt]" success = 0 return success
83a4dbbe38faea87784738af8d69e340d796bf47 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/83a4dbbe38faea87784738af8d69e340d796bf47/compileall.py
print "usage: python compileall.py [-l] [-f] [-d destdir] " \
print "usage: python compileall.py [-l] [-f] [-q] [-d destdir] " \
def main(): """Script main program.""" import getopt try: opts, args = getopt.getopt(sys.argv[1:], 'lfd:x:') except getopt.error, msg: print msg print "usage: python compileall.py [-l] [-f] [-d destdir] " \ "[-s regexp] [directory ...]" print "-l: don't recurse down" print "-f: force rebuild even if timestamps are up-to-date" print "-d destdir: purported directory name for error messages" print " if no directory arguments, -l sys.path is assumed" print "-x regexp: skip files matching the regular expression regexp" print " the regexp is search for in the full path of the file" sys.exit(2) maxlevels = 10 ddir = None force = 0 rx = None for o, a in opts: if o == '-l': maxlevels = 0 if o == '-d': ddir = a if o == '-f': force = 1 if o == '-x': import re rx = re.compile(a) if ddir: if len(args) != 1: print "-d destdir require exactly one directory argument" sys.exit(2) success = 1 try: if args: for dir in args: if not compile_dir(dir, maxlevels, ddir, force, rx): success = 0 else: success = compile_path() except KeyboardInterrupt: print "\n[interrupt]" success = 0 return success
83a4dbbe38faea87784738af8d69e340d796bf47 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/83a4dbbe38faea87784738af8d69e340d796bf47/compileall.py
if not compile_dir(dir, maxlevels, ddir, force, rx):
if not compile_dir(dir, maxlevels, ddir, force, rx, quiet):
def main(): """Script main program.""" import getopt try: opts, args = getopt.getopt(sys.argv[1:], 'lfd:x:') except getopt.error, msg: print msg print "usage: python compileall.py [-l] [-f] [-d destdir] " \ "[-s regexp] [directory ...]" print "-l: don't recurse down" print "-f: force rebuild even if timestamps are up-to-date" print "-d destdir: purported directory name for error messages" print " if no directory arguments, -l sys.path is assumed" print "-x regexp: skip files matching the regular expression regexp" print " the regexp is search for in the full path of the file" sys.exit(2) maxlevels = 10 ddir = None force = 0 rx = None for o, a in opts: if o == '-l': maxlevels = 0 if o == '-d': ddir = a if o == '-f': force = 1 if o == '-x': import re rx = re.compile(a) if ddir: if len(args) != 1: print "-d destdir require exactly one directory argument" sys.exit(2) success = 1 try: if args: for dir in args: if not compile_dir(dir, maxlevels, ddir, force, rx): success = 0 else: success = compile_path() except KeyboardInterrupt: print "\n[interrupt]" success = 0 return success
83a4dbbe38faea87784738af8d69e340d796bf47 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/83a4dbbe38faea87784738af8d69e340d796bf47/compileall.py
self.warn ("file %s (for module %s) not found" % module_file, module)
self.warn ("file %s (for module %s) not found" % (module_file, module))
def check_module (self, module, module_file): if not os.path.isfile (module_file): self.warn ("file %s (for module %s) not found" % module_file, module) return 0 else: return 1
9e8ca7a125e25f76bb2962afdfb237572ee8a816 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9e8ca7a125e25f76bb2962afdfb237572ee8a816/build_py.py
verify(str(c1).find('C instance at ') >= 0)
verify(str(c1).find('C object at ') >= 0)
def __getitem__(self, i): if 0 <= i < 10: return i raise IndexError
aec6f1301c74c527605e5ea54a1cfba8667a5c6b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/aec6f1301c74c527605e5ea54a1cfba8667a5c6b/test_descr.py
verify(str(d1).find('D instance at ') >= 0)
verify(str(d1).find('D object at ') >= 0)
def __getitem__(self, i): if 0 <= i < 10: return i raise IndexError
aec6f1301c74c527605e5ea54a1cfba8667a5c6b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/aec6f1301c74c527605e5ea54a1cfba8667a5c6b/test_descr.py
if '/usr/local/lib' not in self.compiler.library_dirs: self.compiler.library_dirs.insert(0, '/usr/local/lib') if '/usr/local/include' not in self.compiler.include_dirs: self.compiler.include_dirs.insert(0, '/usr/local/include' )
add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') add_dir_to_list(self.compiler.library_dirs, sysconfig.get_config_var("LIBDIR")) add_dir_to_list(self.compiler.include_dirs, sysconfig.get_config_var("INCLUDEDIR"))
def detect_modules(self): # Ensure that /usr/local is always used if '/usr/local/lib' not in self.compiler.library_dirs: self.compiler.library_dirs.insert(0, '/usr/local/lib') if '/usr/local/include' not in self.compiler.include_dirs: self.compiler.include_dirs.insert(0, '/usr/local/include' )
4c979ee99b7c85f54aaa147c6f8177a09623c076 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4c979ee99b7c85f54aaa147c6f8177a09623c076/setup.py
_StringType = type('')
_StringTypes = (str, unicode)
def rfind(s, *args): """rfind(s, sub [,start [,end]]) -> int Return the highest index in s where substring sub is found, such that sub is contained within s[start,end]. Optional arguments start and end are interpreted as in slice notation. Return -1 on failure. """ return s.rfind(*args)
3b389da9947b3ac3d6a1e5af3ac546f3b14f8356 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3b389da9947b3ac3d6a1e5af3ac546f3b14f8356/string.py
if type(x) == type(''): s = x else: s = `x` n = len(s) if n >= width: return s
if not isinstance(x, _StringTypes): x = str(x) n = len(x) if n >= width: return x
def zfill(x, width): """zfill(x, width) -> string Pad a numeric string x with zeros on the left, to fill a field of the specified width. The string x is never truncated. """ if type(x) == type(''): s = x else: s = `x` n = len(s) if n >= width: return s sign = '' if s[0] in ('-', '+'): sign, s = s[0], s[1:] return sign + '0'*(width-n) + s
3b389da9947b3ac3d6a1e5af3ac546f3b14f8356 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3b389da9947b3ac3d6a1e5af3ac546f3b14f8356/string.py
if s[0] in ('-', '+'): sign, s = s[0], s[1:] return sign + '0'*(width-n) + s
if x[0] in '-+': sign, x = x[0], x[1:] return sign + '0'*(width-n) + x
def zfill(x, width): """zfill(x, width) -> string Pad a numeric string x with zeros on the left, to fill a field of the specified width. The string x is never truncated. """ if type(x) == type(''): s = x else: s = `x` n = len(s) if n >= width: return s sign = '' if s[0] in ('-', '+'): sign, s = s[0], s[1:] return sign + '0'*(width-n) + s
3b389da9947b3ac3d6a1e5af3ac546f3b14f8356 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3b389da9947b3ac3d6a1e5af3ac546f3b14f8356/string.py
accept = accept + string.split(line[7:])
accept = accept + string.split(line[7:], ',')
def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = string.rfind(rest, '?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = string.find(rest, '/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scriptname) if not os.path.exists(scriptfile): self.send_error(404, "No such CGI script (%s)" % `scriptname`) return if not os.path.isfile(scriptfile): self.send_error(403, "CGI script is not a plain file (%s)" % `scriptname`) return if not executable(scriptfile): self.send_error(403, "CGI script is not executable (%s)" % `scriptname`) return nobody = nobody_uid() self.send_response(200, "Script output follows") self.wfile.flush() # Always flush before forking pid = os.fork() if pid != 0: # Parent pid, sts = os.waitpid(pid, 0) if sts: self.log_error("CGI script exit status x%x" % sts) return # Child try: # Reference: http://hoohoo.ncsa.uiuc.edu/cgi/env.html # XXX Much of the following could be prepared ahead of time! env = {} env['SERVER_SOFTWARE'] = self.version_string() env['SERVER_NAME'] = self.server.server_name env['GATEWAY_INTERFACE'] = 'CGI/1.1' env['SERVER_PROTOCOL'] = self.protocol_version env['SERVER_PORT'] = str(self.server.server_port) env['REQUEST_METHOD'] = self.command uqrest = urllib.unquote(rest) env['PATH_INFO'] = uqrest env['PATH_TRANSLATED'] = self.translate_path(uqrest) env['SCRIPT_NAME'] = scriptname if query: env['QUERY_STRING'] = query host = self.address_string() if host != self.client_address[0]: env['REMOTE_HOST'] = host env['REMOTE_ADDR'] = self.client_address[0] # AUTH_TYPE # REMOTE_USER # REMOTE_IDENT if self.headers.typeheader is None: env['CONTENT_TYPE'] = self.headers.type else: env['CONTENT_TYPE'] = self.headers.typeheader length = self.headers.getheader('content-length') if length: env['CONTENT_LENGTH'] = length accept = [] for line in self.headers.getallmatchingheaders('accept'): if line[:1] in string.whitespace: accept.append(string.strip(line)) else: accept = accept + string.split(line[7:]) env['HTTP_ACCEPT'] = string.joinfields(accept, ',') ua = self.headers.getheader('user-agent') if ua: env['HTTP_USER_AGENT'] = ua # XXX Other HTTP_* headers decoded_query = string.replace(query, '+', ' ') try: os.setuid(nobody) except os.error: pass os.dup2(self.rfile.fileno(), 0) os.dup2(self.wfile.fileno(), 1) print scriptfile, script, decoded_query os.execve(scriptfile, [script, decoded_query], env) except: self.server.handle_error(self.request, self.client_address) os._exit(127)
0ed3df879f1efecfcede235201aad9d6d889dd0e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0ed3df879f1efecfcede235201aad9d6d889dd0e/CGIHTTPServer.py