rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
self.pimpinstaller = None
def closepimp(self): self.pimpdb.close() self.pimpprefs = None self.pimpdb = None self.pimpinstaller = None self.packages = []
40b2e839246aa74f08eea1c2abb60e5ca93ecab0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/40b2e839246aa74f08eea1c2abb60e5ca93ecab0/PackageManager.py
list, messages = self.pimpinstaller.prepareInstall(pkg, force, recursive)
pimpinstaller = pimp.PimpInstaller(self.pimpdb) list, messages = pimpinstaller.prepareInstall(pkg, force, recursive)
def installpackage(self, sel, output, recursive, force): pkg = self.packages[sel] list, messages = self.pimpinstaller.prepareInstall(pkg, force, recursive) if messages: return messages messages = self.pimpinstaller.install(list, output) return messages
40b2e839246aa74f08eea1c2abb60e5ca93ecab0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/40b2e839246aa74f08eea1c2abb60e5ca93ecab0/PackageManager.py
messages = self.pimpinstaller.install(list, output)
messages = pimpinstaller.install(list, output)
def installpackage(self, sel, output, recursive, force): pkg = self.packages[sel] list, messages = self.pimpinstaller.prepareInstall(pkg, force, recursive) if messages: return messages messages = self.pimpinstaller.install(list, output) return messages
40b2e839246aa74f08eea1c2abb60e5ca93ecab0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/40b2e839246aa74f08eea1c2abb60e5ca93ecab0/PackageManager.py
self.assertEqual(p.stderr.read(), "strawberry")
self.assertEqual(remove_stderr_debug_decorations(p.stderr.read()), "strawberry")
def test_stderr_pipe(self): # stderr redirection p = subprocess.Popen([sys.executable, "-c", 'import sys; sys.stderr.write("strawberry")'], stderr=subprocess.PIPE) self.assertEqual(p.stderr.read(), "strawberry")
3761e8dd6600d1f93c9ba8a013aa5ba51ed6640b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3761e8dd6600d1f93c9ba8a013aa5ba51ed6640b/test_subprocess.py
self.assertEqual(os.read(d, 1024), "strawberry")
self.assertEqual(remove_stderr_debug_decorations(os.read(d, 1024)), "strawberry")
def test_stderr_filedes(self): # stderr is set to open file descriptor tf = tempfile.TemporaryFile() d = tf.fileno() p = subprocess.Popen([sys.executable, "-c", 'import sys; sys.stderr.write("strawberry")'], stderr=d) p.wait() os.lseek(d, 0, 0) self.assertEqual(os.read(d, 1024), "strawberry")
3761e8dd6600d1f93c9ba8a013aa5ba51ed6640b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3761e8dd6600d1f93c9ba8a013aa5ba51ed6640b/test_subprocess.py
self.assertEqual(tf.read(), "strawberry")
self.assertEqual(remove_stderr_debug_decorations(tf.read()), "strawberry")
def test_stderr_fileobj(self): # stderr is set to open file object tf = tempfile.TemporaryFile() p = subprocess.Popen([sys.executable, "-c", 'import sys; sys.stderr.write("strawberry")'], stderr=tf) p.wait() tf.seek(0) self.assertEqual(tf.read(), "strawberry")
3761e8dd6600d1f93c9ba8a013aa5ba51ed6640b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3761e8dd6600d1f93c9ba8a013aa5ba51ed6640b/test_subprocess.py
self.assertEqual(p.stdout.read(), "appleorange")
output = p.stdout.read() stripped = remove_stderr_debug_decorations(output) self.assertEqual(stripped, "appleorange")
def test_stdout_stderr_pipe(self): # capture stdout and stderr to the same pipe p = subprocess.Popen([sys.executable, "-c", 'import sys;' \ 'sys.stdout.write("apple");' \ 'sys.stdout.flush();' \ 'sys.stderr.write("orange")'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) self.assertEqual(p.stdout.read(), "appleorange")
3761e8dd6600d1f93c9ba8a013aa5ba51ed6640b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3761e8dd6600d1f93c9ba8a013aa5ba51ed6640b/test_subprocess.py
self.assertEqual(tf.read(), "appleorange")
output = tf.read() stripped = remove_stderr_debug_decorations(output) self.assertEqual(stripped, "appleorange")
def test_stdout_stderr_file(self): # capture stdout and stderr to the same open file tf = tempfile.TemporaryFile() p = subprocess.Popen([sys.executable, "-c", 'import sys;' \ 'sys.stdout.write("apple");' \ 'sys.stdout.flush();' \ 'sys.stderr.write("orange")'], stdout=tf, stderr=tf) p.wait() tf.seek(0) self.assertEqual(tf.read(), "appleorange")
3761e8dd6600d1f93c9ba8a013aa5ba51ed6640b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3761e8dd6600d1f93c9ba8a013aa5ba51ed6640b/test_subprocess.py
self.assertEqual(stderr, "pineapple")
self.assertEqual(remove_stderr_debug_decorations(stderr), "pineapple")
def test_communicate(self): p = subprocess.Popen([sys.executable, "-c", 'import sys,os;' \ 'sys.stderr.write("pineapple");' \ 'sys.stdout.write(sys.stdin.read())'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stdout, stderr) = p.communicate("banana") self.assertEqual(stdout, "banana") self.assertEqual(stderr, "pineapple")
3761e8dd6600d1f93c9ba8a013aa5ba51ed6640b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3761e8dd6600d1f93c9ba8a013aa5ba51ed6640b/test_subprocess.py
self.assertEqual(stderr, "")
self.assertEqual(remove_stderr_debug_decorations(stderr), "")
def test_writes_before_communicate(self): # stdin.write before communicate() p = subprocess.Popen([sys.executable, "-c", 'import sys,os;' \ 'sys.stdout.write(sys.stdin.read())'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) p.stdin.write("banana") (stdout, stderr) = p.communicate("split") self.assertEqual(stdout, "bananasplit") self.assertEqual(stderr, "")
3761e8dd6600d1f93c9ba8a013aa5ba51ed6640b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3761e8dd6600d1f93c9ba8a013aa5ba51ed6640b/test_subprocess.py
err('usage: classfix file-or-directory ...\n')
err('usage: ' + argv[0] + ' file-or-directory ...\n')
def main(): bad = 0 if not sys.argv[1:]: # No arguments err('usage: classfix file-or-directory ...\n') sys.exit(2) for arg in sys.argv[1:]: if path.isdir(arg): if recursedown(arg): bad = 1 elif path.islink(arg): err(arg + ': will not process symbolic links\n') bad = 1 else: if fix(arg): bad = 1 sys.exit(bad)
11e7f62dbc21d4f7f18994f4cccbe158544ea85b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/11e7f62dbc21d4f7f18994f4cccbe158544ea85b/classfix.py
ispython = regexp.compile('^[a-zA-Z0-9_]+\.py$').match
ispythonprog = regex.compile('^[a-zA-Z0-9_]+\.py$') def ispython(name): return ispythonprog.match(name) >= 0
def main(): bad = 0 if not sys.argv[1:]: # No arguments err('usage: classfix file-or-directory ...\n') sys.exit(2) for arg in sys.argv[1:]: if path.isdir(arg): if recursedown(arg): bad = 1 elif path.islink(arg): err(arg + ': will not process symbolic links\n') bad = 1 else: if fix(arg): bad = 1 sys.exit(bad)
11e7f62dbc21d4f7f18994f4cccbe158544ea85b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/11e7f62dbc21d4f7f18994f4cccbe158544ea85b/classfix.py
if recursedown(fullname): bad = 1
subdirs.append(fullname)
def recursedown(dirname): dbg('recursedown(' + `dirname` + ')\n') bad = 0 try: names = posix.listdir(dirname) except posix.error, msg: err(dirname + ': cannot list directory: ' + `msg` + '\n') return 1 for name in names: if name in ('.', '..'): continue fullname = path.join(dirname, name) if path.islink(fullname): pass elif path.isdir(fullname): if recursedown(fullname): bad = 1 elif ispython(name): if fix(fullname): bad = 1 return bad
11e7f62dbc21d4f7f18994f4cccbe158544ea85b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/11e7f62dbc21d4f7f18994f4cccbe158544ea85b/classfix.py
classexpr = '^([ \t]*class +[a-zA-Z0-9_]+) *\( *\) *((=.*)?):' findclass = regexp.compile(classexpr).match baseexpr = '^ *(.*) *\( *\) *$' findbase = regexp.compile(baseexpr).match
def recursedown(dirname): dbg('recursedown(' + `dirname` + ')\n') bad = 0 try: names = posix.listdir(dirname) except posix.error, msg: err(dirname + ': cannot list directory: ' + `msg` + '\n') return 1 for name in names: if name in ('.', '..'): continue fullname = path.join(dirname, name) if path.islink(fullname): pass elif path.isdir(fullname): if recursedown(fullname): bad = 1 elif ispython(name): if fix(fullname): bad = 1 return bad
11e7f62dbc21d4f7f18994f4cccbe158544ea85b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/11e7f62dbc21d4f7f18994f4cccbe158544ea85b/classfix.py
dbg('fix(' + `filename` + ')\n')
def fix(filename):
11e7f62dbc21d4f7f18994f4cccbe158544ea85b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/11e7f62dbc21d4f7f18994f4cccbe158544ea85b/classfix.py
tf = None
g = None
def fix(filename):
11e7f62dbc21d4f7f18994f4cccbe158544ea85b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/11e7f62dbc21d4f7f18994f4cccbe158544ea85b/classfix.py
res = findclass(line) if not res: if tf: tf.write(line) continue if not tf: try: tf = open(tempname, 'w') except IOError, msg: f.close() err(tempname+': cannot create: '+`msg`+'\n') return 1 rep(filename + ':\n') f.seek(0) continue a0, b0 = res[0] a1, b1 = res[1] a2, b2 = res[2] head = line[:b1] tail = line[b0:] if a2 = b2: newline = head + ':' + tail else: basepart = line[a2+1:b2] bases = string.splitfields(basepart, ',') for i in range(len(bases)): res = findbase(bases[i]) if res: (x0, y0), (x1, y1) = res bases[i] = bases[i][x1:y1] basepart = string.joinfields(bases, ', ') newline = head + '(' + basepart + '):' + tail rep('< ' + line) rep('> ' + newline) tf.write(newline)
lineno = lineno + 1 while line[-2:] == '\\\n': nextline = f.readline() if not nextline: break line = line + nextline lineno = lineno + 1 newline = fixline(line) if newline != line: if g is None: try: g = open(tempname, 'w') except IOError, msg: f.close() err(tempname+': cannot create: '+\ `msg`+'\n') return 1 f.seek(0) lineno = 0 rep(filename + ':\n') continue rep(`lineno` + '\n') rep('< ' + line) rep('> ' + newline) if g is not None: g.write(newline)
def fix(filename):
11e7f62dbc21d4f7f18994f4cccbe158544ea85b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/11e7f62dbc21d4f7f18994f4cccbe158544ea85b/classfix.py
if not tf: return 0
if not g: return 0
def fix(filename):
11e7f62dbc21d4f7f18994f4cccbe158544ea85b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/11e7f62dbc21d4f7f18994f4cccbe158544ea85b/classfix.py
def cmp(f1, f2):
def cmp(f1, f2, shallow=1):
def cmp(f1, f2): # Compare two files, use the cache if possible. # Return 1 for identical files, 0 for different. # Raise exceptions if either file could not be statted, read, etc. s1, s2 = sig(os.stat(f1)), sig(os.stat(f2)) if s1[0] <> 8 or s2[0] <> 8: # Either is a not a plain file -- always report as different return 0 if s1 == s2: # type, size & mtime match -- report same return 1 if s1[:2] <> s2[:2]: # Types or sizes differ, don't bother # types or sizes differ -- report different return 0 # same type and size -- look in the cache key = (f1, f2) try: cs1, cs2, outcome = cache[key] # cache hit if s1 == cs1 and s2 == cs2: # cached signatures match return outcome # stale cached signature(s) except KeyError: # cache miss pass # really compare outcome = do_cmp(f1, f2) cache[key] = s1, s2, outcome return outcome
3aa9ca147b24eb55b350f5dea9ccdf37673de044 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3aa9ca147b24eb55b350f5dea9ccdf37673de044/cmp.py
if s1 == s2:
if shallow and s1 == s2:
def cmp(f1, f2): # Compare two files, use the cache if possible. # Return 1 for identical files, 0 for different. # Raise exceptions if either file could not be statted, read, etc. s1, s2 = sig(os.stat(f1)), sig(os.stat(f2)) if s1[0] <> 8 or s2[0] <> 8: # Either is a not a plain file -- always report as different return 0 if s1 == s2: # type, size & mtime match -- report same return 1 if s1[:2] <> s2[:2]: # Types or sizes differ, don't bother # types or sizes differ -- report different return 0 # same type and size -- look in the cache key = (f1, f2) try: cs1, cs2, outcome = cache[key] # cache hit if s1 == cs1 and s2 == cs2: # cached signatures match return outcome # stale cached signature(s) except KeyError: # cache miss pass # really compare outcome = do_cmp(f1, f2) cache[key] = s1, s2, outcome return outcome
3aa9ca147b24eb55b350f5dea9ccdf37673de044 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3aa9ca147b24eb55b350f5dea9ccdf37673de044/cmp.py
'include_dirs', if given, must be a list of strings, the directories to add to the default include file search path for this compilation only.
'include_dirs', if given, must be a list of strings, the directories to add to the default include file search path for this compilation only. 'debug' is a boolean; if true, the compiler will be instructed to output debug symbols in (or alongside) the object file(s).
def compile (self, sources, output_dir=None, macros=None, include_dirs=None, extra_preargs=None, extra_postargs=None): """Compile one or more C/C++ source files. 'sources' must be a list of strings, each one the name of a C/C++ source file. Return a list of the object filenames generated (one for each source filename in 'sources').
3c045a576649ddf28eb6f9b33c749e8db0dd2255 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3c045a576649ddf28eb6f9b33c749e8db0dd2255/ccompiler.py
output_dir=None):
output_dir=None, debug=0):
def link_static_lib (self, objects, output_libname, output_dir=None): """Link a bunch of stuff together to create a static library file. The "bunch of stuff" consists of the list of object files supplied as 'objects', the extra object files supplied to 'add_link_object()' and/or 'set_link_objects()', the libraries supplied to 'add_library()' and/or 'set_libraries()', and the libraries supplied as 'libraries' (if any).
3c045a576649ddf28eb6f9b33c749e8db0dd2255 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3c045a576649ddf28eb6f9b33c749e8db0dd2255/ccompiler.py
'output_libname' should be a library name, not a filename; the filename will be inferred from the library name.
'output_libname' should be a library name, not a filename; the filename will be inferred from the library name. 'output_dir' is the directory where the library file will be put. 'debug' is a boolean; if true, debugging information will be included in the library (note that on most platforms, it is the compile step where this matters: the 'debug' flag is included here just for consistency).""" pass def link_shared_lib (self, objects, output_libname, output_dir=None, libraries=None, library_dirs=None, debug=0, extra_preargs=None, extra_postargs=None): """Link a bunch of stuff together to create a shared library file. Has the same effect as 'link_static_lib()' except that the filename inferred from 'output_libname' will most likely be different, and the type of file generated will almost certainly be different
def link_static_lib (self, objects, output_libname, output_dir=None): """Link a bunch of stuff together to create a static library file. The "bunch of stuff" consists of the list of object files supplied as 'objects', the extra object files supplied to 'add_link_object()' and/or 'set_link_objects()', the libraries supplied to 'add_library()' and/or 'set_libraries()', and the libraries supplied as 'libraries' (if any).
3c045a576649ddf28eb6f9b33c749e8db0dd2255 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3c045a576649ddf28eb6f9b33c749e8db0dd2255/ccompiler.py
for the particular linker being used).""" pass def link_shared_lib (self, objects, output_libname, output_dir=None, libraries=None, library_dirs=None, extra_preargs=None, extra_postargs=None): """Link a bunch of stuff together to create a shared library file. Has the same effect as 'link_static_lib()' except that the filename inferred from 'output_libname' will most likely be different, and the type of file generated will almost certainly be different."""
for the particular linker being used)."""
def link_static_lib (self, objects, output_libname, output_dir=None): """Link a bunch of stuff together to create a static library file. The "bunch of stuff" consists of the list of object files supplied as 'objects', the extra object files supplied to 'add_link_object()' and/or 'set_link_objects()', the libraries supplied to 'add_library()' and/or 'set_libraries()', and the libraries supplied as 'libraries' (if any).
3c045a576649ddf28eb6f9b33c749e8db0dd2255 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3c045a576649ddf28eb6f9b33c749e8db0dd2255/ccompiler.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)."""
f10f95d6bb7854ba2b3a8f6b554bcb8baecd7674 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f10f95d6bb7854ba2b3a8f6b554bcb8baecd7674/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)."""
f10f95d6bb7854ba2b3a8f6b554bcb8baecd7674 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f10f95d6bb7854ba2b3a8f6b554bcb8baecd7674/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)."""
f10f95d6bb7854ba2b3a8f6b554bcb8baecd7674 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f10f95d6bb7854ba2b3a8f6b554bcb8baecd7674/ccompiler.py
print 'DBG interaction'
def edit_applet(name): pref_handle = openpreffile(READ) app_handle = openapplet(name) notfound = '' l, sr = getprefpath(OVERRIDE_PATH_STRINGS_ID) if l == None: notfound = 'path' l, dummy = getprefpath(PATH_STRINGS_ID) if l == None: message('Cannot find any sys.path resource! (Old python?)') sys.exit(0) fss, dr, fss_changed = getprefdir(OVERRIDE_DIRECTORY_ID) if fss == None: if notfound: notfound = notfound + ', directory' else: notfound = 'directory' fss, dummy, dummy2 = getprefdir(DIRECTORY_ID) if fss == None: fss = macfs.FSSpec(os.getcwd()) fss_changed = 1 options, opr = getoptions(OVERRIDE_OPTIONS_ID) if not opr: if notfound: notfound = notfound + ', options' else: notfound = 'options' options, dummy = getoptions(OPTIONS_ID) saved_options = options[:] creator, type, delaycons, gusi_opr = getgusioptions(OVERRIDE_GUSI_ID) if not gusi_opr: if notfound: notfound = notfound + ', GUSI options' else: notfound = 'GUSI options' creator, type, delaycons, gusi_opr = getgusioptions(GUSI_ID) saved_gusi_options = creator, type, delaycons dummy = dummy2 = None # Discard them. if notfound: message('Warning: initial %s taken from system-wide defaults'%notfound) # Let the user play away print 'DBG interaction' result = interact(l, fss, (options, creator, type, delaycons), name) # See what we have to update, and how if result == None: sys.exit(0) pathlist, nfss, (options, creator, type, delaycons) = result if nfss != fss: fss_changed = 1 if fss_changed: alias = nfss.NewAlias() if dr: dr.data = alias.data dr.ChangedResource() else: dr = Resource(alias.data) dr.AddResource('alis', OVERRIDE_DIRECTORY_ID, '') if pathlist != l: if pathlist == []: if sr.HomeResFile() == app_handle: sr.RemoveResource() elif sr and sr.HomeResFile() == app_handle: sr.data = listtores(pathlist) sr.ChangedResource() else: sr = Resource(listtores(pathlist)) sr.AddResource('STR#', OVERRIDE_PATH_STRINGS_ID, '') if options != saved_options: newdata = reduce(lambda x, y: x+chr(y), options, '') if opr and opr.HomeResFile() == app_handle: opr.data = newdata opr.ChangedResource() else: opr = Resource(newdata) opr.AddResource('Popt', OVERRIDE_OPTIONS_ID, '') if (creator, type, delaycons) != saved_gusi_options: newdata = setgusioptions(gusi_opr, creator, type, delaycons) id, type, name = gusi_opr.GetResInfo() if gusi_opr.HomeResFile() == app_handle and id == OVERRIDE_GUSI_ID: gusi_opr.data = newdata gusi_opr.ChangedResource() else: ngusi_opr = Resource(newdata) ngusi_opr.AddResource('GU\267I', OVERRIDE_GUSI_ID, '') CloseResFile(app_handle)
ebacc2edff21800fc7c917a201ffde472f9bcb00 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ebacc2edff21800fc7c917a201ffde472f9bcb00/EditPythonPrefs.py
del dir, L
del dir, dircase, L
def makepath(*paths): dir = os.path.abspath(os.path.join(*paths)) return dir, os.path.normcase(dir)
34172d5316d099535390777083ccb7849ac76322 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/34172d5316d099535390777083ccb7849ac76322/site.py
print "open", askopenfilename(filetypes=[("all filez", "*")]).encode(enc)
print "open", askopenfilename(filetypes=[("all files", "*")]).encode(enc)
def askdirectory (**options): "Ask for a directory, and return the file name" return Directory(**options).show()
1142d595eed6ee9a8bae0907d2347ddae0692651 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1142d595eed6ee9a8bae0907d2347ddae0692651/tkFileDialog.py
tests.remove("test_file") tests.insert(tests.index("test_optparse"), "test_file")
def main(tests=None, testdir=None, verbose=0, quiet=False, generate=False, exclude=False, single=False, randomize=False, fromfile=None, findleaks=False, use_resources=None, trace=False, coverdir='coverage', runleaks=False, huntrleaks=False, verbose2=False): """Execute a test suite. This also parses command-line options and modifies its behavior accordingly. tests -- a list of strings containing test names (optional) testdir -- the directory in which to look for tests (optional) Users other than the Python test suite will certainly want to specify testdir; if it's omitted, the directory containing the Python test suite is searched for. If the tests argument is omitted, the tests listed on the command-line will be used. If that's empty, too, then all *.py files beginning with test_ will be used. The other default arguments (verbose, quiet, generate, exclude, single, randomize, findleaks, use_resources, trace and coverdir) allow programmers calling main() directly to set the values that would normally be set by flags on the command line. """ test_support.record_original_stdout(sys.stdout) try: opts, args = getopt.getopt(sys.argv[1:], 'hvgqxsrf:lu:t:TD:NLR:wM:', ['help', 'verbose', 'quiet', 'generate', 'exclude', 'single', 'random', 'fromfile', 'findleaks', 'use=', 'threshold=', 'trace', 'coverdir=', 'nocoverdir', 'runleaks', 'huntrleaks=', 'verbose2', 'memlimit=', ]) except getopt.error, msg: usage(2, msg) # Defaults if use_resources is None: use_resources = [] for o, a in opts: if o in ('-h', '--help'): usage(0) elif o in ('-v', '--verbose'): verbose += 1 elif o in ('-w', '--verbose2'): verbose2 = True elif o in ('-q', '--quiet'): quiet = True; verbose = 0 elif o in ('-g', '--generate'): generate = True elif o in ('-x', '--exclude'): exclude = True elif o in ('-s', '--single'): single = True elif o in ('-r', '--randomize'): randomize = True elif o in ('-f', '--fromfile'): fromfile = a elif o in ('-l', '--findleaks'): findleaks = True elif o in ('-L', '--runleaks'): runleaks = True elif o in ('-t', '--threshold'): import gc gc.set_threshold(int(a)) elif o in ('-T', '--coverage'): trace = True elif o in ('-D', '--coverdir'): coverdir = os.path.join(os.getcwd(), a) elif o in ('-N', '--nocoverdir'): coverdir = None elif o in ('-R', '--huntrleaks'): huntrleaks = a.split(':') if len(huntrleaks) != 3: print a, huntrleaks usage(2, '-R takes three colon-separated arguments') if len(huntrleaks[0]) == 0: huntrleaks[0] = 5 else: huntrleaks[0] = int(huntrleaks[0]) if len(huntrleaks[1]) == 0: huntrleaks[1] = 4 else: huntrleaks[1] = int(huntrleaks[1]) if len(huntrleaks[2]) == 0: huntrleaks[2] = "reflog.txt" elif o in ('-M', '--memlimit'): test_support.set_memlimit(a) elif o in ('-u', '--use'): u = [x.lower() for x in a.split(',')] for r in u: if r == 'all': use_resources[:] = RESOURCE_NAMES continue remove = False if r[0] == '-': remove = True r = r[1:] if r not in RESOURCE_NAMES: usage(1, 'Invalid -u/--use option: ' + a) if remove: if r in use_resources: use_resources.remove(r) elif r not in use_resources: use_resources.append(r) if generate and verbose: usage(2, "-g and -v don't go together!") if single and fromfile: usage(2, "-s and -f don't go together!") good = [] bad = [] skipped = [] resource_denieds = [] if findleaks: try: import gc except ImportError: print 'No GC available, disabling findleaks.' findleaks = False else: # Uncomment the line below to report garbage that is not # freeable by reference counting alone. By default only # garbage that is not collectable by the GC is reported. #gc.set_debug(gc.DEBUG_SAVEALL) found_garbage = [] if single: from tempfile import gettempdir filename = os.path.join(gettempdir(), 'pynexttest') try: fp = open(filename, 'r') next = fp.read().strip() tests = [next] fp.close() except IOError: pass if fromfile: tests = [] fp = open(fromfile) for line in fp: guts = line.split() # assuming no test has whitespace in its name if guts and not guts[0].startswith('#'): tests.extend(guts) fp.close() # Strip .py extensions. if args: args = map(removepy, args) if tests: tests = map(removepy, tests) stdtests = STDTESTS[:] nottests = NOTTESTS[:] if exclude: for arg in args: if arg in stdtests: stdtests.remove(arg) nottests[:0] = args args = [] tests = tests or args or findtests(testdir, stdtests, nottests) if single: tests = tests[:1] if randomize: random.shuffle(tests) # XXX Temporary hack to force test_optparse to run immediately # XXX after test_file. This should go away as soon as we fix # XXX whatever it is that's causing that to fail. tests.remove("test_file") tests.insert(tests.index("test_optparse"), "test_file") if trace: import trace tracer = trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix], trace=False, count=True) test_support.verbose = verbose # Tell tests to be moderately quiet test_support.use_resources = use_resources save_modules = sys.modules.keys() for test in tests: if not quiet: print test sys.stdout.flush() if trace: # If we're tracing code coverage, then we don't exit with status # if on a false return value from main. tracer.runctx('runtest(test, generate, verbose, quiet, testdir)', globals=globals(), locals=vars()) else: try: ok = runtest(test, generate, verbose, quiet, testdir, huntrleaks) except KeyboardInterrupt: # print a newline separate from the ^C print break except: raise if ok > 0: good.append(test) elif ok == 0: bad.append(test) else: skipped.append(test) if ok == -2: resource_denieds.append(test) if findleaks: gc.collect() if gc.garbage: print "Warning: test created", len(gc.garbage), print "uncollectable object(s)." # move the uncollectable objects somewhere so we don't see # them again found_garbage.extend(gc.garbage) del gc.garbage[:] # Unload the newly imported modules (best effort finalization) for module in sys.modules.keys(): if module not in save_modules and module.startswith("test."): test_support.unload(module) # The lists won't be sorted if running with -r good.sort() bad.sort() skipped.sort() if good and not quiet: if not bad and not skipped and len(good) > 1: print "All", print count(len(good), "test"), "OK." if verbose: print "CAUTION: stdout isn't compared in verbose mode:" print "a test that passes in verbose mode may fail without it." if bad: print count(len(bad), "test"), "failed:" printlist(bad) if skipped and not quiet: print count(len(skipped), "test"), "skipped:" printlist(skipped) e = _ExpectedSkips() plat = sys.platform if e.isvalid(): surprise = set(skipped) - e.getexpected() - set(resource_denieds) if surprise: print count(len(surprise), "skip"), \ "unexpected on", plat + ":" printlist(surprise) else: print "Those skips are all expected on", plat + "." else: print "Ask someone to teach regrtest.py about which tests are" print "expected to get skipped on", plat + "." if verbose2 and bad: print "Re-running failed tests in verbose mode" for test in bad: print "Re-running test %r in verbose mode" % test sys.stdout.flush() try: test_support.verbose = 1 ok = runtest(test, generate, 1, quiet, testdir, huntrleaks) except KeyboardInterrupt: # print a newline separate from the ^C print break except: raise if single: alltests = findtests(testdir, stdtests, nottests) for i in range(len(alltests)): if tests[0] == alltests[i]: if i == len(alltests) - 1: os.unlink(filename) else: fp = open(filename, 'w') fp.write(alltests[i+1] + '\n') fp.close() break else: os.unlink(filename) if trace: r = tracer.results() r.write_results(show_missing=True, summary=True, coverdir=coverdir) if runleaks: os.system("leaks %d" % os.getpid()) sys.exit(len(bad) > 0)
71dc0a043b288fe70d85addbef0dc361246d8d1c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/71dc0a043b288fe70d85addbef0dc361246d8d1c/regrtest.py
objects = self.object_filenames(sources, 1, outdir)
objects = self.object_filenames(sources, 0, outdir)
def _setup_compile(self, outdir, macros, incdirs, sources, depends, extra): """Process arguments and decide which source files to compile.
9a38dcf05743347c556660347a014620e3625949 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9a38dcf05743347c556660347a014620e3625949/ccompiler.py
objects = self.object_filenames(sources, strip_dir=1,
objects = self.object_filenames(sources, strip_dir=0,
def _prep_compile(self, sources, output_dir, depends=None): """Decide which souce files must be recompiled.
9a38dcf05743347c556660347a014620e3625949 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9a38dcf05743347c556660347a014620e3625949/ccompiler.py
"Strange! filename %s has two different module names" % \ (key, modules[key], other_module[key])
"Strange! filename %s has two different module " \ "names: %s and %s" % \ (key, modules[key], other_modules[key])
def update(self, other): """Merge in the data from another CoverageResults""" counts = self.counts other_counts = other.counts modules = self.modules other_modules = other.modules
66a7e57c7e8aab2bf187991aa5c2aa5e21b44c2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66a7e57c7e8aab2bf187991aa5c2aa5e21b44c2c/trace.py
save_counts = 0):
save_counts = 0, summary = 0, coverdir = None):
def create_results_log(results, dirname = ".", show_missing = 1, save_counts = 0): import re # turn the counts data ("(filename, lineno) = count") into something # accessible on a per-file basis per_file = {} for filename, lineno in results.counts.keys(): lines_hit = per_file[filename] = per_file.get(filename, {}) lines_hit[lineno] = results.counts[(filename, lineno)] # try and merge existing counts and modules file from dirname try: counts = marshal.load(open(os.path.join(dirname, "counts"))) modules = marshal.load(open(os.path.join(dirname, "modules"))) results.update(results.__class__(counts, modules)) except IOError: pass # there are many places where this is insufficient, like a blank # line embedded in a multiline string. blank = re.compile(r'^\s*(#.*)?$') # generate file paths for the coverage files we are going to write... fnlist = [] tfdir = tempfile.gettempdir() for key in per_file.keys(): filename = key # skip some "files" we don't care about... if filename == "<string>": continue # are these caused by code compiled using exec or something? if filename.startswith(tfdir): continue # XXX this is almost certainly not portable!!! fndir = os.path.dirname(filename) if filename[:1] == os.sep: coverpath = os.path.join(dirname, "."+fndir) else: coverpath = os.path.join(dirname, fndir) if filename.endswith(".pyc") or filename.endswith(".pyo"): filename = filename[:-1] # Get the original lines from the .py file try: lines = open(filename, 'r').readlines() except IOError, err: sys.stderr.write("%s: Could not open %s for reading " \ "because: %s - skipping\n" % \ ("trace", `filename`, err.strerror)) continue modulename = os.path.split(results.modules[key])[1] # build list file name by appending a ".cover" to the module name # and sticking it into the specified directory listfilename = os.path.join(coverpath, modulename + ".cover") #sys.stderr.write("modulename: %(modulename)s\n" # "filename: %(filename)s\n" # "coverpath: %(coverpath)s\n" # "listfilename: %(listfilename)s\n" # "dirname: %(dirname)s\n" # % locals()) try: outfile = open(listfilename, 'w') except IOError, err: sys.stderr.write( '%s: Could not open %s for writing because: %s" \ "- skipping\n' % ("trace", `listfilename`, err.strerror)) continue # If desired, get a list of the line numbers which represent # executable content (returned as a dict for better lookup speed) if show_missing: executable_linenos = find_executable_linenos(filename) else: executable_linenos = {} lines_hit = per_file[key] for i in range(len(lines)): line = lines[i] # do the blank/comment match to try to mark more lines # (help the reader find stuff that hasn't been covered) if lines_hit.has_key(i+1): # count precedes the lines that we captured outfile.write('%5d: ' % lines_hit[i+1]) elif blank.match(line): # blank lines and comments are preceded by dots outfile.write(' . ') else: # lines preceded by no marks weren't hit # Highlight them if so indicated, unless the line contains # '#pragma: NO COVER' (it is possible to embed this into # the text as a non-comment; no easy fix) if executable_linenos.has_key(i+1) and \ string.find(lines[i], string.join(['#pragma', 'NO COVER'])) == -1: outfile.write('>>>>>> ') else: outfile.write(' '*7) outfile.write(string.expandtabs(lines[i], 8)) outfile.close() if save_counts: # try and store counts and module info into dirname try: marshal.dump(results.counts, open(os.path.join(dirname, "counts"), "w")) marshal.dump(results.modules, open(os.path.join(dirname, "modules"), "w")) except IOError, err: sys.stderr.write("cannot save counts/modules " \ "files because %s" % err.strerror)
66a7e57c7e8aab2bf187991aa5c2aa5e21b44c2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66a7e57c7e8aab2bf187991aa5c2aa5e21b44c2c/trace.py
fndir = os.path.dirname(filename) if filename[:1] == os.sep: coverpath = os.path.join(dirname, "."+fndir) else: coverpath = os.path.join(dirname, fndir)
modulename = os.path.split(results.modules[key])[1]
def create_results_log(results, dirname = ".", show_missing = 1, save_counts = 0): import re # turn the counts data ("(filename, lineno) = count") into something # accessible on a per-file basis per_file = {} for filename, lineno in results.counts.keys(): lines_hit = per_file[filename] = per_file.get(filename, {}) lines_hit[lineno] = results.counts[(filename, lineno)] # try and merge existing counts and modules file from dirname try: counts = marshal.load(open(os.path.join(dirname, "counts"))) modules = marshal.load(open(os.path.join(dirname, "modules"))) results.update(results.__class__(counts, modules)) except IOError: pass # there are many places where this is insufficient, like a blank # line embedded in a multiline string. blank = re.compile(r'^\s*(#.*)?$') # generate file paths for the coverage files we are going to write... fnlist = [] tfdir = tempfile.gettempdir() for key in per_file.keys(): filename = key # skip some "files" we don't care about... if filename == "<string>": continue # are these caused by code compiled using exec or something? if filename.startswith(tfdir): continue # XXX this is almost certainly not portable!!! fndir = os.path.dirname(filename) if filename[:1] == os.sep: coverpath = os.path.join(dirname, "."+fndir) else: coverpath = os.path.join(dirname, fndir) if filename.endswith(".pyc") or filename.endswith(".pyo"): filename = filename[:-1] # Get the original lines from the .py file try: lines = open(filename, 'r').readlines() except IOError, err: sys.stderr.write("%s: Could not open %s for reading " \ "because: %s - skipping\n" % \ ("trace", `filename`, err.strerror)) continue modulename = os.path.split(results.modules[key])[1] # build list file name by appending a ".cover" to the module name # and sticking it into the specified directory listfilename = os.path.join(coverpath, modulename + ".cover") #sys.stderr.write("modulename: %(modulename)s\n" # "filename: %(filename)s\n" # "coverpath: %(coverpath)s\n" # "listfilename: %(listfilename)s\n" # "dirname: %(dirname)s\n" # % locals()) try: outfile = open(listfilename, 'w') except IOError, err: sys.stderr.write( '%s: Could not open %s for writing because: %s" \ "- skipping\n' % ("trace", `listfilename`, err.strerror)) continue # If desired, get a list of the line numbers which represent # executable content (returned as a dict for better lookup speed) if show_missing: executable_linenos = find_executable_linenos(filename) else: executable_linenos = {} lines_hit = per_file[key] for i in range(len(lines)): line = lines[i] # do the blank/comment match to try to mark more lines # (help the reader find stuff that hasn't been covered) if lines_hit.has_key(i+1): # count precedes the lines that we captured outfile.write('%5d: ' % lines_hit[i+1]) elif blank.match(line): # blank lines and comments are preceded by dots outfile.write(' . ') else: # lines preceded by no marks weren't hit # Highlight them if so indicated, unless the line contains # '#pragma: NO COVER' (it is possible to embed this into # the text as a non-comment; no easy fix) if executable_linenos.has_key(i+1) and \ string.find(lines[i], string.join(['#pragma', 'NO COVER'])) == -1: outfile.write('>>>>>> ') else: outfile.write(' '*7) outfile.write(string.expandtabs(lines[i], 8)) outfile.close() if save_counts: # try and store counts and module info into dirname try: marshal.dump(results.counts, open(os.path.join(dirname, "counts"), "w")) marshal.dump(results.modules, open(os.path.join(dirname, "modules"), "w")) except IOError, err: sys.stderr.write("cannot save counts/modules " \ "files because %s" % err.strerror)
66a7e57c7e8aab2bf187991aa5c2aa5e21b44c2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66a7e57c7e8aab2bf187991aa5c2aa5e21b44c2c/trace.py
sys.stderr.write("%s: Could not open %s for reading " \ "because: %s - skipping\n" % \ ("trace", `filename`, err.strerror)) continue modulename = os.path.split(results.modules[key])[1] listfilename = os.path.join(coverpath, modulename + ".cover")
print >> sys.stderr, "trace: Could not open %s for reading " \ "because: %s - skipping" % (`filename`, err.strerror) continue
def create_results_log(results, dirname = ".", show_missing = 1, save_counts = 0): import re # turn the counts data ("(filename, lineno) = count") into something # accessible on a per-file basis per_file = {} for filename, lineno in results.counts.keys(): lines_hit = per_file[filename] = per_file.get(filename, {}) lines_hit[lineno] = results.counts[(filename, lineno)] # try and merge existing counts and modules file from dirname try: counts = marshal.load(open(os.path.join(dirname, "counts"))) modules = marshal.load(open(os.path.join(dirname, "modules"))) results.update(results.__class__(counts, modules)) except IOError: pass # there are many places where this is insufficient, like a blank # line embedded in a multiline string. blank = re.compile(r'^\s*(#.*)?$') # generate file paths for the coverage files we are going to write... fnlist = [] tfdir = tempfile.gettempdir() for key in per_file.keys(): filename = key # skip some "files" we don't care about... if filename == "<string>": continue # are these caused by code compiled using exec or something? if filename.startswith(tfdir): continue # XXX this is almost certainly not portable!!! fndir = os.path.dirname(filename) if filename[:1] == os.sep: coverpath = os.path.join(dirname, "."+fndir) else: coverpath = os.path.join(dirname, fndir) if filename.endswith(".pyc") or filename.endswith(".pyo"): filename = filename[:-1] # Get the original lines from the .py file try: lines = open(filename, 'r').readlines() except IOError, err: sys.stderr.write("%s: Could not open %s for reading " \ "because: %s - skipping\n" % \ ("trace", `filename`, err.strerror)) continue modulename = os.path.split(results.modules[key])[1] # build list file name by appending a ".cover" to the module name # and sticking it into the specified directory listfilename = os.path.join(coverpath, modulename + ".cover") #sys.stderr.write("modulename: %(modulename)s\n" # "filename: %(filename)s\n" # "coverpath: %(coverpath)s\n" # "listfilename: %(listfilename)s\n" # "dirname: %(dirname)s\n" # % locals()) try: outfile = open(listfilename, 'w') except IOError, err: sys.stderr.write( '%s: Could not open %s for writing because: %s" \ "- skipping\n' % ("trace", `listfilename`, err.strerror)) continue # If desired, get a list of the line numbers which represent # executable content (returned as a dict for better lookup speed) if show_missing: executable_linenos = find_executable_linenos(filename) else: executable_linenos = {} lines_hit = per_file[key] for i in range(len(lines)): line = lines[i] # do the blank/comment match to try to mark more lines # (help the reader find stuff that hasn't been covered) if lines_hit.has_key(i+1): # count precedes the lines that we captured outfile.write('%5d: ' % lines_hit[i+1]) elif blank.match(line): # blank lines and comments are preceded by dots outfile.write(' . ') else: # lines preceded by no marks weren't hit # Highlight them if so indicated, unless the line contains # '#pragma: NO COVER' (it is possible to embed this into # the text as a non-comment; no easy fix) if executable_linenos.has_key(i+1) and \ string.find(lines[i], string.join(['#pragma', 'NO COVER'])) == -1: outfile.write('>>>>>> ') else: outfile.write(' '*7) outfile.write(string.expandtabs(lines[i], 8)) outfile.close() if save_counts: # try and store counts and module info into dirname try: marshal.dump(results.counts, open(os.path.join(dirname, "counts"), "w")) marshal.dump(results.modules, open(os.path.join(dirname, "modules"), "w")) except IOError, err: sys.stderr.write("cannot save counts/modules " \ "files because %s" % err.strerror)
66a7e57c7e8aab2bf187991aa5c2aa5e21b44c2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66a7e57c7e8aab2bf187991aa5c2aa5e21b44c2c/trace.py
modulename = frame.f_globals["__name__"]
try: modulename = frame.f_globals["__name__"] except KeyError: modulename = None
def trace(self, frame, why, arg): if why == 'line': # something is fishy about getting the file name filename = frame.f_globals.get("__file__", None) if filename is None: filename = frame.f_code.co_filename modulename = frame.f_globals["__name__"]
66a7e57c7e8aab2bf187991aa5c2aa5e21b44c2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66a7e57c7e8aab2bf187991aa5c2aa5e21b44c2c/trace.py
self.files = {'<string>': None}
self.files = {'<string>': None}
def __init__(self, ignore = Ignore()): self.ignore = ignore self.ignore_names = ignore._ignore # access ignore's cache (speed hack)
66a7e57c7e8aab2bf187991aa5c2aa5e21b44c2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66a7e57c7e8aab2bf187991aa5c2aa5e21b44c2c/trace.py
modulename = frame.f_globals["__name__"]
try: modulename = frame.f_globals["__name__"] except KeyError: modulename = None
def trace(self, frame, why, arg): if why == 'line': filename = frame.f_code.co_filename modulename = frame.f_globals["__name__"]
66a7e57c7e8aab2bf187991aa5c2aa5e21b44c2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66a7e57c7e8aab2bf187991aa5c2aa5e21b44c2c/trace.py
def trace(self, frame, why, arg): if why == 'line': filename = frame.f_code.co_filename modulename = frame.f_globals["__name__"]
66a7e57c7e8aab2bf187991aa5c2aa5e21b44c2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66a7e57c7e8aab2bf187991aa5c2aa5e21b44c2c/trace.py
sys.stderr.write("%s: %s\n" % (sys.argv[0], msg))
print >> sys.stderr, "%s: %s" % (sys.argv[0], msg)
def _err_exit(msg): sys.stderr.write("%s: %s\n" % (sys.argv[0], msg)) sys.exit(1)
66a7e57c7e8aab2bf187991aa5c2aa5e21b44c2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66a7e57c7e8aab2bf187991aa5c2aa5e21b44c2c/trace.py
opts, prog_argv = getopt.getopt(argv[1:], "tcrRf:d:m",
opts, prog_argv = getopt.getopt(argv[1:], "tcrRf:d:msC:",
def main(argv = None): import getopt if argv is None: argv = sys.argv try: opts, prog_argv = getopt.getopt(argv[1:], "tcrRf:d:m", ["help", "version", "trace", "count", "report", "no-report", "file=", "logdir=", "missing", "ignore-module=", "ignore-dir="]) except getopt.error, msg: sys.stderr.write("%s: %s\n" % (sys.argv[0], msg)) sys.stderr.write("Try `%s --help' for more information\n" % sys.argv[0]) sys.exit(1) trace = 0 count = 0 report = 0 no_report = 0 counts_file = None logdir = "." missing = 0 ignore_modules = [] ignore_dirs = [] for opt, val in opts: if opt == "--help": usage(sys.stdout) sys.exit(0) if opt == "--version": sys.stdout.write("trace 2.0\n") sys.exit(0) if opt == "-t" or opt == "--trace": trace = 1 continue if opt == "-c" or opt == "--count": count = 1 continue if opt == "-r" or opt == "--report": report = 1 continue if opt == "-R" or opt == "--no-report": no_report = 1 continue if opt == "-f" or opt == "--file": counts_file = val continue if opt == "-d" or opt == "--logdir": logdir = val continue if opt == "-m" or opt == "--missing": missing = 1 continue if opt == "--ignore-module": ignore_modules.append(val) continue if opt == "--ignore-dir": for s in string.split(val, os.pathsep): s = os.path.expandvars(s) # should I also call expanduser? (after all, could use $HOME) s = string.replace(s, "$prefix", os.path.join(sys.prefix, "lib", "python" + sys.version[:3])) s = string.replace(s, "$exec_prefix", os.path.join(sys.exec_prefix, "lib", "python" + sys.version[:3])) s = os.path.normpath(s) ignore_dirs.append(s) continue assert 0, "Should never get here" if len(prog_argv) == 0: _err_exit("missing name of file to run") if count + trace + report > 1: _err_exit("can only specify one of --trace, --count or --report") if count + trace + report == 0: _err_exit("must specify one of --trace, --count or --report") if report and counts_file is None: _err_exit("--report requires a --file") if report and no_report: _err_exit("cannot specify both --report and --no-report") if logdir is not None: # warn if the directory doesn't exist, but keep on going # (is this the correct behaviour?) if not os.path.isdir(logdir): sys.stderr.write( "trace: WARNING, --logdir directory %s is not available\n" % `logdir`) sys.argv = prog_argv progname = prog_argv[0] if eval(sys.version[:3])>1.3: sys.path[0] = os.path.split(progname)[0] # ??? # everything is ready ignore = Ignore(ignore_modules, ignore_dirs) if trace: t = Trace(ignore) try: run(t.trace, 'execfile(' + `progname` + ')') except IOError, err: _err_exit("Cannot run file %s because: %s" % \ (`sys.argv[0]`, err.strerror)) elif count: t = Coverage(ignore) try: run(t.trace, 'execfile(' + `progname` + ')') except IOError, err: _err_exit("Cannot run file %s because: %s" % \ (`sys.argv[0]`, err.strerror)) except SystemExit: pass results = t.results() # Add another lookup from the program's file name to its import name # This give the right results, but I'm not sure why ... results.modules[progname] = os.path.splitext(progname)[0] if counts_file: # add in archived data, if available try: old_counts, old_modules = marshal.load(open(counts_file, 'rb')) except IOError: pass else: results.update(CoverageResults(old_counts, old_modules)) if not no_report: create_results_log(results, logdir, missing) if counts_file: try: marshal.dump( (results.counts, results.modules), open(counts_file, 'wb')) except IOError, err: _err_exit("Cannot save counts file %s because: %s" % \ (`counts_file`, err.strerror)) elif report: old_counts, old_modules = marshal.load(open(counts_file, 'rb')) results = CoverageResults(old_counts, old_modules) create_results_log(results, logdir, missing) else: assert 0, "Should never get here"
66a7e57c7e8aab2bf187991aa5c2aa5e21b44c2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66a7e57c7e8aab2bf187991aa5c2aa5e21b44c2c/trace.py
"ignore-module=", "ignore-dir="])
"ignore-module=", "ignore-dir=", "coverdir="])
def main(argv = None): import getopt if argv is None: argv = sys.argv try: opts, prog_argv = getopt.getopt(argv[1:], "tcrRf:d:m", ["help", "version", "trace", "count", "report", "no-report", "file=", "logdir=", "missing", "ignore-module=", "ignore-dir="]) except getopt.error, msg: sys.stderr.write("%s: %s\n" % (sys.argv[0], msg)) sys.stderr.write("Try `%s --help' for more information\n" % sys.argv[0]) sys.exit(1) trace = 0 count = 0 report = 0 no_report = 0 counts_file = None logdir = "." missing = 0 ignore_modules = [] ignore_dirs = [] for opt, val in opts: if opt == "--help": usage(sys.stdout) sys.exit(0) if opt == "--version": sys.stdout.write("trace 2.0\n") sys.exit(0) if opt == "-t" or opt == "--trace": trace = 1 continue if opt == "-c" or opt == "--count": count = 1 continue if opt == "-r" or opt == "--report": report = 1 continue if opt == "-R" or opt == "--no-report": no_report = 1 continue if opt == "-f" or opt == "--file": counts_file = val continue if opt == "-d" or opt == "--logdir": logdir = val continue if opt == "-m" or opt == "--missing": missing = 1 continue if opt == "--ignore-module": ignore_modules.append(val) continue if opt == "--ignore-dir": for s in string.split(val, os.pathsep): s = os.path.expandvars(s) # should I also call expanduser? (after all, could use $HOME) s = string.replace(s, "$prefix", os.path.join(sys.prefix, "lib", "python" + sys.version[:3])) s = string.replace(s, "$exec_prefix", os.path.join(sys.exec_prefix, "lib", "python" + sys.version[:3])) s = os.path.normpath(s) ignore_dirs.append(s) continue assert 0, "Should never get here" if len(prog_argv) == 0: _err_exit("missing name of file to run") if count + trace + report > 1: _err_exit("can only specify one of --trace, --count or --report") if count + trace + report == 0: _err_exit("must specify one of --trace, --count or --report") if report and counts_file is None: _err_exit("--report requires a --file") if report and no_report: _err_exit("cannot specify both --report and --no-report") if logdir is not None: # warn if the directory doesn't exist, but keep on going # (is this the correct behaviour?) if not os.path.isdir(logdir): sys.stderr.write( "trace: WARNING, --logdir directory %s is not available\n" % `logdir`) sys.argv = prog_argv progname = prog_argv[0] if eval(sys.version[:3])>1.3: sys.path[0] = os.path.split(progname)[0] # ??? # everything is ready ignore = Ignore(ignore_modules, ignore_dirs) if trace: t = Trace(ignore) try: run(t.trace, 'execfile(' + `progname` + ')') except IOError, err: _err_exit("Cannot run file %s because: %s" % \ (`sys.argv[0]`, err.strerror)) elif count: t = Coverage(ignore) try: run(t.trace, 'execfile(' + `progname` + ')') except IOError, err: _err_exit("Cannot run file %s because: %s" % \ (`sys.argv[0]`, err.strerror)) except SystemExit: pass results = t.results() # Add another lookup from the program's file name to its import name # This give the right results, but I'm not sure why ... results.modules[progname] = os.path.splitext(progname)[0] if counts_file: # add in archived data, if available try: old_counts, old_modules = marshal.load(open(counts_file, 'rb')) except IOError: pass else: results.update(CoverageResults(old_counts, old_modules)) if not no_report: create_results_log(results, logdir, missing) if counts_file: try: marshal.dump( (results.counts, results.modules), open(counts_file, 'wb')) except IOError, err: _err_exit("Cannot save counts file %s because: %s" % \ (`counts_file`, err.strerror)) elif report: old_counts, old_modules = marshal.load(open(counts_file, 'rb')) results = CoverageResults(old_counts, old_modules) create_results_log(results, logdir, missing) else: assert 0, "Should never get here"
66a7e57c7e8aab2bf187991aa5c2aa5e21b44c2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66a7e57c7e8aab2bf187991aa5c2aa5e21b44c2c/trace.py
sys.stderr.write("%s: %s\n" % (sys.argv[0], msg)) sys.stderr.write("Try `%s --help' for more information\n" % sys.argv[0])
print >> sys.stderr, "%s: %s" % (sys.argv[0], msg) print >> sys.stderr, "Try `%s --help' for more information" \ % sys.argv[0]
def main(argv = None): import getopt if argv is None: argv = sys.argv try: opts, prog_argv = getopt.getopt(argv[1:], "tcrRf:d:m", ["help", "version", "trace", "count", "report", "no-report", "file=", "logdir=", "missing", "ignore-module=", "ignore-dir="]) except getopt.error, msg: sys.stderr.write("%s: %s\n" % (sys.argv[0], msg)) sys.stderr.write("Try `%s --help' for more information\n" % sys.argv[0]) sys.exit(1) trace = 0 count = 0 report = 0 no_report = 0 counts_file = None logdir = "." missing = 0 ignore_modules = [] ignore_dirs = [] for opt, val in opts: if opt == "--help": usage(sys.stdout) sys.exit(0) if opt == "--version": sys.stdout.write("trace 2.0\n") sys.exit(0) if opt == "-t" or opt == "--trace": trace = 1 continue if opt == "-c" or opt == "--count": count = 1 continue if opt == "-r" or opt == "--report": report = 1 continue if opt == "-R" or opt == "--no-report": no_report = 1 continue if opt == "-f" or opt == "--file": counts_file = val continue if opt == "-d" or opt == "--logdir": logdir = val continue if opt == "-m" or opt == "--missing": missing = 1 continue if opt == "--ignore-module": ignore_modules.append(val) continue if opt == "--ignore-dir": for s in string.split(val, os.pathsep): s = os.path.expandvars(s) # should I also call expanduser? (after all, could use $HOME) s = string.replace(s, "$prefix", os.path.join(sys.prefix, "lib", "python" + sys.version[:3])) s = string.replace(s, "$exec_prefix", os.path.join(sys.exec_prefix, "lib", "python" + sys.version[:3])) s = os.path.normpath(s) ignore_dirs.append(s) continue assert 0, "Should never get here" if len(prog_argv) == 0: _err_exit("missing name of file to run") if count + trace + report > 1: _err_exit("can only specify one of --trace, --count or --report") if count + trace + report == 0: _err_exit("must specify one of --trace, --count or --report") if report and counts_file is None: _err_exit("--report requires a --file") if report and no_report: _err_exit("cannot specify both --report and --no-report") if logdir is not None: # warn if the directory doesn't exist, but keep on going # (is this the correct behaviour?) if not os.path.isdir(logdir): sys.stderr.write( "trace: WARNING, --logdir directory %s is not available\n" % `logdir`) sys.argv = prog_argv progname = prog_argv[0] if eval(sys.version[:3])>1.3: sys.path[0] = os.path.split(progname)[0] # ??? # everything is ready ignore = Ignore(ignore_modules, ignore_dirs) if trace: t = Trace(ignore) try: run(t.trace, 'execfile(' + `progname` + ')') except IOError, err: _err_exit("Cannot run file %s because: %s" % \ (`sys.argv[0]`, err.strerror)) elif count: t = Coverage(ignore) try: run(t.trace, 'execfile(' + `progname` + ')') except IOError, err: _err_exit("Cannot run file %s because: %s" % \ (`sys.argv[0]`, err.strerror)) except SystemExit: pass results = t.results() # Add another lookup from the program's file name to its import name # This give the right results, but I'm not sure why ... results.modules[progname] = os.path.splitext(progname)[0] if counts_file: # add in archived data, if available try: old_counts, old_modules = marshal.load(open(counts_file, 'rb')) except IOError: pass else: results.update(CoverageResults(old_counts, old_modules)) if not no_report: create_results_log(results, logdir, missing) if counts_file: try: marshal.dump( (results.counts, results.modules), open(counts_file, 'wb')) except IOError, err: _err_exit("Cannot save counts file %s because: %s" % \ (`counts_file`, err.strerror)) elif report: old_counts, old_modules = marshal.load(open(counts_file, 'rb')) results = CoverageResults(old_counts, old_modules) create_results_log(results, logdir, missing) else: assert 0, "Should never get here"
66a7e57c7e8aab2bf187991aa5c2aa5e21b44c2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66a7e57c7e8aab2bf187991aa5c2aa5e21b44c2c/trace.py
create_results_log(results, logdir, missing)
create_results_log(results, logdir, missing, summary=summary, coverdir=coverdir)
def main(argv = None): import getopt if argv is None: argv = sys.argv try: opts, prog_argv = getopt.getopt(argv[1:], "tcrRf:d:m", ["help", "version", "trace", "count", "report", "no-report", "file=", "logdir=", "missing", "ignore-module=", "ignore-dir="]) except getopt.error, msg: sys.stderr.write("%s: %s\n" % (sys.argv[0], msg)) sys.stderr.write("Try `%s --help' for more information\n" % sys.argv[0]) sys.exit(1) trace = 0 count = 0 report = 0 no_report = 0 counts_file = None logdir = "." missing = 0 ignore_modules = [] ignore_dirs = [] for opt, val in opts: if opt == "--help": usage(sys.stdout) sys.exit(0) if opt == "--version": sys.stdout.write("trace 2.0\n") sys.exit(0) if opt == "-t" or opt == "--trace": trace = 1 continue if opt == "-c" or opt == "--count": count = 1 continue if opt == "-r" or opt == "--report": report = 1 continue if opt == "-R" or opt == "--no-report": no_report = 1 continue if opt == "-f" or opt == "--file": counts_file = val continue if opt == "-d" or opt == "--logdir": logdir = val continue if opt == "-m" or opt == "--missing": missing = 1 continue if opt == "--ignore-module": ignore_modules.append(val) continue if opt == "--ignore-dir": for s in string.split(val, os.pathsep): s = os.path.expandvars(s) # should I also call expanduser? (after all, could use $HOME) s = string.replace(s, "$prefix", os.path.join(sys.prefix, "lib", "python" + sys.version[:3])) s = string.replace(s, "$exec_prefix", os.path.join(sys.exec_prefix, "lib", "python" + sys.version[:3])) s = os.path.normpath(s) ignore_dirs.append(s) continue assert 0, "Should never get here" if len(prog_argv) == 0: _err_exit("missing name of file to run") if count + trace + report > 1: _err_exit("can only specify one of --trace, --count or --report") if count + trace + report == 0: _err_exit("must specify one of --trace, --count or --report") if report and counts_file is None: _err_exit("--report requires a --file") if report and no_report: _err_exit("cannot specify both --report and --no-report") if logdir is not None: # warn if the directory doesn't exist, but keep on going # (is this the correct behaviour?) if not os.path.isdir(logdir): sys.stderr.write( "trace: WARNING, --logdir directory %s is not available\n" % `logdir`) sys.argv = prog_argv progname = prog_argv[0] if eval(sys.version[:3])>1.3: sys.path[0] = os.path.split(progname)[0] # ??? # everything is ready ignore = Ignore(ignore_modules, ignore_dirs) if trace: t = Trace(ignore) try: run(t.trace, 'execfile(' + `progname` + ')') except IOError, err: _err_exit("Cannot run file %s because: %s" % \ (`sys.argv[0]`, err.strerror)) elif count: t = Coverage(ignore) try: run(t.trace, 'execfile(' + `progname` + ')') except IOError, err: _err_exit("Cannot run file %s because: %s" % \ (`sys.argv[0]`, err.strerror)) except SystemExit: pass results = t.results() # Add another lookup from the program's file name to its import name # This give the right results, but I'm not sure why ... results.modules[progname] = os.path.splitext(progname)[0] if counts_file: # add in archived data, if available try: old_counts, old_modules = marshal.load(open(counts_file, 'rb')) except IOError: pass else: results.update(CoverageResults(old_counts, old_modules)) if not no_report: create_results_log(results, logdir, missing) if counts_file: try: marshal.dump( (results.counts, results.modules), open(counts_file, 'wb')) except IOError, err: _err_exit("Cannot save counts file %s because: %s" % \ (`counts_file`, err.strerror)) elif report: old_counts, old_modules = marshal.load(open(counts_file, 'rb')) results = CoverageResults(old_counts, old_modules) create_results_log(results, logdir, missing) else: assert 0, "Should never get here"
66a7e57c7e8aab2bf187991aa5c2aa5e21b44c2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66a7e57c7e8aab2bf187991aa5c2aa5e21b44c2c/trace.py
create_results_log(results, logdir, missing)
create_results_log(results, logdir, missing, summary=summary, coverdir=coverdir)
def main(argv = None): import getopt if argv is None: argv = sys.argv try: opts, prog_argv = getopt.getopt(argv[1:], "tcrRf:d:m", ["help", "version", "trace", "count", "report", "no-report", "file=", "logdir=", "missing", "ignore-module=", "ignore-dir="]) except getopt.error, msg: sys.stderr.write("%s: %s\n" % (sys.argv[0], msg)) sys.stderr.write("Try `%s --help' for more information\n" % sys.argv[0]) sys.exit(1) trace = 0 count = 0 report = 0 no_report = 0 counts_file = None logdir = "." missing = 0 ignore_modules = [] ignore_dirs = [] for opt, val in opts: if opt == "--help": usage(sys.stdout) sys.exit(0) if opt == "--version": sys.stdout.write("trace 2.0\n") sys.exit(0) if opt == "-t" or opt == "--trace": trace = 1 continue if opt == "-c" or opt == "--count": count = 1 continue if opt == "-r" or opt == "--report": report = 1 continue if opt == "-R" or opt == "--no-report": no_report = 1 continue if opt == "-f" or opt == "--file": counts_file = val continue if opt == "-d" or opt == "--logdir": logdir = val continue if opt == "-m" or opt == "--missing": missing = 1 continue if opt == "--ignore-module": ignore_modules.append(val) continue if opt == "--ignore-dir": for s in string.split(val, os.pathsep): s = os.path.expandvars(s) # should I also call expanduser? (after all, could use $HOME) s = string.replace(s, "$prefix", os.path.join(sys.prefix, "lib", "python" + sys.version[:3])) s = string.replace(s, "$exec_prefix", os.path.join(sys.exec_prefix, "lib", "python" + sys.version[:3])) s = os.path.normpath(s) ignore_dirs.append(s) continue assert 0, "Should never get here" if len(prog_argv) == 0: _err_exit("missing name of file to run") if count + trace + report > 1: _err_exit("can only specify one of --trace, --count or --report") if count + trace + report == 0: _err_exit("must specify one of --trace, --count or --report") if report and counts_file is None: _err_exit("--report requires a --file") if report and no_report: _err_exit("cannot specify both --report and --no-report") if logdir is not None: # warn if the directory doesn't exist, but keep on going # (is this the correct behaviour?) if not os.path.isdir(logdir): sys.stderr.write( "trace: WARNING, --logdir directory %s is not available\n" % `logdir`) sys.argv = prog_argv progname = prog_argv[0] if eval(sys.version[:3])>1.3: sys.path[0] = os.path.split(progname)[0] # ??? # everything is ready ignore = Ignore(ignore_modules, ignore_dirs) if trace: t = Trace(ignore) try: run(t.trace, 'execfile(' + `progname` + ')') except IOError, err: _err_exit("Cannot run file %s because: %s" % \ (`sys.argv[0]`, err.strerror)) elif count: t = Coverage(ignore) try: run(t.trace, 'execfile(' + `progname` + ')') except IOError, err: _err_exit("Cannot run file %s because: %s" % \ (`sys.argv[0]`, err.strerror)) except SystemExit: pass results = t.results() # Add another lookup from the program's file name to its import name # This give the right results, but I'm not sure why ... results.modules[progname] = os.path.splitext(progname)[0] if counts_file: # add in archived data, if available try: old_counts, old_modules = marshal.load(open(counts_file, 'rb')) except IOError: pass else: results.update(CoverageResults(old_counts, old_modules)) if not no_report: create_results_log(results, logdir, missing) if counts_file: try: marshal.dump( (results.counts, results.modules), open(counts_file, 'wb')) except IOError, err: _err_exit("Cannot save counts file %s because: %s" % \ (`counts_file`, err.strerror)) elif report: old_counts, old_modules = marshal.load(open(counts_file, 'rb')) results = CoverageResults(old_counts, old_modules) create_results_log(results, logdir, missing) else: assert 0, "Should never get here"
66a7e57c7e8aab2bf187991aa5c2aa5e21b44c2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66a7e57c7e8aab2bf187991aa5c2aa5e21b44c2c/trace.py
ckmsg(s, "'continue' not supported inside 'finally' clause")
if sys.platform.startswith('java'): print "'continue' not supported inside 'finally' clause" print "ok" else: ckmsg(s, "'continue' not supported inside 'finally' clause")
def ckmsg(src, msg): try: compile(src, '<fragment>', 'exec') except SyntaxError, e: print e.msg if e.msg == msg: print "ok" else: print "expected:", msg else: print "failed to get expected SyntaxError"
aa3dc456583aaffcccc16da82bb68669264880b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/aa3dc456583aaffcccc16da82bb68669264880b4/test_exceptions.py
test_capi1()
def test_capi1(): try: _testcapi.raise_exception(BadException, 1) except TypeError, err: exc, err, tb = sys.exc_info() co = tb.tb_frame.f_code assert co.co_name == "test_capi1" assert co.co_filename.endswith('test_exceptions.py') else: print "Expected exception"
aa3dc456583aaffcccc16da82bb68669264880b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/aa3dc456583aaffcccc16da82bb68669264880b4/test_exceptions.py
test_capi2()
if not sys.platform.startswith('java'): test_capi1() test_capi2()
def test_capi2(): try: _testcapi.raise_exception(BadException, 0) except RuntimeError, err: exc, err, tb = sys.exc_info() co = tb.tb_frame.f_code assert co.co_name == "__init__" assert co.co_filename.endswith('test_exceptions.py') co2 = tb.tb_frame.f_back.f_code assert co2.co_name == "test_capi2" else: print "Expected exception"
aa3dc456583aaffcccc16da82bb68669264880b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/aa3dc456583aaffcccc16da82bb68669264880b4/test_exceptions.py
self.scriptsfolder = fss.NewAlias()
def makeusermenus(self): m = Wapplication.Menu(self.menubar, "File") newitem = FrameWork.MenuItem(m, "New", "N", 'new') openitem = FrameWork.MenuItem(m, "Open", "O", 'open') FrameWork.Separator(m) closeitem = FrameWork.MenuItem(m, "Close", "W", 'close') saveitem = FrameWork.MenuItem(m, "Save", "S", 'save') saveasitem = FrameWork.MenuItem(m, "Save as", None, 'save_as') FrameWork.Separator(m) saveasappletitem = FrameWork.MenuItem(m, "Save as Applet", None, 'save_as_applet') FrameWork.Separator(m) quititem = FrameWork.MenuItem(m, "Quit", "Q", 'quit') m = Wapplication.Menu(self.menubar, "Edit") undoitem = FrameWork.MenuItem(m, "Undo", 'Z', "undo") FrameWork.Separator(m) cutitem = FrameWork.MenuItem(m, "Cut", 'X', "cut") copyitem = FrameWork.MenuItem(m, "Copy", "C", "copy") pasteitem = FrameWork.MenuItem(m, "Paste", "V", "paste") FrameWork.MenuItem(m, "Clear", None, "clear") FrameWork.Separator(m) selallitem = FrameWork.MenuItem(m, "Select all", "A", "selectall") sellineitem = FrameWork.MenuItem(m, "Select line", "L", "selectline") FrameWork.Separator(m) finditem = FrameWork.MenuItem(m, "Find", "F", "find") findagainitem = FrameWork.MenuItem(m, "Find again", 'G', "findnext") enterselitem = FrameWork.MenuItem(m, "Enter search string", "E", "entersearchstring") replaceitem = FrameWork.MenuItem(m, "Replace", None, "replace") replacefinditem = FrameWork.MenuItem(m, "Replace & find again", 'T', "replacefind") FrameWork.Separator(m) shiftleftitem = FrameWork.MenuItem(m, "Shift left", "[", "shiftleft") shiftrightitem = FrameWork.MenuItem(m, "Shift right", "]", "shiftright") m = Wapplication.Menu(self.menubar, "Python") runitem = FrameWork.MenuItem(m, "Run window", "R", 'run') runselitem = FrameWork.MenuItem(m, "Run selection", None, 'runselection') FrameWork.Separator(m) moditem = FrameWork.MenuItem(m, "Module browser", "M", self.domenu_modulebrowser) FrameWork.Separator(m) mm = FrameWork.SubMenu(m, "Preferences") FrameWork.MenuItem(mm, "Set Scripts folder", None, self.do_setscriptsfolder) FrameWork.MenuItem(mm, "Editor default settings", None, self.do_editorprefs) self.openwindowsmenu = Wapplication.Menu(self.menubar, 'Windows') self.makeopenwindowsmenu() self._menustocheck = [closeitem, saveitem, saveasitem, saveasappletitem, undoitem, cutitem, copyitem, pasteitem, selallitem, sellineitem, finditem, findagainitem, enterselitem, replaceitem, replacefinditem, shiftleftitem, shiftrightitem, runitem, runselitem] prefs = self.getprefs() try: fss, fss_changed = macfs.RawAlias(prefs.scriptsfolder).Resolve() except: path = os.path.join(os.getcwd(), 'Scripts') if not os.path.exists(path): os.mkdir(path) fss = macfs.FSSpec(path) self.scriptsfolder = fss.NewAlias() self.scriptsfoldermodtime = fss.GetDates()[1] else: self.scriptsfolder = fss.NewAlias() self.scriptsfoldermodtime = fss.GetDates()[1] prefs.scriptsfolder = self.scriptsfolder.data self._scripts = {} self.scriptsmenu = None self.makescriptsmenu()
68922f06bf8fecc15c16e911f5f0a58ec6eabc18 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/68922f06bf8fecc15c16e911f5f0a58ec6eabc18/PythonIDEMain.py
cmd = sys.argv[0]
cmd = os.path.basename(sys.argv[0])
def stopped(): print 'pydoc server stopped'
f9b08b8e609916f970dc5ba2e41c9dbe1897240a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f9b08b8e609916f970dc5ba2e41c9dbe1897240a/pydoc.py
db.DB_INIT_LOCK | db.DB_THREAD)
db.DB_INIT_LOCK | db.DB_THREAD | self.envFlags)
def setUp(self): self.filename = self.__class__.__name__ + '.db' homeDir = os.path.join(os.path.dirname(sys.argv[0]), 'db_home') self.homeDir = homeDir try: os.mkdir(homeDir) except os.error: pass self.env = db.DBEnv() self.env.open(homeDir, db.DB_CREATE | db.DB_INIT_MPOOL | db.DB_INIT_LOCK | db.DB_THREAD)
48796c32417750810d9aea2e0cf5695146821f6f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/48796c32417750810d9aea2e0cf5695146821f6f/test_associate.py
def addDataToDB(self, d):
def addDataToDB(self, d, txn=None):
def addDataToDB(self, d): for key, value in musicdata.items(): if type(self.keytype) == type(''): key = "%02d" % key d.put(key, string.join(value, '|'))
48796c32417750810d9aea2e0cf5695146821f6f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/48796c32417750810d9aea2e0cf5695146821f6f/test_associate.py
d.put(key, string.join(value, '|')) def createDB(self):
d.put(key, string.join(value, '|'), txn=txn) def createDB(self, txn=None):
def addDataToDB(self, d): for key, value in musicdata.items(): if type(self.keytype) == type(''): key = "%02d" % key d.put(key, string.join(value, '|'))
48796c32417750810d9aea2e0cf5695146821f6f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/48796c32417750810d9aea2e0cf5695146821f6f/test_associate.py
db.DB_CREATE | db.DB_THREAD)
db.DB_CREATE | db.DB_THREAD | self.dbFlags, txn=txn)
def createDB(self): self.primary = db.DB(self.env) self.primary.set_get_returns_none(2) self.primary.open(self.filename, "primary", self.dbtype, db.DB_CREATE | db.DB_THREAD)
48796c32417750810d9aea2e0cf5695146821f6f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/48796c32417750810d9aea2e0cf5695146821f6f/test_associate.py
db.DB_CREATE | db.DB_THREAD)
db.DB_CREATE | db.DB_THREAD | self.dbFlags)
def test01_associateWithDB(self): if verbose: print '\n', '-=' * 30 print "Running %s.test01_associateWithDB..." % \ self.__class__.__name__
48796c32417750810d9aea2e0cf5695146821f6f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/48796c32417750810d9aea2e0cf5695146821f6f/test_associate.py
db.DB_CREATE | db.DB_THREAD)
db.DB_CREATE | db.DB_THREAD | self.dbFlags)
def test02_associateAfterDB(self): if verbose: print '\n', '-=' * 30 print "Running %s.test02_associateAfterDB..." % \ self.__class__.__name__
48796c32417750810d9aea2e0cf5695146821f6f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/48796c32417750810d9aea2e0cf5695146821f6f/test_associate.py
def finish_test(self, secDB):
def finish_test(self, secDB, txn=None):
def finish_test(self, secDB): # 'Blues' should not be in the secondary database vals = secDB.pget('Blues') assert vals == None, vals
48796c32417750810d9aea2e0cf5695146821f6f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/48796c32417750810d9aea2e0cf5695146821f6f/test_associate.py
vals = secDB.pget('Blues')
vals = secDB.pget('Blues', txn=txn)
def finish_test(self, secDB): # 'Blues' should not be in the secondary database vals = secDB.pget('Blues') assert vals == None, vals
48796c32417750810d9aea2e0cf5695146821f6f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/48796c32417750810d9aea2e0cf5695146821f6f/test_associate.py
vals = secDB.pget('Unknown')
vals = secDB.pget('Unknown', txn=txn)
def finish_test(self, secDB): # 'Blues' should not be in the secondary database vals = secDB.pget('Blues') assert vals == None, vals
48796c32417750810d9aea2e0cf5695146821f6f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/48796c32417750810d9aea2e0cf5695146821f6f/test_associate.py
c = self.getDB().cursor()
c = self.getDB().cursor(txn)
def finish_test(self, secDB): # 'Blues' should not be in the secondary database vals = secDB.pget('Blues') assert vals == None, vals
48796c32417750810d9aea2e0cf5695146821f6f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/48796c32417750810d9aea2e0cf5695146821f6f/test_associate.py
c = secDB.cursor()
c = secDB.cursor(txn)
def finish_test(self, secDB): # 'Blues' should not be in the secondary database vals = secDB.pget('Blues') assert vals == None, vals
48796c32417750810d9aea2e0cf5695146821f6f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/48796c32417750810d9aea2e0cf5695146821f6f/test_associate.py
host = user + ':' + passwd + '@' + host
host = quote(user, safe='') + ':' + quote(passwd, safe='') + '@' + host
def retry_http_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 = user + ':' + passwd + '@' + host newurl = 'http://' + host + selector if data is None: return self.open(newurl) else: return self.open(newurl, data)
afc4f0413ae7c307207772373937b0eb1e0a645b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/afc4f0413ae7c307207772373937b0eb1e0a645b/urllib.py
host = user + ':' + passwd + '@' + host
host = quote(user, safe='') + ':' + quote(passwd, safe='') + '@' + host
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 = user + ':' + passwd + '@' + host newurl = '//' + host + selector return self.open_https(newurl)
afc4f0413ae7c307207772373937b0eb1e0a645b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/afc4f0413ae7c307207772373937b0eb1e0a645b/urllib.py
return self.open_https(newurl)
return self.open_https(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 = user + ':' + passwd + '@' + host newurl = '//' + host + selector return self.open_https(newurl)
afc4f0413ae7c307207772373937b0eb1e0a645b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/afc4f0413ae7c307207772373937b0eb1e0a645b/urllib.py
>>> x = [pickle.PicklingError()] * 2
>>> from pickletools import _Example >>> x = [_Example(42)] * 2
def dis(pickle, out=None, memo=None, indentlevel=4): """Produce a symbolic disassembly of a pickle. 'pickle' is a file-like object, or string, containing a (at least one) pickle. The pickle is disassembled from the current position, through the first STOP opcode encountered. Optional arg 'out' is a file-like object to which the disassembly is printed. It defaults to sys.stdout. Optional arg 'memo' is a Python dict, used as the pickle's memo. It may be mutated by dis(), if the pickle contains PUT or BINPUT opcodes. Passing the same memo object to another dis() call then allows disassembly to proceed across multiple pickles that were all created by the same pickler with the same memo. Ordinarily you don't need to worry about this. Optional arg indentlevel is the number of blanks by which to indent a new MARK level. It defaults to 4. In addition to printing the disassembly, some sanity checks are made: + All embedded opcode arguments "make sense". + Explicit and implicit pop operations have enough items on the stack. + When an opcode implicitly refers to a markobject, a markobject is actually on the stack. + A memo entry isn't referenced before it's defined. + The markobject isn't stored in the memo. + A memo entry isn't redefined. """ # Most of the hair here is for sanity checks, but most of it is needed # anyway to detect when a protocol 0 POP takes a MARK off the stack # (which in turn is needed to indent MARK blocks correctly). stack = [] # crude emulation of unpickler stack if memo is None: memo = {} # crude emulation of unpicker memo maxproto = -1 # max protocol number seen markstack = [] # bytecode positions of MARK opcodes indentchunk = ' ' * indentlevel errormsg = None for opcode, arg, pos in genops(pickle): if pos is not None: print >> out, "%5d:" % pos, line = "%-4s %s%s" % (repr(opcode.code)[1:-1], indentchunk * len(markstack), opcode.name) maxproto = max(maxproto, opcode.proto) before = opcode.stack_before # don't mutate after = opcode.stack_after # don't mutate numtopop = len(before) # See whether a MARK should be popped. markmsg = None if markobject in before or (opcode.name == "POP" and stack and stack[-1] is markobject): assert markobject not in after if __debug__: if markobject in before: assert before[-1] is stackslice if markstack: markpos = markstack.pop() if markpos is None: markmsg = "(MARK at unknown opcode offset)" else: markmsg = "(MARK at %d)" % markpos # Pop everything at and after the topmost markobject. while stack[-1] is not markobject: stack.pop() stack.pop() # Stop later code from popping too much. try: numtopop = before.index(markobject) except ValueError: assert opcode.name == "POP" numtopop = 0 else: errormsg = markmsg = "no MARK exists on stack" # Check for correct memo usage. if opcode.name in ("PUT", "BINPUT", "LONG_BINPUT"): assert arg is not None if arg in memo: errormsg = "memo key %r already defined" % arg elif not stack: errormsg = "stack is empty -- can't store into memo" elif stack[-1] is markobject: errormsg = "can't store markobject in the memo" else: memo[arg] = stack[-1] elif opcode.name in ("GET", "BINGET", "LONG_BINGET"): if arg in memo: assert len(after) == 1 after = [memo[arg]] # for better stack emulation else: errormsg = "memo key %r has never been stored into" % arg if arg is not None or markmsg: # make a mild effort to align arguments line += ' ' * (10 - len(opcode.name)) if arg is not None: line += ' ' + repr(arg) if markmsg: line += ' ' + markmsg print >> out, line if errormsg: # Note that we delayed complaining until the offending opcode # was printed. raise ValueError(errormsg) # Emulate the stack effects. if len(stack) < numtopop: raise ValueError("tries to pop %d items from stack with " "only %d items" % (numtopop, len(stack))) if numtopop: del stack[-numtopop:] if markobject in after: assert markobject not in before markstack.append(pos) stack.extend(after) print >> out, "highest protocol among opcodes =", maxproto if stack: raise ValueError("stack not empty after STOP: %r" % stack)
90718a4eb5a21d903d9cefdb7f8cdb50e847187b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/90718a4eb5a21d903d9cefdb7f8cdb50e847187b/pickletools.py
6: i INST 'pickle PicklingError' (MARK at 5)
6: i INST 'pickletools _Example' (MARK at 5)
def dis(pickle, out=None, memo=None, indentlevel=4): """Produce a symbolic disassembly of a pickle. 'pickle' is a file-like object, or string, containing a (at least one) pickle. The pickle is disassembled from the current position, through the first STOP opcode encountered. Optional arg 'out' is a file-like object to which the disassembly is printed. It defaults to sys.stdout. Optional arg 'memo' is a Python dict, used as the pickle's memo. It may be mutated by dis(), if the pickle contains PUT or BINPUT opcodes. Passing the same memo object to another dis() call then allows disassembly to proceed across multiple pickles that were all created by the same pickler with the same memo. Ordinarily you don't need to worry about this. Optional arg indentlevel is the number of blanks by which to indent a new MARK level. It defaults to 4. In addition to printing the disassembly, some sanity checks are made: + All embedded opcode arguments "make sense". + Explicit and implicit pop operations have enough items on the stack. + When an opcode implicitly refers to a markobject, a markobject is actually on the stack. + A memo entry isn't referenced before it's defined. + The markobject isn't stored in the memo. + A memo entry isn't redefined. """ # Most of the hair here is for sanity checks, but most of it is needed # anyway to detect when a protocol 0 POP takes a MARK off the stack # (which in turn is needed to indent MARK blocks correctly). stack = [] # crude emulation of unpickler stack if memo is None: memo = {} # crude emulation of unpicker memo maxproto = -1 # max protocol number seen markstack = [] # bytecode positions of MARK opcodes indentchunk = ' ' * indentlevel errormsg = None for opcode, arg, pos in genops(pickle): if pos is not None: print >> out, "%5d:" % pos, line = "%-4s %s%s" % (repr(opcode.code)[1:-1], indentchunk * len(markstack), opcode.name) maxproto = max(maxproto, opcode.proto) before = opcode.stack_before # don't mutate after = opcode.stack_after # don't mutate numtopop = len(before) # See whether a MARK should be popped. markmsg = None if markobject in before or (opcode.name == "POP" and stack and stack[-1] is markobject): assert markobject not in after if __debug__: if markobject in before: assert before[-1] is stackslice if markstack: markpos = markstack.pop() if markpos is None: markmsg = "(MARK at unknown opcode offset)" else: markmsg = "(MARK at %d)" % markpos # Pop everything at and after the topmost markobject. while stack[-1] is not markobject: stack.pop() stack.pop() # Stop later code from popping too much. try: numtopop = before.index(markobject) except ValueError: assert opcode.name == "POP" numtopop = 0 else: errormsg = markmsg = "no MARK exists on stack" # Check for correct memo usage. if opcode.name in ("PUT", "BINPUT", "LONG_BINPUT"): assert arg is not None if arg in memo: errormsg = "memo key %r already defined" % arg elif not stack: errormsg = "stack is empty -- can't store into memo" elif stack[-1] is markobject: errormsg = "can't store markobject in the memo" else: memo[arg] = stack[-1] elif opcode.name in ("GET", "BINGET", "LONG_BINGET"): if arg in memo: assert len(after) == 1 after = [memo[arg]] # for better stack emulation else: errormsg = "memo key %r has never been stored into" % arg if arg is not None or markmsg: # make a mild effort to align arguments line += ' ' * (10 - len(opcode.name)) if arg is not None: line += ' ' + repr(arg) if markmsg: line += ' ' + markmsg print >> out, line if errormsg: # Note that we delayed complaining until the offending opcode # was printed. raise ValueError(errormsg) # Emulate the stack effects. if len(stack) < numtopop: raise ValueError("tries to pop %d items from stack with " "only %d items" % (numtopop, len(stack))) if numtopop: del stack[-numtopop:] if markobject in after: assert markobject not in before markstack.append(pos) stack.extend(after) print >> out, "highest protocol among opcodes =", maxproto if stack: raise ValueError("stack not empty after STOP: %r" % stack)
90718a4eb5a21d903d9cefdb7f8cdb50e847187b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/90718a4eb5a21d903d9cefdb7f8cdb50e847187b/pickletools.py
36: S STRING 'args' 44: p PUT 3 47: ( MARK 48: t TUPLE (MARK at 47) 49: s SETITEM 50: b BUILD 51: a APPEND 52: g GET 1 55: a APPEND 56: . STOP
36: S STRING 'value' 45: p PUT 3 48: I INT 42 52: s SETITEM 53: b BUILD 54: a APPEND 55: g GET 1 58: a APPEND 59: . STOP
def dis(pickle, out=None, memo=None, indentlevel=4): """Produce a symbolic disassembly of a pickle. 'pickle' is a file-like object, or string, containing a (at least one) pickle. The pickle is disassembled from the current position, through the first STOP opcode encountered. Optional arg 'out' is a file-like object to which the disassembly is printed. It defaults to sys.stdout. Optional arg 'memo' is a Python dict, used as the pickle's memo. It may be mutated by dis(), if the pickle contains PUT or BINPUT opcodes. Passing the same memo object to another dis() call then allows disassembly to proceed across multiple pickles that were all created by the same pickler with the same memo. Ordinarily you don't need to worry about this. Optional arg indentlevel is the number of blanks by which to indent a new MARK level. It defaults to 4. In addition to printing the disassembly, some sanity checks are made: + All embedded opcode arguments "make sense". + Explicit and implicit pop operations have enough items on the stack. + When an opcode implicitly refers to a markobject, a markobject is actually on the stack. + A memo entry isn't referenced before it's defined. + The markobject isn't stored in the memo. + A memo entry isn't redefined. """ # Most of the hair here is for sanity checks, but most of it is needed # anyway to detect when a protocol 0 POP takes a MARK off the stack # (which in turn is needed to indent MARK blocks correctly). stack = [] # crude emulation of unpickler stack if memo is None: memo = {} # crude emulation of unpicker memo maxproto = -1 # max protocol number seen markstack = [] # bytecode positions of MARK opcodes indentchunk = ' ' * indentlevel errormsg = None for opcode, arg, pos in genops(pickle): if pos is not None: print >> out, "%5d:" % pos, line = "%-4s %s%s" % (repr(opcode.code)[1:-1], indentchunk * len(markstack), opcode.name) maxproto = max(maxproto, opcode.proto) before = opcode.stack_before # don't mutate after = opcode.stack_after # don't mutate numtopop = len(before) # See whether a MARK should be popped. markmsg = None if markobject in before or (opcode.name == "POP" and stack and stack[-1] is markobject): assert markobject not in after if __debug__: if markobject in before: assert before[-1] is stackslice if markstack: markpos = markstack.pop() if markpos is None: markmsg = "(MARK at unknown opcode offset)" else: markmsg = "(MARK at %d)" % markpos # Pop everything at and after the topmost markobject. while stack[-1] is not markobject: stack.pop() stack.pop() # Stop later code from popping too much. try: numtopop = before.index(markobject) except ValueError: assert opcode.name == "POP" numtopop = 0 else: errormsg = markmsg = "no MARK exists on stack" # Check for correct memo usage. if opcode.name in ("PUT", "BINPUT", "LONG_BINPUT"): assert arg is not None if arg in memo: errormsg = "memo key %r already defined" % arg elif not stack: errormsg = "stack is empty -- can't store into memo" elif stack[-1] is markobject: errormsg = "can't store markobject in the memo" else: memo[arg] = stack[-1] elif opcode.name in ("GET", "BINGET", "LONG_BINGET"): if arg in memo: assert len(after) == 1 after = [memo[arg]] # for better stack emulation else: errormsg = "memo key %r has never been stored into" % arg if arg is not None or markmsg: # make a mild effort to align arguments line += ' ' * (10 - len(opcode.name)) if arg is not None: line += ' ' + repr(arg) if markmsg: line += ' ' + markmsg print >> out, line if errormsg: # Note that we delayed complaining until the offending opcode # was printed. raise ValueError(errormsg) # Emulate the stack effects. if len(stack) < numtopop: raise ValueError("tries to pop %d items from stack with " "only %d items" % (numtopop, len(stack))) if numtopop: del stack[-numtopop:] if markobject in after: assert markobject not in before markstack.append(pos) stack.extend(after) print >> out, "highest protocol among opcodes =", maxproto if stack: raise ValueError("stack not empty after STOP: %r" % stack)
90718a4eb5a21d903d9cefdb7f8cdb50e847187b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/90718a4eb5a21d903d9cefdb7f8cdb50e847187b/pickletools.py
5: c GLOBAL 'pickle PicklingError'
5: c GLOBAL 'pickletools _Example'
def dis(pickle, out=None, memo=None, indentlevel=4): """Produce a symbolic disassembly of a pickle. 'pickle' is a file-like object, or string, containing a (at least one) pickle. The pickle is disassembled from the current position, through the first STOP opcode encountered. Optional arg 'out' is a file-like object to which the disassembly is printed. It defaults to sys.stdout. Optional arg 'memo' is a Python dict, used as the pickle's memo. It may be mutated by dis(), if the pickle contains PUT or BINPUT opcodes. Passing the same memo object to another dis() call then allows disassembly to proceed across multiple pickles that were all created by the same pickler with the same memo. Ordinarily you don't need to worry about this. Optional arg indentlevel is the number of blanks by which to indent a new MARK level. It defaults to 4. In addition to printing the disassembly, some sanity checks are made: + All embedded opcode arguments "make sense". + Explicit and implicit pop operations have enough items on the stack. + When an opcode implicitly refers to a markobject, a markobject is actually on the stack. + A memo entry isn't referenced before it's defined. + The markobject isn't stored in the memo. + A memo entry isn't redefined. """ # Most of the hair here is for sanity checks, but most of it is needed # anyway to detect when a protocol 0 POP takes a MARK off the stack # (which in turn is needed to indent MARK blocks correctly). stack = [] # crude emulation of unpickler stack if memo is None: memo = {} # crude emulation of unpicker memo maxproto = -1 # max protocol number seen markstack = [] # bytecode positions of MARK opcodes indentchunk = ' ' * indentlevel errormsg = None for opcode, arg, pos in genops(pickle): if pos is not None: print >> out, "%5d:" % pos, line = "%-4s %s%s" % (repr(opcode.code)[1:-1], indentchunk * len(markstack), opcode.name) maxproto = max(maxproto, opcode.proto) before = opcode.stack_before # don't mutate after = opcode.stack_after # don't mutate numtopop = len(before) # See whether a MARK should be popped. markmsg = None if markobject in before or (opcode.name == "POP" and stack and stack[-1] is markobject): assert markobject not in after if __debug__: if markobject in before: assert before[-1] is stackslice if markstack: markpos = markstack.pop() if markpos is None: markmsg = "(MARK at unknown opcode offset)" else: markmsg = "(MARK at %d)" % markpos # Pop everything at and after the topmost markobject. while stack[-1] is not markobject: stack.pop() stack.pop() # Stop later code from popping too much. try: numtopop = before.index(markobject) except ValueError: assert opcode.name == "POP" numtopop = 0 else: errormsg = markmsg = "no MARK exists on stack" # Check for correct memo usage. if opcode.name in ("PUT", "BINPUT", "LONG_BINPUT"): assert arg is not None if arg in memo: errormsg = "memo key %r already defined" % arg elif not stack: errormsg = "stack is empty -- can't store into memo" elif stack[-1] is markobject: errormsg = "can't store markobject in the memo" else: memo[arg] = stack[-1] elif opcode.name in ("GET", "BINGET", "LONG_BINGET"): if arg in memo: assert len(after) == 1 after = [memo[arg]] # for better stack emulation else: errormsg = "memo key %r has never been stored into" % arg if arg is not None or markmsg: # make a mild effort to align arguments line += ' ' * (10 - len(opcode.name)) if arg is not None: line += ' ' + repr(arg) if markmsg: line += ' ' + markmsg print >> out, line if errormsg: # Note that we delayed complaining until the offending opcode # was printed. raise ValueError(errormsg) # Emulate the stack effects. if len(stack) < numtopop: raise ValueError("tries to pop %d items from stack with " "only %d items" % (numtopop, len(stack))) if numtopop: del stack[-numtopop:] if markobject in after: assert markobject not in before markstack.append(pos) stack.extend(after) print >> out, "highest protocol among opcodes =", maxproto if stack: raise ValueError("stack not empty after STOP: %r" % stack)
90718a4eb5a21d903d9cefdb7f8cdb50e847187b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/90718a4eb5a21d903d9cefdb7f8cdb50e847187b/pickletools.py
35: U SHORT_BINSTRING 'args' 41: q BINPUT 4 43: ) EMPTY_TUPLE 44: s SETITEM 45: b BUILD 46: h BINGET 2 48: e APPENDS (MARK at 3) 49: . STOP
35: U SHORT_BINSTRING 'value' 42: q BINPUT 4 44: K BININT1 42 46: s SETITEM 47: b BUILD 48: h BINGET 2 50: e APPENDS (MARK at 3) 51: . STOP
def dis(pickle, out=None, memo=None, indentlevel=4): """Produce a symbolic disassembly of a pickle. 'pickle' is a file-like object, or string, containing a (at least one) pickle. The pickle is disassembled from the current position, through the first STOP opcode encountered. Optional arg 'out' is a file-like object to which the disassembly is printed. It defaults to sys.stdout. Optional arg 'memo' is a Python dict, used as the pickle's memo. It may be mutated by dis(), if the pickle contains PUT or BINPUT opcodes. Passing the same memo object to another dis() call then allows disassembly to proceed across multiple pickles that were all created by the same pickler with the same memo. Ordinarily you don't need to worry about this. Optional arg indentlevel is the number of blanks by which to indent a new MARK level. It defaults to 4. In addition to printing the disassembly, some sanity checks are made: + All embedded opcode arguments "make sense". + Explicit and implicit pop operations have enough items on the stack. + When an opcode implicitly refers to a markobject, a markobject is actually on the stack. + A memo entry isn't referenced before it's defined. + The markobject isn't stored in the memo. + A memo entry isn't redefined. """ # Most of the hair here is for sanity checks, but most of it is needed # anyway to detect when a protocol 0 POP takes a MARK off the stack # (which in turn is needed to indent MARK blocks correctly). stack = [] # crude emulation of unpickler stack if memo is None: memo = {} # crude emulation of unpicker memo maxproto = -1 # max protocol number seen markstack = [] # bytecode positions of MARK opcodes indentchunk = ' ' * indentlevel errormsg = None for opcode, arg, pos in genops(pickle): if pos is not None: print >> out, "%5d:" % pos, line = "%-4s %s%s" % (repr(opcode.code)[1:-1], indentchunk * len(markstack), opcode.name) maxproto = max(maxproto, opcode.proto) before = opcode.stack_before # don't mutate after = opcode.stack_after # don't mutate numtopop = len(before) # See whether a MARK should be popped. markmsg = None if markobject in before or (opcode.name == "POP" and stack and stack[-1] is markobject): assert markobject not in after if __debug__: if markobject in before: assert before[-1] is stackslice if markstack: markpos = markstack.pop() if markpos is None: markmsg = "(MARK at unknown opcode offset)" else: markmsg = "(MARK at %d)" % markpos # Pop everything at and after the topmost markobject. while stack[-1] is not markobject: stack.pop() stack.pop() # Stop later code from popping too much. try: numtopop = before.index(markobject) except ValueError: assert opcode.name == "POP" numtopop = 0 else: errormsg = markmsg = "no MARK exists on stack" # Check for correct memo usage. if opcode.name in ("PUT", "BINPUT", "LONG_BINPUT"): assert arg is not None if arg in memo: errormsg = "memo key %r already defined" % arg elif not stack: errormsg = "stack is empty -- can't store into memo" elif stack[-1] is markobject: errormsg = "can't store markobject in the memo" else: memo[arg] = stack[-1] elif opcode.name in ("GET", "BINGET", "LONG_BINGET"): if arg in memo: assert len(after) == 1 after = [memo[arg]] # for better stack emulation else: errormsg = "memo key %r has never been stored into" % arg if arg is not None or markmsg: # make a mild effort to align arguments line += ' ' * (10 - len(opcode.name)) if arg is not None: line += ' ' + repr(arg) if markmsg: line += ' ' + markmsg print >> out, line if errormsg: # Note that we delayed complaining until the offending opcode # was printed. raise ValueError(errormsg) # Emulate the stack effects. if len(stack) < numtopop: raise ValueError("tries to pop %d items from stack with " "only %d items" % (numtopop, len(stack))) if numtopop: del stack[-numtopop:] if markobject in after: assert markobject not in before markstack.append(pos) stack.extend(after) print >> out, "highest protocol among opcodes =", maxproto if stack: raise ValueError("stack not empty after STOP: %r" % stack)
90718a4eb5a21d903d9cefdb7f8cdb50e847187b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/90718a4eb5a21d903d9cefdb7f8cdb50e847187b/pickletools.py
self.baseFilename = filename
self.baseFilename = os.path.abspath(filename)
def __init__(self, filename, mode="a"): """ Open the specified file and use it as the stream for logging. """ StreamHandler.__init__(self, open(filename, mode)) self.baseFilename = filename self.mode = mode
4bbab2bde4fa7df27d9b9f04793d53d4754e22b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4bbab2bde4fa7df27d9b9f04793d53d4754e22b4/__init__.py
UpdateEditIdle = "UpdateEditIDLE"
UpdateEditIDLE = "UpdateEditIDLE"
def add_ui(db): x = y = 50 w = 370 h = 300 title = "[ProductName] Setup" # see "Dialog Style Bits" modal = 3 # visible | modal modeless = 1 # visible track_disk_space = 32 add_data(db, 'ActionText', uisample.ActionText) add_data(db, 'UIText', uisample.UIText) # Bitmaps if not os.path.exists(srcdir+r"\PC\python_icon.exe"): raise "Run icons.mak in PC directory" add_data(db, "Binary", [("PythonWin", msilib.Binary(srcdir+r"\PCbuild\installer.bmp")), # 152x328 pixels ("py.ico",msilib.Binary(srcdir+r"\PC\py.ico")), ]) add_data(db, "Icon", [("python_icon.exe", msilib.Binary(srcdir+r"\PC\python_icon.exe"))]) # Scripts # CheckDir sets TargetExists if TARGETDIR exists. # UpdateEditIDLE sets the REGISTRY.tcl component into # the installed/uninstalled state according to both the # Extensions and TclTk features. if os.system("nmake /nologo /c /f msisupport.mak") != 0: raise "'nmake /f msisupport.mak' failed" add_data(db, "Binary", [("Script", msilib.Binary("msisupport.dll"))]) # See "Custom Action Type 1" if msilib.Win64: CheckDir = "CheckDir" UpdateEditIdle = "UpdateEditIDLE" else: CheckDir = "_CheckDir@4" UpdateEditIDLE = "_UpdateEditIDLE@4" add_data(db, "CustomAction", [("CheckDir", 1, "Script", CheckDir)]) if have_tcl: add_data(db, "CustomAction", [("UpdateEditIDLE", 1, "Script", UpdateEditIDLE)]) # UI customization properties add_data(db, "Property", # See "DefaultUIFont Property" [("DefaultUIFont", "DlgFont8"), # See "ErrorDialog Style Bit" ("ErrorDialog", "ErrorDlg"), ("Progress1", "Install"), # modified in maintenance type dlg ("Progress2", "installs"), ("MaintenanceForm_Action", "Repair")]) # Fonts, see "TextStyle Table" add_data(db, "TextStyle", [("DlgFont8", "Tahoma", 9, None, 0), ("DlgFontBold8", "Tahoma", 8, None, 1), #bold ("VerdanaBold10", "Verdana", 10, None, 1), ("VerdanaRed9", "Verdana", 9, 255, 0), ]) compileargs = r"-Wi [TARGETDIR]Lib\compileall.py -f -x badsyntax [TARGETDIR]Lib" # See "CustomAction Table" add_data(db, "CustomAction", [ # msidbCustomActionTypeFirstSequence + msidbCustomActionTypeTextData + msidbCustomActionTypeProperty # See "Custom Action Type 51", # "Custom Action Execution Scheduling Options" ("InitialTargetDir", 307, "TARGETDIR", "[WindowsVolume]Python%s%s" % (major, minor)), ("SetDLLDirToTarget", 307, "DLLDIR", "[TARGETDIR]"), ("SetDLLDirToSystem32", 307, "DLLDIR", SystemFolderName), # msidbCustomActionTypeExe + msidbCustomActionTypeSourceFile # See "Custom Action Type 18" ("CompilePyc", 18, "python.exe", compileargs), ("CompilePyo", 18, "python.exe", "-O "+compileargs), ]) # UI Sequences, see "InstallUISequence Table", "Using a Sequence Table" # Numbers indicate sequence; see sequence.py for how these action integrate add_data(db, "InstallUISequence", [("PrepareDlg", "Not Privileged or Windows9x or Installed", 140), ("WhichUsersDlg", "Privileged and not Windows9x and not Installed", 141), ("InitialTargetDir", 'TARGETDIR=""', 750), # In the user interface, assume all-users installation if privileged. ("SetDLLDirToSystem32", 'DLLDIR="" and ' + sys32cond, 751), ("SetDLLDirToTarget", 'DLLDIR="" and not ' + sys32cond, 752), ("SelectDirectoryDlg", "Not Installed", 1230), # XXX no support for resume installations yet #("ResumeDlg", "Installed AND (RESUME OR Preselected)", 1240), ("MaintenanceTypeDlg", "Installed AND NOT RESUME AND NOT Preselected", 1250), ("ProgressDlg", None, 1280)]) add_data(db, "AdminUISequence", [("InitialTargetDir", 'TARGETDIR=""', 750), ("SetDLLDirToTarget", 'DLLDIR=""', 751), ]) # Execute Sequences add_data(db, "InstallExecuteSequence", [("InitialTargetDir", 'TARGETDIR=""', 750), ("SetDLLDirToSystem32", 'DLLDIR="" and ' + sys32cond, 751), ("SetDLLDirToTarget", 'DLLDIR="" and not ' + sys32cond, 752), ("UpdateEditIDLE", None, 1050), ("CompilePyc", "COMPILEALL", 6800), ("CompilePyo", "COMPILEALL", 6801), ]) add_data(db, "AdminExecuteSequence", [("InitialTargetDir", 'TARGETDIR=""', 750), ("SetDLLDirToTarget", 'DLLDIR=""', 751), ("CompilePyc", "COMPILEALL", 6800), ("CompilePyo", "COMPILEALL", 6801), ]) ##################################################################### # Standard dialogs: FatalError, UserExit, ExitDialog fatal=PyDialog(db, "FatalError", x, y, w, h, modal, title, "Finish", "Finish", "Finish") fatal.title("[ProductName] Installer ended prematurely") fatal.back("< Back", "Finish", active = 0) fatal.cancel("Cancel", "Back", active = 0) fatal.text("Description1", 135, 70, 220, 80, 0x30003, "[ProductName] setup ended prematurely because of an error. Your system has not been modified. To install this program at a later time, please run the installation again.") fatal.text("Description2", 135, 155, 220, 20, 0x30003, "Click the Finish button to exit the Installer.") c=fatal.next("Finish", "Cancel", name="Finish") # See "ControlEvent Table". Parameters are the event, the parameter # to the action, and optionally the condition for the event, and the order # of events. c.event("EndDialog", "Exit") user_exit=PyDialog(db, "UserExit", x, y, w, h, modal, title, "Finish", "Finish", "Finish") user_exit.title("[ProductName] Installer was interrupted") user_exit.back("< Back", "Finish", active = 0) user_exit.cancel("Cancel", "Back", active = 0) user_exit.text("Description1", 135, 70, 220, 80, 0x30003, "[ProductName] setup was interrupted. Your system has not been modified. " "To install this program at a later time, please run the installation again.") user_exit.text("Description2", 135, 155, 220, 20, 0x30003, "Click the Finish button to exit the Installer.") c = user_exit.next("Finish", "Cancel", name="Finish") c.event("EndDialog", "Exit") exit_dialog = PyDialog(db, "ExitDialog", x, y, w, h, modal, title, "Finish", "Finish", "Finish") exit_dialog.title("Completing the [ProductName] Installer") exit_dialog.back("< Back", "Finish", active = 0) exit_dialog.cancel("Cancel", "Back", active = 0) exit_dialog.text("Acknowledgements", 135, 95, 220, 120, 0x30003, "Special Windows thanks to:\n" " LettError, Erik van Blokland, for the \n" " Python for Windows graphic.\n" " http://www.letterror.com/\n" "\n" " Mark Hammond, without whose years of freely \n" " shared Windows expertise, Python for Windows \n" " would still be Python for DOS.") exit_dialog.text("Description", 135, 235, 220, 20, 0x30003, "Click the Finish button to exit the Installer.") c = exit_dialog.next("Finish", "Cancel", name="Finish") c.event("EndDialog", "Return") ##################################################################### # Required dialog: FilesInUse, ErrorDlg inuse = PyDialog(db, "FilesInUse", x, y, w, h, 19, # KeepModeless|Modal|Visible title, "Retry", "Retry", "Retry", bitmap=False) inuse.text("Title", 15, 6, 200, 15, 0x30003, r"{\DlgFontBold8}Files in Use") inuse.text("Description", 20, 23, 280, 20, 0x30003, "Some files that need to be updated are currently in use.") inuse.text("Text", 20, 55, 330, 50, 3, "The following applications are using files that need to be updated by this setup. Close these applications and then click Retry to continue the installation or Cancel to exit it.") inuse.control("List", "ListBox", 20, 107, 330, 130, 7, "FileInUseProcess", None, None, None) c=inuse.back("Exit", "Ignore", name="Exit") c.event("EndDialog", "Exit") c=inuse.next("Ignore", "Retry", name="Ignore") c.event("EndDialog", "Ignore") c=inuse.cancel("Retry", "Exit", name="Retry") c.event("EndDialog","Retry") # See "Error Dialog". See "ICE20" for the required names of the controls. error = Dialog(db, "ErrorDlg", 50, 10, 330, 101, 65543, # Error|Minimize|Modal|Visible title, "ErrorText", None, None) error.text("ErrorText", 50,9,280,48,3, "") error.control("ErrorIcon", "Icon", 15, 9, 24, 24, 5242881, None, "py.ico", None, None) error.pushbutton("N",120,72,81,21,3,"No",None).event("EndDialog","ErrorNo") error.pushbutton("Y",240,72,81,21,3,"Yes",None).event("EndDialog","ErrorYes") error.pushbutton("A",0,72,81,21,3,"Abort",None).event("EndDialog","ErrorAbort") error.pushbutton("C",42,72,81,21,3,"Cancel",None).event("EndDialog","ErrorCancel") error.pushbutton("I",81,72,81,21,3,"Ignore",None).event("EndDialog","ErrorIgnore") error.pushbutton("O",159,72,81,21,3,"Ok",None).event("EndDialog","ErrorOk") error.pushbutton("R",198,72,81,21,3,"Retry",None).event("EndDialog","ErrorRetry") ##################################################################### # Global "Query Cancel" dialog cancel = Dialog(db, "CancelDlg", 50, 10, 260, 85, 3, title, "No", "No", "No") cancel.text("Text", 48, 15, 194, 30, 3, "Are you sure you want to cancel [ProductName] installation?") cancel.control("Icon", "Icon", 15, 15, 24, 24, 5242881, None, "py.ico", None, None) c=cancel.pushbutton("Yes", 72, 57, 56, 17, 3, "Yes", "No") c.event("EndDialog", "Exit") c=cancel.pushbutton("No", 132, 57, 56, 17, 3, "No", "Yes") c.event("EndDialog", "Return") ##################################################################### # Global "Wait for costing" dialog costing = Dialog(db, "WaitForCostingDlg", 50, 10, 260, 85, modal, title, "Return", "Return", "Return") costing.text("Text", 48, 15, 194, 30, 3, "Please wait while the installer finishes determining your disk space requirements.") costing.control("Icon", "Icon", 15, 15, 24, 24, 5242881, None, "py.ico", None, None) c = costing.pushbutton("Return", 102, 57, 56, 17, 3, "Return", None) c.event("EndDialog", "Exit") ##################################################################### # Preparation dialog: no user input except cancellation prep = PyDialog(db, "PrepareDlg", x, y, w, h, modeless, title, "Cancel", "Cancel", "Cancel") prep.text("Description", 135, 70, 220, 40, 0x30003, "Please wait while the Installer prepares to guide you through the installation.") prep.title("Welcome to the [ProductName] Installer") c=prep.text("ActionText", 135, 110, 220, 20, 0x30003, "Pondering...") c.mapping("ActionText", "Text") c=prep.text("ActionData", 135, 135, 220, 30, 0x30003, None) c.mapping("ActionData", "Text") prep.back("Back", None, active=0) prep.next("Next", None, active=0) c=prep.cancel("Cancel", None) c.event("SpawnDialog", "CancelDlg") ##################################################################### # Target directory selection seldlg = PyDialog(db, "SelectDirectoryDlg", x, y, w, h, modal, title, "Next", "Next", "Cancel") seldlg.title("Select Destination Directory") c = seldlg.text("Existing", 135, 25, 235, 30, 0x30003, "{\VerdanaRed9}This update will replace your existing [ProductLine] installation.") c.condition("Hide", 'REMOVEOLDVERSION="" and REMOVEOLDSNAPSHOT=""') seldlg.text("Description", 135, 50, 220, 40, 0x30003, "Please select a directory for the [ProductName] files.") seldlg.back("< Back", None, active=0) c = seldlg.next("Next >", "Cancel") c.event("DoAction", "CheckDir", "TargetExistsOk<>1", order=1) # If the target exists, but we found that we are going to remove old versions, don't bother # confirming that the target directory exists. Strictly speaking, we should determine that # the target directory is indeed the target of the product that we are going to remove, but # I don't know how to do that. c.event("SpawnDialog", "ExistingDirectoryDlg", 'TargetExists=1 and REMOVEOLDVERSION="" and REMOVEOLDSNAPSHOT=""', 2) c.event("SetTargetPath", "TARGETDIR", 'TargetExists=0 or REMOVEOLDVERSION<>"" or REMOVEOLDSNAPSHOT<>""', 3) c.event("SpawnWaitDialog", "WaitForCostingDlg", "CostingComplete=1", 4) c.event("NewDialog", "SelectFeaturesDlg", 'TargetExists=0 or REMOVEOLDVERSION<>"" or REMOVEOLDSNAPSHOT<>""', 5) c = seldlg.cancel("Cancel", "DirectoryCombo") c.event("SpawnDialog", "CancelDlg") seldlg.control("DirectoryCombo", "DirectoryCombo", 135, 70, 172, 80, 393219, "TARGETDIR", None, "DirectoryList", None) seldlg.control("DirectoryList", "DirectoryList", 135, 90, 208, 136, 3, "TARGETDIR", None, "PathEdit", None) seldlg.control("PathEdit", "PathEdit", 135, 230, 206, 16, 3, "TARGETDIR", None, "Next", None) c = seldlg.pushbutton("Up", 306, 70, 18, 18, 3, "Up", None) c.event("DirectoryListUp", "0") c = seldlg.pushbutton("NewDir", 324, 70, 30, 18, 3, "New", None) c.event("DirectoryListNew", "0") ##################################################################### # SelectFeaturesDlg features = PyDialog(db, "SelectFeaturesDlg", x, y, w, h, modal|track_disk_space, title, "Tree", "Next", "Cancel") features.title("Customize [ProductName]") features.text("Description", 135, 35, 220, 15, 0x30003, "Select the way you want features to be installed.") features.text("Text", 135,45,220,30, 3, "Click on the icons in the tree below to change the way features will be installed.") c=features.back("< Back", "Next") c.event("NewDialog", "SelectDirectoryDlg") c=features.next("Next >", "Cancel") c.mapping("SelectionNoItems", "Enabled") c.event("SpawnDialog", "DiskCostDlg", "OutOfDiskSpace=1", order=1) c.event("EndDialog", "Return", "OutOfDiskSpace<>1", order=2) c=features.cancel("Cancel", "Tree") c.event("SpawnDialog", "CancelDlg") # The browse property is not used, since we have only a single target path (selected already) features.control("Tree", "SelectionTree", 135, 75, 220, 95, 7, "_BrowseProperty", "Tree of selections", "Back", None) #c=features.pushbutton("Reset", 42, 243, 56, 17, 3, "Reset", "DiskCost") #c.mapping("SelectionNoItems", "Enabled") #c.event("Reset", "0") features.control("Box", "GroupBox", 135, 170, 225, 90, 1, None, None, None, None) c=features.xbutton("DiskCost", "Disk &Usage", None, 0.10) c.mapping("SelectionNoItems","Enabled") c.event("SpawnDialog", "DiskCostDlg") c=features.xbutton("Advanced", "Advanced", None, 0.30) c.event("SpawnDialog", "AdvancedDlg") c=features.text("ItemDescription", 140, 180, 210, 30, 3, "Multiline description of the currently selected item.") c.mapping("SelectionDescription","Text") c=features.text("ItemSize", 140, 210, 210, 45, 3, "The size of the currently selected item.") c.mapping("SelectionSize", "Text") ##################################################################### # Disk cost cost = PyDialog(db, "DiskCostDlg", x, y, w, h, modal, title, "OK", "OK", "OK", bitmap=False) cost.text("Title", 15, 6, 200, 15, 0x30003, "{\DlgFontBold8}Disk Space Requirements") cost.text("Description", 20, 20, 280, 20, 0x30003, "The disk space required for the installation of the selected features.") cost.text("Text", 20, 53, 330, 60, 3, "The highlighted volumes (if any) do not have enough disk space " "available for the currently selected features. You can either " "remove some files from the highlighted volumes, or choose to " "install less features onto local drive(s), or select different " "destination drive(s).") cost.control("VolumeList", "VolumeCostList", 20, 100, 330, 150, 393223, None, "{120}{70}{70}{70}{70}", None, None) cost.xbutton("OK", "Ok", None, 0.5).event("EndDialog", "Return") ##################################################################### # WhichUsers Dialog. Only available on NT, and for privileged users. # This must be run before FindRelatedProducts, because that will # take into account whether the previous installation was per-user # or per-machine. We currently don't support going back to this # dialog after "Next" was selected; to support this, we would need to # find how to reset the ALLUSERS property, and how to re-run # FindRelatedProducts. # On Windows9x, the ALLUSERS property is ignored on the command line # and in the Property table, but installer fails according to the documentation # if a dialog attempts to set ALLUSERS. whichusers = PyDialog(db, "WhichUsersDlg", x, y, w, h, modal, title, "AdminInstall", "Next", "Cancel") whichusers.title("Select whether to install [ProductName] for all users of this computer.") # A radio group with two options: allusers, justme g = whichusers.radiogroup("AdminInstall", 135, 60, 160, 50, 3, "WhichUsers", "", "Next") g.add("ALL", 0, 5, 150, 20, "Install for all users") g.add("JUSTME", 0, 25, 150, 20, "Install just for me") whichusers.back("Back", None, active=0) c = whichusers.next("Next >", "Cancel") c.event("[ALLUSERS]", "1", 'WhichUsers="ALL"', 1) c.event("EndDialog", "Return", order = 2) c = whichusers.cancel("Cancel", "AdminInstall") c.event("SpawnDialog", "CancelDlg") ##################################################################### # Advanced Dialog. advanced = PyDialog(db, "AdvancedDlg", x, y, w, h, modal, title, "CompilePyc", "Next", "Cancel") advanced.title("Advanced Options for [ProductName]") # A radio group with two options: allusers, justme advanced.checkbox("CompilePyc", 135, 60, 230, 50, 3, "COMPILEALL", "Compile .py files to byte code after installation", "Next") c = advanced.next("Finish", "Cancel") c.event("EndDialog", "Return") c = advanced.cancel("Cancel", "CompilePyc") c.event("SpawnDialog", "CancelDlg") ##################################################################### # Existing Directory dialog dlg = Dialog(db, "ExistingDirectoryDlg", 50, 30, 200, 80, modal, title, "No", "No", "No") dlg.text("Title", 10, 20, 180, 40, 3, "[TARGETDIR] exists. Are you sure you want to overwrite existing files?") c=dlg.pushbutton("Yes", 30, 60, 55, 17, 3, "Yes", "No") c.event("[TargetExists]", "0", order=1) c.event("[TargetExistsOk]", "1", order=2) c.event("EndDialog", "Return", order=3) c=dlg.pushbutton("No", 115, 60, 55, 17, 3, "No", "Yes") c.event("EndDialog", "Return") ##################################################################### # Installation Progress dialog (modeless) progress = PyDialog(db, "ProgressDlg", x, y, w, h, modeless, title, "Cancel", "Cancel", "Cancel", bitmap=False) progress.text("Title", 20, 15, 200, 15, 0x30003, "{\DlgFontBold8}[Progress1] [ProductName]") progress.text("Text", 35, 65, 300, 30, 3, "Please wait while the Installer [Progress2] [ProductName]. " "This may take several minutes.") progress.text("StatusLabel", 35, 100, 35, 20, 3, "Status:") c=progress.text("ActionText", 70, 100, w-70, 20, 3, "Pondering...") c.mapping("ActionText", "Text") #c=progress.text("ActionData", 35, 140, 300, 20, 3, None) #c.mapping("ActionData", "Text") c=progress.control("ProgressBar", "ProgressBar", 35, 120, 300, 10, 65537, None, "Progress done", None, None) c.mapping("SetProgress", "Progress") progress.back("< Back", "Next", active=False) progress.next("Next >", "Cancel", active=False) progress.cancel("Cancel", "Back").event("SpawnDialog", "CancelDlg") # Maintenance type: repair/uninstall maint = PyDialog(db, "MaintenanceTypeDlg", x, y, w, h, modal, title, "Next", "Next", "Cancel") maint.title("Welcome to the [ProductName] Setup Wizard") maint.text("BodyText", 135, 63, 230, 42, 3, "Select whether you want to repair or remove [ProductName].") g=maint.radiogroup("RepairRadioGroup", 135, 108, 230, 60, 3, "MaintenanceForm_Action", "", "Next") g.add("Change", 0, 0, 200, 17, "&Change [ProductName]") g.add("Repair", 0, 18, 200, 17, "&Repair [ProductName]") g.add("Remove", 0, 36, 200, 17, "Re&move [ProductName]") maint.back("< Back", None, active=False) c=maint.next("Finish", "Cancel") # Change installation: Change progress dialog to "Change", then ask # for feature selection c.event("[Progress1]", "Change", 'MaintenanceForm_Action="Change"', 1) c.event("[Progress2]", "changes", 'MaintenanceForm_Action="Change"', 2) # Reinstall: Change progress dialog to "Repair", then invoke reinstall # Also set list of reinstalled features to "ALL" c.event("[REINSTALL]", "ALL", 'MaintenanceForm_Action="Repair"', 5) c.event("[Progress1]", "Repairing", 'MaintenanceForm_Action="Repair"', 6) c.event("[Progress2]", "repairs", 'MaintenanceForm_Action="Repair"', 7) c.event("Reinstall", "ALL", 'MaintenanceForm_Action="Repair"', 8) # Uninstall: Change progress to "Remove", then invoke uninstall # Also set list of removed features to "ALL" c.event("[REMOVE]", "ALL", 'MaintenanceForm_Action="Remove"', 11) c.event("[Progress1]", "Removing", 'MaintenanceForm_Action="Remove"', 12) c.event("[Progress2]", "removes", 'MaintenanceForm_Action="Remove"', 13) c.event("Remove", "ALL", 'MaintenanceForm_Action="Remove"', 14) # Close dialog when maintenance action scheduled c.event("EndDialog", "Return", 'MaintenanceForm_Action<>"Change"', 20) c.event("NewDialog", "SelectFeaturesDlg", 'MaintenanceForm_Action="Change"', 21) maint.cancel("Cancel", "RepairRadioGroup").event("SpawnDialog", "CancelDlg")
df40ce3646a4bd099b10a5b92e7333e0141fef7e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/df40ce3646a4bd099b10a5b92e7333e0141fef7e/msi.py
return (action, pattern, dir, dir_pattern)
return (action, patterns, dir, dir_pattern)
def _parse_template_line (self, line): words = string.split (line) action = words[0]
d5dcc174b0b8d3bef3e51b64f6fb1383e803cdd0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d5dcc174b0b8d3bef3e51b64f6fb1383e803cdd0/filelist.py
epoch = time.gmtime(0)[0]
gm_epoch = time.gmtime(0)[0:3] loc_epoch = time.localtime(0)[0:3]
def test_formatdate(self): now = 1005327232.109884 epoch = time.gmtime(0)[0] # When does the epoch start? if epoch == 1970: # traditional Unix epoch matchdate = 'Fri, 09 Nov 2001 17:33:52 -0000' elif epoch == 1904: # Mac epoch matchdate = 'Sat, 09 Nov 1935 16:33:52 -0000' else: matchdate = "I don't understand your epoch" gdate = Utils.formatdate(now) self.assertEqual(gdate, matchdate)
e274864004995f7b8b80abe1cea61b5ec8111ad7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e274864004995f7b8b80abe1cea61b5ec8111ad7/test_email.py
if epoch == 1970:
if gm_epoch == (1970, 1, 1):
def test_formatdate(self): now = 1005327232.109884 epoch = time.gmtime(0)[0] # When does the epoch start? if epoch == 1970: # traditional Unix epoch matchdate = 'Fri, 09 Nov 2001 17:33:52 -0000' elif epoch == 1904: # Mac epoch matchdate = 'Sat, 09 Nov 1935 16:33:52 -0000' else: matchdate = "I don't understand your epoch" gdate = Utils.formatdate(now) self.assertEqual(gdate, matchdate)
e274864004995f7b8b80abe1cea61b5ec8111ad7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e274864004995f7b8b80abe1cea61b5ec8111ad7/test_email.py
elif epoch == 1904:
elif loc_epoch == (1904, 1, 1):
def test_formatdate(self): now = 1005327232.109884 epoch = time.gmtime(0)[0] # When does the epoch start? if epoch == 1970: # traditional Unix epoch matchdate = 'Fri, 09 Nov 2001 17:33:52 -0000' elif epoch == 1904: # Mac epoch matchdate = 'Sat, 09 Nov 1935 16:33:52 -0000' else: matchdate = "I don't understand your epoch" gdate = Utils.formatdate(now) self.assertEqual(gdate, matchdate)
e274864004995f7b8b80abe1cea61b5ec8111ad7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e274864004995f7b8b80abe1cea61b5ec8111ad7/test_email.py
if self.runtime_library_dirs:
if runtime_library_dirs:
def link_shared_object (self, objects, output_filename, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, debug=0, extra_preargs=None, extra_postargs=None):
f70c6031495f885839f077f06858b33cd0c04d2b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f70c6031495f885839f077f06858b33cd0c04d2b/msvccompiler.py
if type (output_dir) not in (StringType, NoneType): raise TypeError, "'output_dir' must be a string or None"
def link_shared_object (self, objects, output_filename, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, debug=0, extra_preargs=None, extra_postargs=None):
f70c6031495f885839f077f06858b33cd0c04d2b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f70c6031495f885839f077f06858b33cd0c04d2b/msvccompiler.py
if not self._dict['Download-URL']: return "%s: This package needs to be installed manually (no Download-URL field)" % _fmtpackagename(self)
if not self._dict.get('Download-URL'): return "%s: This package needs to be installed manually (no Download-URL field)" % self.fullname()
def installSinglePackage(self, output=None): """Download, unpack and install a single package. If output is given it should be a file-like object and it will receive a log of what happened.""" if not self._dict['Download-URL']: return "%s: This package needs to be installed manually (no Download-URL field)" % _fmtpackagename(self) msg = self.downloadPackageOnly(output) if msg: return "%s: download: %s" % (self.fullname(), msg) msg = self.unpackPackageOnly(output) if msg: return "%s: unpack: %s" % (self.fullname(), msg) return self.installPackageOnly(output)
749f481478023f3aea9c2e7456240e84d8efe188 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/749f481478023f3aea9c2e7456240e84d8efe188/pimp.py
origin_req_host = cookielib.request_host(self)
origin_req_host = request_host(self)
def __init__(self, url, data=None, headers={}, origin_req_host=None, unverifiable=False): # unwrap('<URL:type://host/path>') --> 'type://host/path' self.__original = unwrap(url) self.type = None # self.__r_type is what's left after doing the splittype self.host = None self.port = None self.data = data self.headers = {} for key, value in headers.items(): self.add_header(key, value) self.unredirected_hdrs = {} if origin_req_host is None: origin_req_host = cookielib.request_host(self) self.origin_req_host = origin_req_host self.unverifiable = unverifiable
9d6da3e2f29344598178243bb519bc68ad8045b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9d6da3e2f29344598178243bb519bc68ad8045b4/urllib2.py
if inspect.isclass(check):
if isclass(check):
def build_opener(*handlers): """Create an opener object from a list of handlers. The opener will use several default handlers, including support for HTTP and FTP. If any of the handlers passed as arguments are subclasses of the default handlers, the default handlers will not be used. """ opener = OpenerDirector() default_classes = [ProxyHandler, UnknownHandler, HTTPHandler, HTTPDefaultErrorHandler, HTTPRedirectHandler, FTPHandler, FileHandler, HTTPErrorProcessor] if hasattr(httplib, 'HTTPS'): default_classes.append(HTTPSHandler) skip = [] for klass in default_classes: for check in handlers: if inspect.isclass(check): if issubclass(check, klass): skip.append(klass) elif isinstance(check, klass): skip.append(klass) for klass in skip: default_classes.remove(klass) for klass in default_classes: opener.add_handler(klass()) for h in handlers: if inspect.isclass(h): h = h() opener.add_handler(h) return opener
9d6da3e2f29344598178243bb519bc68ad8045b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9d6da3e2f29344598178243bb519bc68ad8045b4/urllib2.py
if inspect.isclass(h):
if isclass(h):
def build_opener(*handlers): """Create an opener object from a list of handlers. The opener will use several default handlers, including support for HTTP and FTP. If any of the handlers passed as arguments are subclasses of the default handlers, the default handlers will not be used. """ opener = OpenerDirector() default_classes = [ProxyHandler, UnknownHandler, HTTPHandler, HTTPDefaultErrorHandler, HTTPRedirectHandler, FTPHandler, FileHandler, HTTPErrorProcessor] if hasattr(httplib, 'HTTPS'): default_classes.append(HTTPSHandler) skip = [] for klass in default_classes: for check in handlers: if inspect.isclass(check): if issubclass(check, klass): skip.append(klass) elif isinstance(check, klass): skip.append(klass) for klass in skip: default_classes.remove(klass) for klass in default_classes: opener.add_handler(klass()) for h in handlers: if inspect.isclass(h): h = h() opener.add_handler(h) return opener
9d6da3e2f29344598178243bb519bc68ad8045b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9d6da3e2f29344598178243bb519bc68ad8045b4/urllib2.py
default_startupinfo = STARTUPINFO()
def _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite): """Execute program (MS Windows version)"""
ad62489e4706ec4ad6cf24a067969e8d64612fcb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ad62489e4706ec4ad6cf24a067969e8d64612fcb/subprocess.py
startupinfo = default_startupinfo if not None in (p2cread, c2pwrite, errwrite):
startupinfo = STARTUPINFO() if None not in (p2cread, c2pwrite, errwrite):
def _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite): """Execute program (MS Windows version)"""
ad62489e4706ec4ad6cf24a067969e8d64612fcb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ad62489e4706ec4ad6cf24a067969e8d64612fcb/subprocess.py
default_startupinfo.dwFlags |= STARTF_USESHOWWINDOW default_startupinfo.wShowWindow = SW_HIDE
startupinfo.dwFlags |= STARTF_USESHOWWINDOW startupinfo.wShowWindow = SW_HIDE
def _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite): """Execute program (MS Windows version)"""
ad62489e4706ec4ad6cf24a067969e8d64612fcb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ad62489e4706ec4ad6cf24a067969e8d64612fcb/subprocess.py
self.checkequal(('this', ' is ', 'the partition method'), 'this is the partition method', 'partition', ' is ')
self.checkequal(('this is the par', 'ti', 'tion method'), 'this is the partition method', 'partition', 'ti')
def test_partition(self):
9c0e9c089c758bc9b64f0379bc93f8ea6740eb53 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9c0e9c089c758bc9b64f0379bc93f8ea6740eb53/string_tests.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
345df170e6bc8daf8cd3687a167a910d7e4f593a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/345df170e6bc8daf8cd3687a167a910d7e4f593a/freeze.py
self.assert_(len(items) == 0, "iterator did not touch all items")
self.assert_(len(items) == 0, "iteritems() did not touch all items")
def check_iters(self, dict): # item iterator: items = dict.items() for item in dict.iteritems(): items.remove(item) self.assert_(len(items) == 0, "iterator did not touch all items")
aaa48ff5c90dc0d9d6ab5c91392e02287a1133e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/aaa48ff5c90dc0d9d6ab5c91392e02287a1133e7/test_weakref.py
self.assert_(len(keys) == 0, "iterator did not touch all keys")
self.assert_(len(keys) == 0, "__iter__() did not touch all keys") keys = dict.keys() for k in dict.iterkeys(): keys.remove(k) self.assert_(len(keys) == 0, "iterkeys() did not touch all keys")
def check_iters(self, dict): # item iterator: items = dict.items() for item in dict.iteritems(): items.remove(item) self.assert_(len(items) == 0, "iterator did not touch all items")
aaa48ff5c90dc0d9d6ab5c91392e02287a1133e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/aaa48ff5c90dc0d9d6ab5c91392e02287a1133e7/test_weakref.py
self.assert_(len(values) == 0, "iterator did not touch all values")
self.assert_(len(values) == 0, "itervalues() did not touch all values")
def check_iters(self, dict): # item iterator: items = dict.items() for item in dict.iteritems(): items.remove(item) self.assert_(len(items) == 0, "iterator did not touch all items")
aaa48ff5c90dc0d9d6ab5c91392e02287a1133e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/aaa48ff5c90dc0d9d6ab5c91392e02287a1133e7/test_weakref.py
underline=0,indicatoron=FALSE,highlightthickness=0,
indicatoron=FALSE,highlightthickness=0,
def __init__(self,parent): Frame.__init__(self, parent,borderwidth=2,relief=RIDGE) self.button=Radiobutton(self,padx=5,pady=5,takefocus=FALSE, underline=0,indicatoron=FALSE,highlightthickness=0, borderwidth=0,selectcolor=self.cget('bg')) self.button.pack()
361cfcd69b62b37acebe99417fa13a1e62a1ca7b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/361cfcd69b62b37acebe99417fa13a1e62a1ca7b/tabpage.py
def __init__(self,parent,pageNames,**kw):
def __init__(self,parent,pageNames=[],**kw):
def __init__(self,parent,pageNames,**kw): """ pageNames - a list of strings, each string will be the dictionary key to a page's data, and the name displayed on the page's tab. Should be specified in desired page order. The first page will be the default and first active page. """ Frame.__init__(self, parent, kw) self.grid_location(0,0) self.columnconfigure(0,weight=1) self.rowconfigure(1,weight=1) self.tabBar=Frame(self) self.tabBar.grid(row=0,column=0,sticky=EW) self.activePage=StringVar(self) self.defaultPage='' self.pages={} for name in pageNames: self.AddPage(name)
361cfcd69b62b37acebe99417fa13a1e62a1ca7b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/361cfcd69b62b37acebe99417fa13a1e62a1ca7b/tabpage.py
filename = fp.read(centdir[12])
filename = fp.read(centdir[_CD_FILENAME_LENGTH])
def _GetContents(self): """Read in the table of contents for the ZIP file.""" fp = self.fp fp.seek(-22, 2) # Start of end-of-archive record filesize = fp.tell() + 22 # Get file size endrec = fp.read(22) # Archive must not end with a comment! if endrec[0:4] != stringEndArchive or endrec[-2:] != "\000\000": raise BadZipfile, "File is not a zip file, or ends with a comment" endrec = struct.unpack(structEndArchive, endrec) if self.debug > 1: print endrec size_cd = endrec[5] # bytes in central directory offset_cd = endrec[6] # offset of central directory x = filesize - 22 - size_cd # "concat" is zero, unless zip was concatenated to another file concat = x - offset_cd if self.debug > 2: print "given, inferred, offset", offset_cd, x, concat # self.start_dir: Position of start of central directory self.start_dir = offset_cd + concat fp.seek(self.start_dir, 0) total = 0 while total < size_cd: centdir = fp.read(46) total = total + 46 if centdir[0:4] != stringCentralDir: raise BadZipfile, "Bad magic number for central directory" centdir = struct.unpack(structCentralDir, centdir) if self.debug > 2: print centdir filename = fp.read(centdir[12]) # Create ZipInfo instance to store file information x = ZipInfo(filename) x.extra = fp.read(centdir[13]) x.comment = fp.read(centdir[14]) total = total + centdir[12] + centdir[13] + centdir[14] x.header_offset = centdir[18] + concat x.file_offset = x.header_offset + 30 + centdir[12] + centdir[13] (x.create_version, x.create_system, x.extract_version, x.reserved, x.flag_bits, x.compress_type, t, d, x.CRC, x.compress_size, x.file_size) = centdir[1:12] x.volume, x.internal_attr, x.external_attr = centdir[15:18] # Convert date/time code to (year, month, day, hour, min, sec) x.date_time = ( (d>>9)+1980, (d>>5)&0xF, d&0x1F, t>>11, (t>>5)&0x3F, (t&0x1F) * 2 ) self.filelist.append(x) self.NameToInfo[x.filename] = x if self.debug > 2: print "total", total for data in self.filelist: fp.seek(data.header_offset, 0) fheader = fp.read(30) if fheader[0:4] != stringFileHeader: raise BadZipfile, "Bad magic number for file header" fheader = struct.unpack(structFileHeader, fheader) fname = fp.read(fheader[10]) if fname != data.filename: raise RuntimeError, \ 'File name in directory "%s" and header "%s" differ.' % ( data.filename, fname)
3e038e5e2551df9d37e1d44f7cc59cdce797f1a3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3e038e5e2551df9d37e1d44f7cc59cdce797f1a3/zipfile.py
x.extra = fp.read(centdir[13]) x.comment = fp.read(centdir[14]) total = total + centdir[12] + centdir[13] + centdir[14] x.header_offset = centdir[18] + concat x.file_offset = x.header_offset + 30 + centdir[12] + centdir[13]
x.extra = fp.read(centdir[_CD_EXTRA_FIELD_LENGTH]) x.comment = fp.read(centdir[_CD_COMMENT_LENGTH]) total = (total + centdir[_CD_FILENAME_LENGTH] + centdir[_CD_EXTRA_FIELD_LENGTH] + centdir[_CD_COMMENT_LENGTH]) x.header_offset = centdir[_CD_LOCAL_HEADER_OFFSET] + concat
def _GetContents(self): """Read in the table of contents for the ZIP file.""" fp = self.fp fp.seek(-22, 2) # Start of end-of-archive record filesize = fp.tell() + 22 # Get file size endrec = fp.read(22) # Archive must not end with a comment! if endrec[0:4] != stringEndArchive or endrec[-2:] != "\000\000": raise BadZipfile, "File is not a zip file, or ends with a comment" endrec = struct.unpack(structEndArchive, endrec) if self.debug > 1: print endrec size_cd = endrec[5] # bytes in central directory offset_cd = endrec[6] # offset of central directory x = filesize - 22 - size_cd # "concat" is zero, unless zip was concatenated to another file concat = x - offset_cd if self.debug > 2: print "given, inferred, offset", offset_cd, x, concat # self.start_dir: Position of start of central directory self.start_dir = offset_cd + concat fp.seek(self.start_dir, 0) total = 0 while total < size_cd: centdir = fp.read(46) total = total + 46 if centdir[0:4] != stringCentralDir: raise BadZipfile, "Bad magic number for central directory" centdir = struct.unpack(structCentralDir, centdir) if self.debug > 2: print centdir filename = fp.read(centdir[12]) # Create ZipInfo instance to store file information x = ZipInfo(filename) x.extra = fp.read(centdir[13]) x.comment = fp.read(centdir[14]) total = total + centdir[12] + centdir[13] + centdir[14] x.header_offset = centdir[18] + concat x.file_offset = x.header_offset + 30 + centdir[12] + centdir[13] (x.create_version, x.create_system, x.extract_version, x.reserved, x.flag_bits, x.compress_type, t, d, x.CRC, x.compress_size, x.file_size) = centdir[1:12] x.volume, x.internal_attr, x.external_attr = centdir[15:18] # Convert date/time code to (year, month, day, hour, min, sec) x.date_time = ( (d>>9)+1980, (d>>5)&0xF, d&0x1F, t>>11, (t>>5)&0x3F, (t&0x1F) * 2 ) self.filelist.append(x) self.NameToInfo[x.filename] = x if self.debug > 2: print "total", total for data in self.filelist: fp.seek(data.header_offset, 0) fheader = fp.read(30) if fheader[0:4] != stringFileHeader: raise BadZipfile, "Bad magic number for file header" fheader = struct.unpack(structFileHeader, fheader) fname = fp.read(fheader[10]) if fname != data.filename: raise RuntimeError, \ 'File name in directory "%s" and header "%s" differ.' % ( data.filename, fname)
3e038e5e2551df9d37e1d44f7cc59cdce797f1a3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3e038e5e2551df9d37e1d44f7cc59cdce797f1a3/zipfile.py
fname = fp.read(fheader[10])
data.file_offset = (data.header_offset + 30 + fheader[_FH_FILENAME_LENGTH] + fheader[_FH_EXTRA_FIELD_LENGTH]) fname = fp.read(fheader[_FH_FILENAME_LENGTH])
def _GetContents(self): """Read in the table of contents for the ZIP file.""" fp = self.fp fp.seek(-22, 2) # Start of end-of-archive record filesize = fp.tell() + 22 # Get file size endrec = fp.read(22) # Archive must not end with a comment! if endrec[0:4] != stringEndArchive or endrec[-2:] != "\000\000": raise BadZipfile, "File is not a zip file, or ends with a comment" endrec = struct.unpack(structEndArchive, endrec) if self.debug > 1: print endrec size_cd = endrec[5] # bytes in central directory offset_cd = endrec[6] # offset of central directory x = filesize - 22 - size_cd # "concat" is zero, unless zip was concatenated to another file concat = x - offset_cd if self.debug > 2: print "given, inferred, offset", offset_cd, x, concat # self.start_dir: Position of start of central directory self.start_dir = offset_cd + concat fp.seek(self.start_dir, 0) total = 0 while total < size_cd: centdir = fp.read(46) total = total + 46 if centdir[0:4] != stringCentralDir: raise BadZipfile, "Bad magic number for central directory" centdir = struct.unpack(structCentralDir, centdir) if self.debug > 2: print centdir filename = fp.read(centdir[12]) # Create ZipInfo instance to store file information x = ZipInfo(filename) x.extra = fp.read(centdir[13]) x.comment = fp.read(centdir[14]) total = total + centdir[12] + centdir[13] + centdir[14] x.header_offset = centdir[18] + concat x.file_offset = x.header_offset + 30 + centdir[12] + centdir[13] (x.create_version, x.create_system, x.extract_version, x.reserved, x.flag_bits, x.compress_type, t, d, x.CRC, x.compress_size, x.file_size) = centdir[1:12] x.volume, x.internal_attr, x.external_attr = centdir[15:18] # Convert date/time code to (year, month, day, hour, min, sec) x.date_time = ( (d>>9)+1980, (d>>5)&0xF, d&0x1F, t>>11, (t>>5)&0x3F, (t&0x1F) * 2 ) self.filelist.append(x) self.NameToInfo[x.filename] = x if self.debug > 2: print "total", total for data in self.filelist: fp.seek(data.header_offset, 0) fheader = fp.read(30) if fheader[0:4] != stringFileHeader: raise BadZipfile, "Bad magic number for file header" fheader = struct.unpack(structFileHeader, fheader) fname = fp.read(fheader[10]) if fname != data.filename: raise RuntimeError, \ 'File name in directory "%s" and header "%s" differ.' % ( data.filename, fname)
3e038e5e2551df9d37e1d44f7cc59cdce797f1a3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3e038e5e2551df9d37e1d44f7cc59cdce797f1a3/zipfile.py
ext_modules=[Extension('struct', ['structmodule.c'])],
ext_modules=[Extension('_struct', ['_struct.c'])],
def main(): # turn off warnings when deprecated modules are imported import warnings warnings.filterwarnings("ignore",category=DeprecationWarning) setup(# PyPI Metadata (PEP 301) name = "Python", version = sys.version.split()[0], url = "http://www.python.org/%s" % sys.version[:3], maintainer = "Guido van Rossum and the Python community", maintainer_email = "[email protected]", description = "A high-level object-oriented programming language", long_description = SUMMARY.strip(), license = "PSF license", classifiers = filter(None, CLASSIFIERS.split("\n")), platforms = ["Many"], # Build info cmdclass = {'build_ext':PyBuildExt, 'install':PyBuildInstall, 'install_lib':PyBuildInstallLib}, # The struct module is defined here, because build_ext won't be # called unless there's at least one extension module defined. ext_modules=[Extension('struct', ['structmodule.c'])], # Scripts to install scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle', 'Lib/smtpd.py'] )
7ccc95a315315568dd0660b5fb915f9e2e38f9da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7ccc95a315315568dd0660b5fb915f9e2e38f9da/setup.py
self.flag = 0
self.flags[flag] = 0
def clear_flags(self): """Reset all flags to zero""" for flag in self.flags: self.flag = 0
b1b605ef546c45eac3c53db369ea6e881f05dc8b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b1b605ef546c45eac3c53db369ea6e881f05dc8b/decimal.py
self.saved_clear() self.hrefstack.append(href) def anchor_end(self): if self.proc: title = cgi.escape(self.saved_get(), True) path = self.path + '/' + self.hrefstack.pop()
def anchor_bgn(self, href, name, type): if self.proc: self.saved_clear() self.hrefstack.append(href)
4a0db06edf1e1be71d27c682f7bc0fb4040a5300 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4a0db06edf1e1be71d27c682f7bc0fb4040a5300/prechm.py
def anchor_end(self): if self.proc: title = cgi.escape(self.saved_get(), True) path = self.path + '/' + self.hrefstack.pop() # XXX See SF bug <http://www.python.org/sf/546579>. # XXX index.html for the 2.2 language reference manual contains # XXX nested <a></a> tags in the entry for the section on blank # XXX lines. We want to ignore the nested part completely. if len(self.hrefstack) == 0: self.tab(object_sitemap % (title, path))
4a0db06edf1e1be71d27c682f7bc0fb4040a5300 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4a0db06edf1e1be71d27c682f7bc0fb4040a5300/prechm.py