rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
"""ScrolledWindow - Window with scrollbars."""
"""ScrolledWindow - Window with automatic scrollbars."""
def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixScrolledTList', ['options'], cnf, kw) self.subwidget_list['tlist'] = _dummyTList(self, 'tlist') self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
b7b32601281f25ffed50f8187c78a3802fa14039 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b7b32601281f25ffed50f8187c78a3802fa14039/Tix.py
"""Select - Container for buttons. Can enforce radio buttons etc. Subwidgets are buttons added dynamically"""
"""Select - Container of button subwidgets. It can be used to provide radio-box or check-box style of selection options for the user. Subwidgets are buttons added dynamically using the add method."""
def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixScrolledWindow', ['options'], cnf, kw) self.subwidget_list['window'] = _dummyFrame(self, 'window') self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
b7b32601281f25ffed50f8187c78a3802fa14039 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b7b32601281f25ffed50f8187c78a3802fa14039/Tix.py
"""TList - Hierarchy display.
"""TList - Hierarchy display widget which can be used to display data in a tabular format. The list entries of a TList widget are similar to the entries in the Tk listbox widget. The main differences are (1) the TList widget can display the list entries in a two dimensional format and (2) you can use graphical images as well as multiple colors and fonts for the list entries.
def invoke(self, name): if self.subwidget_list.has_key(name): self.tk.call(self._w, 'invoke', name)
b7b32601281f25ffed50f8187c78a3802fa14039 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b7b32601281f25ffed50f8187c78a3802fa14039/Tix.py
"""Tree - The tixTree widget (general purpose DirList like widget)"""
"""Tree - The tixTree widget can be used to display hierachical data in a tree form. The user can adjust the view of the tree by opening or closing parts of the tree."""
def yview(self, *args): apply(self.tk.call, (self._w, 'yview') + args)
b7b32601281f25ffed50f8187c78a3802fa14039 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b7b32601281f25ffed50f8187c78a3802fa14039/Tix.py
class _dummyTList(TList, TixSubWidget): def __init__(self, master, name, destroy_physically=1): TixSubWidget.__init__(self, master, name, destroy_physically) class _dummyComboBox(ComboBox, TixSubWidget): def __init__(self, master, name, destroy_physically=1): TixSubWidget.__init__(self, master, name, destroy_physically) self.subwidget_list['entry'] = _dummyEntry(self, 'entry') self.subwidget_list['arrow'] = _dummyButton(self, 'arrow') self.subwidget_list['slistbox'] = _dummyScrolledListBox(self, 'slistbox') self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox', destroy_physically=0) class _dummyDirList(DirList, TixSubWidget):
class _dummyScrolledHList(ScrolledHList, TixSubWidget):
def __init__(self, master, name, destroy_physically=1): TixSubWidget.__init__(self, master, name, destroy_physically)
b7b32601281f25ffed50f8187c78a3802fa14039 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b7b32601281f25ffed50f8187c78a3802fa14039/Tix.py
index = self._tclCommands.index(name) del self._tclCommands[index]
try: self._tclCommands.remove(name) except ValueError: pass
def deletecommand(self, name): #print '- Tkinter: deleted command', name self.tk.deletecommand(name) index = self._tclCommands.index(name) del self._tclCommands[index]
5ac00ac1403e4d0981c5042cc76cd09ae6de2570 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5ac00ac1403e4d0981c5042cc76cd09ae6de2570/Tkinter.py
def _bind(self, what, sequence, func, add):
def _bind(self, what, sequence, func, add, needcleanup=1):
def _bind(self, what, sequence, func, add): if func: cmd = ("%sset _tkinter_break [%s %s]\n" 'if {"$_tkinter_break" == "break"} break\n') \ % (add and '+' or '', self._register(func, self._substitute), _string.join(self._subst_format)) apply(self.tk.call, what + (sequence, cmd)) elif func == '': apply(self.tk.call, what + (sequence, func)) else: return apply(self.tk.call, what + (sequence,))
5ac00ac1403e4d0981c5042cc76cd09ae6de2570 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5ac00ac1403e4d0981c5042cc76cd09ae6de2570/Tkinter.py
self._register(func, self._substitute),
self._register(func, self._substitute, needcleanup),
def _bind(self, what, sequence, func, add): if func: cmd = ("%sset _tkinter_break [%s %s]\n" 'if {"$_tkinter_break" == "break"} break\n') \ % (add and '+' or '', self._register(func, self._substitute), _string.join(self._subst_format)) apply(self.tk.call, what + (sequence, cmd)) elif func == '': apply(self.tk.call, what + (sequence, func)) else: return apply(self.tk.call, what + (sequence,))
5ac00ac1403e4d0981c5042cc76cd09ae6de2570 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5ac00ac1403e4d0981c5042cc76cd09ae6de2570/Tkinter.py
return self._bind(('bind', 'all'), sequence, func, add)
return self._bind(('bind', 'all'), sequence, func, add, 0)
def bind_all(self, sequence=None, func=None, add=None): return self._bind(('bind', 'all'), sequence, func, add)
5ac00ac1403e4d0981c5042cc76cd09ae6de2570 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5ac00ac1403e4d0981c5042cc76cd09ae6de2570/Tkinter.py
return self._bind(('bind', className), sequence, func, add)
return self._bind(('bind', className), sequence, func, add, 0)
def bind_class(self, className, sequence=None, func=None, add=None): return self._bind(('bind', className), sequence, func, add)
5ac00ac1403e4d0981c5042cc76cd09ae6de2570 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5ac00ac1403e4d0981c5042cc76cd09ae6de2570/Tkinter.py
def _register(self, func, subst=None):
def _register(self, func, subst=None, needcleanup=1):
def _register(self, func, subst=None): f = CallWrapper(func, subst, self).__call__ name = `id(f)` try: func = func.im_func except AttributeError: pass try: name = name + func.__name__ except AttributeError: pass self.tk.createcommand(name, f) if self._tclCommands is None: self._tclCommands = [] self._tclCommands.append(name) #print '+ Tkinter created command', name return name
5ac00ac1403e4d0981c5042cc76cd09ae6de2570 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5ac00ac1403e4d0981c5042cc76cd09ae6de2570/Tkinter.py
if self._tclCommands is None: self._tclCommands = [] self._tclCommands.append(name)
if needcleanup: if self._tclCommands is None: self._tclCommands = [] self._tclCommands.append(name)
def _register(self, func, subst=None): f = CallWrapper(func, subst, self).__call__ name = `id(f)` try: func = func.im_func except AttributeError: pass try: name = name + func.__name__ except AttributeError: pass self.tk.createcommand(name, f) if self._tclCommands is None: self._tclCommands = [] self._tclCommands.append(name) #print '+ Tkinter created command', name return name
5ac00ac1403e4d0981c5042cc76cd09ae6de2570 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5ac00ac1403e4d0981c5042cc76cd09ae6de2570/Tkinter.py
self.announce('Building RPMs') rpm_args = ['rpm',]
self.announce('building RPMs') rpm_cmd = ['rpm']
def run (self):
d0e4b42ee241b29cc924b18f4c1efd29723c85cf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d0e4b42ee241b29cc924b18f4c1efd29723c85cf/bdist_rpm.py
rpm_args.append('-bs')
rpm_cmd.append('-bs')
def run (self):
d0e4b42ee241b29cc924b18f4c1efd29723c85cf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d0e4b42ee241b29cc924b18f4c1efd29723c85cf/bdist_rpm.py
rpm_args.append('-bb')
rpm_cmd.append('-bb')
def run (self):
d0e4b42ee241b29cc924b18f4c1efd29723c85cf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d0e4b42ee241b29cc924b18f4c1efd29723c85cf/bdist_rpm.py
rpm_args.append('-ba')
rpm_cmd.append('-ba')
def run (self):
d0e4b42ee241b29cc924b18f4c1efd29723c85cf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d0e4b42ee241b29cc924b18f4c1efd29723c85cf/bdist_rpm.py
rpm_args.extend(['--define',
rpm_cmd.extend(['--define',
def run (self):
d0e4b42ee241b29cc924b18f4c1efd29723c85cf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d0e4b42ee241b29cc924b18f4c1efd29723c85cf/bdist_rpm.py
rpm_args.append('--clean') rpm_args.append(spec_path) self.spawn(rpm_args)
rpm_cmd.append('--clean') rpm_cmd.append(spec_path) self.spawn(rpm_cmd)
def run (self):
d0e4b42ee241b29cc924b18f4c1efd29723c85cf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d0e4b42ee241b29cc924b18f4c1efd29723c85cf/bdist_rpm.py
def_build = 'env CFLAGS="$RPM_OPT_FLAGS" python setup.py build' else: def_build = 'python setup.py build'
def_build = 'env CFLAGS="$RPM_OPT_FLAGS" ' + def_build
def _make_spec_file(self): """Generate the text of an RPM spec file and return it as a list of strings (one per line). """ # definitions and headers spec_file = [ '%define name ' + self.distribution.get_name(), '%define version ' + self.distribution.get_version(), '%define release ' + self.release, '', 'Summary: ' + self.distribution.get_description(), ]
d0e4b42ee241b29cc924b18f4c1efd29723c85cf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d0e4b42ee241b29cc924b18f4c1efd29723c85cf/bdist_rpm.py
"python setup.py install " "--root=$RPM_BUILD_ROOT " "--record=INSTALLED_FILES"),
("%s setup.py install " "--root=$RPM_BUILD_ROOT " "--record=INSTALLED_FILES") % self.python),
def _make_spec_file(self): """Generate the text of an RPM spec file and return it as a list of strings (one per line). """ # definitions and headers spec_file = [ '%define name ' + self.distribution.get_name(), '%define version ' + self.distribution.get_version(), '%define release ' + self.release, '', 'Summary: ' + self.distribution.get_description(), ]
d0e4b42ee241b29cc924b18f4c1efd29723c85cf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d0e4b42ee241b29cc924b18f4c1efd29723c85cf/bdist_rpm.py
QSIZE = 16 TIME = 5
format = SV.RGB8_FRAMES qsize = 2
def main(): QSIZE = 16 TIME = 5 audio = 0 num, den = 1, 1 opts, args = getopt.getopt(sys.argv[1:], 'aq:r:t:') for opt, arg in opts: if opt == '-a': audio = 1 elif opt == '-q': QSIZE = string.atoi(arg) elif opt == '-r': [nstr, dstr] = string.splitfields(arg, '/') num, den = string.atoi(nstr), string.atoi(dstr) elif opt == '-t': TIME = string.atoi(arg) if args[2:]: sys.stderr.write('usage: Vrec [options] [file [audiofile]]\n') sys.exit(2) if args: filename = args[0] else: filename = 'film.video' if args[1:] and not audio: sys.stderr.write('-a turned on by appearance of 2nd file\n') audio = 1 if audio: if args[1:]: audiofilename = args[1] else: audiofilename = 'film.aiff' else: audiofilename = None gl.foreground() x, y = SV.PAL_XMAX / 4, SV.PAL_YMAX / 4 print x, 'x', y gl.minsize(40, 30) gl.stepunit(8, 6) gl.maxsize(SV.PAL_XMAX, SV.PAL_YMAX) gl.keepaspect(SV.PAL_XMAX, SV.PAL_YMAX) win = gl.winopen(filename) x, y = gl.getsize() print x, 'x', y v = sv.OpenVideo() v.BindGLWindow(win, SV.IN_REPLACE) v.SetSize(x, y) v.BindGLWindow(win, SV.IN_REPLACE) v.SetCaptureFormat(SV.RGB_FRAMES) v.SetCaptureMode(SV.BLOCKING_CAPTURE) v.SetQueueSize(QSIZE) v.InitCapture() if v.GetQueueSize() != QSIZE: QSIZE = v.GetQueueSize() print 'Warning: QSIZE reduced to', QSIZE
62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a/Vrec.py
num, den = 1, 1 opts, args = getopt.getopt(sys.argv[1:], 'aq:r:t:')
rate = 2 opts, args = getopt.getopt(sys.argv[1:], 'aq:r:')
def main(): QSIZE = 16 TIME = 5 audio = 0 num, den = 1, 1 opts, args = getopt.getopt(sys.argv[1:], 'aq:r:t:') for opt, arg in opts: if opt == '-a': audio = 1 elif opt == '-q': QSIZE = string.atoi(arg) elif opt == '-r': [nstr, dstr] = string.splitfields(arg, '/') num, den = string.atoi(nstr), string.atoi(dstr) elif opt == '-t': TIME = string.atoi(arg) if args[2:]: sys.stderr.write('usage: Vrec [options] [file [audiofile]]\n') sys.exit(2) if args: filename = args[0] else: filename = 'film.video' if args[1:] and not audio: sys.stderr.write('-a turned on by appearance of 2nd file\n') audio = 1 if audio: if args[1:]: audiofilename = args[1] else: audiofilename = 'film.aiff' else: audiofilename = None gl.foreground() x, y = SV.PAL_XMAX / 4, SV.PAL_YMAX / 4 print x, 'x', y gl.minsize(40, 30) gl.stepunit(8, 6) gl.maxsize(SV.PAL_XMAX, SV.PAL_YMAX) gl.keepaspect(SV.PAL_XMAX, SV.PAL_YMAX) win = gl.winopen(filename) x, y = gl.getsize() print x, 'x', y v = sv.OpenVideo() v.BindGLWindow(win, SV.IN_REPLACE) v.SetSize(x, y) v.BindGLWindow(win, SV.IN_REPLACE) v.SetCaptureFormat(SV.RGB_FRAMES) v.SetCaptureMode(SV.BLOCKING_CAPTURE) v.SetQueueSize(QSIZE) v.InitCapture() if v.GetQueueSize() != QSIZE: QSIZE = v.GetQueueSize() print 'Warning: QSIZE reduced to', QSIZE
62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a/Vrec.py
QSIZE = string.atoi(arg)
qsize = string.atoi(arg)
def main(): QSIZE = 16 TIME = 5 audio = 0 num, den = 1, 1 opts, args = getopt.getopt(sys.argv[1:], 'aq:r:t:') for opt, arg in opts: if opt == '-a': audio = 1 elif opt == '-q': QSIZE = string.atoi(arg) elif opt == '-r': [nstr, dstr] = string.splitfields(arg, '/') num, den = string.atoi(nstr), string.atoi(dstr) elif opt == '-t': TIME = string.atoi(arg) if args[2:]: sys.stderr.write('usage: Vrec [options] [file [audiofile]]\n') sys.exit(2) if args: filename = args[0] else: filename = 'film.video' if args[1:] and not audio: sys.stderr.write('-a turned on by appearance of 2nd file\n') audio = 1 if audio: if args[1:]: audiofilename = args[1] else: audiofilename = 'film.aiff' else: audiofilename = None gl.foreground() x, y = SV.PAL_XMAX / 4, SV.PAL_YMAX / 4 print x, 'x', y gl.minsize(40, 30) gl.stepunit(8, 6) gl.maxsize(SV.PAL_XMAX, SV.PAL_YMAX) gl.keepaspect(SV.PAL_XMAX, SV.PAL_YMAX) win = gl.winopen(filename) x, y = gl.getsize() print x, 'x', y v = sv.OpenVideo() v.BindGLWindow(win, SV.IN_REPLACE) v.SetSize(x, y) v.BindGLWindow(win, SV.IN_REPLACE) v.SetCaptureFormat(SV.RGB_FRAMES) v.SetCaptureMode(SV.BLOCKING_CAPTURE) v.SetQueueSize(QSIZE) v.InitCapture() if v.GetQueueSize() != QSIZE: QSIZE = v.GetQueueSize() print 'Warning: QSIZE reduced to', QSIZE
62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a/Vrec.py
[nstr, dstr] = string.splitfields(arg, '/') num, den = string.atoi(nstr), string.atoi(dstr) elif opt == '-t': TIME = string.atoi(arg)
rate = string.atoi(arg) if rate < 2: sys.stderr.write('-r rate must be >= 2\n') sys.exit(2)
def main(): QSIZE = 16 TIME = 5 audio = 0 num, den = 1, 1 opts, args = getopt.getopt(sys.argv[1:], 'aq:r:t:') for opt, arg in opts: if opt == '-a': audio = 1 elif opt == '-q': QSIZE = string.atoi(arg) elif opt == '-r': [nstr, dstr] = string.splitfields(arg, '/') num, den = string.atoi(nstr), string.atoi(dstr) elif opt == '-t': TIME = string.atoi(arg) if args[2:]: sys.stderr.write('usage: Vrec [options] [file [audiofile]]\n') sys.exit(2) if args: filename = args[0] else: filename = 'film.video' if args[1:] and not audio: sys.stderr.write('-a turned on by appearance of 2nd file\n') audio = 1 if audio: if args[1:]: audiofilename = args[1] else: audiofilename = 'film.aiff' else: audiofilename = None gl.foreground() x, y = SV.PAL_XMAX / 4, SV.PAL_YMAX / 4 print x, 'x', y gl.minsize(40, 30) gl.stepunit(8, 6) gl.maxsize(SV.PAL_XMAX, SV.PAL_YMAX) gl.keepaspect(SV.PAL_XMAX, SV.PAL_YMAX) win = gl.winopen(filename) x, y = gl.getsize() print x, 'x', y v = sv.OpenVideo() v.BindGLWindow(win, SV.IN_REPLACE) v.SetSize(x, y) v.BindGLWindow(win, SV.IN_REPLACE) v.SetCaptureFormat(SV.RGB_FRAMES) v.SetCaptureMode(SV.BLOCKING_CAPTURE) v.SetQueueSize(QSIZE) v.InitCapture() if v.GetQueueSize() != QSIZE: QSIZE = v.GetQueueSize() print 'Warning: QSIZE reduced to', QSIZE
62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a/Vrec.py
v.BindGLWindow(win, SV.IN_REPLACE)
def main(): QSIZE = 16 TIME = 5 audio = 0 num, den = 1, 1 opts, args = getopt.getopt(sys.argv[1:], 'aq:r:t:') for opt, arg in opts: if opt == '-a': audio = 1 elif opt == '-q': QSIZE = string.atoi(arg) elif opt == '-r': [nstr, dstr] = string.splitfields(arg, '/') num, den = string.atoi(nstr), string.atoi(dstr) elif opt == '-t': TIME = string.atoi(arg) if args[2:]: sys.stderr.write('usage: Vrec [options] [file [audiofile]]\n') sys.exit(2) if args: filename = args[0] else: filename = 'film.video' if args[1:] and not audio: sys.stderr.write('-a turned on by appearance of 2nd file\n') audio = 1 if audio: if args[1:]: audiofilename = args[1] else: audiofilename = 'film.aiff' else: audiofilename = None gl.foreground() x, y = SV.PAL_XMAX / 4, SV.PAL_YMAX / 4 print x, 'x', y gl.minsize(40, 30) gl.stepunit(8, 6) gl.maxsize(SV.PAL_XMAX, SV.PAL_YMAX) gl.keepaspect(SV.PAL_XMAX, SV.PAL_YMAX) win = gl.winopen(filename) x, y = gl.getsize() print x, 'x', y v = sv.OpenVideo() v.BindGLWindow(win, SV.IN_REPLACE) v.SetSize(x, y) v.BindGLWindow(win, SV.IN_REPLACE) v.SetCaptureFormat(SV.RGB_FRAMES) v.SetCaptureMode(SV.BLOCKING_CAPTURE) v.SetQueueSize(QSIZE) v.InitCapture() if v.GetQueueSize() != QSIZE: QSIZE = v.GetQueueSize() print 'Warning: QSIZE reduced to', QSIZE
62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a/Vrec.py
v.SetCaptureFormat(SV.RGB_FRAMES) v.SetCaptureMode(SV.BLOCKING_CAPTURE) v.SetQueueSize(QSIZE) v.InitCapture() if v.GetQueueSize() != QSIZE: QSIZE = v.GetQueueSize() print 'Warning: QSIZE reduced to', QSIZE
def main(): QSIZE = 16 TIME = 5 audio = 0 num, den = 1, 1 opts, args = getopt.getopt(sys.argv[1:], 'aq:r:t:') for opt, arg in opts: if opt == '-a': audio = 1 elif opt == '-q': QSIZE = string.atoi(arg) elif opt == '-r': [nstr, dstr] = string.splitfields(arg, '/') num, den = string.atoi(nstr), string.atoi(dstr) elif opt == '-t': TIME = string.atoi(arg) if args[2:]: sys.stderr.write('usage: Vrec [options] [file [audiofile]]\n') sys.exit(2) if args: filename = args[0] else: filename = 'film.video' if args[1:] and not audio: sys.stderr.write('-a turned on by appearance of 2nd file\n') audio = 1 if audio: if args[1:]: audiofilename = args[1] else: audiofilename = 'film.aiff' else: audiofilename = None gl.foreground() x, y = SV.PAL_XMAX / 4, SV.PAL_YMAX / 4 print x, 'x', y gl.minsize(40, 30) gl.stepunit(8, 6) gl.maxsize(SV.PAL_XMAX, SV.PAL_YMAX) gl.keepaspect(SV.PAL_XMAX, SV.PAL_YMAX) win = gl.winopen(filename) x, y = gl.getsize() print x, 'x', y v = sv.OpenVideo() v.BindGLWindow(win, SV.IN_REPLACE) v.SetSize(x, y) v.BindGLWindow(win, SV.IN_REPLACE) v.SetCaptureFormat(SV.RGB_FRAMES) v.SetCaptureMode(SV.BLOCKING_CAPTURE) v.SetQueueSize(QSIZE) v.InitCapture() if v.GetQueueSize() != QSIZE: QSIZE = v.GetQueueSize() print 'Warning: QSIZE reduced to', QSIZE
62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a/Vrec.py
recorded = 0
def main(): QSIZE = 16 TIME = 5 audio = 0 num, den = 1, 1 opts, args = getopt.getopt(sys.argv[1:], 'aq:r:t:') for opt, arg in opts: if opt == '-a': audio = 1 elif opt == '-q': QSIZE = string.atoi(arg) elif opt == '-r': [nstr, dstr] = string.splitfields(arg, '/') num, den = string.atoi(nstr), string.atoi(dstr) elif opt == '-t': TIME = string.atoi(arg) if args[2:]: sys.stderr.write('usage: Vrec [options] [file [audiofile]]\n') sys.exit(2) if args: filename = args[0] else: filename = 'film.video' if args[1:] and not audio: sys.stderr.write('-a turned on by appearance of 2nd file\n') audio = 1 if audio: if args[1:]: audiofilename = args[1] else: audiofilename = 'film.aiff' else: audiofilename = None gl.foreground() x, y = SV.PAL_XMAX / 4, SV.PAL_YMAX / 4 print x, 'x', y gl.minsize(40, 30) gl.stepunit(8, 6) gl.maxsize(SV.PAL_XMAX, SV.PAL_YMAX) gl.keepaspect(SV.PAL_XMAX, SV.PAL_YMAX) win = gl.winopen(filename) x, y = gl.getsize() print x, 'x', y v = sv.OpenVideo() v.BindGLWindow(win, SV.IN_REPLACE) v.SetSize(x, y) v.BindGLWindow(win, SV.IN_REPLACE) v.SetCaptureFormat(SV.RGB_FRAMES) v.SetCaptureMode(SV.BLOCKING_CAPTURE) v.SetQueueSize(QSIZE) v.InitCapture() if v.GetQueueSize() != QSIZE: QSIZE = v.GetQueueSize() print 'Warning: QSIZE reduced to', QSIZE
62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a/Vrec.py
if recorded: gl.ringbell() continue gl.prefsize(x, y) gl.winconstraints() record(v, filename, audiofilename) recorded = 1 print 'Wait until "Done writing" is printed!'
info = format, x, y, qsize, rate record(v, info, filename, audiofilename)
def main(): QSIZE = 16 TIME = 5 audio = 0 num, den = 1, 1 opts, args = getopt.getopt(sys.argv[1:], 'aq:r:t:') for opt, arg in opts: if opt == '-a': audio = 1 elif opt == '-q': QSIZE = string.atoi(arg) elif opt == '-r': [nstr, dstr] = string.splitfields(arg, '/') num, den = string.atoi(nstr), string.atoi(dstr) elif opt == '-t': TIME = string.atoi(arg) if args[2:]: sys.stderr.write('usage: Vrec [options] [file [audiofile]]\n') sys.exit(2) if args: filename = args[0] else: filename = 'film.video' if args[1:] and not audio: sys.stderr.write('-a turned on by appearance of 2nd file\n') audio = 1 if audio: if args[1:]: audiofilename = args[1] else: audiofilename = 'film.aiff' else: audiofilename = None gl.foreground() x, y = SV.PAL_XMAX / 4, SV.PAL_YMAX / 4 print x, 'x', y gl.minsize(40, 30) gl.stepunit(8, 6) gl.maxsize(SV.PAL_XMAX, SV.PAL_YMAX) gl.keepaspect(SV.PAL_XMAX, SV.PAL_YMAX) win = gl.winopen(filename) x, y = gl.getsize() print x, 'x', y v = sv.OpenVideo() v.BindGLWindow(win, SV.IN_REPLACE) v.SetSize(x, y) v.BindGLWindow(win, SV.IN_REPLACE) v.SetCaptureFormat(SV.RGB_FRAMES) v.SetCaptureMode(SV.BLOCKING_CAPTURE) v.SetQueueSize(QSIZE) v.InitCapture() if v.GetQueueSize() != QSIZE: QSIZE = v.GetQueueSize() print 'Warning: QSIZE reduced to', QSIZE
62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a/Vrec.py
if not recorded: x, y = gl.getsize() print x, 'x', y v.SetSize(x, y) v.BindGLWindow(win, SV.IN_REPLACE)
x, y = gl.getsize() print x, 'x', y v.SetSize(x, y) v.BindGLWindow(win, SV.IN_REPLACE)
def main(): QSIZE = 16 TIME = 5 audio = 0 num, den = 1, 1 opts, args = getopt.getopt(sys.argv[1:], 'aq:r:t:') for opt, arg in opts: if opt == '-a': audio = 1 elif opt == '-q': QSIZE = string.atoi(arg) elif opt == '-r': [nstr, dstr] = string.splitfields(arg, '/') num, den = string.atoi(nstr), string.atoi(dstr) elif opt == '-t': TIME = string.atoi(arg) if args[2:]: sys.stderr.write('usage: Vrec [options] [file [audiofile]]\n') sys.exit(2) if args: filename = args[0] else: filename = 'film.video' if args[1:] and not audio: sys.stderr.write('-a turned on by appearance of 2nd file\n') audio = 1 if audio: if args[1:]: audiofilename = args[1] else: audiofilename = 'film.aiff' else: audiofilename = None gl.foreground() x, y = SV.PAL_XMAX / 4, SV.PAL_YMAX / 4 print x, 'x', y gl.minsize(40, 30) gl.stepunit(8, 6) gl.maxsize(SV.PAL_XMAX, SV.PAL_YMAX) gl.keepaspect(SV.PAL_XMAX, SV.PAL_YMAX) win = gl.winopen(filename) x, y = gl.getsize() print x, 'x', y v = sv.OpenVideo() v.BindGLWindow(win, SV.IN_REPLACE) v.SetSize(x, y) v.BindGLWindow(win, SV.IN_REPLACE) v.SetCaptureFormat(SV.RGB_FRAMES) v.SetCaptureMode(SV.BLOCKING_CAPTURE) v.SetQueueSize(QSIZE) v.InitCapture() if v.GetQueueSize() != QSIZE: QSIZE = v.GetQueueSize() print 'Warning: QSIZE reduced to', QSIZE
62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a/Vrec.py
if not recorded: posix._exit(0) v.EndCapture()
def main(): QSIZE = 16 TIME = 5 audio = 0 num, den = 1, 1 opts, args = getopt.getopt(sys.argv[1:], 'aq:r:t:') for opt, arg in opts: if opt == '-a': audio = 1 elif opt == '-q': QSIZE = string.atoi(arg) elif opt == '-r': [nstr, dstr] = string.splitfields(arg, '/') num, den = string.atoi(nstr), string.atoi(dstr) elif opt == '-t': TIME = string.atoi(arg) if args[2:]: sys.stderr.write('usage: Vrec [options] [file [audiofile]]\n') sys.exit(2) if args: filename = args[0] else: filename = 'film.video' if args[1:] and not audio: sys.stderr.write('-a turned on by appearance of 2nd file\n') audio = 1 if audio: if args[1:]: audiofilename = args[1] else: audiofilename = 'film.aiff' else: audiofilename = None gl.foreground() x, y = SV.PAL_XMAX / 4, SV.PAL_YMAX / 4 print x, 'x', y gl.minsize(40, 30) gl.stepunit(8, 6) gl.maxsize(SV.PAL_XMAX, SV.PAL_YMAX) gl.keepaspect(SV.PAL_XMAX, SV.PAL_YMAX) win = gl.winopen(filename) x, y = gl.getsize() print x, 'x', y v = sv.OpenVideo() v.BindGLWindow(win, SV.IN_REPLACE) v.SetSize(x, y) v.BindGLWindow(win, SV.IN_REPLACE) v.SetCaptureFormat(SV.RGB_FRAMES) v.SetCaptureMode(SV.BLOCKING_CAPTURE) v.SetQueueSize(QSIZE) v.InitCapture() if v.GetQueueSize() != QSIZE: QSIZE = v.GetQueueSize() print 'Warning: QSIZE reduced to', QSIZE
62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a/Vrec.py
def record(v, filename, audiofilename):
def record(v, info, filename, audiofilename):
def record(v, filename, audiofilename): import thread x, y = gl.getsize() vout = VFile.VoutFile().init(filename) vout.format = 'rgb8' vout.width = x vout.height = y vout.writeheader() buffer = [] thread.start_new_thread(saveframes, (vout, buffer)) if audiofilename: initaudio(audiofilename, buffer) gl.wintitle('(rec) ' + filename) v.StartCapture() t0 = time.millitimer() while not gl.qtest(): if v.GetCaptured() > 2: t = time.millitimer() - t0 cd, st = v.GetCaptureData() data = cd.interleave(x, y) cd.UnlockCaptureData() buffer.append(data, t) else: time.millisleep(10) v.StopCapture() while v.GetCaptured() > 0: t = time.millitimer() - t0 cd, st = v.GetCaptureData() data = cd.interleave(x, y) cd.UnlockCaptureData() buffer.append(data, t) buffer.append(None) # Sentinel gl.wintitle('(done) ' + filename)
62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a/Vrec.py
x, y = gl.getsize()
format, x, y, qsize, rate = info fps = 59.64 tpf = 1000.0 / fps
def record(v, filename, audiofilename): import thread x, y = gl.getsize() vout = VFile.VoutFile().init(filename) vout.format = 'rgb8' vout.width = x vout.height = y vout.writeheader() buffer = [] thread.start_new_thread(saveframes, (vout, buffer)) if audiofilename: initaudio(audiofilename, buffer) gl.wintitle('(rec) ' + filename) v.StartCapture() t0 = time.millitimer() while not gl.qtest(): if v.GetCaptured() > 2: t = time.millitimer() - t0 cd, st = v.GetCaptureData() data = cd.interleave(x, y) cd.UnlockCaptureData() buffer.append(data, t) else: time.millisleep(10) v.StopCapture() while v.GetCaptured() > 0: t = time.millitimer() - t0 cd, st = v.GetCaptureData() data = cd.interleave(x, y) cd.UnlockCaptureData() buffer.append(data, t) buffer.append(None) # Sentinel gl.wintitle('(done) ' + filename)
62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a/Vrec.py
buffer = [] thread.start_new_thread(saveframes, (vout, buffer))
MAXSIZE = 20 import Queue queue = Queue.Queue().init(MAXSIZE) done = thread.allocate_lock() done.acquire_lock() thread.start_new_thread(saveframes, (vout, queue, done))
def record(v, filename, audiofilename): import thread x, y = gl.getsize() vout = VFile.VoutFile().init(filename) vout.format = 'rgb8' vout.width = x vout.height = y vout.writeheader() buffer = [] thread.start_new_thread(saveframes, (vout, buffer)) if audiofilename: initaudio(audiofilename, buffer) gl.wintitle('(rec) ' + filename) v.StartCapture() t0 = time.millitimer() while not gl.qtest(): if v.GetCaptured() > 2: t = time.millitimer() - t0 cd, st = v.GetCaptureData() data = cd.interleave(x, y) cd.UnlockCaptureData() buffer.append(data, t) else: time.millisleep(10) v.StopCapture() while v.GetCaptured() > 0: t = time.millitimer() - t0 cd, st = v.GetCaptureData() data = cd.interleave(x, y) cd.UnlockCaptureData() buffer.append(data, t) buffer.append(None) # Sentinel gl.wintitle('(done) ' + filename)
62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a/Vrec.py
initaudio(audiofilename, buffer)
audiodone = thread.allocate_lock() audiodone.acquire_lock() audiostop = [] initaudio(audiofilename, audiostop, audiodone)
def record(v, filename, audiofilename): import thread x, y = gl.getsize() vout = VFile.VoutFile().init(filename) vout.format = 'rgb8' vout.width = x vout.height = y vout.writeheader() buffer = [] thread.start_new_thread(saveframes, (vout, buffer)) if audiofilename: initaudio(audiofilename, buffer) gl.wintitle('(rec) ' + filename) v.StartCapture() t0 = time.millitimer() while not gl.qtest(): if v.GetCaptured() > 2: t = time.millitimer() - t0 cd, st = v.GetCaptureData() data = cd.interleave(x, y) cd.UnlockCaptureData() buffer.append(data, t) else: time.millisleep(10) v.StopCapture() while v.GetCaptured() > 0: t = time.millitimer() - t0 cd, st = v.GetCaptureData() data = cd.interleave(x, y) cd.UnlockCaptureData() buffer.append(data, t) buffer.append(None) # Sentinel gl.wintitle('(done) ' + filename)
62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a/Vrec.py
v.StartCapture()
lastid = 0
def record(v, filename, audiofilename): import thread x, y = gl.getsize() vout = VFile.VoutFile().init(filename) vout.format = 'rgb8' vout.width = x vout.height = y vout.writeheader() buffer = [] thread.start_new_thread(saveframes, (vout, buffer)) if audiofilename: initaudio(audiofilename, buffer) gl.wintitle('(rec) ' + filename) v.StartCapture() t0 = time.millitimer() while not gl.qtest(): if v.GetCaptured() > 2: t = time.millitimer() - t0 cd, st = v.GetCaptureData() data = cd.interleave(x, y) cd.UnlockCaptureData() buffer.append(data, t) else: time.millisleep(10) v.StopCapture() while v.GetCaptured() > 0: t = time.millitimer() - t0 cd, st = v.GetCaptureData() data = cd.interleave(x, y) cd.UnlockCaptureData() buffer.append(data, t) buffer.append(None) # Sentinel gl.wintitle('(done) ' + filename)
62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a/Vrec.py
if v.GetCaptured() > 2: t = time.millitimer() - t0 cd, st = v.GetCaptureData() data = cd.interleave(x, y) cd.UnlockCaptureData() buffer.append(data, t) else: time.millisleep(10) v.StopCapture() while v.GetCaptured() > 0: t = time.millitimer() - t0 cd, st = v.GetCaptureData() data = cd.interleave(x, y)
try: cd, id = v.GetCaptureData() except RuntimeError: time.millisleep(10) continue id = id + 2*rate lastid = id data = cd.InterleaveFields(1)
def record(v, filename, audiofilename): import thread x, y = gl.getsize() vout = VFile.VoutFile().init(filename) vout.format = 'rgb8' vout.width = x vout.height = y vout.writeheader() buffer = [] thread.start_new_thread(saveframes, (vout, buffer)) if audiofilename: initaudio(audiofilename, buffer) gl.wintitle('(rec) ' + filename) v.StartCapture() t0 = time.millitimer() while not gl.qtest(): if v.GetCaptured() > 2: t = time.millitimer() - t0 cd, st = v.GetCaptureData() data = cd.interleave(x, y) cd.UnlockCaptureData() buffer.append(data, t) else: time.millisleep(10) v.StopCapture() while v.GetCaptured() > 0: t = time.millitimer() - t0 cd, st = v.GetCaptureData() data = cd.interleave(x, y) cd.UnlockCaptureData() buffer.append(data, t) buffer.append(None) # Sentinel gl.wintitle('(done) ' + filename)
62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a/Vrec.py
buffer.append(data, t) buffer.append(None)
queue.put(data, int(id*tpf)) t1 = time.millitimer() gl.wintitle('(busy) ' + filename) print lastid, 'fields in', t1-t0, 'msec', print '--', 0.1 * int(lastid * 10000.0 / (t1-t0)), 'fields/sec' if audiofilename: audiostop.append(None) audiodone.acquire_lock() v.EndContinuousCapture() queue.put(None) done.acquire_lock()
def record(v, filename, audiofilename): import thread x, y = gl.getsize() vout = VFile.VoutFile().init(filename) vout.format = 'rgb8' vout.width = x vout.height = y vout.writeheader() buffer = [] thread.start_new_thread(saveframes, (vout, buffer)) if audiofilename: initaudio(audiofilename, buffer) gl.wintitle('(rec) ' + filename) v.StartCapture() t0 = time.millitimer() while not gl.qtest(): if v.GetCaptured() > 2: t = time.millitimer() - t0 cd, st = v.GetCaptureData() data = cd.interleave(x, y) cd.UnlockCaptureData() buffer.append(data, t) else: time.millisleep(10) v.StopCapture() while v.GetCaptured() > 0: t = time.millitimer() - t0 cd, st = v.GetCaptureData() data = cd.interleave(x, y) cd.UnlockCaptureData() buffer.append(data, t) buffer.append(None) # Sentinel gl.wintitle('(done) ' + filename)
62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a/Vrec.py
def saveframes(vout, buffer):
def saveframes(vout, queue, done):
def saveframes(vout, buffer): while 1: if not buffer: time.millisleep(10) else: x = buffer[0] if not x: break del buffer[0] data, t = x vout.writeframe(t, data, None) del data sys.stderr.write('Done writing\n') vout.close()
62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a/Vrec.py
if not buffer: time.millisleep(10) else: x = buffer[0] if not x: break del buffer[0] data, t = x vout.writeframe(t, data, None) del data sys.stderr.write('Done writing\n')
x = queue.get() if not x: break data, t = x vout.writeframe(t, data, None) del data sys.stderr.write('Done writing video\n')
def saveframes(vout, buffer): while 1: if not buffer: time.millisleep(10) else: x = buffer[0] if not x: break del buffer[0] data, t = x vout.writeframe(t, data, None) del data sys.stderr.write('Done writing\n') vout.close()
62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a/Vrec.py
AQSIZE = 8000 def initaudio(filename, buffer):
AQSIZE = 8000 def initaudio(filename, stop, done):
def saveframes(vout, buffer): while 1: if not buffer: time.millisleep(10) else: x = buffer[0] if not x: break del buffer[0] data, t = x vout.writeframe(t, data, None) del data sys.stderr.write('Done writing\n') vout.close()
62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a/Vrec.py
thread.start_new_thread(audiorecord, (afile, aport, buffer))
thread.start_new_thread(audiorecord, (afile, aport, stop, done))
def initaudio(filename, buffer): import thread, aiff afile = aiff.Aiff().init(filename, 'w') afile.nchannels = AL.MONO afile.sampwidth = AL.SAMPLE_8 params = [AL.INPUT_RATE, 0] al.getparams(AL.DEFAULT_DEVICE, params) print 'audio sampling rate =', params[1] afile.samprate = params[1] c = al.newconfig() c.setchannels(AL.MONO) c.setqueuesize(AQSIZE) c.setwidth(AL.SAMPLE_8) aport = al.openport(filename, 'r', c) thread.start_new_thread(audiorecord, (afile, aport, buffer))
62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a/Vrec.py
def audiorecord(afile, aport, buffer): while buffer[-1:] <> [None]:
def audiorecord(afile, aport, stop, done): while not stop:
def audiorecord(afile, aport, buffer): while buffer[-1:] <> [None]: data = aport.readsamps(AQSIZE/2)
62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/62f6bc8e55ef2d0e226b1c3ad7b9aca58407ab7a/Vrec.py
z = zipfile.ZipFile (base_dir + ".zip", "wb", compression=zipfile.ZIP_DEFLATED)
z = zipfile.ZipFile (base_dir + ".zip", "wb", compression=zipfile.ZIP_DEFLATED)
def make_zipfile (self, base_dir):
9f200cbaa607675014d0aa297b11d13f5c4709a7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9f200cbaa607675014d0aa297b11d13f5c4709a7/dist.py
sys.path.append('/ufs/guido/src/video')
sys.path.append('/ufs/jack/src/av/video')
def help(): print 'Usage: video2rgb [options] [file] ...' print print 'Options:' print '-q : quiet, no informative messages' print '-m : create monochrome (greyscale) image files' print '-f prefix : create image files with names "prefix0000.rgb"' print 'file ... : file(s) to convert; default film.video'
c82cfc86df16f9f6e72654f0b8912c78e4b0eada /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c82cfc86df16f9f6e72654f0b8912c78e4b0eada/video2rgb.py
start = min(start, len(lines) - context)
start = max(0, min(start, len(lines) - context))
def getframeinfo(frame, context=1): """Get information about a frame or traceback object. A tuple of five things is returned: the filename, the line number of the current line, the function name, a list of lines of context from the source code, and the index of the current line within that list. The optional second argument specifies the number of lines of context to return, which are centered around the current line.""" if istraceback(frame): lineno = frame.tb_lineno frame = frame.tb_frame else: lineno = frame.f_lineno if not isframe(frame): raise TypeError('arg is not a frame or traceback object') filename = getsourcefile(frame) or getfile(frame) if context > 0: start = lineno - 1 - context//2 try: lines, lnum = findsource(frame) except IOError: lines = index = None else: start = max(start, 1) start = min(start, len(lines) - context) lines = lines[start:start+context] index = lineno - 1 - start else: lines = index = None return (filename, lineno, frame.f_code.co_name, lines, index)
a050171ee9e44697260cd5415310777dadb5555e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a050171ee9e44697260cd5415310777dadb5555e/inspect.py
print "Can't copy %s to %s: %s" % (`srcname`, `dstname`, str(why))
errors.append((srcname, dstname, why)) if errors: raise Error, errors
def copytree(src, dst, symlinks=0): """Recursively copy a directory tree using copy2(). The destination directory must not already exist. Error are reported to standard output. If the optional symlinks flag is true, symbolic links in the source tree result in symbolic links in the destination tree; if it is false, the contents of the files pointed to by symbolic links are copied. XXX Consider this example code rather than the ultimate tool. """ names = os.listdir(src) os.mkdir(dst) for name in names: srcname = os.path.join(src, name) dstname = os.path.join(dst, name) try: if symlinks and os.path.islink(srcname): linkto = os.readlink(srcname) os.symlink(linkto, dstname) elif os.path.isdir(srcname): copytree(srcname, dstname, symlinks) else: copy2(srcname, dstname) # XXX What about devices, sockets etc.? except (IOError, os.error), why: print "Can't copy %s to %s: %s" % (`srcname`, `dstname`, str(why))
e9ce0b0fea16453cb8d75ecac02669998cc7ff36 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e9ce0b0fea16453cb8d75ecac02669998cc7ff36/shutil.py
return '\n'.join(output)
return '\n'.join(output) + '\n'
def script_from_examples(s): r"""Extract script from text with examples. Converts text with examples to a Python script. Example input is converted to regular code. Example output and all other words are converted to comments: >>> text = ''' ... Here are examples of simple math. ... ... Python has super accurate integer addition ... ... >>> 2 + 2 ... 5 ... ... And very friendly error messages: ... ... >>> 1/0 ... To Infinity ... And ... Beyond ... ... You can use logic if you want: ... ... >>> if 0: ... ... blah ... ... blah ... ... ... ... Ho hum ... ''' >>> print script_from_examples(text) # Here are examples of simple math. # # Python has super accurate integer addition # 2 + 2 # Expected: ## 5 # # And very friendly error messages: # 1/0 # Expected: ## To Infinity ## And ## Beyond # # You can use logic if you want: # if 0: blah blah # # Ho hum """ output = [] for piece in DocTestParser().parse(s): if isinstance(piece, Example): # Add the example's source code (strip trailing NL) output.append(piece.source[:-1]) # Add the expected output: want = piece.want if want: output.append('# Expected:') output += ['## '+l for l in want.split('\n')[:-1]] else: # Add non-example text. output += [_comment_line(l) for l in piece.split('\n')[:-1]] # Trim junk on both ends. while output and output[-1] == '#': output.pop() while output and output[0] == '#': output.pop(0) # Combine the output, and return it. return '\n'.join(output)
1f149642c9940662f45004a0bf5f5b05034aa67b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1f149642c9940662f45004a0bf5f5b05034aa67b/doctest.py
if self.license: self.licence = 1
def parse_command_line (self, args): """Parse the setup script's command line: set any Distribution attributes tied to command-line options, create all command objects, and set their options from the command-line. 'args' must be a list of command-line arguments, most likely 'sys.argv[1:]' (see the 'setup()' function). This list is first processed for "global options" -- options that set attributes of the Distribution instance. Then, it is alternately scanned for Distutils command and options for that command. Each new command terminates the options for the previous command. The allowed options for a command are determined by the 'options' attribute of the command object -- thus, we instantiate (and cache) every command object here, in order to access its 'options' attribute. Any error in that 'options' attribute raises DistutilsGetoptError; any error on the command-line raises DistutilsArgError. If no Distutils commands were found on the command line, raises DistutilsArgError. Return true if command-line successfully parsed and we should carry on with executing commands; false if no errors but we shouldn't execute commands (currently, this only happens if user asks for help)."""
58ec6ede20d0b632f8325e1363aaa6e445ad61ef /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/58ec6ede20d0b632f8325e1363aaa6e445ad61ef/dist.py
assert sCursor.set('red')
tmp = sCursor.set('red') assert tmp
def test01_join(self): if verbose: print '\n', '-=' * 30 print "Running %s.test01_join..." % \ self.__class__.__name__
e676c5ef3ed8a34431f1c30cf91ef67ab70c6d4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e676c5ef3ed8a34431f1c30cf91ef67ab70c6d4e/test_join.py
if _active:
if _active is not None:
def __del__(self): # In case the child hasn't been waited on, check if it's done. self.poll(_deadstate=sys.maxint) if self.sts < 0: if _active: # Child is still running, keep us alive until we can wait on it. _active.append(self)
4085f1499c55b38343b86ced4b67b7382ffbecc3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4085f1499c55b38343b86ced4b67b7382ffbecc3/popen2.py
currentThread()
def wait(self, timeout=None): currentThread() # for side-effect assert self._is_owned(), "wait() of un-acquire()d lock" waiter = _allocate_lock() waiter.acquire() self.__waiters.append(waiter) saved_state = self._release_save() try: # restore state no matter what (e.g., KeyboardInterrupt) if timeout is None: waiter.acquire() if __debug__: self._note("%s.wait(): got it", self) else: # Balancing act: We can't afford a pure busy loop, so we # have to sleep; but if we sleep the whole timeout time, # we'll be unresponsive. The scheme here sleeps very # little at first, longer as time goes on, but never longer # than 20 times per second (or the timeout time remaining). endtime = _time() + timeout delay = 0.0005 # 500 us -> initial delay of 1 ms while True: gotit = waiter.acquire(0) if gotit: break remaining = endtime - _time() if remaining <= 0: break delay = min(delay * 2, remaining, .05) _sleep(delay) if not gotit: if __debug__: self._note("%s.wait(%s): timed out", self, timeout) try: self.__waiters.remove(waiter) except ValueError: pass else: if __debug__: self._note("%s.wait(%s): got it", self, timeout) finally: self._acquire_restore(saved_state)
4b6b7f151501eaee0af46220553c78607474e420 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4b6b7f151501eaee0af46220553c78607474e420/threading.py
currentThread()
def notify(self, n=1): currentThread() # for side-effect assert self._is_owned(), "notify() of un-acquire()d lock" __waiters = self.__waiters waiters = __waiters[:n] if not waiters: if __debug__: self._note("%s.notify(): no waiters", self) return self._note("%s.notify(): notifying %d waiter%s", self, n, n!=1 and "s" or "") for waiter in waiters: waiter.release() try: __waiters.remove(waiter) except ValueError: pass
4b6b7f151501eaee0af46220553c78607474e420 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4b6b7f151501eaee0af46220553c78607474e420/threading.py
matches = (['class', name], ['class', name + ':'])
pat = re.compile(r'^\s*class\s*' + name + r'\b')
def findsource(object): """Return the entire source file and starting line number for an object. The argument may be a module, class, method, function, traceback, frame, or code object. The source code is returned as a list of all the lines in the file and the line number indexes a line in that list. An IOError is raised if the source code cannot be retrieved.""" try: file = open(getsourcefile(object)) except (TypeError, IOError): raise IOError, 'could not get source code' lines = file.readlines() file.close() if ismodule(object): return lines, 0 if isclass(object): name = object.__name__ matches = (['class', name], ['class', name + ':']) for i in range(len(lines)): if string.split(lines[i])[:2] in matches: return lines, i else: raise IOError, 'could not find class definition' if ismethod(object): object = object.im_func if isfunction(object): object = object.func_code if istraceback(object): object = object.tb_frame if isframe(object): object = object.f_code if iscode(object): if not hasattr(object, 'co_firstlineno'): raise IOError, 'could not find function definition' lnum = object.co_firstlineno - 1 while lnum > 0: if string.split(lines[lnum])[:1] == ['def']: break lnum = lnum - 1 return lines, lnum
a6e59719ec611a012227719e7d3ed1730601cca9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a6e59719ec611a012227719e7d3ed1730601cca9/inspect.py
if string.split(lines[i])[:2] in matches: return lines, i
if pat.match(lines[i]): return lines, i
def findsource(object): """Return the entire source file and starting line number for an object. The argument may be a module, class, method, function, traceback, frame, or code object. The source code is returned as a list of all the lines in the file and the line number indexes a line in that list. An IOError is raised if the source code cannot be retrieved.""" try: file = open(getsourcefile(object)) except (TypeError, IOError): raise IOError, 'could not get source code' lines = file.readlines() file.close() if ismodule(object): return lines, 0 if isclass(object): name = object.__name__ matches = (['class', name], ['class', name + ':']) for i in range(len(lines)): if string.split(lines[i])[:2] in matches: return lines, i else: raise IOError, 'could not find class definition' if ismethod(object): object = object.im_func if isfunction(object): object = object.func_code if istraceback(object): object = object.tb_frame if isframe(object): object = object.f_code if iscode(object): if not hasattr(object, 'co_firstlineno'): raise IOError, 'could not find function definition' lnum = object.co_firstlineno - 1 while lnum > 0: if string.split(lines[lnum])[:1] == ['def']: break lnum = lnum - 1 return lines, lnum
a6e59719ec611a012227719e7d3ed1730601cca9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a6e59719ec611a012227719e7d3ed1730601cca9/inspect.py
if string.split(lines[lnum])[:1] == ['def']: break
if pat.match(lines[lnum]): break
def findsource(object): """Return the entire source file and starting line number for an object. The argument may be a module, class, method, function, traceback, frame, or code object. The source code is returned as a list of all the lines in the file and the line number indexes a line in that list. An IOError is raised if the source code cannot be retrieved.""" try: file = open(getsourcefile(object)) except (TypeError, IOError): raise IOError, 'could not get source code' lines = file.readlines() file.close() if ismodule(object): return lines, 0 if isclass(object): name = object.__name__ matches = (['class', name], ['class', name + ':']) for i in range(len(lines)): if string.split(lines[i])[:2] in matches: return lines, i else: raise IOError, 'could not find class definition' if ismethod(object): object = object.im_func if isfunction(object): object = object.func_code if istraceback(object): object = object.tb_frame if isframe(object): object = object.f_code if iscode(object): if not hasattr(object, 'co_firstlineno'): raise IOError, 'could not find function definition' lnum = object.co_firstlineno - 1 while lnum > 0: if string.split(lines[lnum])[:1] == ['def']: break lnum = lnum - 1 return lines, lnum
a6e59719ec611a012227719e7d3ed1730601cca9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a6e59719ec611a012227719e7d3ed1730601cca9/inspect.py
elif self.header_encoding is QP:
elif self.body_encoding is QP:
def body_encode(self, s, convert=True): """Body-encode a string and convert it to output_charset.
3d57589f0fe4e682df2961294b5cf23571cab70f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3d57589f0fe4e682df2961294b5cf23571cab70f/Charset.py
if address[0] == '<' and address[-1] == '>' and address != '<>':
if not address: pass elif address[0] == '<' and address[-1] == '>' and address != '<>':
def __getaddr(self, keyword, arg): address = None keylen = len(keyword) if arg[:keylen].upper() == keyword: address = arg[keylen:].strip() if address[0] == '<' and address[-1] == '>' and address != '<>': # Addresses can be in the form <[email protected]> but watch out # for null address, e.g. <> address = address[1:-1] return address
ebf5427bfacae1c0bc497410626cbb3e995dc214 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ebf5427bfacae1c0bc497410626cbb3e995dc214/smtpd.py
Node.debug=open( "debug4.out", "w" )
Node.debug=StringIO()
def __init__( self ): self.childNodes=[] if Node._debug: index=repr( id( self ))+repr( self.__class__ ) Node.allnodes[index]=repr( self.__dict__ ) if Node.debug==None: Node.debug=open( "debug4.out", "w" ) Node.debug.write( "create %s\n"%index )
1e68827c8fa95d10df3c805e5dd8383b19048b18 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1e68827c8fa95d10df3c805e5dd8383b19048b18/minidom.py
if type( attname_or_tuple ) == type( () ):
if type( attname_or_tuple ) == types.TupleType:
def __getitem__( self, attname_or_tuple ): if type( attname_or_tuple ) == type( () ): return self._attrsNS[attname_or_tuple] else: return self._attrs[attname_or_tuple]
1e68827c8fa95d10df3c805e5dd8383b19048b18 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1e68827c8fa95d10df3c805e5dd8383b19048b18/minidom.py
def __setitem__( self, attname ): raise TypeError, "object does not support item assignment"
def __setitem__( self, attname, value ): if type( value ) == types.StringType: node=Attr( attname ) node.value=value else: assert isinstance( value, Attr ) or type( value )==types.StringType node=value old=self._attrs.get( attname, None) if old: old.unlink() self._attrs[node.name]=node self._attrsNS[(node.namespaceURI,node.localName)]=node
def __setitem__( self, attname ): raise TypeError, "object does not support item assignment"
1e68827c8fa95d10df3c805e5dd8383b19048b18 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1e68827c8fa95d10df3c805e5dd8383b19048b18/minidom.py
'sys_prefix': sysconfig.PREFIX, 'sys_exec_prefix': sysconfig.EXEC_PREFIX,
'sys_prefix': prefix, 'prefix': prefix, 'sys_exec_prefix': exec_prefix, 'exec_prefix': exec_prefix,
def finalize_options (self):
9bd3e9b6b260ac249024c426ec62133e05919f10 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9bd3e9b6b260ac249024c426ec62133e05919f10/install.py
verify(L == ['Commented Bar', 'Foo Bar', 'Internationalized Stuff', 'Spacey Bar'],
verify(L == [r'Commented Bar', r'Foo Bar', r'Internationalized Stuff', r'Section\with$weird%characters[' '\t', r'Spacey Bar', ],
def basic(src): print "Testing basic accessors..." cf = ConfigParser.ConfigParser() sio = StringIO.StringIO(src) cf.readfp(sio) L = cf.sections() L.sort() verify(L == ['Commented Bar', 'Foo Bar', 'Internationalized Stuff', 'Spacey Bar'], "unexpected list of section names") # The use of spaces in the section names serves as a regression test for # SourceForge bug #115357. # http://sourceforge.net/bugs/?func=detailbug&group_id=5470&bug_id=115357 verify(cf.get('Foo Bar', 'foo', raw=1) == 'bar') verify(cf.get('Spacey Bar', 'foo', raw=1) == 'bar') verify(cf.get('Commented Bar', 'foo', raw=1) == 'bar') verify('__name__' not in cf.options("Foo Bar"), '__name__ "option" should not be exposed by the API!') # Make sure the right things happen for remove_option(); # added to include check for SourceForge bug #123324: verify(cf.remove_option('Foo Bar', 'foo'), "remove_option() failed to report existance of option") verify(not cf.has_option('Foo Bar', 'foo'), "remove_option() failed to remove option") verify(not cf.remove_option('Foo Bar', 'foo'), "remove_option() failed to report non-existance of option" " that was removed") try: cf.remove_option('No Such Section', 'foo') except ConfigParser.NoSectionError: pass else: raise TestFailed( "remove_option() failed to report non-existance of option" " that never existed")
cc1f951b4c4e100979897655c4b8c12f3334936e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cc1f951b4c4e100979897655c4b8c12f3334936e/test_cfgparser.py
def range(*a): if len(a) == 1: start, stop, step = 0, a[0], 1 elif len(a) == 2: start, stop = a step = 1 elif len(a) == 3: start, stop, step = a else: raise TypeError, 'range() needs 1-3 arguments' return Range(start, stop, step)
def genrange(*a): """Function to implement 'range' as a generator""" start, stop, step = handleargs(a) value = start while value < stop: yield value value += step
def range(*a): if len(a) == 1: start, stop, step = 0, a[0], 1 elif len(a) == 2: start, stop = a step = 1 elif len(a) == 3: start, stop, step = a else: raise TypeError, 'range() needs 1-3 arguments' return Range(start, stop, step)
c2b151c66ee9bc6e686400ee93e65e07d1999888 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c2b151c66ee9bc6e686400ee93e65e07d1999888/Range.py
Done using the old way (pre-iterators; __len__ and __getitem__) to have an object be used by a 'for' loop.
def range(*a): if len(a) == 1: start, stop, step = 0, a[0], 1 elif len(a) == 2: start, stop = a step = 1 elif len(a) == 3: start, stop, step = a else: raise TypeError, 'range() needs 1-3 arguments' return Range(start, stop, step)
c2b151c66ee9bc6e686400ee93e65e07d1999888 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c2b151c66ee9bc6e686400ee93e65e07d1999888/Range.py
class Range:
"""
def range(*a): if len(a) == 1: start, stop, step = 0, a[0], 1 elif len(a) == 2: start, stop = a step = 1 elif len(a) == 3: start, stop, step = a else: raise TypeError, 'range() needs 1-3 arguments' return Range(start, stop, step)
c2b151c66ee9bc6e686400ee93e65e07d1999888 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c2b151c66ee9bc6e686400ee93e65e07d1999888/Range.py
def __init__(self, start, stop, step): if step == 0: raise ValueError, 'range() called with zero step' self.start = start self.stop = stop self.step = step self.len = max(0, int((self.stop - self.start) / self.step))
def __init__(self, *a): """ Initialize start, stop, and step values along with calculating the nubmer of values (what __len__ will return) in the range""" self.start, self.stop, self.step = handleargs(a) self.len = max(0, (self.stop - self.start) // self.step)
def range(*a): if len(a) == 1: start, stop, step = 0, a[0], 1 elif len(a) == 2: start, stop = a step = 1 elif len(a) == 3: start, stop, step = a else: raise TypeError, 'range() needs 1-3 arguments' return Range(start, stop, step)
c2b151c66ee9bc6e686400ee93e65e07d1999888 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c2b151c66ee9bc6e686400ee93e65e07d1999888/Range.py
def __init__(self, start, stop, step): if step == 0: raise ValueError, 'range() called with zero step' self.start = start self.stop = stop self.step = step self.len = max(0, int((self.stop - self.start) / self.step))
c2b151c66ee9bc6e686400ee93e65e07d1999888 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c2b151c66ee9bc6e686400ee93e65e07d1999888/Range.py
def __repr__(self): return 'range(%r, %r, %r)' % (self.start, self.stop, self.step)
c2b151c66ee9bc6e686400ee93e65e07d1999888 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c2b151c66ee9bc6e686400ee93e65e07d1999888/Range.py
def __len__(self): return self.len
c2b151c66ee9bc6e686400ee93e65e07d1999888 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c2b151c66ee9bc6e686400ee93e65e07d1999888/Range.py
if 0 <= i < self.len:
"""implement x[i]""" if 0 <= i <= self.len:
def __getitem__(self, i): if 0 <= i < self.len: return self.start + self.step * i else: raise IndexError, 'range[i] index out of range'
c2b151c66ee9bc6e686400ee93e65e07d1999888 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c2b151c66ee9bc6e686400ee93e65e07d1999888/Range.py
def __getitem__(self, i): if 0 <= i < self.len: return self.start + self.step * i else: raise IndexError, 'range[i] index out of range'
c2b151c66ee9bc6e686400ee93e65e07d1999888 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c2b151c66ee9bc6e686400ee93e65e07d1999888/Range.py
self.plist.CFBundleExecutable = self.name
def preProcess(self): self.plist.CFBundleExecutable = self.name resdir = pathjoin("Contents", "Resources") if self.executable is not None: if self.mainprogram is None: execpath = pathjoin(self.execdir, self.name) else: execpath = pathjoin(resdir, os.path.basename(self.executable)) self.files.append((self.executable, execpath)) # For execve wrapper setexecutable = setExecutableTemplate % os.path.basename(self.executable) else: setexecutable = "" # XXX for locals() call
f7aba23644d76d85815d053964dba90c63d1c811 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f7aba23644d76d85815d053964dba90c63d1c811/bundlebuilder.py
python [options] command
python bundlebuilder.py [options] command
def pathjoin(*args): """Safe wrapper for os.path.join: asserts that all but the first argument are relative paths.""" for seg in args[1:]: assert seg[0] != "/" return os.path.join(*args)
f7aba23644d76d85815d053964dba90c63d1c811 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f7aba23644d76d85815d053964dba90c63d1c811/bundlebuilder.py
def read(self, filenames):
2539451fb9ca2cb0828ee10a91ef1ef688670eb3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2539451fb9ca2cb0828ee10a91ef1ef688670eb3/ConfigParser.py
designed so that you can specifiy a list of potential
designed so that you can specify a list of potential
def read(self, filenames):
2539451fb9ca2cb0828ee10a91ef1ef688670eb3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2539451fb9ca2cb0828ee10a91ef1ef688670eb3/ConfigParser.py
index.append(keys[j], offset + len(buf))
index.append( (keys[j], offset + len(buf)) )
def addname(self, name): # Domain name packing (section 4.1.4) # Add a domain name to the buffer, possibly using pointers. # The case of the first occurrence of a name is preserved. # Redundant dots are ignored. list = [] for label in string.splitfields(name, '.'): if label: if len(label) > 63: raise PackError, 'label too long' list.append(label) keys = [] for i in range(len(list)): key = string.upper(string.joinfields(list[i:], '.')) keys.append(key) if self.index.has_key(key): pointer = self.index[key] break else: i = len(list) pointer = None # Do it into temporaries first so exceptions don't # mess up self.index and self.buf buf = '' offset = len(self.buf) index = [] for j in range(i): label = list[j] n = len(label) if offset + len(buf) < 0x3FFF: index.append(keys[j], offset + len(buf)) else: print 'dnslib.Packer.addname:', print 'warning: pointer too big' buf = buf + (chr(n) + label) if pointer: buf = buf + pack16bit(pointer | 0xC000) else: buf = buf + '\0' self.buf = self.buf + buf for key, value in index: self.index[key] = value
01b3aa4d08085083c5ecc622ade790441083420f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/01b3aa4d08085083c5ecc622ade790441083420f/dnslib.py
self.fail("Error testing host resolution mechanisms. (fqdn: %s, all: %s)" % (fqdn, repr(all_host_names)))
self.fail("Error testing host resolution mechanisms. (fqdn: %s, all: %s)" % (fqhn, repr(all_host_names)))
def testHostnameRes(self): # Testing hostname resolution mechanisms hostname = socket.gethostname() try: ip = socket.gethostbyname(hostname) except socket.error: # Probably name lookup wasn't set up right; skip this test return self.assert_(ip.find('.') >= 0, "Error resolving host to ip.") try: hname, aliases, ipaddrs = socket.gethostbyaddr(ip) except socket.error: # Probably a similar problem as above; skip this test return all_host_names = [hostname, hname] + aliases fqhn = socket.getfqdn() if not fqhn in all_host_names: self.fail("Error testing host resolution mechanisms. (fqdn: %s, all: %s)" % (fqdn, repr(all_host_names)))
04855cc100f2edcb58bac46f7be45e3c770b5d7d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/04855cc100f2edcb58bac46f7be45e3c770b5d7d/test_socket.py
spec_file.append('Source0: %{name}-%{version}.tar.bz2')
spec_file.append('Source0: %{name}-%{unmangled_version}.tar.bz2')
def _make_spec_file(self): """Generate the text of an RPM spec file and return it as a list of strings (one per line). """ # definitions and headers spec_file = [ '%define name ' + self.distribution.get_name(), '%define version ' + self.distribution.get_version().replace('-','_'), '%define release ' + self.release.replace('-','_'), '', 'Summary: ' + self.distribution.get_description(), ]
962e4317bc925d284d960e04ef304586cabaf479 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/962e4317bc925d284d960e04ef304586cabaf479/bdist_rpm.py
spec_file.append('Source0: %{name}-%{version}.tar.gz')
spec_file.append('Source0: %{name}-%{unmangled_version}.tar.gz')
def _make_spec_file(self): """Generate the text of an RPM spec file and return it as a list of strings (one per line). """ # definitions and headers spec_file = [ '%define name ' + self.distribution.get_name(), '%define version ' + self.distribution.get_version().replace('-','_'), '%define release ' + self.release.replace('-','_'), '', 'Summary: ' + self.distribution.get_description(), ]
962e4317bc925d284d960e04ef304586cabaf479 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/962e4317bc925d284d960e04ef304586cabaf479/bdist_rpm.py
('prep', 'prep_script', "%setup"),
('prep', 'prep_script', "%setup -n %{name}-%{unmangled_version}"),
def _make_spec_file(self): """Generate the text of an RPM spec file and return it as a list of strings (one per line). """ # definitions and headers spec_file = [ '%define name ' + self.distribution.get_name(), '%define version ' + self.distribution.get_version().replace('-','_'), '%define release ' + self.release.replace('-','_'), '', 'Summary: ' + self.distribution.get_description(), ]
962e4317bc925d284d960e04ef304586cabaf479 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/962e4317bc925d284d960e04ef304586cabaf479/bdist_rpm.py
def buildappbundle(executable, output=None, copyfunc=None, creator=None, plist=None, nib=None, resources=None): if not output: output = os.path.split(executable)[1] + '.app' if not copyfunc: copyfunc = shutil.copy2 if not creator: creator='????' if not resources: resources = [] if nib: resources = resources + [nib] if not os.path.isdir(output): os.mkdir(output) contents = os.path.join(output, 'Contents') if not os.path.isdir(contents): os.mkdir(contents) macos = os.path.join(contents, 'MacOS') if not os.path.isdir(macos): os.mkdir(macos) shortname = os.path.split(executable)[1] execname = os.path.join(macos, shortname) try: os.remove(execname) except OSError: pass copyfunc(executable, execname) pkginfo = os.path.join(contents, 'PkgInfo') open(pkginfo, 'wb').write('APPL'+creator) if plist: plistdata = open(plist).read() else: if not nib: nibname = "" else: nibname, ext = os.path.splitext(os.path.split(nib)[1]) if ext == '.lproj': files = os.listdir(nib) for f in files: if f[-4:] == '.nib': nibname = os.path.split(f)[1][:-4] break else: nibname = "" if nibname: cocoainfo = """ <key>NSMainNibFile</key> <string>%s</string> <key>NSPrincipalClass</key> <string>NSApplication</string>""" % nibname else: cocoainfo = "" plistdata = \ """<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> <plist version="0.9"> <dict> <key>CFBundleDevelopmentRegion</key> <string>English</string> <key>CFBundleExecutable</key> <string>%s</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleSignature</key> <string>%s</string> <key>CFBundleVersion</key> <string>0.1</string> %s </dict> </plist> """ % (shortname, creator, cocoainfo) infoplist = os.path.join(contents, 'Info.plist') open(infoplist, 'w').write(plistdata) if resources: resdir = os.path.join(contents, 'Resources') if not os.path.isdir(resdir): os.mkdir(resdir) for src in resources: dst = os.path.join(resdir, os.path.split(src)[1]) if os.path.isdir(src): shutil.copytree(src, dst) else: shutil.copy2(src, dst)
def buildappbundle(executable, output=None, copyfunc=None, creator=None, plist=None, nib=None, resources=None): if not output: output = os.path.split(executable)[1] + '.app' if not copyfunc: copyfunc = shutil.copy2 if not creator: creator='????' if not resources: resources = [] if nib: resources = resources + [nib] # # Create the main directory structure # if not os.path.isdir(output): os.mkdir(output) contents = os.path.join(output, 'Contents') if not os.path.isdir(contents): os.mkdir(contents) macos = os.path.join(contents, 'MacOS') if not os.path.isdir(macos): os.mkdir(macos) # # Create the executable # shortname = os.path.split(executable)[1] execname = os.path.join(macos, shortname) try: os.remove(execname) except OSError: pass copyfunc(executable, execname) # # Create the PkgInfo file # pkginfo = os.path.join(contents, 'PkgInfo') open(pkginfo, 'wb').write('APPL'+creator) if plist: # A plist file is specified. Read it. plistdata = open(plist).read() else: # # If we have a main NIB we create the extra Cocoa specific info for the plist file # if not nib: nibname = "" else: nibname, ext = os.path.splitext(os.path.split(nib)[1]) if ext == '.lproj': # Special case: if the main nib is a .lproj we assum a directory # and use the first nib from there files = os.listdir(nib) for f in files: if f[-4:] == '.nib': nibname = os.path.split(f)[1][:-4] break else: nibname = "" if nibname: cocoainfo = """ <key>NSMainNibFile</key> <string>%s</string> <key>NSPrincipalClass</key> <string>NSApplication</string>""" % nibname else: cocoainfo = "" plistdata = \
224405fcfd863017b5b96c37d24251060c5683e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/224405fcfd863017b5b96c37d24251060c5683e5/buildappbundle.py
print "buildappbundle creates an application bundle" print "Usage:" print " buildappbundle [options] executable" print "Options:" print " --output o Output file; default executable with .app appended, short -o" print " --link Symlink the executable (default: copy), short -l" print " --plist file Plist file (default: generate one), short -p" print " --nib file Main nib file or lproj folder for Cocoa program, short -n" print " --resource r Extra resource file to be copied to Resources, short -r" print " --creator c 4-char creator code (default: ????), short -c" print " --help This message, short -?"
print __doc__
def usage(): print "buildappbundle creates an application bundle" print "Usage:" print " buildappbundle [options] executable" print "Options:" print " --output o Output file; default executable with .app appended, short -o" print " --link Symlink the executable (default: copy), short -l" print " --plist file Plist file (default: generate one), short -p" print " --nib file Main nib file or lproj folder for Cocoa program, short -n" print " --resource r Extra resource file to be copied to Resources, short -r" print " --creator c 4-char creator code (default: ????), short -c" print " --help This message, short -?" sys.exit(1)
224405fcfd863017b5b96c37d24251060c5683e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/224405fcfd863017b5b96c37d24251060c5683e5/buildappbundle.py
output=None copyfunc=None creator=None plist=None nib=None resources=[] SHORTOPTS = "o:ln:r:p:c:?" LONGOPTS=("output=", "link", "nib=", "resource=", "plist=", "creator=", "help")
output = None symlink = 0 creator = "????" plist = None nib = None resources = [] verbosity = 0 SHORTOPTS = "o:ln:r:p:c:v?h" LONGOPTS=("output=", "link", "nib=", "resource=", "plist=", "creator=", "help", "verbose")
def main(): output=None copyfunc=None creator=None plist=None nib=None resources=[] SHORTOPTS = "o:ln:r:p:c:?" LONGOPTS=("output=", "link", "nib=", "resource=", "plist=", "creator=", "help") try: options, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS) except getopt.error: usage() if len(args) != 1: usage() for opt, arg in options: if opt in ('-o', '--output'): output = arg elif opt in ('-l', '--link'): copyfunc = os.symlink elif opt in ('-n', '--nib'): nib = arg elif opt in ('-r', '--resource'): resources.append(arg) elif opt in ('-c', '--creator'): creator = arg elif opt in ('-p', '--plist'): plist = arg elif opt in ('-?', '--help'): usage() buildappbundle(args[0], output=output, copyfunc=copyfunc, creator=creator, plist=plist, resources=resources)
224405fcfd863017b5b96c37d24251060c5683e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/224405fcfd863017b5b96c37d24251060c5683e5/buildappbundle.py
copyfunc = os.symlink
symlink = 1
def main(): output=None copyfunc=None creator=None plist=None nib=None resources=[] SHORTOPTS = "o:ln:r:p:c:?" LONGOPTS=("output=", "link", "nib=", "resource=", "plist=", "creator=", "help") try: options, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS) except getopt.error: usage() if len(args) != 1: usage() for opt, arg in options: if opt in ('-o', '--output'): output = arg elif opt in ('-l', '--link'): copyfunc = os.symlink elif opt in ('-n', '--nib'): nib = arg elif opt in ('-r', '--resource'): resources.append(arg) elif opt in ('-c', '--creator'): creator = arg elif opt in ('-p', '--plist'): plist = arg elif opt in ('-?', '--help'): usage() buildappbundle(args[0], output=output, copyfunc=copyfunc, creator=creator, plist=plist, resources=resources)
224405fcfd863017b5b96c37d24251060c5683e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/224405fcfd863017b5b96c37d24251060c5683e5/buildappbundle.py
elif opt in ('-?', '--help'):
elif opt in ('-v', '--verbose'): verbosity += 1 elif opt in ('-?', '-h', '--help'):
def main(): output=None copyfunc=None creator=None plist=None nib=None resources=[] SHORTOPTS = "o:ln:r:p:c:?" LONGOPTS=("output=", "link", "nib=", "resource=", "plist=", "creator=", "help") try: options, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS) except getopt.error: usage() if len(args) != 1: usage() for opt, arg in options: if opt in ('-o', '--output'): output = arg elif opt in ('-l', '--link'): copyfunc = os.symlink elif opt in ('-n', '--nib'): nib = arg elif opt in ('-r', '--resource'): resources.append(arg) elif opt in ('-c', '--creator'): creator = arg elif opt in ('-p', '--plist'): plist = arg elif opt in ('-?', '--help'): usage() buildappbundle(args[0], output=output, copyfunc=copyfunc, creator=creator, plist=plist, resources=resources)
224405fcfd863017b5b96c37d24251060c5683e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/224405fcfd863017b5b96c37d24251060c5683e5/buildappbundle.py
buildappbundle(args[0], output=output, copyfunc=copyfunc, creator=creator, plist=plist, resources=resources)
if output is not None: builddir, bundlename = os.path.split(output) else: builddir = os.curdir bundlename = None if plist is not None: plist = Plist.fromFile(plist) builder = AppBuilder(name=bundlename, executable=executable, builddir=builddir, creator=creator, plist=plist, resources=resources, symlink=symlink, verbosity=verbosity) if nib is not None: resources.append(nib) nibname, ext = os.path.splitext(os.path.basename(nib)) if ext == '.lproj': files = os.listdir(nib) for f in files: if f[-4:] == '.nib': nibname = os.path.split(f)[1][:-4] break else: nibname = "" if nibname: builder.plist.NSMainNibFile = nibname if not hasattr(builder.plist, "NSPrincipalClass"): builder.plist.NSPrincipalClass = "NSApplication" builder.setup() builder.build()
def main(): output=None copyfunc=None creator=None plist=None nib=None resources=[] SHORTOPTS = "o:ln:r:p:c:?" LONGOPTS=("output=", "link", "nib=", "resource=", "plist=", "creator=", "help") try: options, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS) except getopt.error: usage() if len(args) != 1: usage() for opt, arg in options: if opt in ('-o', '--output'): output = arg elif opt in ('-l', '--link'): copyfunc = os.symlink elif opt in ('-n', '--nib'): nib = arg elif opt in ('-r', '--resource'): resources.append(arg) elif opt in ('-c', '--creator'): creator = arg elif opt in ('-p', '--plist'): plist = arg elif opt in ('-?', '--help'): usage() buildappbundle(args[0], output=output, copyfunc=copyfunc, creator=creator, plist=plist, resources=resources)
224405fcfd863017b5b96c37d24251060c5683e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/224405fcfd863017b5b96c37d24251060c5683e5/buildappbundle.py
def main(): output=None copyfunc=None creator=None plist=None nib=None resources=[] SHORTOPTS = "o:ln:r:p:c:?" LONGOPTS=("output=", "link", "nib=", "resource=", "plist=", "creator=", "help") try: options, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS) except getopt.error: usage() if len(args) != 1: usage() for opt, arg in options: if opt in ('-o', '--output'): output = arg elif opt in ('-l', '--link'): copyfunc = os.symlink elif opt in ('-n', '--nib'): nib = arg elif opt in ('-r', '--resource'): resources.append(arg) elif opt in ('-c', '--creator'): creator = arg elif opt in ('-p', '--plist'): plist = arg elif opt in ('-?', '--help'): usage() buildappbundle(args[0], output=output, copyfunc=copyfunc, creator=creator, plist=plist, resources=resources)
224405fcfd863017b5b96c37d24251060c5683e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/224405fcfd863017b5b96c37d24251060c5683e5/buildappbundle.py
codestring = open(pathname, 'r').read()
codestring = open(pathname, 'rU').read()
def _compile(pathname, timestamp): """Compile (and cache) a Python source file. The file specified by <pathname> is compiled to a code object and returned. Presuming the appropriate privileges exist, the bytecodes will be saved back to the filesystem for future imports. The source file's modification timestamp must be provided as a Long value. """ codestring = open(pathname, 'r').read() if codestring and codestring[-1] != '\n': codestring = codestring + '\n' code = __builtin__.compile(codestring, pathname, 'exec') # try to cache the compiled code try: f = open(pathname + _suffix_char, 'wb') except IOError: pass else: f.write('\0\0\0\0') f.write(struct.pack('<I', timestamp)) marshal.dump(code, f) f.flush() f.seek(0, 0) f.write(imp.get_magic()) f.close() return code
13f99d7097c23231c18049904b651956e0fd771c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/13f99d7097c23231c18049904b651956e0fd771c/imputil.py
if audioop.lin2ulaw(data[0], 1) != '\377\347\333' or \ audioop.lin2ulaw(data[1], 2) != '\377\377\377' or \ audioop.lin2ulaw(data[2], 4) != '\377\377\377':
if audioop.lin2ulaw(data[0], 1) != '\xff\xe7\xdb' or \ audioop.lin2ulaw(data[1], 2) != '\xff\xff\xff' or \ audioop.lin2ulaw(data[2], 4) != '\xff\xff\xff':
def testlin2ulaw(data): if verbose: print 'lin2ulaw' if audioop.lin2ulaw(data[0], 1) != '\377\347\333' or \ audioop.lin2ulaw(data[1], 2) != '\377\377\377' or \ audioop.lin2ulaw(data[2], 4) != '\377\377\377': return 0 return 1
fa86907aae0178ae93df4e7df3629df748f462b5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/fa86907aae0178ae93df4e7df3629df748f462b5/test_audioop.py
mode = (os.stat(file)[ST_MODE]) | 0111
mode = ((os.stat(file)[ST_MODE]) | 0111) & 07777
def run (self): if not self.skip_build: self.run_command('build_scripts') self.outfiles = self.copy_tree(self.build_dir, self.install_dir) if os.name == 'posix': # Set the executable bits (owner, group, and world) on # all the scripts we just installed. for file in self.get_outputs(): if self.dry_run: self.announce("changing mode of %s" % file) else: mode = (os.stat(file)[ST_MODE]) | 0111 self.announce("changing mode of %s to %o" % (file, mode)) os.chmod(file, mode)
b24231e088ad8c0b99ded3294dc0b1f4c671d38b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b24231e088ad8c0b99ded3294dc0b1f4c671d38b/install_scripts.py
os.chmod(p, stat.S_IMODE(st.st_mode) | stat.S_IXGRP)
os.chmod(p, stat.S_IMODE(st.st_mode) | stat.S_IWGRP) os.chown(p, -1, gid)
def buildPython(): print "Building a universal python" buildDir = os.path.join(WORKDIR, '_bld', 'python') rootDir = os.path.join(WORKDIR, '_root') if os.path.exists(buildDir): shutil.rmtree(buildDir) if os.path.exists(rootDir): shutil.rmtree(rootDir) os.mkdir(buildDir) os.mkdir(rootDir) os.mkdir(os.path.join(rootDir, 'empty-dir')) curdir = os.getcwd() os.chdir(buildDir) # Not sure if this is still needed, the original build script # claims that parts of the install assume python.exe exists. os.symlink('python', os.path.join(buildDir, 'python.exe')) # Extract the version from the configure file, needed to calculate # several paths. version = getVersion() print "Running configure..." runCommand("%s -C --enable-framework --enable-universalsdk=%s LDFLAGS='-g -L%s/libraries/usr/local/lib' OPT='-g -O3 -I%s/libraries/usr/local/include' 2>&1"%( shellQuote(os.path.join(SRCDIR, 'configure')), shellQuote(SDKPATH), shellQuote(WORKDIR)[1:-1], shellQuote(WORKDIR)[1:-1])) print "Running make" runCommand("make") print "Runing make frameworkinstall" runCommand("make frameworkinstall DESTDIR=%s"%( shellQuote(rootDir))) print "Runing make frameworkinstallextras" runCommand("make frameworkinstallextras DESTDIR=%s"%( shellQuote(rootDir))) print "Copy required shared libraries" if os.path.exists(os.path.join(WORKDIR, 'libraries', 'Library')): runCommand("mv %s/* %s"%( shellQuote(os.path.join( WORKDIR, 'libraries', 'Library', 'Frameworks', 'Python.framework', 'Versions', getVersion(), 'lib')), shellQuote(os.path.join(WORKDIR, '_root', 'Library', 'Frameworks', 'Python.framework', 'Versions', getVersion(), 'lib')))) print "Fix file modes" frmDir = os.path.join(rootDir, 'Library', 'Frameworks', 'Python.framework') for dirpath, dirnames, filenames in os.walk(frmDir): for dn in dirnames: os.chmod(os.path.join(dirpath, dn), 0775) for fn in filenames: if os.path.islink(fn): continue # "chmod g+w $fn" p = os.path.join(dirpath, fn) st = os.stat(p) os.chmod(p, stat.S_IMODE(st.st_mode) | stat.S_IXGRP) # We added some directories to the search path during the configure # phase. Remove those because those directories won't be there on # the end-users system. path =os.path.join(rootDir, 'Library', 'Frameworks', 'Python.framework', 'Versions', version, 'lib', 'python%s'%(version,), 'config', 'Makefile') fp = open(path, 'r') data = fp.read() fp.close() data = data.replace('-L%s/libraries/usr/local/lib'%(WORKDIR,), '') data = data.replace('-I%s/libraries/usr/local/include'%(WORKDIR,), '') fp = open(path, 'w') fp.write(data) fp.close() # Add symlinks in /usr/local/bin, using relative links usr_local_bin = os.path.join(rootDir, 'usr', 'local', 'bin') to_framework = os.path.join('..', '..', '..', 'Library', 'Frameworks', 'Python.framework', 'Versions', version, 'bin') if os.path.exists(usr_local_bin): shutil.rmtree(usr_local_bin) os.makedirs(usr_local_bin) for fn in os.listdir( os.path.join(frmDir, 'Versions', version, 'bin')): os.symlink(os.path.join(to_framework, fn), os.path.join(usr_local_bin, fn)) os.chdir(curdir)
74d3eef73ee22d198245094d765b4b7a1b5b2cd6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/74d3eef73ee22d198245094d765b4b7a1b5b2cd6/build-installer.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()
97225da29afabd4f5421f649257c3c9b088ccdd0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/97225da29afabd4f5421f649257c3c9b088ccdd0/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
97225da29afabd4f5421f649257c3c9b088ccdd0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/97225da29afabd4f5421f649257c3c9b088ccdd0/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
97225da29afabd4f5421f649257c3c9b088ccdd0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/97225da29afabd4f5421f649257c3c9b088ccdd0/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
97225da29afabd4f5421f649257c3c9b088ccdd0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/97225da29afabd4f5421f649257c3c9b088ccdd0/makeunicodedata.py
class Backquote(Node): def __init__(self, expr, lineno=None): self.expr = expr self.lineno = lineno def getChildren(self): return self.expr, def getChildNodes(self): return self.expr, def __repr__(self): return "Backquote(%s)" % (repr(self.expr),)
def __repr__(self): return "AugAssign(%s, %s, %s)" % (repr(self.node), repr(self.op), repr(self.expr))
ecfd0b2f3bfd622c3ba148e53d3feebb8c1ae721 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ecfd0b2f3bfd622c3ba148e53d3feebb8c1ae721/ast.py
if map(max, Squares(3), Squares(2)) != [0, 1, None]:
if map(max, Squares(3), Squares(2)) != [0, 1, 4]:
def plus(*v): accu = 0 for i in v: accu = accu + i return accu
38f0223c9cf8d157c596c2e4622a36aa29f4bd84 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/38f0223c9cf8d157c596c2e4622a36aa29f4bd84/test_b1.py
import regex prefix_cache = {} def prefix_regex (needle): if prefix_cache.has_key (needle): return prefix_cache[needle] else: reg = needle[-1] for i in range(1,len(needle)): reg = '%c\(%s\)?' % (needle[-(i+1)], reg) reg = regex.compile (reg+'$') prefix_cache[needle] = reg, len(needle) return reg, len(needle)
def pop (self): if self.list: result = self.list[0] del self.list[0] return (1, result) else: return (0, None)
d305f515f9c4e3cedb3e47ec2711f1dd2a99ceb5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d305f515f9c4e3cedb3e47ec2711f1dd2a99ceb5/asynchat.py
s = ''
s = []
def _safe_read(self, amt): """Read the number of bytes requested, compensating for partial reads.
80ba8e85490515c293959a4196cbd99b1b3819a2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/80ba8e85490515c293959a4196cbd99b1b3819a2/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.
80ba8e85490515c293959a4196cbd99b1b3819a2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/80ba8e85490515c293959a4196cbd99b1b3819a2/httplib.py