rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
framework = sysconfig.get_config_var('PYTHONFRAMEWORK') if framework: exts.append( Extension('gestalt', ['gestaltmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('MacOS', ['macosmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('icglue', ['icgluemodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('macfs', ['macfsmodule.c', '../Python/getapplbycreator.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Res', ['res/_Resmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Snd', ['snd/_Sndmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('Nav', ['Nav.c'],
exts.append( Extension('gestalt', ['gestaltmodule.c'],
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')
66bc4a46a7fb3489b8760a3b1faf31bc78b9cc0f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/66bc4a46a7fb3489b8760a3b1faf31bc78b9cc0f/setup.py
exts.append( Extension('_AE', ['ae/_AEmodule.c'],
exts.append( Extension('MacOS', ['macosmodule.c'],
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')
66bc4a46a7fb3489b8760a3b1faf31bc78b9cc0f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/66bc4a46a7fb3489b8760a3b1faf31bc78b9cc0f/setup.py
exts.append( Extension('_AH', ['ah/_AHmodule.c'],
exts.append( Extension('icglue', ['icgluemodule.c'],
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')
66bc4a46a7fb3489b8760a3b1faf31bc78b9cc0f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/66bc4a46a7fb3489b8760a3b1faf31bc78b9cc0f/setup.py
exts.append( Extension('_Alias', ['alias/_Aliasmodule.c'],
exts.append( Extension('macfs', ['macfsmodule.c', '../Python/getapplbycreator.c'],
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')
66bc4a46a7fb3489b8760a3b1faf31bc78b9cc0f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/66bc4a46a7fb3489b8760a3b1faf31bc78b9cc0f/setup.py
exts.append( Extension('_App', ['app/_Appmodule.c'],
exts.append( Extension('_Res', ['res/_Resmodule.c'],
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')
66bc4a46a7fb3489b8760a3b1faf31bc78b9cc0f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/66bc4a46a7fb3489b8760a3b1faf31bc78b9cc0f/setup.py
exts.append( Extension('_CarbonEvt', ['carbonevt/_CarbonEvtmodule.c'],
exts.append( Extension('_Snd', ['snd/_Sndmodule.c'],
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')
66bc4a46a7fb3489b8760a3b1faf31bc78b9cc0f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/66bc4a46a7fb3489b8760a3b1faf31bc78b9cc0f/setup.py
exts.append( Extension('_CG', ['cg/_CGmodule.c'], extra_link_args=['-framework', 'ApplicationServices', '-framework', 'Carbon']) ) exts.append( Extension('_Cm', ['cm/_Cmmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Ctl', ['ctl/_Ctlmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Dlg', ['dlg/_Dlgmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Drag', ['drag/_Dragmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Evt', ['evt/_Evtmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_File', ['file/_Filemodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Folder', ['folder/_Foldermodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Fm', ['fm/_Fmmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Help', ['help/_Helpmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Icn', ['icn/_Icnmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_IBCarbon', ['ibcarbon/_IBCarbon.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_List', ['list/_Listmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Menu', ['menu/_Menumodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Mlte', ['mlte/_Mltemodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Qd', ['qd/_Qdmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Qdoffs', ['qdoffs/_Qdoffsmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Qt', ['qt/_Qtmodule.c'], extra_link_args=['-framework', 'QuickTime', '-framework', 'Carbon']) ) exts.append( Extension('_Scrap', ['scrap/_Scrapmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_TE', ['te/_TEmodule.c'], extra_link_args=['-framework', 'Carbon']) ) waste_incs = find_file("WASTE.h", [], ['../'*n + 'waste/C_C++ Headers' for n in (0,1,2,3,4)]) waste_libs = find_library_file(self.compiler, "WASTE", [], [ "../"*n + "waste/Static Libraries" for n in (0,1,2,3,4)]) if waste_incs != None and waste_libs != None: (srcdir,) = sysconfig.get_config_vars('srcdir') exts.append( Extension('waste', ['waste/wastemodule.c'] + [ os.path.join(srcdir, d) for d in 'Mac/Wastemods/WEObjectHandlers.c', 'Mac/Wastemods/WETabHooks.c', 'Mac/Wastemods/WETabs.c' ], include_dirs = waste_incs + [os.path.join(srcdir, 'Mac/Wastemods')], library_dirs = waste_libs, libraries = ['WASTE'], extra_link_args = ['-framework', 'Carbon'], ) ) exts.append( Extension('_Win', ['win/_Winmodule.c'], extra_link_args=['-framework', 'Carbon']) )
exts.append( Extension('Nav', ['Nav.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_AE', ['ae/_AEmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_AH', ['ah/_AHmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Alias', ['alias/_Aliasmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_App', ['app/_Appmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_CarbonEvt', ['carbonevt/_CarbonEvtmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_CG', ['cg/_CGmodule.c'], extra_link_args=['-framework', 'ApplicationServices', '-framework', 'Carbon']) ) exts.append( Extension('_Cm', ['cm/_Cmmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Ctl', ['ctl/_Ctlmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Dlg', ['dlg/_Dlgmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Drag', ['drag/_Dragmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Evt', ['evt/_Evtmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_File', ['file/_Filemodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Folder', ['folder/_Foldermodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Fm', ['fm/_Fmmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Help', ['help/_Helpmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Icn', ['icn/_Icnmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_IBCarbon', ['ibcarbon/_IBCarbon.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_List', ['list/_Listmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Menu', ['menu/_Menumodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Mlte', ['mlte/_Mltemodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Qd', ['qd/_Qdmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Qdoffs', ['qdoffs/_Qdoffsmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Qt', ['qt/_Qtmodule.c'], extra_link_args=['-framework', 'QuickTime', '-framework', 'Carbon']) ) exts.append( Extension('_Scrap', ['scrap/_Scrapmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_TE', ['te/_TEmodule.c'], extra_link_args=['-framework', 'Carbon']) ) waste_incs = find_file("WASTE.h", [], ['../'*n + 'waste/C_C++ Headers' for n in (0,1,2,3,4)]) waste_libs = find_library_file(self.compiler, "WASTE", [], ["../"*n + "waste/Static Libraries" for n in (0,1,2,3,4)]) if waste_incs != None and waste_libs != None: (srcdir,) = sysconfig.get_config_vars('srcdir') exts.append( Extension('waste', ['waste/wastemodule.c'] + [ os.path.join(srcdir, d) for d in 'Mac/Wastemods/WEObjectHandlers.c', 'Mac/Wastemods/WETabHooks.c', 'Mac/Wastemods/WETabs.c' ], include_dirs = waste_incs + [os.path.join(srcdir, 'Mac/Wastemods')], library_dirs = waste_libs, libraries = ['WASTE'], extra_link_args = ['-framework', 'Carbon'], ) ) exts.append( Extension('_Win', ['win/_Winmodule.c'], extra_link_args=['-framework', 'Carbon']) )
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')
66bc4a46a7fb3489b8760a3b1faf31bc78b9cc0f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/66bc4a46a7fb3489b8760a3b1faf31bc78b9cc0f/setup.py
def __init__(self, format):
def __init__(self, format, len):
def __init__(self, format): self.format = format
c823fb07e24cb8ab64893a3655fc51e362895570 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c823fb07e24cb8ab64893a3655fc51e362895570/calendar.py
day_name = _localized_name('%A') day_abbr = _localized_name('%a')
day_name = _localized_name('%A', 7) day_abbr = _localized_name('%a', 7)
def __getitem__(self, item): return strftime(self.format, (item,)*9).capitalize()
c823fb07e24cb8ab64893a3655fc51e362895570 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c823fb07e24cb8ab64893a3655fc51e362895570/calendar.py
month_name = _localized_name('%B') month_abbr = _localized_name('%b')
month_name = _localized_name('%B', 12) month_abbr = _localized_name('%b', 12)
def __getitem__(self, item): return strftime(self.format, (item,)*9).capitalize()
c823fb07e24cb8ab64893a3655fc51e362895570 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c823fb07e24cb8ab64893a3655fc51e362895570/calendar.py
"""Converts self to a int, truncating if necessary."""
"""Converts self to an int, truncating if necessary."""
def __int__(self): """Converts self to a int, truncating if necessary.""" if self._is_special: if self._isnan(): context = getcontext() return context._raise_error(InvalidContext) elif self._isinfinity(): raise OverflowError, "Cannot convert infinity to long" if self._exp >= 0: s = ''.join(map(str, self._int)) + '0'*self._exp else: s = ''.join(map(str, self._int))[:self._exp] if s == '': s = '0' sign = '-'*self._sign return int(sign + s)
54700ff4778b5b2b239cb7cdf3628a6a72f8971d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54700ff4778b5b2b239cb7cdf3628a6a72f8971d/decimal.py
list.append('%s: %s\n' % (str(stype), _some_str(value)))
s = _some_str(value) if s: list.append('%s: %s\n' % (str(stype), s)) else: list.append('%s\n' % str(stype))
def format_exception_only(etype, value): """Format the exception part of a traceback. The arguments are the exception type and value such as given by sys.last_type and sys.last_value. The return value is a list of strings, each ending in a newline. Normally, the list contains a single string; however, for SyntaxError exceptions, it contains several lines that (when printed) display detailed information about where the syntax error occurred. The message indicating which exception occurred is the always last string in the list.""" list = [] if type(etype) == types.ClassType: stype = etype.__name__ else: stype = etype if value is None: list.append(str(stype) + '\n') else: if etype is SyntaxError: try: msg, (filename, lineno, offset, line) = value except: pass else: if not filename: filename = "<string>" list.append(' File "%s", line %d\n' % (filename, lineno)) i = 0 while i < len(line) and \ line[i] in string.whitespace: i = i+1 list.append(' %s\n' % string.strip(line)) s = ' ' for c in line[i:offset-1]: if c in string.whitespace: s = s + c else: s = s + ' ' list.append('%s^\n' % s) value = msg list.append('%s: %s\n' % (str(stype), _some_str(value))) return list
9b5398070aeef1e1f8db32061805f335365d3d68 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9b5398070aeef1e1f8db32061805f335365d3d68/traceback.py
_write_data(writer, "<![CDATA[%s]]>" % self.data)
writer.write("<![CDATA[%s]]>" % self.data)
def writexml(self, writer, indent="", addindent="", newl=""): _write_data(writer, "<![CDATA[%s]]>" % self.data)
f5189e97178b0c77d23ec419bbcecbb5600b18e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f5189e97178b0c77d23ec419bbcecbb5600b18e7/minidom.py
res = platform.libc_ver()
from sys import executable import os if os.path.isdir(executable) and os.path.exists(executable+'.exe'): executable = executable + '.exe' res = platform.libc_ver(executable)
def test_libc_ver(self): res = platform.libc_ver()
7491235ba1992b0006ad6fa7bd49f0fc339f9779 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7491235ba1992b0006ad6fa7bd49f0fc339f9779/test_platform.py
print e.__dict__
def update(self): self.prepare() for file in self.rcsfiles: e = self.preparedetails(file) if e.lsum == e.sum == e.rsum: print '=', file continue if e.sum == e.rsum: if e.rev != e.rrev: print '%s: %s -> %s w/o change' % \ (file, e.rev, e.rrev) e.rev = e.rrev if e.lsum != e.sum: if e.lsum is None: print '%s: file was lost' % \ (file,) self.get(e) elif e.new: print 'A', file else: print 'M', file continue if e.lsum == e.sum: if e.rev == e.rrev: print '%s: no new revision' % file print 'U', file, sys.stdout.flush() self.get(e) print continue if e.lsum == e.rsum: print 'c', file print e.__dict__ e.rev = e.rrev e.sum = e.rsum e.new = e.sum is None and e.lsum is not None if e.sum: e.mtime, e.ctime = os.stat(e.file)[-2:] print e.__dict__ self.entries[file] = e continue print 'C', file, '(not resolved)' self.writeentries() self.writesums()
1f5483adf7d98befbf37e27af5cb00e0def2fc1f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1f5483adf7d98befbf37e27af5cb00e0def2fc1f/rcvs.py
print e.__dict__
def update(self): self.prepare() for file in self.rcsfiles: e = self.preparedetails(file) if e.lsum == e.sum == e.rsum: print '=', file continue if e.sum == e.rsum: if e.rev != e.rrev: print '%s: %s -> %s w/o change' % \ (file, e.rev, e.rrev) e.rev = e.rrev if e.lsum != e.sum: if e.lsum is None: print '%s: file was lost' % \ (file,) self.get(e) elif e.new: print 'A', file else: print 'M', file continue if e.lsum == e.sum: if e.rev == e.rrev: print '%s: no new revision' % file print 'U', file, sys.stdout.flush() self.get(e) print continue if e.lsum == e.rsum: print 'c', file print e.__dict__ e.rev = e.rrev e.sum = e.rsum e.new = e.sum is None and e.lsum is not None if e.sum: e.mtime, e.ctime = os.stat(e.file)[-2:] print e.__dict__ self.entries[file] = e continue print 'C', file, '(not resolved)' self.writeentries() self.writesums()
1f5483adf7d98befbf37e27af5cb00e0def2fc1f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1f5483adf7d98befbf37e27af5cb00e0def2fc1f/rcvs.py
end = self.newBlock() self.set_lineno(node) self.emit('LOAD_GLOBAL', '__debug__') self.emit('JUMP_IF_FALSE', end) self.nextBlock() self.emit('POP_TOP') self.visit(node.test) self.emit('JUMP_IF_TRUE', end) self.nextBlock() self.emit('POP_TOP') self.emit('LOAD_GLOBAL', 'AssertionError') if node.fail: self.visit(node.fail) self.emit('RAISE_VARARGS', 2) else: self.emit('RAISE_VARARGS', 1) self.nextBlock(end) self.emit('POP_TOP')
if __debug__: end = self.newBlock() self.set_lineno(node) self.nextBlock() self.visit(node.test) self.emit('JUMP_IF_TRUE', end) self.nextBlock() self.emit('POP_TOP') self.emit('LOAD_GLOBAL', 'AssertionError') if node.fail: self.visit(node.fail) self.emit('RAISE_VARARGS', 2) else: self.emit('RAISE_VARARGS', 1) self.nextBlock(end) self.emit('POP_TOP')
def visitAssert(self, node): # XXX would be interesting to implement this via a # transformation of the AST before this stage end = self.newBlock() self.set_lineno(node) # XXX __debug__ and AssertionError appear to be special cases # -- they are always loaded as globals even if there are local # names. I guess this is a sort of renaming op. self.emit('LOAD_GLOBAL', '__debug__') self.emit('JUMP_IF_FALSE', end) self.nextBlock() self.emit('POP_TOP') self.visit(node.test) self.emit('JUMP_IF_TRUE', end) self.nextBlock() self.emit('POP_TOP') self.emit('LOAD_GLOBAL', 'AssertionError') if node.fail: self.visit(node.fail) self.emit('RAISE_VARARGS', 2) else: self.emit('RAISE_VARARGS', 1) self.nextBlock(end) self.emit('POP_TOP')
67c7285464eb89202df46b7c89b703a63e0d12d7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/67c7285464eb89202df46b7c89b703a63e0d12d7/pycodegen.py
try: if os.isatty(sys.stdin.fileno()): NO_ARG_FUNCTIONS.append("getlogin") except: pass
def testNoArgFunctions(self): # test posix functions which take no arguments and have # no side-effects which we need to cleanup (e.g., fork, wait, abort) NO_ARG_FUNCTIONS = [ "ctermid", "getcwd", "getcwdu", "uname", "times", "getloadavg", "tmpnam", "getegid", "geteuid", "getgid", "getgroups", "getpid", "getpgrp", "getppid", "getuid", ] # getlogin() only works when run from a tty (terminal) try: if os.isatty(sys.stdin.fileno()): NO_ARG_FUNCTIONS.append("getlogin") except: pass
eab635b1a51f6578469a8924140531c5851dede3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/eab635b1a51f6578469a8924140531c5851dede3/test_posix.py
if (arg[0],arg[-1]) in (('(',')'),('"','"')):
if len(arg) >= 2 and (arg[0],arg[-1]) in (('(',')'),('"','"')):
def _checkquote(self, arg):
6a118ed0889412b8d01dd2cc2f7f05f675f9c8a8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6a118ed0889412b8d01dd2cc2f7f05f675f9c8a8/imaplib.py
if self.mustquote.search(arg) is None:
if arg and self.mustquote.search(arg) is None:
def _checkquote(self, arg):
6a118ed0889412b8d01dd2cc2f7f05f675f9c8a8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6a118ed0889412b8d01dd2cc2f7f05f675f9c8a8/imaplib.py
post_interp = match.group(1)
post_interp = match.group(1) or ''
def copy_scripts (self): """Copy each script listed in 'self.scripts'; if it's marked as a Python script in the Unix way (first line matches 'first_line_re', ie. starts with "\#!" and contains "python"), then adjust the first line to refer to the current Python interpreter as we copy. """ self.mkpath(self.build_dir) for script in self.scripts: adjust = 0 script = convert_path(script) outfile = os.path.join(self.build_dir, os.path.basename(script))
59c1d41ceb3d8587d9ee0264ff7e3c69a46d358f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/59c1d41ceb3d8587d9ee0264ff7e3c69a46d358f/build_scripts.py
f.fileno = None
def open_data(self, url, data=None): """Use "data" URL.""" # ignore POSTed data # # syntax of data URLs: # dataurl := "data:" [ mediatype ] [ ";base64" ] "," data # mediatype := [ type "/" subtype ] *( ";" parameter ) # data := *urlchar # parameter := attribute "=" value import mimetools try: from cStringIO import StringIO except ImportError: from StringIO import StringIO try: [type, data] = url.split(',', 1) except ValueError: raise IOError, ('data error', 'bad data URL') if not type: type = 'text/plain;charset=US-ASCII' semi = type.rfind(';') if semi >= 0 and '=' not in type[semi:]: encoding = type[semi+1:] type = type[:semi] else: encoding = '' msg = [] msg.append('Date: %s'%time.strftime('%a, %d %b %Y %T GMT', time.gmtime(time.time()))) msg.append('Content-type: %s' % type) if encoding == 'base64': import base64 data = base64.decodestring(data) else: data = unquote(data) msg.append('Content-length: %d' % len(data)) msg.append('') msg.append(data) msg = '\n'.join(msg) f = StringIO(msg) headers = mimetools.Message(f, 0) f.fileno = None # needed for addinfourl return addinfourl(f, headers, url)
a92a7d7afd7fff55e301af8ee291cbd5ceac957f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a92a7d7afd7fff55e301af8ee291cbd5ceac957f/urllib.py
if hasattr(self.fp, "fileno"): self.fileno = self.fp.fileno
if hasattr(self.fp, "fileno"): self.fileno = self.fp.fileno else: self.fileno = lambda: None
def __init__(self, fp): self.fp = fp self.read = self.fp.read self.readline = self.fp.readline if hasattr(self.fp, "readlines"): self.readlines = self.fp.readlines if hasattr(self.fp, "fileno"): self.fileno = self.fp.fileno if hasattr(self.fp, "__iter__"): self.__iter__ = self.fp.__iter__ if hasattr(self.fp, "next"): self.next = self.fp.next
a92a7d7afd7fff55e301af8ee291cbd5ceac957f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a92a7d7afd7fff55e301af8ee291cbd5ceac957f/urllib.py
outputs[-1:] = \
outputs.extend (
def copy_tree (src, dst, preserve_mode=1, preserve_times=1, preserve_symlinks=0, update=0, verbose=0, dry_run=0): """Copy an entire directory tree 'src' to a new location 'dst'. Both 'src' and 'dst' must be directory names. If 'src' is not a directory, raise DistutilsFileError. If 'dst' does not exist, it is created with 'mkpath()'. The end result of the copy is that every file in 'src' is copied to 'dst', and directories under 'src' are recursively copied to 'dst'. Return the list of files copied (under their output names) -- note that if 'update' is true, this might be less than the list of files considered. Return value is not affected by 'dry_run'. 'preserve_mode' and 'preserve_times' are the same as for 'copy_file'; note that they only apply to regular files, not to directories. If 'preserve_symlinks' is true, symlinks will be copied as symlinks (on platforms that support them!); otherwise (the default), the destination of the symlink will be copied. 'update' and 'verbose' are the same as for 'copy_file'.""" if not dry_run and not os.path.isdir (src): raise DistutilsFileError, \ "cannot copy tree %s: not a directory" % src try: names = os.listdir (src) except os.error, (errno, errstr): if dry_run: names = [] else: raise DistutilsFileError, \ "error listing files in %s: %s" % (src, errstr) if not dry_run: mkpath (dst, verbose=verbose) outputs = [] for n in names: src_name = os.path.join (src, n) dst_name = os.path.join (dst, n) if preserve_symlinks and os.path.islink (src_name): link_dest = os.readlink (src_name) if verbose: print "linking %s -> %s" % (dst_name, link_dest) if not dry_run: os.symlink (link_dest, dst_name) outputs.append (dst_name) elif os.path.isdir (src_name): outputs[-1:] = \ copy_tree (src_name, dst_name, preserve_mode, preserve_times, preserve_symlinks, update, verbose, dry_run) else: if (copy_file (src_name, dst_name, preserve_mode, preserve_times, update, verbose, dry_run)): outputs.append (dst_name) return outputs
a464d2d5f4233b3cf4e2396b8ebfbe58f7931b1b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a464d2d5f4233b3cf4e2396b8ebfbe58f7931b1b/util.py
update, verbose, dry_run)
update, verbose, dry_run))
def copy_tree (src, dst, preserve_mode=1, preserve_times=1, preserve_symlinks=0, update=0, verbose=0, dry_run=0): """Copy an entire directory tree 'src' to a new location 'dst'. Both 'src' and 'dst' must be directory names. If 'src' is not a directory, raise DistutilsFileError. If 'dst' does not exist, it is created with 'mkpath()'. The end result of the copy is that every file in 'src' is copied to 'dst', and directories under 'src' are recursively copied to 'dst'. Return the list of files copied (under their output names) -- note that if 'update' is true, this might be less than the list of files considered. Return value is not affected by 'dry_run'. 'preserve_mode' and 'preserve_times' are the same as for 'copy_file'; note that they only apply to regular files, not to directories. If 'preserve_symlinks' is true, symlinks will be copied as symlinks (on platforms that support them!); otherwise (the default), the destination of the symlink will be copied. 'update' and 'verbose' are the same as for 'copy_file'.""" if not dry_run and not os.path.isdir (src): raise DistutilsFileError, \ "cannot copy tree %s: not a directory" % src try: names = os.listdir (src) except os.error, (errno, errstr): if dry_run: names = [] else: raise DistutilsFileError, \ "error listing files in %s: %s" % (src, errstr) if not dry_run: mkpath (dst, verbose=verbose) outputs = [] for n in names: src_name = os.path.join (src, n) dst_name = os.path.join (dst, n) if preserve_symlinks and os.path.islink (src_name): link_dest = os.readlink (src_name) if verbose: print "linking %s -> %s" % (dst_name, link_dest) if not dry_run: os.symlink (link_dest, dst_name) outputs.append (dst_name) elif os.path.isdir (src_name): outputs[-1:] = \ copy_tree (src_name, dst_name, preserve_mode, preserve_times, preserve_symlinks, update, verbose, dry_run) else: if (copy_file (src_name, dst_name, preserve_mode, preserve_times, update, verbose, dry_run)): outputs.append (dst_name) return outputs
a464d2d5f4233b3cf4e2396b8ebfbe58f7931b1b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a464d2d5f4233b3cf4e2396b8ebfbe58f7931b1b/util.py
s.save_views()
def run(app, s): try: app.start() except KeyboardInterrupt: pass # save the option database s.save_views()
f0786b2e2c4866857ab02932b64151626a7cb04d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f0786b2e2c4866857ab02932b64151626a7cb04d/Main.py
run()
app, sb = build(initialcolor=initialcolor, initfile=initfile, ignore=ignore) run(app, sb) sb.save_views()
def main(): try: opts, args = getopt.getopt( sys.argv[1:], 'hd:i:X', ['database=', 'initfile=', 'ignore', 'help']) except getopt.error, msg: usage(1, msg) if len(args) == 0: initialcolor = None elif len(args) == 1: initialcolor = args[0] else: usage(1) ignore = 0 initfile = os.path.expanduser('~/.pynche') for opt, arg in opts: if opt in ('-h', '--help'): usage(0) elif opt in ('-d', '--database'): RGB_TXT.insert(0, arg) elif opt in ('-X', '--ignore'): ignore = 1 elif opt in ('-i', '--initfile'): initfile = arg run()
f0786b2e2c4866857ab02932b64151626a7cb04d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f0786b2e2c4866857ab02932b64151626a7cb04d/Main.py
# dlltool --dllname python15.dll --def python15.def \
b73f4b8b3064a2e4acf8f18234897d79c4843d52 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b73f4b8b3064a2e4acf8f18234897d79c4843d52/cygwinccompiler.py
linker_so=('%s -mcygwin -mdll -static' %
linker_so=('%s -mcygwin -mdll' %
def __init__ (self, verbose=0, dry_run=0, force=0):
b73f4b8b3064a2e4acf8f18234897d79c4843d52 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b73f4b8b3064a2e4acf8f18234897d79c4843d52/cygwinccompiler.py
linker_so='%s -mno-cygwin -mdll -static %s'
linker_so='%s -mno-cygwin -mdll %s'
def __init__ (self, verbose=0, dry_run=0, force=0):
b73f4b8b3064a2e4acf8f18234897d79c4843d52 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b73f4b8b3064a2e4acf8f18234897d79c4843d52/cygwinccompiler.py
Return a list of all keywords, built-in functions and names currently defines in __main__ that match.
Return a list of all keywords, built-in functions and names currently defined in self.namespace that match.
def global_matches(self, text): """Compute matches when text is a simple name.
d18d418fb2a9d39a9807f353a7759bd968c14cf2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d18d418fb2a9d39a9807f353a7759bd968c14cf2/rlcompleter.py
__main__.__dict__.keys()]:
self.namespace.keys()]:
def global_matches(self, text): """Compute matches when text is a simple name.
d18d418fb2a9d39a9807f353a7759bd968c14cf2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d18d418fb2a9d39a9807f353a7759bd968c14cf2/rlcompleter.py
evaluatable in the globals of __main__, it will be evaluated and its attributes (as revealed by dir()) are used as possible completions. (For class instances, class members are are also considered.)
evaluatable in self.namespace, it will be evaluated and its attributes (as revealed by dir()) are used as possible completions. (For class instances, class members are are also considered.)
def attr_matches(self, text): """Compute matches when text contains a dot.
d18d418fb2a9d39a9807f353a7759bd968c14cf2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d18d418fb2a9d39a9807f353a7759bd968c14cf2/rlcompleter.py
object = eval(expr, __main__.__dict__)
object = eval(expr, self.namespace)
def attr_matches(self, text): """Compute matches when text contains a dot.
d18d418fb2a9d39a9807f353a7759bd968c14cf2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d18d418fb2a9d39a9807f353a7759bd968c14cf2/rlcompleter.py
s = ''
s = []
def _safe_read(self, amt): """Read the number of bytes requested, compensating for partial reads.
e44e6f8d0905df90ccdbc34eea46d10061c401d1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e44e6f8d0905df90ccdbc34eea46d10061c401d1/httplib.py
chunk = self.fp.read(amt)
chunk = self.fp.read(min(amt, MAXAMOUNT))
def _safe_read(self, amt): """Read the number of bytes requested, compensating for partial reads.
e44e6f8d0905df90ccdbc34eea46d10061c401d1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e44e6f8d0905df90ccdbc34eea46d10061c401d1/httplib.py
s += chunk
s.append(chunk)
def _safe_read(self, amt): """Read the number of bytes requested, compensating for partial reads.
e44e6f8d0905df90ccdbc34eea46d10061c401d1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e44e6f8d0905df90ccdbc34eea46d10061c401d1/httplib.py
return s
return ''.join(s)
def _safe_read(self, amt): """Read the number of bytes requested, compensating for partial reads.
e44e6f8d0905df90ccdbc34eea46d10061c401d1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e44e6f8d0905df90ccdbc34eea46d10061c401d1/httplib.py
assert sre.split("(b)|(:+)", ":a:b::c") == \ ['', None, ':', 'a', None, ':', '', 'b', None, '', None, '::', 'c']
def bump_num(matchobj): int_value = int(matchobj.group(0)) return str(int_value + 1)
c64299e97179aeb82b2233a5f57e6303159045e4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c64299e97179aeb82b2233a5f57e6303159045e4/test_sre.py
>>> max(tupleids) - min(tupleids)
>>> int(max(tupleids) - min(tupleids))
>>> def f(n):
775870886609caf95dd357a0bd8d6039a80cff0c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/775870886609caf95dd357a0bd8d6039a80cff0c/test_genexps.py
test(r"""sre.match(r"\%03o" % i, chr(i)) != None""", 1) test(r"""sre.match(r"\%03o0" % i, chr(i)+"0") != None""", 1) test(r"""sre.match(r"\%03o8" % i, chr(i)+"8") != None""", 1) test(r"""sre.match(r"\x%02x" % i, chr(i)) != None""", 1) test(r"""sre.match(r"\x%02x0" % i, chr(i)+"0") != None""", 1) test(r"""sre.match(r"\x%02xz" % i, chr(i)+"z") != None""", 1)
test(r"""sre.match(r"\%03o" % i, chr(i)) is not None""", 1) test(r"""sre.match(r"\%03o0" % i, chr(i)+"0") is not None""", 1) test(r"""sre.match(r"\%03o8" % i, chr(i)+"8") is not None""", 1) test(r"""sre.match(r"\x%02x" % i, chr(i)) is not None""", 1) test(r"""sre.match(r"\x%02x0" % i, chr(i)+"0") is not None""", 1) test(r"""sre.match(r"\x%02xz" % i, chr(i)+"z") is not None""", 1)
def test(expression, result, exception=None): try: r = eval(expression) except: if exception: if not isinstance(sys.exc_value, exception): print expression, "FAILED" # display name, not actual value if exception is sre.error: print "expected", "sre.error" else: print "expected", exception.__name__ print "got", sys.exc_type.__name__, str(sys.exc_value) else: print expression, "FAILED" traceback.print_exc(file=sys.stdout) else: if exception: print expression, "FAILED" if exception is sre.error: print "expected", "sre.error" else: print "expected", exception.__name__ print "got result", repr(r) else: if r != result: print expression, "FAILED" print "expected", repr(result) print "got result", repr(r)
43203310e1400f4f6211972756449af0de8cca51 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/43203310e1400f4f6211972756449af0de8cca51/test_sre.py
test(r"""sre.match(sre.escape(chr(i)), chr(i)) != None""", 1)
test(r"""sre.match(sre.escape(chr(i)), chr(i)) is not None""", 1)
def bump_num(matchobj): int_value = int(matchobj.group(0)) return str(int_value + 1)
43203310e1400f4f6211972756449af0de8cca51 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/43203310e1400f4f6211972756449af0de8cca51/test_sre.py
test(r"""pat.match(p) != None""", 1)
test(r"""pat.match(p) is not None""", 1)
def bump_num(matchobj): int_value = int(matchobj.group(0)) return str(int_value + 1)
43203310e1400f4f6211972756449af0de8cca51 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/43203310e1400f4f6211972756449af0de8cca51/test_sre.py
class _Verbose:
class _Verbose(object):
def _note(self, format, *args): if self.__verbose: format = format % args format = "%s: %s\n" % ( currentThread().getName(), format) _sys.stderr.write(format)
f3b554dccf45b59e9675bf533b76ee151f1e7695 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f3b554dccf45b59e9675bf533b76ee151f1e7695/threading.py
text = text[:75] + ' ...'
textlines = text.splitlines() for i, line in enumerate(textlines): if len(line) > 79: textlines[i] = line[:75] + ' ...' text = '\n'.join(textlines)
def showtip(self, text, parenleft, parenright): """Show the calltip, bind events which will close it and reposition it. """ # truncate overly long calltip if len(text) >= 79: text = text[:75] + ' ...' self.text = text if self.tipwindow or not self.text: return
60edb2f34970014fef9ae013182ffcdd964a96ad /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/60edb2f34970014fef9ae013182ffcdd964a96ad/CallTipWindow.py
def test_compresscopy(self): data0 = HAMLET_SCENE data1 = HAMLET_SCENE.swapcase() c0 = zlib.compressobj(zlib.Z_BEST_COMPRESSION) bufs0 = [] bufs0.append(c0.compress(data0)) c1 = c0.copy() bufs1 = bufs0[:] bufs0.append(c0.compress(data0)) bufs0.append(c0.flush()) s0 = ''.join(bufs0) bufs1.append(c1.compress(data1)) bufs1.append(c1.flush()) s1 = ''.join(bufs1) self.assertEqual(zlib.decompress(s0),data0+data0) self.assertEqual(zlib.decompress(s1),data0+data1) def test_badcompresscopy(self): c = zlib.compressobj() c.compress(HAMLET_SCENE) c.flush() self.assertRaises(ValueError, c.copy) def test_decompresscopy(self): data = HAMLET_SCENE comp = zlib.compress(data) d0 = zlib.decompressobj() bufs0 = [] bufs0.append(d0.decompress(comp[:32])) d1 = d0.copy() bufs1 = bufs0[:] bufs0.append(d0.decompress(comp[32:])) s0 = ''.join(bufs0) bufs1.append(d1.decompress(comp[32:])) s1 = ''.join(bufs1) self.assertEqual(s0,s1) self.assertEqual(s0,data) def test_baddecompresscopy(self): data = zlib.compress(HAMLET_SCENE) d = zlib.decompressobj() d.decompress(data) d.flush() self.assertRaises(ValueError, d.copy)
if hasattr(zlib.compressobj(), "copy"): def test_compresscopy(self): data0 = HAMLET_SCENE data1 = HAMLET_SCENE.swapcase() c0 = zlib.compressobj(zlib.Z_BEST_COMPRESSION) bufs0 = [] bufs0.append(c0.compress(data0)) c1 = c0.copy() bufs1 = bufs0[:] bufs0.append(c0.compress(data0)) bufs0.append(c0.flush()) s0 = ''.join(bufs0) bufs1.append(c1.compress(data1)) bufs1.append(c1.flush()) s1 = ''.join(bufs1) self.assertEqual(zlib.decompress(s0),data0+data0) self.assertEqual(zlib.decompress(s1),data0+data1) def test_badcompresscopy(self): c = zlib.compressobj() c.compress(HAMLET_SCENE) c.flush() self.assertRaises(ValueError, c.copy) if hasattr(zlib.decompressobj(), "copy"): def test_decompresscopy(self): data = HAMLET_SCENE comp = zlib.compress(data) d0 = zlib.decompressobj() bufs0 = [] bufs0.append(d0.decompress(comp[:32])) d1 = d0.copy() bufs1 = bufs0[:] bufs0.append(d0.decompress(comp[32:])) s0 = ''.join(bufs0) bufs1.append(d1.decompress(comp[32:])) s1 = ''.join(bufs1) self.assertEqual(s0,s1) self.assertEqual(s0,data) def test_baddecompresscopy(self): data = zlib.compress(HAMLET_SCENE) d = zlib.decompressobj() d.decompress(data) d.flush() self.assertRaises(ValueError, d.copy)
def test_compresscopy(self): # Test copying a compression object data0 = HAMLET_SCENE data1 = HAMLET_SCENE.swapcase() c0 = zlib.compressobj(zlib.Z_BEST_COMPRESSION) bufs0 = [] bufs0.append(c0.compress(data0))
861377e48bf63b26a3f409ef71e652a45d701ff0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/861377e48bf63b26a3f409ef71e652a45d701ff0/test_zlib.py
alltests.addTest(module.suite())
alltests.addTest(module.test_suite())
def suite(): test_modules = [ 'test_associate', 'test_basics', 'test_compat', 'test_dbobj', 'test_dbshelve', 'test_dbtables', 'test_env_close', 'test_get_none', 'test_join', 'test_lock', 'test_misc', 'test_queue', 'test_recno', 'test_thread', ] alltests = unittest.TestSuite() for name in test_modules: module = __import__(name) alltests.addTest(module.suite()) return alltests
93c13e0ecab1c8b3a9a4df7b2c00a5f55cdb8ad7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/93c13e0ecab1c8b3a9a4df7b2c00a5f55cdb8ad7/test_all.py
def _fix_link_args (self, objects, output_dir, takes_libs=0, libraries=None, library_dirs=None): """Typecheck and fix up some of the arguments supplied to the 'link_*' methods and return the fixed values. Specifically: ensure that 'objects' is a list; if output_dir is None, use self.output_dir; ensure that 'libraries' and 'library_dirs' are both lists, and augment them with 'self.libraries' and 'self.library_dirs'. If 'takes_libs' is true, return a tuple (objects, output_dir, libraries, library_dirs; else return (objects, output_dir)."""
def _fix_object_args (self, objects, output_dir): """Typecheck and fix up some arguments supplied to various methods. Specifically: ensure that 'objects' is a list; if output_dir is None, replace with self.output_dir. Return fixed versions of 'objects' and 'output_dir'."""
def _fix_link_args (self, objects, output_dir, takes_libs=0, libraries=None, library_dirs=None): """Typecheck and fix up some of the arguments supplied to the 'link_*' methods and return the fixed values. Specifically: ensure that 'objects' is a list; if output_dir is None, use self.output_dir; ensure that 'libraries' and 'library_dirs' are both lists, and augment them with 'self.libraries' and 'self.library_dirs'. If 'takes_libs' is true, return a tuple (objects, output_dir, libraries, library_dirs; else return (objects, output_dir)."""
bd53a3698d3459267002a8cbfb4e9f4730e89b16 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bd53a3698d3459267002a8cbfb4e9f4730e89b16/ccompiler.py
if takes_libs: if libraries is None: libraries = self.libraries elif type (libraries) in (ListType, TupleType): libraries = list (libraries) + (self.libraries or []) else: raise TypeError, \ "'libraries' (if supplied) must be a list of strings" if library_dirs is None: library_dirs = self.library_dirs elif type (library_dirs) in (ListType, TupleType): library_dirs = list (library_dirs) + (self.library_dirs or []) else: raise TypeError, \ "'library_dirs' (if supplied) must be a list of strings" return (objects, output_dir, libraries, library_dirs)
return (objects, output_dir) def _fix_lib_args (self, libraries, library_dirs, runtime_library_dirs): """Typecheck and fix up some of the arguments supplied to the 'link_*' methods. Specifically: ensure that all arguments are lists, and augment them with their permanent versions (eg. 'self.libraries' augments 'libraries'). Return a tuple with fixed versions of all arguments.""" if libraries is None: libraries = self.libraries elif type (libraries) in (ListType, TupleType): libraries = list (libraries) + (self.libraries or [])
def _fix_link_args (self, objects, output_dir, takes_libs=0, libraries=None, library_dirs=None): """Typecheck and fix up some of the arguments supplied to the 'link_*' methods and return the fixed values. Specifically: ensure that 'objects' is a list; if output_dir is None, use self.output_dir; ensure that 'libraries' and 'library_dirs' are both lists, and augment them with 'self.libraries' and 'self.library_dirs'. If 'takes_libs' is true, return a tuple (objects, output_dir, libraries, library_dirs; else return (objects, output_dir)."""
bd53a3698d3459267002a8cbfb4e9f4730e89b16 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bd53a3698d3459267002a8cbfb4e9f4730e89b16/ccompiler.py
return (objects, output_dir)
raise TypeError, \ "'libraries' (if supplied) must be a list of strings" if library_dirs is None: library_dirs = self.library_dirs elif type (library_dirs) in (ListType, TupleType): library_dirs = list (library_dirs) + (self.library_dirs or []) else: raise TypeError, \ "'library_dirs' (if supplied) must be a list of strings" if runtime_library_dirs is None: runtime_library_dirs = self.runtime_library_dirs elif type (runtime_library_dirs) in (ListType, TupleType): runtime_library_dirs = (list (runtime_library_dirs) + (self.runtime_library_dirs or [])) else: raise TypeError, \ "'runtime_library_dirs' (if supplied) " + \ "must be a list of strings" return (libraries, library_dirs, runtime_library_dirs)
def _fix_link_args (self, objects, output_dir, takes_libs=0, libraries=None, library_dirs=None): """Typecheck and fix up some of the arguments supplied to the 'link_*' methods and return the fixed values. Specifically: ensure that 'objects' is a list; if output_dir is None, use self.output_dir; ensure that 'libraries' and 'library_dirs' are both lists, and augment them with 'self.libraries' and 'self.library_dirs'. If 'takes_libs' is true, return a tuple (objects, output_dir, libraries, library_dirs; else return (objects, output_dir)."""
bd53a3698d3459267002a8cbfb4e9f4730e89b16 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bd53a3698d3459267002a8cbfb4e9f4730e89b16/ccompiler.py
once and write the results to sys.stdout after the the
once and write the results to sys.stdout after the
def usage(outfile): outfile.write("""Usage: %s [OPTIONS] <file> [ARGS]
e822327da42a5ebcdf8c4c5b2ac1f2a504fb29d7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e822327da42a5ebcdf8c4c5b2ac1f2a504fb29d7/trace.py
try: value = SyntaxError(msg, (filename, lineno, offset, line)) except: value = msg, (filename, lineno, offset, line)
value = SyntaxError(msg, (filename, lineno, offset, line))
def showsyntaxerror(self, filename=None): """Display the syntax error that just occurred.
f71c84a93a5a75433886512c13a2439196d8cd97 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f71c84a93a5a75433886512c13a2439196d8cd97/code.py
except:
except ImportError:
def interact(banner=None, readfunc=None, local=None): """Closely emulate the interactive Python interpreter. This is a backwards compatible interface to the InteractiveConsole class. When readfunc is not specified, it attempts to import the readline module to enable GNU readline if it is available. Arguments (all optional, all default to None): banner -- passed to InteractiveConsole.interact() readfunc -- if not None, replaces InteractiveConsole.raw_input() local -- passed to InteractiveInterpreter.__init__() """ console = InteractiveConsole(local) if readfunc is not None: console.raw_input = readfunc else: try: import readline except: pass console.interact(banner)
f71c84a93a5a75433886512c13a2439196d8cd97 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f71c84a93a5a75433886512c13a2439196d8cd97/code.py
import thread
import threading
def __init__(self, maxsize=0): """Initialize a queue object with a given maximum size.
24b591c389afae6378d2e3e841011a539991a8c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/24b591c389afae6378d2e3e841011a539991a8c6/Queue.py
import dummy_thread as thread
import dummy_threading as threading
def __init__(self, maxsize=0): """Initialize a queue object with a given maximum size.
24b591c389afae6378d2e3e841011a539991a8c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/24b591c389afae6378d2e3e841011a539991a8c6/Queue.py
self.mutex = thread.allocate_lock() self.esema = thread.allocate_lock() self.esema.acquire() self.fsema = thread.allocate_lock()
self.mutex = threading.Lock() self.not_empty = threading.Condition(self.mutex) self.not_full = threading.Condition(self.mutex)
def __init__(self, maxsize=0): """Initialize a queue object with a given maximum size.
24b591c389afae6378d2e3e841011a539991a8c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/24b591c389afae6378d2e3e841011a539991a8c6/Queue.py
if block:
if not block: return self.put_nowait(item) self.not_full.acquire() try:
def put(self, item, block=True, timeout=None): """Put an item into the queue.
24b591c389afae6378d2e3e841011a539991a8c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/24b591c389afae6378d2e3e841011a539991a8c6/Queue.py
self.fsema.acquire() elif timeout >= 0: delay = 0.0005
while self._full(): self.not_full.wait() else: if timeout < 0: raise ValueError("'timeout' must be a positive number")
def put(self, item, block=True, timeout=None): """Put an item into the queue.
24b591c389afae6378d2e3e841011a539991a8c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/24b591c389afae6378d2e3e841011a539991a8c6/Queue.py
while True: if self.fsema.acquire(0): break
while self._full():
def put(self, item, block=True, timeout=None): """Put an item into the queue.
24b591c389afae6378d2e3e841011a539991a8c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/24b591c389afae6378d2e3e841011a539991a8c6/Queue.py
if remaining <= 0:
if remaining < 0.0:
def put(self, item, block=True, timeout=None): """Put an item into the queue.
24b591c389afae6378d2e3e841011a539991a8c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/24b591c389afae6378d2e3e841011a539991a8c6/Queue.py
delay = min(delay * 2, remaining, .05) _sleep(delay) else: raise ValueError("'timeout' must be a positive number") elif not self.fsema.acquire(0): raise Full self.mutex.acquire() release_fsema = True try: was_empty = self._empty()
self.not_full.wait(remaining)
def put(self, item, block=True, timeout=None): """Put an item into the queue.
24b591c389afae6378d2e3e841011a539991a8c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/24b591c389afae6378d2e3e841011a539991a8c6/Queue.py
if was_empty: self.esema.release() release_fsema = not self._full()
self.not_empty.notify()
def put(self, item, block=True, timeout=None): """Put an item into the queue.
24b591c389afae6378d2e3e841011a539991a8c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/24b591c389afae6378d2e3e841011a539991a8c6/Queue.py
if release_fsema: self.fsema.release() self.mutex.release()
self.not_full.release()
def put(self, item, block=True, timeout=None): """Put an item into the queue.
24b591c389afae6378d2e3e841011a539991a8c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/24b591c389afae6378d2e3e841011a539991a8c6/Queue.py
return self.put(item, False)
self.not_full.acquire() try: if self._full(): raise Full else: self._put(item) self.not_empty.notify() finally: self.not_full.release()
def put_nowait(self, item): """Put an item into the queue without blocking.
24b591c389afae6378d2e3e841011a539991a8c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/24b591c389afae6378d2e3e841011a539991a8c6/Queue.py
if block:
if not block: return self.get_nowait() self.not_empty.acquire() try:
def get(self, block=True, timeout=None): """Remove and return an item from the queue.
24b591c389afae6378d2e3e841011a539991a8c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/24b591c389afae6378d2e3e841011a539991a8c6/Queue.py
self.esema.acquire() elif timeout >= 0: delay = 0.0005
while self._empty(): self.not_empty.wait() else: if timeout < 0: raise ValueError("'timeout' must be a positive number")
def get(self, block=True, timeout=None): """Remove and return an item from the queue.
24b591c389afae6378d2e3e841011a539991a8c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/24b591c389afae6378d2e3e841011a539991a8c6/Queue.py
while 1: if self.esema.acquire(0): break
while self._empty():
def get(self, block=True, timeout=None): """Remove and return an item from the queue.
24b591c389afae6378d2e3e841011a539991a8c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/24b591c389afae6378d2e3e841011a539991a8c6/Queue.py
if remaining <= 0:
if remaining < 0.0:
def get(self, block=True, timeout=None): """Remove and return an item from the queue.
24b591c389afae6378d2e3e841011a539991a8c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/24b591c389afae6378d2e3e841011a539991a8c6/Queue.py
delay = min(delay * 2, remaining, .05) _sleep(delay) else: raise ValueError("'timeout' must be a positive number") elif not self.esema.acquire(0): raise Empty self.mutex.acquire() release_esema = True try: was_full = self._full()
self.not_empty.wait(remaining)
def get(self, block=True, timeout=None): """Remove and return an item from the queue.
24b591c389afae6378d2e3e841011a539991a8c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/24b591c389afae6378d2e3e841011a539991a8c6/Queue.py
if was_full: self.fsema.release() release_esema = not self._empty()
self.not_full.notify() return item
def get(self, block=True, timeout=None): """Remove and return an item from the queue.
24b591c389afae6378d2e3e841011a539991a8c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/24b591c389afae6378d2e3e841011a539991a8c6/Queue.py
if release_esema: self.esema.release() self.mutex.release() return item
self.not_empty.release()
def get(self, block=True, timeout=None): """Remove and return an item from the queue.
24b591c389afae6378d2e3e841011a539991a8c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/24b591c389afae6378d2e3e841011a539991a8c6/Queue.py
return self.get(False)
self.not_empty.acquire() try: if self._empty(): raise Empty else: item = self._get() self.not_full.notify() return item finally: self.not_empty.release()
def get_nowait(self): """Remove and return an item from the queue without blocking.
24b591c389afae6378d2e3e841011a539991a8c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/24b591c389afae6378d2e3e841011a539991a8c6/Queue.py
def remap_element_names(root, name_map): queue = [] for child in root.childNodes: if child.nodeType == ELEMENT: queue.append(child) while queue: node = queue.pop() tagName = node.tagName if name_map.has_key(tagName): name, attrs = name_map[tagName] node._node.name = name for attr, value in attrs.items(): node.setAttribute(attr, value) for child in node.childNodes: if child.nodeType == ELEMENT: queue.append(child)
def remap_element_names(root, name_map): queue = [] for child in root.childNodes: if child.nodeType == ELEMENT: queue.append(child) while queue: node = queue.pop() tagName = node.tagName if name_map.has_key(tagName): name, attrs = name_map[tagName] node._node.name = name for attr, value in attrs.items(): node.setAttribute(attr, value) for child in node.childNodes: if child.nodeType == ELEMENT: queue.append(child)
f66d7c84616487ad225f84e5ebdad598dad70152 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f66d7c84616487ad225f84e5ebdad598dad70152/docfixer.py
def fixup_table_structures(doc, fragment): # must be done after remap_element_names(), or the tables won't be found for table in find_all_elements(fragment, "table"): fixup_table(doc, table)
f66d7c84616487ad225f84e5ebdad598dad70152 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f66d7c84616487ad225f84e5ebdad598dad70152/docfixer.py
"sectionauthor", "seealso",
"sectionauthor", "seealso", "itemize",
def move_elements_by_name(doc, source, dest, name, sep=None): nodes = [] for child in source.childNodes: if child.nodeType == ELEMENT and child.tagName == name: nodes.append(child) for node in nodes: source.removeChild(node) dest.appendChild(node) if sep: dest.appendChild(doc.createTextNode(sep))
f66d7c84616487ad225f84e5ebdad598dad70152 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f66d7c84616487ad225f84e5ebdad598dad70152/docfixer.py
"index", "indexii", "indexiii", "indexiv", "setindexsubitem",
"setindexsubitem",
def move_elements_by_name(doc, source, dest, name, sep=None): nodes = [] for child in source.childNodes: if child.nodeType == ELEMENT and child.tagName == name: nodes.append(child) for node in nodes: source.removeChild(node) dest.appendChild(node) if sep: dest.appendChild(doc.createTextNode(sep))
f66d7c84616487ad225f84e5ebdad598dad70152 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f66d7c84616487ad225f84e5ebdad598dad70152/docfixer.py
"moduleauthor", "indexterm",
"moduleauthor", "indexterm", "leader",
def move_elements_by_name(doc, source, dest, name, sep=None): nodes = [] for child in source.childNodes: if child.nodeType == ELEMENT and child.tagName == name: nodes.append(child) for node in nodes: source.removeChild(node) dest.appendChild(node) if sep: dest.appendChild(doc.createTextNode(sep))
f66d7c84616487ad225f84e5ebdad598dad70152 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f66d7c84616487ad225f84e5ebdad598dad70152/docfixer.py
module_name = entry.getAttribute("name")
module_name = entry.getAttribute("module")
def fixup_refmodindexes_chunk(container): # node is probably a <para>; let's see how often it isn't: if container.tagName != PARA_ELEMENT: bwrite("--- fixup_refmodindexes_chunk(%s)\n" % container) module_entries = find_all_elements(container, "module") if not module_entries: return index_entries = find_all_elements_from_set(container, REFMODINDEX_ELEMENTS) removes = [] for entry in index_entries: children = entry.childNodes if len(children) != 0: bwrite("--- unexpected number of children for %s node:\n" % entry.tagName) ewrite(entry.toxml() + "\n") continue found = 0 module_name = entry.getAttribute("name") for node in module_entries: if len(node.childNodes) != 1: continue this_name = node.childNodes[0].data if this_name == module_name: found = 1 node.setAttribute("index", "yes") if found: removes.append(entry) for node in removes: container.removeChild(node)
f66d7c84616487ad225f84e5ebdad598dad70152 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f66d7c84616487ad225f84e5ebdad598dad70152/docfixer.py
remap_element_names(fragment, { "tableii": ("table", {"cols": "2"}), "tableiii": ("table", {"cols": "3"}), "tableiv": ("table", {"cols": "4"}), "lineii": ("row", {}), "lineiii": ("row", {}), "lineiv": ("row", {}), "refmodule": ("module", {"link": "link"}), })
def convert(ifp, ofp): p = esistools.ExtendedEsisBuilder() p.feed(ifp.read()) doc = p.document fragment = p.fragment normalize(fragment) simplify(doc, fragment) handle_labels(doc, fragment) handle_appendix(doc, fragment) fixup_trailing_whitespace(doc, { "abstract": "\n", "title": "", "chapter": "\n\n", "section": "\n\n", "subsection": "\n\n", "subsubsection": "\n\n", "paragraph": "\n\n", "subparagraph": "\n\n", }) cleanup_root_text(doc) cleanup_trailing_parens(fragment, ["function", "method", "cfunction"]) cleanup_synopses(doc, fragment) fixup_descriptors(doc, fragment) fixup_verbatims(fragment) normalize(fragment) fixup_paras(doc, fragment) fixup_sectionauthors(doc, fragment) remap_element_names(fragment, { "tableii": ("table", {"cols": "2"}), "tableiii": ("table", {"cols": "3"}), "tableiv": ("table", {"cols": "4"}), "lineii": ("row", {}), "lineiii": ("row", {}), "lineiv": ("row", {}), "refmodule": ("module", {"link": "link"}), }) fixup_table_structures(doc, fragment) fixup_rfc_references(doc, fragment) fixup_signatures(doc, fragment) add_node_ids(fragment) fixup_refmodindexes(fragment) fixup_bifuncindexes(fragment) # d = {} for gi in p.get_empties(): d[gi] = gi if d.has_key("rfc"): del d["rfc"] knownempty = d.has_key # try: write_esis(fragment, ofp, knownempty) except IOError, (err, msg): # Ignore EPIPE; it just means that whoever we're writing to stopped # reading. The rest of the output would be ignored. All other errors # should still be reported, if err != errno.EPIPE: raise
f66d7c84616487ad225f84e5ebdad598dad70152 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f66d7c84616487ad225f84e5ebdad598dad70152/docfixer.py
makevars = parsesetup.getmakevars(makefile_in)
def main(): # overridable context prefix = None # settable with -p option exec_prefix = None # settable with -P option extensions = [] path = sys.path odir = '' win = sys.platform[:3] == 'win' # output files frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' # normally derived from script name makefile = 'Makefile' subsystem = 'console' # parse command line try: opts, args = getopt.getopt(sys.argv[1:], 'he:o:p:P:s:w') except getopt.error, msg: usage('getopt error: ' + str(msg)) # proces option arguments for o, a in opts: if o == '-h': print __doc__ return if o == '-e': extensions.append(a) if o == '-o': odir = a if o == '-p': prefix = a if o == '-P': exec_prefix = a if o == '-w': win = not win if o == '-s': if not win: usage("-s subsystem option only on Windows") subsystem = a # default prefix and exec_prefix if not exec_prefix: if prefix: exec_prefix = prefix else: exec_prefix = sys.exec_prefix if not prefix: prefix = sys.prefix # determine whether -p points to the Python source tree ishome = os.path.exists(os.path.join(prefix, 'Include', 'pythonrun.h')) # locations derived from options version = sys.version[:3] if ishome: print "(Using Python source directory)" binlib = exec_prefix incldir = os.path.join(prefix, 'Include') config_c_in = os.path.join(prefix, 'Modules', 'config.c.in') frozenmain_c = os.path.join(prefix, 'Python', 'frozenmain.c') makefile_in = os.path.join(exec_prefix, 'Modules', 'Makefile') else: binlib = os.path.join(exec_prefix, 'lib', 'python%s' % version, 'config') incldir = os.path.join(prefix, 'include', 'python%s' % version) config_c_in = os.path.join(binlib, 'config.c.in') frozenmain_c = os.path.join(binlib, 'frozenmain.c') makefile_in = os.path.join(binlib, 'Makefile') supp_sources = [] defines = [] includes = ['-I' + incldir, '-I' + binlib] # sanity check of directories and files for dir in [prefix, exec_prefix, binlib, incldir] + extensions: if not os.path.exists(dir): usage('needed directory %s not found' % dir) if not os.path.isdir(dir): usage('%s: not a directory' % dir) if win: files = supp_sources else: files = [config_c_in, makefile_in] + supp_sources for file in supp_sources: if not os.path.exists(file): usage('needed file %s not found' % file) if not os.path.isfile(file): usage('%s: not a plain file' % file) if not win: for dir in extensions: setup = os.path.join(dir, 'Setup') if not os.path.exists(setup): usage('needed file %s not found' % setup) if not os.path.isfile(setup): usage('%s: not a plain file' % setup) # check that enough arguments are passed if not args: usage('at least one filename argument required') # check that the script name ends in ".py" if args[0][-3:] != ".py": usage('the script name must have a .py suffix') # check that file arguments exist for arg in args: if not os.path.exists(arg): usage('argument %s not found' % arg) if not os.path.isfile(arg): usage('%s: not a plain file' % arg) # process non-option arguments scriptfile = args[0] modules = args[1:] # derive target name from script name base = os.path.basename(scriptfile) base, ext = os.path.splitext(base) if base: if base != scriptfile: target = base else: target = base + '.bin' # handle -o option base_frozen_c = frozen_c base_config_c = config_c base_target = target if odir and not os.path.isdir(odir): try: os.mkdir(odir) print "Created output directory", odir except os.error, msg: usage('%s: mkdir failed (%s)' % (odir, str(msg))) if odir: frozen_c = os.path.join(odir, frozen_c) config_c = os.path.join(odir, config_c) target = os.path.join(odir, target) makefile = os.path.join(odir, makefile) # Actual work starts here... dict = findmodules.findmodules(scriptfile, modules, path) names = dict.keys() names.sort() print "Modules being frozen:" for name in names: print '\t', name backup = frozen_c + '~' try: os.rename(frozen_c, backup) except os.error: backup = None outfp = open(frozen_c, 'w') try: makefreeze.makefreeze(outfp, dict) finally: outfp.close() if backup: if cmp.cmp(backup, frozen_c): sys.stderr.write('%s not changed, not written\n' % frozen_c) os.rename(backup, frozen_c) if win: # Taking a shortcut here... import winmakemakefile outfp = open(makefile, 'w') try: winmakemakefile.makemakefile(outfp, locals(), [frozenmain_c, frozen_c], target) finally: outfp.close() return builtins = [] unknown = [] mods = dict.keys() mods.sort() for mod in mods: if dict[mod] == '<builtin>': builtins.append(mod) elif dict[mod] == '<unknown>': unknown.append(mod) addfiles = [] if unknown: addfiles, addmods = \ checkextensions.checkextensions(unknown, extensions) for mod in addmods: unknown.remove(mod) builtins = builtins + addmods if unknown: sys.stderr.write('Warning: unknown modules remain: %s\n' % string.join(unknown)) builtins.sort() infp = open(config_c_in) backup = config_c + '~' try: os.rename(config_c, backup) except os.error: backup = None outfp = open(config_c, 'w') try: makeconfig.makeconfig(infp, outfp, builtins) finally: outfp.close() infp.close() if backup: if cmp.cmp(backup, config_c): sys.stderr.write('%s not changed, not written\n' % config_c) os.rename(backup, config_c) cflags = defines + includes + ['$(OPT)'] libs = [os.path.join(binlib, 'libpython$(VERSION).a')] makevars = parsesetup.getmakevars(makefile_in) somevars = {} for key in makevars.keys(): somevars[key] = makevars[key] somevars['CFLAGS'] = string.join(cflags) # override files = ['$(OPT)', '$(LDFLAGS)', base_config_c, base_frozen_c] + \ supp_sources + addfiles + libs + \ ['$(MODLIBS)', '$(LIBS)', '$(SYSLIBS)'] backup = makefile + '~' try: os.rename(makefile, backup) except os.error: backup = None outfp = open(makefile, 'w') try: makemakefile.makemakefile(outfp, somevars, files, base_target) finally: outfp.close() if backup: if not cmp.cmp(backup, makefile): print 'previous Makefile saved as', backup else: sys.stderr.write('%s not changed, not written\n' % makefile) os.rename(backup, makefile) # Done! if odir: print 'Now run "make" in', odir, print 'to build the target:', base_target else: print 'Now run "make" to build the target:', base_target
2d38b18ab194b37adfbe5581c4be8675b4cc9728 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2d38b18ab194b37adfbe5581c4be8675b4cc9728/freeze.py
def _utc2time(utc): return utc[1]
def _utc2time(utc): t = utc[1] if t < 0: t = t + 0x100000000L return t
def _utc2time(utc): return utc[1]
b31bfa9f75a2ca7c837cdc9ba44b65bf3fcf49f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b31bfa9f75a2ca7c837cdc9ba44b65bf3fcf49f5/macfs.py
del os
fp = None try: fp = open(TESTFN, 'w+') except IOError: TMP_TESTFN = os.path.join('/tmp', TESTFN) try: fp = open(TMP_TESTFN, 'w+') TESTFN = TMP_TESTFN del TMP_TESTFN except IOError: print ('WARNING: tests will fail, unable to write to: %s or %s' % (TESTFN, TMP_TESTFN)) if fp is not None: fp.close() try: os.unlink(TESTFN) except: pass del os, fp
def fcmp(x, y): # fuzzy comparison function if type(x) == type(0.0) or type(y) == type(0.0): try: x, y = coerce(x, y) fuzz = (abs(x) + abs(y)) * FUZZ if abs(x-y) <= fuzz: return 0 except: pass elif type(x) == type(y) and type(x) in (type(()), type([])): for i in range(min(len(x), len(y))): outcome = fcmp(x[i], y[i]) if outcome != 0: return outcome return cmp(len(x), len(y)) return cmp(x, y)
05de356315eb78fd2dd7fa351f59d8ace448ef1d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/05de356315eb78fd2dd7fa351f59d8ace448ef1d/test_support.py
return st[stat.ST_MTIME]
return st[stat.ST_ATIME]
def getatime(filename): """Return the last access time of a file, reported by os.stat()""" st = os.stat(filename) return st[stat.ST_MTIME]
fcd30354042fa934f15ec557fb5b6f6b336f0d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fcd30354042fa934f15ec557fb5b6f6b336f0d6c/ntpath.py
self.lines = []
def __init__(self, fp=None, headers=None, outerboundary="", environ=os.environ, keep_blank_values=0, strict_parsing=0): """Constructor. Read multipart/* until last part.
fa508f5f5f5df61d0663db211dc1d6d7672c56d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fa508f5f5f5df61d0663db211dc1d6d7672c56d2/cgi.py
self.lines.append(line)
def read_lines_to_eof(self): """Internal: read lines until EOF.""" while 1: line = self.fp.readline() if not line: self.done = -1 break self.lines.append(line) self.file.write(line)
fa508f5f5f5df61d0663db211dc1d6d7672c56d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fa508f5f5f5df61d0663db211dc1d6d7672c56d2/cgi.py
self.lines.append(line)
def read_lines_to_outerboundary(self): """Internal: read lines until outerboundary.""" next = "--" + self.outerboundary last = next + "--" delim = "" while 1: line = self.fp.readline() if not line: self.done = -1 break self.lines.append(line) if line[:2] == "--": strippedline = string.strip(line) if strippedline == next: break if strippedline == last: self.done = 1 break odelim = delim if line[-2:] == "\r\n": delim = "\r\n" line = line[:-2] elif line[-1] == "\n": delim = "\n" line = line[:-1] else: delim = "" self.file.write(odelim + line)
fa508f5f5f5df61d0663db211dc1d6d7672c56d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fa508f5f5f5df61d0663db211dc1d6d7672c56d2/cgi.py
self.lines.append(line)
def skip_lines(self): """Internal: skip lines until outer boundary if defined.""" if not self.outerboundary or self.done: return next = "--" + self.outerboundary last = next + "--" while 1: line = self.fp.readline() if not line: self.done = -1 break self.lines.append(line) if line[:2] == "--": strippedline = string.strip(line) if strippedline == next: break if strippedline == last: self.done = 1 break
fa508f5f5f5df61d0663db211dc1d6d7672c56d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fa508f5f5f5df61d0663db211dc1d6d7672c56d2/cgi.py
home = os.environ['HOME']
home = os.environ.get('HOME')
def addpackage(sitedir, name): global _dirs_in_sys_path if _dirs_in_sys_path is None: _init_pathinfo() reset = 1 else: reset = 0 fullname = os.path.join(sitedir, name) try: f = open(fullname) except IOError: return while 1: dir = f.readline() if not dir: break if dir[0] == '#': continue if dir.startswith("import"): exec dir continue if dir[-1] == '\n': dir = dir[:-1] dir, dircase = makepath(sitedir, dir) if not dircase in _dirs_in_sys_path and os.path.exists(dir): sys.path.append(dir) _dirs_in_sys_path[dircase] = 1 if reset: _dirs_in_sys_path = None
5e54b021914bfb46a5f3bc5aa1885d6d3bb87ca4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5e54b021914bfb46a5f3bc5aa1885d6d3bb87ca4/site.py
def swig_sources (self, sources):
9f327ca7d1e7d7f0d14033733b43011e5f2c4d8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9f327ca7d1e7d7f0d14033733b43011e5f2c4d8c/build_ext.py
new_sources.append(base + ".c")
new_sources.append(base + target_ext)
def swig_sources (self, sources):
9f327ca7d1e7d7f0d14033733b43011e5f2c4d8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9f327ca7d1e7d7f0d14033733b43011e5f2c4d8c/build_ext.py
swig_cmd = [swig, "-python", "-dnone", "-ISWIG"]
swig_cmd = [swig, "-python", "-dnone", "-ISWIG"] if self.swig_cpp: swig_cmd.append ("-c++")
def swig_sources (self, sources):
9f327ca7d1e7d7f0d14033733b43011e5f2c4d8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9f327ca7d1e7d7f0d14033733b43011e5f2c4d8c/build_ext.py
self.announce ("swigging %s to %s" % (src, obj)) self.spawn(swig_cmd + ["-o", swig_targets[source], source])
target = swig_targets[source] self.announce ("swigging %s to %s" % (source, target)) self.spawn(swig_cmd + ["-o", target, source])
def swig_sources (self, sources):
9f327ca7d1e7d7f0d14033733b43011e5f2c4d8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9f327ca7d1e7d7f0d14033733b43011e5f2c4d8c/build_ext.py
def msvc_prelink_hack (self, sources, ext, extra_args):
9f327ca7d1e7d7f0d14033733b43011e5f2c4d8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9f327ca7d1e7d7f0d14033733b43011e5f2c4d8c/build_ext.py
startofline = tell()
try: startofline = tell() except IOError: startofline = tell = None self.seekable = 0
def readheaders(self): """Read header lines. Read header lines up to the entirely blank line that terminates them. The (normally blank) line that ends the headers is skipped, but not included in the returned list. If a non-header line ends the headers, (which is an error), an attempt is made to backspace over it; it is never included in the returned list. The variable self.status is set to the empty string if all went well, otherwise it is an error message. The variable self.headers is a completely uninterpreted list of lines contained in the header (so printing them will reproduce the header exactly as it appears in the file). """ self.dict = {} self.unixfrom = '' self.headers = list = [] self.status = '' headerseen = "" firstline = 1 startofline = unread = tell = None if hasattr(self.fp, 'unread'): unread = self.fp.unread elif self.seekable: tell = self.fp.tell while 1: if tell: startofline = tell() line = self.fp.readline() if not line: self.status = 'EOF in headers' break # Skip unix From name time lines if firstline and line[:5] == 'From ': self.unixfrom = self.unixfrom + line continue firstline = 0 if headerseen and line[0] in ' \t': # It's a continuation line. list.append(line) x = (self.dict[headerseen] + "\n " + string.strip(line)) self.dict[headerseen] = string.strip(x) continue elif self.iscomment(line): # It's a comment. Ignore it. continue elif self.islast(line): # Note! No pushback here! The delimiter line gets eaten. break headerseen = self.isheader(line) if headerseen: # It's a legal header line, save it. list.append(line) self.dict[headerseen] = string.strip(line[len(headerseen)+1:]) continue else: # It's not a header line; throw it back and stop here. if not self.dict: self.status = 'No headers' else: self.status = 'Non-header line where header expected' # Try to undo the read. if unread: unread(line) elif tell: self.fp.seek(startofline) else: self.status = self.status + '; bad seek' break
80a2fef1f39d4c5fba699f4b23a78d00dbc67d49 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/80a2fef1f39d4c5fba699f4b23a78d00dbc67d49/rfc822.py
if auth: h.putheader('Authorization', 'Basic %s' % auth)
if proxy_auth: h.putheader('Proxy-Authorization: Basic %s' % proxy_auth) if auth: h.putheader('Authorization: Basic %s' % auth)
def open_https(self, url, data=None): """Use HTTPS protocol.""" import httplib user_passwd = None if isinstance(url, str): host, selector = splithost(url) if host: user_passwd, host = splituser(host) host = unquote(host) realhost = host else: host, selector = url urltype, rest = splittype(selector) url = rest user_passwd = None if urltype.lower() != 'https': realhost = None else: realhost, rest = splithost(rest) if realhost: user_passwd, realhost = splituser(realhost) if user_passwd: selector = "%s://%s%s" % (urltype, realhost, rest) #print "proxy via https:", host, selector if not host: raise IOError, ('https error', 'no host given') if user_passwd: import base64 auth = base64.encodestring(user_passwd).strip() else: auth = None h = httplib.HTTPS(host, 0, key_file=self.key_file, cert_file=self.cert_file) if data is not None: h.putrequest('POST', selector) h.putheader('Content-type', 'application/x-www-form-urlencoded') h.putheader('Content-length', '%d' % len(data)) else: h.putrequest('GET', selector) if auth: h.putheader('Authorization', 'Basic %s' % auth) if realhost: h.putheader('Host', realhost) for args in self.addheaders: h.putheader(*args) h.endheaders() if data is not None: h.send(data) errcode, errmsg, headers = h.getreply() fp = h.getfile() if errcode == 200: return addinfourl(fp, headers, "https:" + url) else: if data is None: return self.http_error(url, fp, errcode, errmsg, headers) else: return self.http_error(url, fp, errcode, errmsg, headers, data)
1a1f364a04fe29234d39589bc5414308efc90fd4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1a1f364a04fe29234d39589bc5414308efc90fd4/urllib.py
See this URL for a description of the basic authentication scheme: http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-v10-spec-00.txt"""
This function supports Basic authentication only."""
def http_error_401(self, url, fp, errcode, errmsg, headers, data=None): """Error 401 -- authentication required. See this URL for a description of the basic authentication scheme: http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-v10-spec-00.txt""" if not 'www-authenticate' in headers: URLopener.http_error_default(self, url, fp, errcode, errmsg, headers) stuff = headers['www-authenticate'] import re match = re.match('[ \t]*([^ \t]+)[ \t]+realm="([^"]*)"', stuff) if not match: URLopener.http_error_default(self, url, fp, errcode, errmsg, headers) scheme, realm = match.groups() if scheme.lower() != 'basic': URLopener.http_error_default(self, url, fp, errcode, errmsg, headers) name = 'retry_' + self.type + '_basic_auth' if data is None: return getattr(self,name)(url, realm) else: return getattr(self,name)(url, realm, data)
1a1f364a04fe29234d39589bc5414308efc90fd4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1a1f364a04fe29234d39589bc5414308efc90fd4/urllib.py
def http_error_407(self, url, fp, errcode, errmsg, headers, data=None): """Error 407 -- proxy authentication required. This function supports Basic authentication only.""" if not 'proxy-authenticate' in headers: URLopener.http_error_default(self, url, fp, errcode, errmsg, headers) stuff = headers['proxy-authenticate'] import re match = re.match('[ \t]*([^ \t]+)[ \t]+realm="([^"]*)"', stuff) if not match: URLopener.http_error_default(self, url, fp, errcode, errmsg, headers) scheme, realm = match.groups() if scheme.lower() != 'basic': URLopener.http_error_default(self, url, fp, errcode, errmsg, headers) name = 'retry_proxy_' + self.type + '_basic_auth' if data is None: return getattr(self,name)(url, realm) else: return getattr(self,name)(url, realm, data) def retry_proxy_http_basic_auth(self, url, realm, data=None): host, selector = splithost(url) newurl = 'http://' + host + selector proxy = self.proxies['http'] urltype, proxyhost = splittype(proxy) proxyhost, proxyselector = splithost(proxyhost) i = proxyhost.find('@') + 1 proxyhost = proxyhost[i:] user, passwd = self.get_user_passwd(proxyhost, realm, i) if not (user or passwd): return None proxyhost = quote(user, safe='') + ':' + quote(passwd, safe='') + '@' + proxyhost self.proxies['http'] = 'http://' + proxyhost + proxyselector if data is None: return self.open(newurl) else: return self.open(newurl, data) def retry_proxy_https_basic_auth(self, url, realm, data=None): host, selector = splithost(url) newurl = 'https://' + host + selector proxy = self.proxies['https'] urltype, proxyhost = splittype(proxy) proxyhost, proxyselector = splithost(proxyhost) i = proxyhost.find('@') + 1 proxyhost = proxyhost[i:] user, passwd = self.get_user_passwd(proxyhost, realm, i) if not (user or passwd): return None proxyhost = quote(user, safe='') + ':' + quote(passwd, safe='') + '@' + proxyhost self.proxies['https'] = 'https://' + proxyhost + proxyselector if data is None: return self.open(newurl) else: return self.open(newurl, data)
def http_error_401(self, url, fp, errcode, errmsg, headers, data=None): """Error 401 -- authentication required. See this URL for a description of the basic authentication scheme: http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-v10-spec-00.txt""" if not 'www-authenticate' in headers: URLopener.http_error_default(self, url, fp, errcode, errmsg, headers) stuff = headers['www-authenticate'] import re match = re.match('[ \t]*([^ \t]+)[ \t]+realm="([^"]*)"', stuff) if not match: URLopener.http_error_default(self, url, fp, errcode, errmsg, headers) scheme, realm = match.groups() if scheme.lower() != 'basic': URLopener.http_error_default(self, url, fp, errcode, errmsg, headers) name = 'retry_' + self.type + '_basic_auth' if data is None: return getattr(self,name)(url, realm) else: return getattr(self,name)(url, realm, data)
1a1f364a04fe29234d39589bc5414308efc90fd4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1a1f364a04fe29234d39589bc5414308efc90fd4/urllib.py
newurl = '//' + host + selector return self.open_https(newurl, data)
newurl = 'https://' + host + selector if data is None: return self.open(newurl) else: return self.open(newurl, data)
def retry_https_basic_auth(self, url, realm, data=None): host, selector = splithost(url) i = host.find('@') + 1 host = host[i:] user, passwd = self.get_user_passwd(host, realm, i) if not (user or passwd): return None host = quote(user, safe='') + ':' + quote(passwd, safe='') + '@' + host newurl = '//' + host + selector return self.open_https(newurl, data)
1a1f364a04fe29234d39589bc5414308efc90fd4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1a1f364a04fe29234d39589bc5414308efc90fd4/urllib.py
def make_release_tree (self, base_dir, files):
295279b0a41fae4e77cc443c4f7827918bfcba06 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/295279b0a41fae4e77cc443c4f7827918bfcba06/dist.py
self.announce ("making hard links in %s..." % base_dir)
try: link = os.link msg = "making hard links in %s..." % base_dir except AttributeError: link = 0 msg = "copying files to %s..." % base_dir self.announce (msg)
def make_release_tree (self, base_dir, files):
295279b0a41fae4e77cc443c4f7827918bfcba06 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/295279b0a41fae4e77cc443c4f7827918bfcba06/dist.py