rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
"""SMTP 'verify' command. Checks for address validity.""" | """SMTP 'verify' command -- checks for address validity.""" | def verify(self, address): """SMTP 'verify' command. Checks for address validity.""" self.putcmd("vrfy", quoteaddr(address)) return self.getreply() | 58a0b3fcac35fd85d6794fbcb62a4f4925cb00da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/58a0b3fcac35fd85d6794fbcb62a4f4925cb00da/smtplib.py |
"""SMTP 'verify' command. Checks for address validity.""" | """SMTP 'verify' command -- checks for address validity.""" | def expn(self, address): """SMTP 'verify' command. Checks for address validity.""" self.putcmd("expn", quoteaddr(address)) return self.getreply() | 58a0b3fcac35fd85d6794fbcb62a4f4925cb00da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/58a0b3fcac35fd85d6794fbcb62a4f4925cb00da/smtplib.py |
makefile_in = os.path.join(exec_prefix, 'Modules', 'Makefile') | makefile_in = os.path.join(exec_prefix, 'Makefile') | def main(): # overridable context prefix = None # settable with -p option exec_prefix = None # settable with -P option extensions = [] exclude = [] # settable with -x option addn_link = [] # settable with -l, but only honored under Windows. path = sys.path[:] modargs = 0 debug = 1 odir = '' win = sys.platform[:3] == 'win' replace_paths = [] # settable with -r option error_if_any_missing = 0 # default the exclude list for each platform if win: exclude = exclude + [ 'dos', 'dospath', 'mac', 'macpath', 'macfs', 'MACFS', 'posix', 'os2', 'ce', 'riscos', 'riscosenviron', 'riscospath', ] fail_import = exclude[:] # 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 by first replacing any "-i" options with the # file contents. pos = 1 while pos < len(sys.argv)-1: # last option can not be "-i", so this ensures "pos+1" is in range! if sys.argv[pos] == '-i': try: options = open(sys.argv[pos+1]).read().split() except IOError, why: usage("File name '%s' specified with the -i option " "can not be read - %s" % (sys.argv[pos+1], why) ) # Replace the '-i' and the filename with the read params. sys.argv[pos:pos+2] = options pos = pos + len(options) - 1 # Skip the name and the included args. pos = pos + 1 # Now parse the command line with the extras inserted. try: opts, args = getopt.getopt(sys.argv[1:], 'r:a:dEe:hmo:p:P:qs:wX:x:l:') 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 == '-d': debug = debug + 1 if o == '-e': extensions.append(a) if o == '-m': modargs = 1 if o == '-o': odir = a if o == '-p': prefix = a if o == '-P': exec_prefix = a if o == '-q': debug = 0 if o == '-w': win = not win if o == '-s': if not win: usage("-s subsystem option only on Windows") subsystem = a if o == '-x': exclude.append(a) if o == '-X': exclude.append(a) fail_import.append(a) if o == '-E': error_if_any_missing = 1 if o == '-l': addn_link.append(a) if o == '-a': apply(modulefinder.AddPackagePath, tuple(a.split("=", 2))) if o == '-r': f,r = a.split("=", 2) replace_paths.append( (f,r) ) # modules that are imported by the Python runtime implicits = [] for module in ('site', 'warnings',): if module not in exclude: implicits.append(module) # 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, 'Python', 'ceval.c')) # locations derived from options version = sys.version[:3] if win: extensions_c = 'frozen_extensions.c' if ishome: print "(Using Python source directory)" binlib = exec_prefix incldir = os.path.join(prefix, 'Include') config_h_dir = exec_prefix 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') if win: frozendllmain_c = os.path.join(exec_prefix, 'Pc\\frozen_dllmain.c') else: binlib = os.path.join(exec_prefix, 'lib', 'python%s' % version, 'config') incldir = os.path.join(prefix, 'include', 'python%s' % version) config_h_dir = os.path.join(exec_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') frozendllmain_c = os.path.join(binlib, 'frozen_dllmain.c') supp_sources = [] defines = [] includes = ['-I' + incldir, '-I' + config_h_dir] # sanity check of directories and files check_dirs = [prefix, exec_prefix, binlib, incldir] if not win: # These are not directories on Windows. check_dirs = check_dirs + extensions for dir in check_dirs: 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 + extensions # extensions are files on Windows. 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 file arguments exist for arg in args: if arg == '-m': break # if user specified -m on the command line before _any_ # file names, then nothing should be checked (as the # very first file should be a module name) if modargs: break 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))) base = '' if odir: base = os.path.join(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) if win: extensions_c = os.path.join(odir, extensions_c) # Handle special entry point requirements # (on Windows, some frozen programs do not use __main__, but # import the module directly. Eg, DLLs, Services, etc custom_entry_point = None # Currently only used on Windows python_entry_is_main = 1 # Is the entry point called __main__? # handle -s option on Windows if win: import winmakemakefile try: custom_entry_point, python_entry_is_main = \ winmakemakefile.get_custom_entry_point(subsystem) except ValueError, why: usage(why) # Actual work starts here... # collect all modules of the program dir = os.path.dirname(scriptfile) path[0] = dir mf = modulefinder.ModuleFinder(path, debug, exclude, replace_paths) if win and subsystem=='service': # If a Windows service, then add the "built-in" module. mod = mf.add_module("servicemanager") mod.__file__="dummy.pyd" # really built-in to the resulting EXE for mod in implicits: mf.import_hook(mod) for mod in modules: if mod == '-m': modargs = 1 continue if modargs: if mod[-2:] == '.*': mf.import_hook(mod[:-2], None, ["*"]) else: mf.import_hook(mod) else: mf.load_file(mod) # Add the main script as either __main__, or the actual module name. if python_entry_is_main: mf.run_script(scriptfile) else: mf.load_file(scriptfile) if debug > 0: mf.report() print dict = mf.modules if error_if_any_missing: missing = mf.any_missing() if missing: sys.exit("There are some missing modules: %r" % missing) # generate output for frozen modules files = makefreeze.makefreeze(base, dict, debug, custom_entry_point, fail_import) # look for unfrozen modules (builtin and of unknown origin) builtins = [] unknown = [] mods = dict.keys() mods.sort() for mod in mods: if dict[mod].__code__: continue if not dict[mod].__file__: builtins.append(mod) else: unknown.append(mod) # search for unknown modules in extensions directories (not on Windows) addfiles = [] frozen_extensions = [] # Windows list of modules. if unknown or (not win and builtins): if not win: addfiles, addmods = \ checkextensions.checkextensions(unknown+builtins, extensions) for mod in addmods: if mod in unknown: unknown.remove(mod) builtins.append(mod) else: # Do the windows thang... import checkextensions_win32 # Get a list of CExtension instances, each describing a module # (including its source files) frozen_extensions = checkextensions_win32.checkextensions( unknown, extensions, prefix) for mod in frozen_extensions: unknown.remove(mod.name) # report unknown modules if unknown: sys.stderr.write('Warning: unknown modules remain: %s\n' % ' '.join(unknown)) # windows gets different treatment if win: # Taking a shortcut here... import winmakemakefile, checkextensions_win32 checkextensions_win32.write_extension_table(extensions_c, frozen_extensions) # Create a module definition for the bootstrap C code. xtras = [frozenmain_c, os.path.basename(frozen_c), frozendllmain_c, os.path.basename(extensions_c)] + files maindefn = checkextensions_win32.CExtension( '__main__', xtras ) frozen_extensions.append( maindefn ) outfp = open(makefile, 'w') try: winmakemakefile.makemakefile(outfp, locals(), frozen_extensions, os.path.basename(target)) finally: outfp.close() return # generate config.c and Makefile builtins.sort() infp = open(config_c_in) outfp = bkfile.open(config_c, 'w') try: makeconfig.makeconfig(infp, outfp, builtins) finally: outfp.close() infp.close() cflags = ['$(OPT)'] cppflags = defines + includes libs = [os.path.join(binlib, 'libpython$(VERSION).a')] somevars = {} if os.path.exists(makefile_in): makevars = parsesetup.getmakevars(makefile_in) for key in makevars.keys(): somevars[key] = makevars[key] somevars['CFLAGS'] = ' '.join(cflags) # override somevars['CPPFLAGS'] = ' '.join(cppflags) # override files = [base_config_c, base_frozen_c] + \ files + supp_sources + addfiles + libs + \ ['$(MODLIBS)', '$(LIBS)', '$(SYSLIBS)'] outfp = bkfile.open(makefile, 'w') try: makemakefile.makemakefile(outfp, somevars, files, base_target) finally: outfp.close() # 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 | 5f8e4896b53d4de9b29f1bbd488026c74edcbf54 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5f8e4896b53d4de9b29f1bbd488026c74edcbf54/freeze.py |
for key in makevars.keys(): somevars[key] = makevars[key] | for key in makevars.keys(): somevars[key] = makevars[key] | def main(): # overridable context prefix = None # settable with -p option exec_prefix = None # settable with -P option extensions = [] exclude = [] # settable with -x option addn_link = [] # settable with -l, but only honored under Windows. path = sys.path[:] modargs = 0 debug = 1 odir = '' win = sys.platform[:3] == 'win' replace_paths = [] # settable with -r option error_if_any_missing = 0 # default the exclude list for each platform if win: exclude = exclude + [ 'dos', 'dospath', 'mac', 'macpath', 'macfs', 'MACFS', 'posix', 'os2', 'ce', 'riscos', 'riscosenviron', 'riscospath', ] fail_import = exclude[:] # 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 by first replacing any "-i" options with the # file contents. pos = 1 while pos < len(sys.argv)-1: # last option can not be "-i", so this ensures "pos+1" is in range! if sys.argv[pos] == '-i': try: options = open(sys.argv[pos+1]).read().split() except IOError, why: usage("File name '%s' specified with the -i option " "can not be read - %s" % (sys.argv[pos+1], why) ) # Replace the '-i' and the filename with the read params. sys.argv[pos:pos+2] = options pos = pos + len(options) - 1 # Skip the name and the included args. pos = pos + 1 # Now parse the command line with the extras inserted. try: opts, args = getopt.getopt(sys.argv[1:], 'r:a:dEe:hmo:p:P:qs:wX:x:l:') 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 == '-d': debug = debug + 1 if o == '-e': extensions.append(a) if o == '-m': modargs = 1 if o == '-o': odir = a if o == '-p': prefix = a if o == '-P': exec_prefix = a if o == '-q': debug = 0 if o == '-w': win = not win if o == '-s': if not win: usage("-s subsystem option only on Windows") subsystem = a if o == '-x': exclude.append(a) if o == '-X': exclude.append(a) fail_import.append(a) if o == '-E': error_if_any_missing = 1 if o == '-l': addn_link.append(a) if o == '-a': apply(modulefinder.AddPackagePath, tuple(a.split("=", 2))) if o == '-r': f,r = a.split("=", 2) replace_paths.append( (f,r) ) # modules that are imported by the Python runtime implicits = [] for module in ('site', 'warnings',): if module not in exclude: implicits.append(module) # 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, 'Python', 'ceval.c')) # locations derived from options version = sys.version[:3] if win: extensions_c = 'frozen_extensions.c' if ishome: print "(Using Python source directory)" binlib = exec_prefix incldir = os.path.join(prefix, 'Include') config_h_dir = exec_prefix 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') if win: frozendllmain_c = os.path.join(exec_prefix, 'Pc\\frozen_dllmain.c') else: binlib = os.path.join(exec_prefix, 'lib', 'python%s' % version, 'config') incldir = os.path.join(prefix, 'include', 'python%s' % version) config_h_dir = os.path.join(exec_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') frozendllmain_c = os.path.join(binlib, 'frozen_dllmain.c') supp_sources = [] defines = [] includes = ['-I' + incldir, '-I' + config_h_dir] # sanity check of directories and files check_dirs = [prefix, exec_prefix, binlib, incldir] if not win: # These are not directories on Windows. check_dirs = check_dirs + extensions for dir in check_dirs: 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 + extensions # extensions are files on Windows. 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 file arguments exist for arg in args: if arg == '-m': break # if user specified -m on the command line before _any_ # file names, then nothing should be checked (as the # very first file should be a module name) if modargs: break 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))) base = '' if odir: base = os.path.join(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) if win: extensions_c = os.path.join(odir, extensions_c) # Handle special entry point requirements # (on Windows, some frozen programs do not use __main__, but # import the module directly. Eg, DLLs, Services, etc custom_entry_point = None # Currently only used on Windows python_entry_is_main = 1 # Is the entry point called __main__? # handle -s option on Windows if win: import winmakemakefile try: custom_entry_point, python_entry_is_main = \ winmakemakefile.get_custom_entry_point(subsystem) except ValueError, why: usage(why) # Actual work starts here... # collect all modules of the program dir = os.path.dirname(scriptfile) path[0] = dir mf = modulefinder.ModuleFinder(path, debug, exclude, replace_paths) if win and subsystem=='service': # If a Windows service, then add the "built-in" module. mod = mf.add_module("servicemanager") mod.__file__="dummy.pyd" # really built-in to the resulting EXE for mod in implicits: mf.import_hook(mod) for mod in modules: if mod == '-m': modargs = 1 continue if modargs: if mod[-2:] == '.*': mf.import_hook(mod[:-2], None, ["*"]) else: mf.import_hook(mod) else: mf.load_file(mod) # Add the main script as either __main__, or the actual module name. if python_entry_is_main: mf.run_script(scriptfile) else: mf.load_file(scriptfile) if debug > 0: mf.report() print dict = mf.modules if error_if_any_missing: missing = mf.any_missing() if missing: sys.exit("There are some missing modules: %r" % missing) # generate output for frozen modules files = makefreeze.makefreeze(base, dict, debug, custom_entry_point, fail_import) # look for unfrozen modules (builtin and of unknown origin) builtins = [] unknown = [] mods = dict.keys() mods.sort() for mod in mods: if dict[mod].__code__: continue if not dict[mod].__file__: builtins.append(mod) else: unknown.append(mod) # search for unknown modules in extensions directories (not on Windows) addfiles = [] frozen_extensions = [] # Windows list of modules. if unknown or (not win and builtins): if not win: addfiles, addmods = \ checkextensions.checkextensions(unknown+builtins, extensions) for mod in addmods: if mod in unknown: unknown.remove(mod) builtins.append(mod) else: # Do the windows thang... import checkextensions_win32 # Get a list of CExtension instances, each describing a module # (including its source files) frozen_extensions = checkextensions_win32.checkextensions( unknown, extensions, prefix) for mod in frozen_extensions: unknown.remove(mod.name) # report unknown modules if unknown: sys.stderr.write('Warning: unknown modules remain: %s\n' % ' '.join(unknown)) # windows gets different treatment if win: # Taking a shortcut here... import winmakemakefile, checkextensions_win32 checkextensions_win32.write_extension_table(extensions_c, frozen_extensions) # Create a module definition for the bootstrap C code. xtras = [frozenmain_c, os.path.basename(frozen_c), frozendllmain_c, os.path.basename(extensions_c)] + files maindefn = checkextensions_win32.CExtension( '__main__', xtras ) frozen_extensions.append( maindefn ) outfp = open(makefile, 'w') try: winmakemakefile.makemakefile(outfp, locals(), frozen_extensions, os.path.basename(target)) finally: outfp.close() return # generate config.c and Makefile builtins.sort() infp = open(config_c_in) outfp = bkfile.open(config_c, 'w') try: makeconfig.makeconfig(infp, outfp, builtins) finally: outfp.close() infp.close() cflags = ['$(OPT)'] cppflags = defines + includes libs = [os.path.join(binlib, 'libpython$(VERSION).a')] somevars = {} if os.path.exists(makefile_in): makevars = parsesetup.getmakevars(makefile_in) for key in makevars.keys(): somevars[key] = makevars[key] somevars['CFLAGS'] = ' '.join(cflags) # override somevars['CPPFLAGS'] = ' '.join(cppflags) # override files = [base_config_c, base_frozen_c] + \ files + supp_sources + addfiles + libs + \ ['$(MODLIBS)', '$(LIBS)', '$(SYSLIBS)'] outfp = bkfile.open(makefile, 'w') try: makemakefile.makemakefile(outfp, somevars, files, base_target) finally: outfp.close() # 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 | 5f8e4896b53d4de9b29f1bbd488026c74edcbf54 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5f8e4896b53d4de9b29f1bbd488026c74edcbf54/freeze.py |
ef = codecs.EncodedFile(f, 'utf-16', 'utf-8') | ef = codecs.EncodedFile(f, 'utf-16-le', 'utf-8') | def test_basic(self): f = StringIO.StringIO('\xed\x95\x9c\n\xea\xb8\x80') ef = codecs.EncodedFile(f, 'utf-16', 'utf-8') self.assertEquals(ef.read(), '\xff\xfe\\\xd5\n\x00\x00\xae') | e4cc181031b7a5d95083edefdaf1e64bcc4055f7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e4cc181031b7a5d95083edefdaf1e64bcc4055f7/test_codecs.py |
self.compiler = new_compiler ( compiler="msvc", | self.compiler = new_compiler (compiler=self.compiler, | def run (self): | f60bef333ef8ad447c5473c4762d823cc8b8b159 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f60bef333ef8ad447c5473c4762d823cc8b8b159/build_ext.py |
extra_args = ext.extra_compile_args | extra_args = ext.extra_compile_args or [] | def build_extensions (self): | f60bef333ef8ad447c5473c4762d823cc8b8b159 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f60bef333ef8ad447c5473c4762d823cc8b8b159/build_ext.py |
extra_args = ext.extra_link_args | extra_args = ext.extra_link_args or [] | def build_extensions (self): | f60bef333ef8ad447c5473c4762d823cc8b8b159 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f60bef333ef8ad447c5473c4762d823cc8b8b159/build_ext.py |
xmlrpclib.Fault(1, "%s:%s" % (sys.exc_type, sys.exc_value)), | xmlrpclib.Fault(1, "%s:%s" % (exc_type, exc_value)), | def _marshaled_dispatch(self, data, dispatch_method = None): """Dispatches an XML-RPC method from marshalled (XML) data. | b303381c9c144da95fae19f5665221483f2a6696 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b303381c9c144da95fae19f5665221483f2a6696/SimpleXMLRPCServer.py |
'faultString' : "%s:%s" % (sys.exc_type, sys.exc_value)} | 'faultString' : "%s:%s" % (exc_type, exc_value)} | def system_multicall(self, call_list): """system.multicall([{'methodName': 'add', 'params': [2, 2]}, ...]) => \ | b303381c9c144da95fae19f5665221483f2a6696 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b303381c9c144da95fae19f5665221483f2a6696/SimpleXMLRPCServer.py |
if i < 0: return None data[0] = data[0][i+1:] | if i >= 0: data[0] = data[0][i+1:] | def parsedate_tz(data): """Convert a date string to a time tuple. Accounts for military timezones. """ data = data.split() # The FWS after the comma after the day-of-week is optional, so search and # adjust for this. if data[0].endswith(',') or data[0].lower() in _daynames: # There's a dayname here. Skip it del data[0] else: i = data[0].rfind(',') if i < 0: return None data[0] = data[0][i+1:] if len(data) == 3: # RFC 850 date, deprecated stuff = data[0].split('-') if len(stuff) == 3: data = stuff + data[1:] if len(data) == 4: s = data[3] i = s.find('+') if i > 0: data[3:] = [s[:i], s[i+1:]] else: data.append('') # Dummy tz if len(data) < 5: return None data = data[:5] [dd, mm, yy, tm, tz] = data mm = mm.lower() if mm not in _monthnames: dd, mm = mm, dd.lower() if mm not in _monthnames: return None mm = _monthnames.index(mm) + 1 if mm > 12: mm -= 12 if dd[-1] == ',': dd = dd[:-1] i = yy.find(':') if i > 0: yy, tm = tm, yy if yy[-1] == ',': yy = yy[:-1] if not yy[0].isdigit(): yy, tz = tz, yy if tm[-1] == ',': tm = tm[:-1] tm = tm.split(':') if len(tm) == 2: [thh, tmm] = tm tss = '0' elif len(tm) == 3: [thh, tmm, tss] = tm else: return None try: yy = int(yy) dd = int(dd) thh = int(thh) tmm = int(tmm) tss = int(tss) except ValueError: return None tzoffset = None tz = tz.upper() if _timezones.has_key(tz): tzoffset = _timezones[tz] else: try: tzoffset = int(tz) except ValueError: pass # Convert a timezone offset into seconds ; -0500 -> -18000 if tzoffset: if tzoffset < 0: tzsign = -1 tzoffset = -tzoffset else: tzsign = 1 tzoffset = tzsign * ( (tzoffset/100)*3600 + (tzoffset % 100)*60) tuple = (yy, mm, dd, thh, tmm, tss, 0, 0, 0, tzoffset) return tuple | bc0bf14de3689b8c264266e301eb219beb1ec19e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bc0bf14de3689b8c264266e301eb219beb1ec19e/_parseaddr.py |
tester('ntpath.splitdrive("\\\\conky\\mountpoint\\foo\\bar")', ('\\\\conky\\mountpoint', '\\foo\\bar')) | tester('ntpath.splitunc("\\\\conky\\mountpoint\\foo\\bar")', ('\\\\conky\\mountpoint', '\\foo\\bar')) | def tester(fn, wantResult): fn = string.replace(fn, "\\", "\\\\") gotResult = eval(fn) if wantResult != gotResult: print "error!" print "evaluated: " + str(fn) print "should be: " + str(wantResult) print " returned: " + str(gotResult) print "" global errors errors = errors + 1 | 754dfbd207e5f65cc11d757aae86f5b3d51a1ff9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/754dfbd207e5f65cc11d757aae86f5b3d51a1ff9/test_ntpath.py |
tester('ntpath.splitdrive("//conky/mountpoint/foo/bar")', ('//conky/mountpoint', '/foo/bar')) | tester('ntpath.splitunc("//conky/mountpoint/foo/bar")', ('//conky/mountpoint', '/foo/bar')) | def tester(fn, wantResult): fn = string.replace(fn, "\\", "\\\\") gotResult = eval(fn) if wantResult != gotResult: print "error!" print "evaluated: " + str(fn) print "should be: " + str(wantResult) print " returned: " + str(gotResult) print "" global errors errors = errors + 1 | 754dfbd207e5f65cc11d757aae86f5b3d51a1ff9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/754dfbd207e5f65cc11d757aae86f5b3d51a1ff9/test_ntpath.py |
tester('ntpath.split("\\\\conky\\mountpoint\\")', ('\\\\conky\\mountpoint\\', '')) | tester('ntpath.split("\\\\conky\\mountpoint\\")', ('\\\\conky\\mountpoint', '')) | def tester(fn, wantResult): fn = string.replace(fn, "\\", "\\\\") gotResult = eval(fn) if wantResult != gotResult: print "error!" print "evaluated: " + str(fn) print "should be: " + str(wantResult) print " returned: " + str(gotResult) print "" global errors errors = errors + 1 | 754dfbd207e5f65cc11d757aae86f5b3d51a1ff9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/754dfbd207e5f65cc11d757aae86f5b3d51a1ff9/test_ntpath.py |
tester('ntpath.split("//conky/mountpoint/")', ('//conky/mountpoint/', '')) | tester('ntpath.split("//conky/mountpoint/")', ('//conky/mountpoint', '')) | def tester(fn, wantResult): fn = string.replace(fn, "\\", "\\\\") gotResult = eval(fn) if wantResult != gotResult: print "error!" print "evaluated: " + str(fn) print "should be: " + str(wantResult) print " returned: " + str(gotResult) print "" global errors errors = errors + 1 | 754dfbd207e5f65cc11d757aae86f5b3d51a1ff9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/754dfbd207e5f65cc11d757aae86f5b3d51a1ff9/test_ntpath.py |
if name in ('os2', ): | if name in ('os2', 'nt', 'dos'): | def _execvpe(file, args, env = None): if env: func = execve argrest = (args, env) else: func = execv argrest = (args,) env = environ global _notfound head, tail = path.split(file) if head: apply(func, (file,) + argrest) return if env.has_key('PATH'): envpath = env['PATH'] else: envpath = defpath import string PATH = string.splitfields(envpath, pathsep) if not _notfound: import tempfile # Exec a file that is guaranteed not to exist try: execv(tempfile.mktemp(), ()) except error, _notfound: pass exc, arg = error, _notfound for dir in PATH: fullname = path.join(dir, file) try: apply(func, (fullname,) + argrest) except error, (errno, msg): if errno != arg[0]: exc, arg = error, (errno, msg) raise exc, arg | f4e72db40428bd47f54ddfb3fd610276a11c72f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f4e72db40428bd47f54ddfb3fd610276a11c72f5/os.py |
key = string.upper(key) | def __setitem__(self, key, item): key = string.upper(key) putenv(key, item) self.data[key] = item | f4e72db40428bd47f54ddfb3fd610276a11c72f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f4e72db40428bd47f54ddfb3fd610276a11c72f5/os.py |
|
def __getitem__(self, key): return self.data[string.upper(key)] else: class _Environ(UserDict.UserDict): def __init__(self, environ): UserDict.UserDict.__init__(self) self.data = environ def __getinitargs__(self): import copy return (copy.copy(self.data),) def __setitem__(self, key, item): putenv(key, item) self.data[key] = item def __copy__(self): return _Environ(self.data.copy()) | def __getitem__(self, key): return self.data[string.upper(key)] | f4e72db40428bd47f54ddfb3fd610276a11c72f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f4e72db40428bd47f54ddfb3fd610276a11c72f5/os.py |
|
from distutils.core import DEBUG | def parse_config_files (self, filenames=None): | a68503516cad098c6448d0a4ae33c57e288bbf26 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a68503516cad098c6448d0a4ae33c57e288bbf26/dist.py |
|
from distutils.core import DEBUG | def get_command_obj (self, command, create=1): """Return the command object for 'command'. Normally this object is cached on a previous call to 'get_command_obj()'; if no command object for 'command' is in the cache, then we either create and return it (if 'create' is true) or return None. """ from distutils.core import DEBUG cmd_obj = self.command_obj.get(command) if not cmd_obj and create: if DEBUG: print "Distribution.get_command_obj(): " \ "creating '%s' command object" % command | a68503516cad098c6448d0a4ae33c57e288bbf26 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a68503516cad098c6448d0a4ae33c57e288bbf26/dist.py |
|
from distutils.core import DEBUG | def _set_command_options (self, command_obj, option_dict=None): """Set the options for 'command_obj' from 'option_dict'. Basically this means copying elements of a dictionary ('option_dict') to attributes of an instance ('command'). | a68503516cad098c6448d0a4ae33c57e288bbf26 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a68503516cad098c6448d0a4ae33c57e288bbf26/dist.py |
|
for key, val in dict.items(): | for key in dict.keys(): | def __fixdict(self, dict): for key, val in dict.items(): if key[:6] == 'start_': key = key[6:] start, end = self.elements.get(key, (None, None)) if start is None: self.elements[key] = val, end elif key[:4] == 'end_': key = key[4:] start, end = self.elements.get(key, (None, None)) if end is None: self.elements[key] = start, val | 85afe3cf7b6468e27cbca4451e87bfc49d31ebb0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/85afe3cf7b6468e27cbca4451e87bfc49d31ebb0/xmllib.py |
key = key[6:] start, end = self.elements.get(key, (None, None)) | tag = key[6:] start, end = self.elements.get(tag, (None, None)) | def __fixdict(self, dict): for key, val in dict.items(): if key[:6] == 'start_': key = key[6:] start, end = self.elements.get(key, (None, None)) if start is None: self.elements[key] = val, end elif key[:4] == 'end_': key = key[4:] start, end = self.elements.get(key, (None, None)) if end is None: self.elements[key] = start, val | 85afe3cf7b6468e27cbca4451e87bfc49d31ebb0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/85afe3cf7b6468e27cbca4451e87bfc49d31ebb0/xmllib.py |
self.elements[key] = val, end | self.elements[tag] = getattr(self, key), end | def __fixdict(self, dict): for key, val in dict.items(): if key[:6] == 'start_': key = key[6:] start, end = self.elements.get(key, (None, None)) if start is None: self.elements[key] = val, end elif key[:4] == 'end_': key = key[4:] start, end = self.elements.get(key, (None, None)) if end is None: self.elements[key] = start, val | 85afe3cf7b6468e27cbca4451e87bfc49d31ebb0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/85afe3cf7b6468e27cbca4451e87bfc49d31ebb0/xmllib.py |
key = key[4:] start, end = self.elements.get(key, (None, None)) | tag = key[4:] start, end = self.elements.get(tag, (None, None)) | def __fixdict(self, dict): for key, val in dict.items(): if key[:6] == 'start_': key = key[6:] start, end = self.elements.get(key, (None, None)) if start is None: self.elements[key] = val, end elif key[:4] == 'end_': key = key[4:] start, end = self.elements.get(key, (None, None)) if end is None: self.elements[key] = start, val | 85afe3cf7b6468e27cbca4451e87bfc49d31ebb0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/85afe3cf7b6468e27cbca4451e87bfc49d31ebb0/xmllib.py |
self.elements[key] = start, val | self.elements[tag] = start, getattr(self, key) | def __fixdict(self, dict): for key, val in dict.items(): if key[:6] == 'start_': key = key[6:] start, end = self.elements.get(key, (None, None)) if start is None: self.elements[key] = val, end elif key[:4] == 'end_': key = key[4:] start, end = self.elements.get(key, (None, None)) if end is None: self.elements[key] = start, val | 85afe3cf7b6468e27cbca4451e87bfc49d31ebb0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/85afe3cf7b6468e27cbca4451e87bfc49d31ebb0/xmllib.py |
def pop (self): if self.list: result = self.list[0] del self.list[0] return (1, result) else: return (0, None) | 75cfc1004de146eee2cc17f8b0ac6ed4c72c15e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/75cfc1004de146eee2cc17f8b0ac6ed4c72c15e8/asynchat.py |
||
def pop (self): if self.list: result = self.list[0] del self.list[0] return (1, result) else: return (0, None) | 75cfc1004de146eee2cc17f8b0ac6ed4c72c15e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/75cfc1004de146eee2cc17f8b0ac6ed4c72c15e8/asynchat.py |
||
i = 0 while i < len(line) and line[i].isspace(): i = i+1 list.append(' %s\n' % line.strip()) if offset is not None: s = ' ' for c in line[i:offset-1]: if c.isspace(): s = s + c else: s = s + ' ' list.append('%s^\n' % s) value = msg | if line is not None: i = 0 while i < len(line) and line[i].isspace(): i = i+1 list.append(' %s\n' % line.strip()) if offset is not None: s = ' ' for c in line[i:offset-1]: if c.isspace(): s = s + c else: s = s + ' ' list.append('%s^\n' % s) value = msg | def format_exception_only(etype, value): """Format the exception part of a traceback. The arguments are the exception type and value such as given by sys.last_type and sys.last_value. The return value is a list of strings, each ending in a newline. Normally, the list contains a single string; however, for SyntaxError exceptions, it contains several lines that (when printed) display detailed information about where the syntax error occurred. The message indicating which exception occurred is the always last string in the list. """ list = [] if type(etype) == types.ClassType: stype = etype.__name__ else: stype = etype if value is None: list.append(str(stype) + '\n') else: if etype is SyntaxError: try: msg, (filename, lineno, offset, line) = value except: pass else: if not filename: filename = "<string>" list.append(' File "%s", line %d\n' % (filename, lineno)) i = 0 while i < len(line) and line[i].isspace(): i = i+1 list.append(' %s\n' % line.strip()) if offset is not None: s = ' ' for c in line[i:offset-1]: if c.isspace(): s = s + c else: s = s + ' ' list.append('%s^\n' % s) value = msg s = _some_str(value) if s: list.append('%s: %s\n' % (str(stype), s)) else: list.append('%s\n' % str(stype)) return list | 89f6e8c77bee38434b8fb8aea90a0e88f44a7203 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/89f6e8c77bee38434b8fb8aea90a0e88f44a7203/traceback.py |
compileargs = r"-Wi [TARGETDIR]Lib\compileall.py -f -x badsyntax [TARGETDIR]Lib" | compileargs = r"-Wi [TARGETDIR]Lib\compileall.py -f -x bad_coding|badsyntax|site-packages [TARGETDIR]Lib" | 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.") c = exit_dialog.text("warning", 135, 200, 220, 40, 0x30003, "{\\VerdanaRed9}Warning: Python 2.5.x is the last " "Python release for Windows 9x.") c.condition("Hide", "NOT Version9X") 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") | c8e664fb8b471867d15e8c4ed4aa7555160fcc4b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8e664fb8b471867d15e8c4ed4aa7555160fcc4b/msi.py |
except SyntaxWarning, msg: print "got SyntaxWarning as expected" | except SyntaxError, msg: print "got SyntaxError as expected" | def compile_and_catch_warning(text): try: compile(text, "<test code>", "exec") except SyntaxWarning, msg: print "got SyntaxWarning as expected" else: print "expected SyntaxWarning" | a1eb4eb036f5bd0d3416f564ddf4deb75c1f2632 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a1eb4eb036f5bd0d3416f564ddf4deb75c1f2632/test_global.py |
print "expected SyntaxWarning" | print "expected SyntaxError" | def compile_and_catch_warning(text): try: compile(text, "<test code>", "exec") except SyntaxWarning, msg: print "got SyntaxWarning as expected" else: print "expected SyntaxWarning" | a1eb4eb036f5bd0d3416f564ddf4deb75c1f2632 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a1eb4eb036f5bd0d3416f564ddf4deb75c1f2632/test_global.py |
def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') | 637e5aa23d513f9f0eb05233f49db4bd638d2eee /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/637e5aa23d513f9f0eb05233f49db4bd638d2eee/setup.py |
||
'/usr/lib', | def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') | 637e5aa23d513f9f0eb05233f49db4bd638d2eee /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/637e5aa23d513f9f0eb05233f49db4bd638d2eee/setup.py |
|
'/lib', | def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') | 637e5aa23d513f9f0eb05233f49db4bd638d2eee /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/637e5aa23d513f9f0eb05233f49db4bd638d2eee/setup.py |
|
), 'incs': ('db.h',)}, | )}, | def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') | 637e5aa23d513f9f0eb05233f49db4bd638d2eee /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/637e5aa23d513f9f0eb05233f49db4bd638d2eee/setup.py |
'/usr/lib', '/lib', | def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') | 637e5aa23d513f9f0eb05233f49db4bd638d2eee /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/637e5aa23d513f9f0eb05233f49db4bd638d2eee/setup.py |
|
), 'incs': ('db.h',)}, | )}, | def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') | 637e5aa23d513f9f0eb05233f49db4bd638d2eee /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/637e5aa23d513f9f0eb05233f49db4bd638d2eee/setup.py |
find_lib_file = self.compiler.find_library_file | def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') | 637e5aa23d513f9f0eb05233f49db4bd638d2eee /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/637e5aa23d513f9f0eb05233f49db4bd638d2eee/setup.py |
|
for dbinc in dbd['incs']: db_incs = find_file(dbinc, [], dbd['incdirs']) dblib_dir = find_lib_file(dbd['libdirs'], dblib) if db_incs and dblib_dir: dblib_dir = os.path.dirname(dblib_dir) dblibs = [dblib] raise found | db_incs = find_file('db.h', [], dbd['incdirs']) dblib_dir = find_library_file(self.compiler, dblib, lib_dirs, list(dbd['libdirs'])) if (db_incs or dbkey == std_dbinc) and \ dblib_dir is not None: dblibs = [dblib] raise found | def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') | 637e5aa23d513f9f0eb05233f49db4bd638d2eee /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/637e5aa23d513f9f0eb05233f49db4bd638d2eee/setup.py |
library_dirs=[dblib_dir], runtime_library_dirs=[dblib_dir], | library_dirs=dblib_dir, runtime_library_dirs=dblib_dir, | def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') | 637e5aa23d513f9f0eb05233f49db4bd638d2eee /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/637e5aa23d513f9f0eb05233f49db4bd638d2eee/setup.py |
try: os.rename(self.baseFilename, dfn) except (KeyboardInterrupt, SystemExit): raise except: self.handleError(record) | os.rename(self.baseFilename, dfn) | def doRollover(self): """ Do a rollover, as described in __init__(). """ | 2ec385f5122cb4f7fc4678471f65cdb012c5030b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2ec385f5122cb4f7fc4678471f65cdb012c5030b/handlers.py |
try: os.rename(self.baseFilename, dfn) except (KeyboardInterrupt, SystemExit): raise except: self.handleError(record) | os.rename(self.baseFilename, dfn) | def doRollover(self): """ do a rollover; in this case, a date/time stamp is appended to the filename when the rollover happens. However, you want the file to be named for the start of the interval, not the current time. If there is a backup count, then we have to get a list of matching filenames, sort them and remove the one with the oldest suffix. """ self.stream.close() # get the time that this sequence started at and make it a TimeTuple t = self.rolloverAt - self.interval timeTuple = time.localtime(t) dfn = self.baseFilename + "." + time.strftime(self.suffix, timeTuple) if os.path.exists(dfn): os.remove(dfn) try: os.rename(self.baseFilename, dfn) except (KeyboardInterrupt, SystemExit): raise except: self.handleError(record) if self.backupCount > 0: # find the oldest log file and delete it s = glob.glob(self.baseFilename + ".20*") if len(s) > self.backupCount: s.sort() os.remove(s[0]) #print "%s -> %s" % (self.baseFilename, dfn) if self.encoding: self.stream = codecs.open(self.baseFilename, 'w', self.encoding) else: self.stream = open(self.baseFilename, 'w') self.rolloverAt = self.rolloverAt + self.interval | 2ec385f5122cb4f7fc4678471f65cdb012c5030b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2ec385f5122cb4f7fc4678471f65cdb012c5030b/handlers.py |
print f(2)(5) | class TestFuture(unittest.TestCase): def test_floor_div_operator(self): self.assertEqual(7 // 2, 3) def test_true_div_as_default(self): self.assertAlmostEqual(7 / 2, 3.5) def test_nested_scopes(self): self.assertEqual(nester(), 3) def test_main(): test_support.run_unittest(TestFuture) if __name__ == "__main__": test_main() | def g(y): return y // x | 31e84142e3a185fa26e39d0c525ce386f31b61a2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/31e84142e3a185fa26e39d0c525ce386f31b61a2/test_future3.py |
if self.__at_start: | data = rawdata[i:j] if self.__at_start and space.match(data) is None: | def goahead(self, end): rawdata = self.rawdata i = 0 n = len(rawdata) while i < n: if i > 0: self.__at_start = 0 if self.nomoretags: data = rawdata[i:n] self.handle_data(data) self.lineno = self.lineno + string.count(data, '\n') i = n break res = interesting.search(rawdata, i) if res: j = res.start(0) else: j = n if i < j: if self.__at_start: self.syntax_error('illegal data at start of file') self.__at_start = 0 data = rawdata[i:j] if not self.stack and space.match(data) is None: self.syntax_error('data not in content') if illegal.search(data): self.syntax_error('illegal character in content') self.handle_data(data) self.lineno = self.lineno + string.count(data, '\n') i = j if i == n: break if rawdata[i] == '<': if starttagopen.match(rawdata, i): if self.literal: data = rawdata[i] self.handle_data(data) self.lineno = self.lineno + string.count(data, '\n') i = i+1 continue k = self.parse_starttag(i) if k < 0: break self.__seen_starttag = 1 self.lineno = self.lineno + string.count(rawdata[i:k], '\n') i = k continue if endtagopen.match(rawdata, i): k = self.parse_endtag(i) if k < 0: break self.lineno = self.lineno + string.count(rawdata[i:k], '\n') i = k continue if commentopen.match(rawdata, i): if self.literal: data = rawdata[i] self.handle_data(data) self.lineno = self.lineno + string.count(data, '\n') i = i+1 continue k = self.parse_comment(i) if k < 0: break self.lineno = self.lineno + string.count(rawdata[i:k], '\n') i = k continue if cdataopen.match(rawdata, i): k = self.parse_cdata(i) if k < 0: break self.lineno = self.lineno + string.count(rawdata[i:i], '\n') i = k continue res = xmldecl.match(rawdata, i) if res: if not self.__at_start: self.syntax_error("<?xml?> declaration not at start of document") version, encoding, standalone = res.group('version', 'encoding', 'standalone') if version[1:-1] != '1.0': raise RuntimeError, 'only XML version 1.0 supported' if encoding: encoding = encoding[1:-1] if standalone: standalone = standalone[1:-1] self.handle_xml(encoding, standalone) i = res.end(0) continue res = procopen.match(rawdata, i) if res: k = self.parse_proc(i) if k < 0: break self.lineno = self.lineno + string.count(rawdata[i:k], '\n') i = k continue res = doctype.match(rawdata, i) if res: if self.literal: data = rawdata[i] self.handle_data(data) self.lineno = self.lineno + string.count(data, '\n') i = i+1 continue if self.__seen_doctype: self.syntax_error('multiple DOCTYPE elements') if self.__seen_starttag: self.syntax_error('DOCTYPE not at beginning of document') k = self.parse_doctype(res) if k < 0: break self.__seen_doctype = res.group('name') self.lineno = self.lineno + string.count(rawdata[i:k], '\n') i = k continue elif rawdata[i] == '&': if self.literal: data = rawdata[i] self.handle_data(data) i = i+1 continue res = charref.match(rawdata, i) if res is not None: i = res.end(0) if rawdata[i-1] != ';': self.syntax_error("`;' missing in charref") i = i-1 if not self.stack: self.syntax_error('data not in content') self.handle_charref(res.group('char')[:-1]) self.lineno = self.lineno + string.count(res.group(0), '\n') continue res = entityref.match(rawdata, i) if res is not None: i = res.end(0) if rawdata[i-1] != ';': self.syntax_error("`;' missing in entityref") i = i-1 name = res.group('name') if self.entitydefs.has_key(name): self.rawdata = rawdata = rawdata[:res.start(0)] + self.entitydefs[name] + rawdata[i:] n = len(rawdata) i = res.start(0) else: self.syntax_error('reference to unknown entity') self.unknown_entityref(name) self.lineno = self.lineno + string.count(res.group(0), '\n') continue elif rawdata[i] == ']': if self.literal: data = rawdata[i] self.handle_data(data) i = i+1 continue if n-i < 3: break if cdataclose.match(rawdata, i): self.syntax_error("bogus `]]>'") self.handle_data(rawdata[i]) i = i+1 continue else: raise RuntimeError, 'neither < nor & ??' # We get here only if incomplete matches but # nothing else break # end while if i > 0: self.__at_start = 0 if end and i < n: data = rawdata[i] self.syntax_error("bogus `%s'" % data) if illegal.search(data): self.syntax_error('illegal character in content') self.handle_data(data) self.lineno = self.lineno + string.count(data, '\n') self.rawdata = rawdata[i+1:] return self.goahead(end) self.rawdata = rawdata[i:] if end: if not self.__seen_starttag: self.syntax_error('no elements in file') if self.stack: self.syntax_error('missing end tags') while self.stack: self.finish_endtag(self.stack[-1][0]) | 6e34cc63866fd44f80a155ce15438c7767002341 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6e34cc63866fd44f80a155ce15438c7767002341/xmllib.py |
data = rawdata[i:j] | def goahead(self, end): rawdata = self.rawdata i = 0 n = len(rawdata) while i < n: if i > 0: self.__at_start = 0 if self.nomoretags: data = rawdata[i:n] self.handle_data(data) self.lineno = self.lineno + string.count(data, '\n') i = n break res = interesting.search(rawdata, i) if res: j = res.start(0) else: j = n if i < j: if self.__at_start: self.syntax_error('illegal data at start of file') self.__at_start = 0 data = rawdata[i:j] if not self.stack and space.match(data) is None: self.syntax_error('data not in content') if illegal.search(data): self.syntax_error('illegal character in content') self.handle_data(data) self.lineno = self.lineno + string.count(data, '\n') i = j if i == n: break if rawdata[i] == '<': if starttagopen.match(rawdata, i): if self.literal: data = rawdata[i] self.handle_data(data) self.lineno = self.lineno + string.count(data, '\n') i = i+1 continue k = self.parse_starttag(i) if k < 0: break self.__seen_starttag = 1 self.lineno = self.lineno + string.count(rawdata[i:k], '\n') i = k continue if endtagopen.match(rawdata, i): k = self.parse_endtag(i) if k < 0: break self.lineno = self.lineno + string.count(rawdata[i:k], '\n') i = k continue if commentopen.match(rawdata, i): if self.literal: data = rawdata[i] self.handle_data(data) self.lineno = self.lineno + string.count(data, '\n') i = i+1 continue k = self.parse_comment(i) if k < 0: break self.lineno = self.lineno + string.count(rawdata[i:k], '\n') i = k continue if cdataopen.match(rawdata, i): k = self.parse_cdata(i) if k < 0: break self.lineno = self.lineno + string.count(rawdata[i:i], '\n') i = k continue res = xmldecl.match(rawdata, i) if res: if not self.__at_start: self.syntax_error("<?xml?> declaration not at start of document") version, encoding, standalone = res.group('version', 'encoding', 'standalone') if version[1:-1] != '1.0': raise RuntimeError, 'only XML version 1.0 supported' if encoding: encoding = encoding[1:-1] if standalone: standalone = standalone[1:-1] self.handle_xml(encoding, standalone) i = res.end(0) continue res = procopen.match(rawdata, i) if res: k = self.parse_proc(i) if k < 0: break self.lineno = self.lineno + string.count(rawdata[i:k], '\n') i = k continue res = doctype.match(rawdata, i) if res: if self.literal: data = rawdata[i] self.handle_data(data) self.lineno = self.lineno + string.count(data, '\n') i = i+1 continue if self.__seen_doctype: self.syntax_error('multiple DOCTYPE elements') if self.__seen_starttag: self.syntax_error('DOCTYPE not at beginning of document') k = self.parse_doctype(res) if k < 0: break self.__seen_doctype = res.group('name') self.lineno = self.lineno + string.count(rawdata[i:k], '\n') i = k continue elif rawdata[i] == '&': if self.literal: data = rawdata[i] self.handle_data(data) i = i+1 continue res = charref.match(rawdata, i) if res is not None: i = res.end(0) if rawdata[i-1] != ';': self.syntax_error("`;' missing in charref") i = i-1 if not self.stack: self.syntax_error('data not in content') self.handle_charref(res.group('char')[:-1]) self.lineno = self.lineno + string.count(res.group(0), '\n') continue res = entityref.match(rawdata, i) if res is not None: i = res.end(0) if rawdata[i-1] != ';': self.syntax_error("`;' missing in entityref") i = i-1 name = res.group('name') if self.entitydefs.has_key(name): self.rawdata = rawdata = rawdata[:res.start(0)] + self.entitydefs[name] + rawdata[i:] n = len(rawdata) i = res.start(0) else: self.syntax_error('reference to unknown entity') self.unknown_entityref(name) self.lineno = self.lineno + string.count(res.group(0), '\n') continue elif rawdata[i] == ']': if self.literal: data = rawdata[i] self.handle_data(data) i = i+1 continue if n-i < 3: break if cdataclose.match(rawdata, i): self.syntax_error("bogus `]]>'") self.handle_data(rawdata[i]) i = i+1 continue else: raise RuntimeError, 'neither < nor & ??' # We get here only if incomplete matches but # nothing else break # end while if i > 0: self.__at_start = 0 if end and i < n: data = rawdata[i] self.syntax_error("bogus `%s'" % data) if illegal.search(data): self.syntax_error('illegal character in content') self.handle_data(data) self.lineno = self.lineno + string.count(data, '\n') self.rawdata = rawdata[i+1:] return self.goahead(end) self.rawdata = rawdata[i:] if end: if not self.__seen_starttag: self.syntax_error('no elements in file') if self.stack: self.syntax_error('missing end tags') while self.stack: self.finish_endtag(self.stack[-1][0]) | 6e34cc63866fd44f80a155ce15438c7767002341 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6e34cc63866fd44f80a155ce15438c7767002341/xmllib.py |
|
res = qname.match(tagname) | if self.__use_namespaces: res = qname.match(tagname) else: res = None | def parse_starttag(self, i): rawdata = self.rawdata # i points to start of tag end = endbracketfind.match(rawdata, i+1) if end is None: return -1 tag = starttagmatch.match(rawdata, i) if tag is None or tag.end(0) != end.end(0): self.syntax_error('garbage in starttag') return end.end(0) nstag = tagname = tag.group('tagname') if not self.__seen_starttag and self.__seen_doctype and \ tagname != self.__seen_doctype: self.syntax_error('starttag does not match DOCTYPE') if self.__seen_starttag and not self.stack: self.syntax_error('multiple elements on top level') k, j = tag.span('attrs') attrdict, nsdict, k = self.parse_attributes(tagname, k, j) self.stack.append((tagname, nsdict, nstag)) res = qname.match(tagname) if res is not None: prefix, nstag = res.group('prefix', 'local') if prefix is None: prefix = '' ns = None for t, d, nst in self.stack: if d.has_key(prefix): ns = d[prefix] if ns is None and prefix != '': ns = self.__namespaces.get(prefix) if ns is not None: nstag = ns + ' ' + nstag elif prefix != '': nstag = prefix + ':' + nstag # undo split self.stack[-1] = tagname, nsdict, nstag # translate namespace of attributes nattrdict = {} for key, val in attrdict.items(): res = qname.match(key) if res is not None: aprefix, key = res.group('prefix', 'local') if aprefix is None: aprefix = '' ans = None for t, d, nst in self.stack: if d.has_key(aprefix): ans = d[aprefix] if ans is None and aprefix != '': ans = self.__namespaces.get(aprefix) if ans is not None: key = ans + ' ' + key elif aprefix != '': key = aprefix + ':' + key elif ns is not None: key = ns + ' ' + key nattrdict[key] = val attrdict = nattrdict attributes = self.attributes.get(nstag) if attributes is not None: for key in attrdict.keys(): if not attributes.has_key(key): self.syntax_error("unknown attribute `%s' in tag `%s'" % (key, tagname)) for key, val in attributes.items(): if val is not None and not attrdict.has_key(key): attrdict[key] = val method = self.elements.get(nstag, (None, None))[0] self.finish_starttag(nstag, attrdict, method) if tag.group('slash') == '/': self.finish_endtag(tagname) return tag.end(0) | 6e34cc63866fd44f80a155ce15438c7767002341 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6e34cc63866fd44f80a155ce15438c7767002341/xmllib.py |
nattrdict = {} for key, val in attrdict.items(): res = qname.match(key) if res is not None: aprefix, key = res.group('prefix', 'local') if aprefix is None: aprefix = '' ans = None for t, d, nst in self.stack: if d.has_key(aprefix): ans = d[aprefix] if ans is None and aprefix != '': ans = self.__namespaces.get(aprefix) if ans is not None: key = ans + ' ' + key elif aprefix != '': key = aprefix + ':' + key elif ns is not None: key = ns + ' ' + key nattrdict[key] = val attrdict = nattrdict | if self.__use_namespaces: nattrdict = {} for key, val in attrdict.items(): res = qname.match(key) if res is not None: aprefix, key = res.group('prefix', 'local') if aprefix is None: aprefix = '' ans = None for t, d, nst in self.stack: if d.has_key(aprefix): ans = d[aprefix] if ans is None and aprefix != '': ans = self.__namespaces.get(aprefix) if ans is not None: key = ans + ' ' + key elif aprefix != '': key = aprefix + ':' + key elif ns is not None: key = ns + ' ' + key nattrdict[key] = val attrdict = nattrdict | def parse_starttag(self, i): rawdata = self.rawdata # i points to start of tag end = endbracketfind.match(rawdata, i+1) if end is None: return -1 tag = starttagmatch.match(rawdata, i) if tag is None or tag.end(0) != end.end(0): self.syntax_error('garbage in starttag') return end.end(0) nstag = tagname = tag.group('tagname') if not self.__seen_starttag and self.__seen_doctype and \ tagname != self.__seen_doctype: self.syntax_error('starttag does not match DOCTYPE') if self.__seen_starttag and not self.stack: self.syntax_error('multiple elements on top level') k, j = tag.span('attrs') attrdict, nsdict, k = self.parse_attributes(tagname, k, j) self.stack.append((tagname, nsdict, nstag)) res = qname.match(tagname) if res is not None: prefix, nstag = res.group('prefix', 'local') if prefix is None: prefix = '' ns = None for t, d, nst in self.stack: if d.has_key(prefix): ns = d[prefix] if ns is None and prefix != '': ns = self.__namespaces.get(prefix) if ns is not None: nstag = ns + ' ' + nstag elif prefix != '': nstag = prefix + ':' + nstag # undo split self.stack[-1] = tagname, nsdict, nstag # translate namespace of attributes nattrdict = {} for key, val in attrdict.items(): res = qname.match(key) if res is not None: aprefix, key = res.group('prefix', 'local') if aprefix is None: aprefix = '' ans = None for t, d, nst in self.stack: if d.has_key(aprefix): ans = d[aprefix] if ans is None and aprefix != '': ans = self.__namespaces.get(aprefix) if ans is not None: key = ans + ' ' + key elif aprefix != '': key = aprefix + ':' + key elif ns is not None: key = ns + ' ' + key nattrdict[key] = val attrdict = nattrdict attributes = self.attributes.get(nstag) if attributes is not None: for key in attrdict.keys(): if not attributes.has_key(key): self.syntax_error("unknown attribute `%s' in tag `%s'" % (key, tagname)) for key, val in attributes.items(): if val is not None and not attrdict.has_key(key): attrdict[key] = val method = self.elements.get(nstag, (None, None))[0] self.finish_starttag(nstag, attrdict, method) if tag.group('slash') == '/': self.finish_endtag(tagname) return tag.end(0) | 6e34cc63866fd44f80a155ce15438c7767002341 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6e34cc63866fd44f80a155ce15438c7767002341/xmllib.py |
self.assertRaises(ValueError, lambda: bytes([C(-1)])) self.assertRaises(ValueError, lambda: bytes([C(256)])) | self.assertRaises(ValueError, bytes, [C(-1)]) self.assertRaises(ValueError, bytes, [C(256)]) | def __index__(self): return self.i | 94d9d7deb67cb084db642b11ea4f6c2fa56d0dfb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/94d9d7deb67cb084db642b11ea4f6c2fa56d0dfb/test_bytes.py |
self.assertRaises(TypeError, lambda: bytes(["0"])) self.assertRaises(TypeError, lambda: bytes([0.0])) self.assertRaises(TypeError, lambda: bytes([None])) self.assertRaises(TypeError, lambda: bytes([C()])) | self.assertRaises(TypeError, bytes, ["0"]) self.assertRaises(TypeError, bytes, [0.0]) self.assertRaises(TypeError, bytes, [None]) self.assertRaises(TypeError, bytes, [C()]) | def test_constructor_type_errors(self): class C: pass self.assertRaises(TypeError, lambda: bytes(["0"])) self.assertRaises(TypeError, lambda: bytes([0.0])) self.assertRaises(TypeError, lambda: bytes([None])) self.assertRaises(TypeError, lambda: bytes([C()])) | 94d9d7deb67cb084db642b11ea4f6c2fa56d0dfb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/94d9d7deb67cb084db642b11ea4f6c2fa56d0dfb/test_bytes.py |
self.assertRaises(ValueError, lambda: bytes([-1])) self.assertRaises(ValueError, lambda: bytes([-sys.maxint])) self.assertRaises(ValueError, lambda: bytes([-sys.maxint-1])) self.assertRaises(ValueError, lambda: bytes([-sys.maxint-2])) self.assertRaises(ValueError, lambda: bytes([-10**100])) self.assertRaises(ValueError, lambda: bytes([256])) self.assertRaises(ValueError, lambda: bytes([257])) self.assertRaises(ValueError, lambda: bytes([sys.maxint])) self.assertRaises(ValueError, lambda: bytes([sys.maxint+1])) self.assertRaises(ValueError, lambda: bytes([10**100])) | self.assertRaises(ValueError, bytes, [-1]) self.assertRaises(ValueError, bytes, [-sys.maxint]) self.assertRaises(ValueError, bytes, [-sys.maxint-1]) self.assertRaises(ValueError, bytes, [-sys.maxint-2]) self.assertRaises(ValueError, bytes, [-10**100]) self.assertRaises(ValueError, bytes, [256]) self.assertRaises(ValueError, bytes, [257]) self.assertRaises(ValueError, bytes, [sys.maxint]) self.assertRaises(ValueError, bytes, [sys.maxint+1]) self.assertRaises(ValueError, bytes, [10**100]) | def test_constructor_value_errors(self): self.assertRaises(ValueError, lambda: bytes([-1])) self.assertRaises(ValueError, lambda: bytes([-sys.maxint])) self.assertRaises(ValueError, lambda: bytes([-sys.maxint-1])) self.assertRaises(ValueError, lambda: bytes([-sys.maxint-2])) self.assertRaises(ValueError, lambda: bytes([-10**100])) self.assertRaises(ValueError, lambda: bytes([256])) self.assertRaises(ValueError, lambda: bytes([257])) self.assertRaises(ValueError, lambda: bytes([sys.maxint])) self.assertRaises(ValueError, lambda: bytes([sys.maxint+1])) self.assertRaises(ValueError, lambda: bytes([10**100])) | 94d9d7deb67cb084db642b11ea4f6c2fa56d0dfb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/94d9d7deb67cb084db642b11ea4f6c2fa56d0dfb/test_bytes.py |
def __init__(self, widget): self.widget = widget self.tipwindow = None self.id = None self.x = self.y = 0 | keydefs = { '<<paren-open>>': ['<Key-parenleft>'], '<<paren-close>>': ['<Key-parenright>'], '<<check-calltip-cancel>>': ['<KeyRelease>', '<ButtonRelease>'] } windows_keydefs = { } | def __init__(self, widget): self.widget = widget self.tipwindow = None self.id = None self.x = self.y = 0 | e3be6bfd1a3c9b8a90b99878151505c3c52878da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e3be6bfd1a3c9b8a90b99878151505c3c52878da/CallTips.py |
def showtip(self, text): self.text = text if self.tipwindow or not self.text: return self.widget.see("insert") x, y, cx, cy = self.widget.bbox("insert") x = x + self.widget.winfo_rootx() + 2 y = y + cy + self.widget.winfo_rooty() self.tipwindow = tw = Toplevel(self.widget) tw.wm_overrideredirect(1) tw.wm_geometry("+%d+%d" % (x, y)) label = Label(tw, text=self.text, justify=LEFT, background=" label.pack() def hidetip(self): tw = self.tipwindow self.tipwindow = None if tw: tw.destroy() | unix_keydefs = { } def __init__(self, editwin): self.editwin = editwin self.text = editwin.text self.calltip = None if hasattr(self.text, "make_calltip_window"): self._make_calltip_window = self.text.make_calltip_window else: self._make_calltip_window = self._make_tk_calltip_window def _make_tk_calltip_window(self): import CallTipWindow return CallTipWindow.CallTip(self.text) def _remove_calltip_window(self): if self.calltip: self.calltip.hidetip() self.calltip = None def paren_open_event(self, event): self._remove_calltip_window() arg_text = get_arg_text(self.get_object_at_cursor()) if arg_text: self.calltip_start = self.text.index("insert") self.calltip = self._make_calltip_window() self.calltip.showtip(arg_text) def paren_close_event(self, event): self._remove_calltip_window() def check_calltip_cancel_event(self, event): if self.calltip: if self.text.compare("insert", "<=", self.calltip_start) or \ self.text.compare("insert", ">", self.calltip_start + " lineend"): self._remove_calltip_window() def get_object_at_cursor(self, wordchars="._" + string.uppercase + string.lowercase + string.digits): text = self.text index = 0 while 1: index = index + 1 indexspec = "insert-%dc" % index ch = text.get(indexspec) if ch not in wordchars: break if text.compare(indexspec, "<=", "1.0"): break word = text.get("insert-%dc" % (index-1,), "insert") if word: import sys, __main__ namespace = sys.modules.copy() namespace.update(__main__.__dict__) try: return eval(word, namespace) except: pass return None def get_arg_text(ob): argText = "" if ob is not None: argOffset = 0 if type(ob)==types.MethodType: ob = ob.im_func argOffset = 1 if type(ob) in [types.FunctionType, types.LambdaType]: try: realArgs = ob.func_code.co_varnames[argOffset:ob.func_code.co_argcount] defaults = ob.func_defaults or [] defaults = list(map(lambda name: "=%s" % name, defaults)) defaults = [""] * (len(realArgs)-len(defaults)) + defaults argText = string.join( map(lambda arg, dflt: arg+dflt, realArgs, defaults), ", ") if len(realArgs)+argOffset < (len(ob.func_code.co_varnames) - len(ob.func_code.co_names) ): if argText: argText = argText + ", " argText = argText + "..." argText = "(%s)" % argText except: pass if not argText and hasattr(ob, "__doc__") and ob.__doc__: pos = string.find(ob.__doc__, "\n") if pos<0 or pos>70: pos=70 argText = ob.__doc__[:pos] return argText if __name__=='__main__': def t1(): "()" def t2(a, b=None): "(a, b=None)" def t3(a, *args): "(a, ...)" def t4(*args): "(...)" def t5(a, *args): "(a, ...)" def t6(a, b=None, *args, **kw): "(a, b=None, ...)" class TC: def t1(self): "()" def t2(self, a, b=None): "(a, b=None)" def t3(self, a, *args): "(a, ...)" def t4(self, *args): "(...)" def t5(self, a, *args): "(a, ...)" def t6(self, a, b=None, *args, **kw): "(a, b=None, ...)" | def showtip(self, text): self.text = text if self.tipwindow or not self.text: return self.widget.see("insert") x, y, cx, cy = self.widget.bbox("insert") x = x + self.widget.winfo_rootx() + 2 y = y + cy + self.widget.winfo_rooty() self.tipwindow = tw = Toplevel(self.widget) tw.wm_overrideredirect(1) tw.wm_geometry("+%d+%d" % (x, y)) label = Label(tw, text=self.text, justify=LEFT, background="#ffffe0", relief=SOLID, borderwidth=1) label.pack() | e3be6bfd1a3c9b8a90b99878151505c3c52878da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e3be6bfd1a3c9b8a90b99878151505c3c52878da/CallTips.py |
class container: def __init__(self): root = Tk() text = self.text = Text(root) text.pack(side=LEFT, fill=BOTH, expand=1) text.insert("insert", "string.split") root.update() self.calltip = CallTip(text) | def test( tests ): failed=[] for t in tests: if get_arg_text(t) != t.__doc__: failed.append(t) print "%s - expected %s, but got %s" % (t, `t.__doc__`, `get_arg_text(t)`) print "%d of %d tests failed" % (len(failed), len(tests)) | def hidetip(self): tw = self.tipwindow self.tipwindow = None if tw: tw.destroy() | e3be6bfd1a3c9b8a90b99878151505c3c52878da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e3be6bfd1a3c9b8a90b99878151505c3c52878da/CallTips.py |
text.event_add("<<calltip-show>>", "(") text.event_add("<<calltip-hide>>", ")") text.bind("<<calltip-show>>", self.calltip_show) text.bind("<<calltip-hide>>", self.calltip_hide) text.focus_set() | tc = TC() tests = t1, t2, t3, t4, t5, t6, \ tc.t1, tc.t2, tc.t3, tc.t4, tc.t5, tc.t6 | def __init__(self): root = Tk() text = self.text = Text(root) text.pack(side=LEFT, fill=BOTH, expand=1) text.insert("insert", "string.split") root.update() self.calltip = CallTip(text) | e3be6bfd1a3c9b8a90b99878151505c3c52878da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e3be6bfd1a3c9b8a90b99878151505c3c52878da/CallTips.py |
def calltip_show(self, event): self.calltip.showtip("Hello world") def calltip_hide(self, event): self.calltip.hidetip() def main(): c=container() if __name__=='__main__': main() | test(tests) | def calltip_show(self, event): self.calltip.showtip("Hello world") | e3be6bfd1a3c9b8a90b99878151505c3c52878da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e3be6bfd1a3c9b8a90b99878151505c3c52878da/CallTips.py |
print "open", askopenfilename(filetypes=[("all files", "*")]).encode(enc) print "saveas", asksaveasfilename().encode(enc) | def askdirectory (**options): "Ask for a directory, and return the file name" return Directory(**options).show() | 63d1e57f2380f3be657cfca2d7f07e5b5a77c9c4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/63d1e57f2380f3be657cfca2d7f07e5b5a77c9c4/tkFileDialog.py |
|
extern int _QdRGB_Convert(PyObject *, RGBColorPtr *); | extern int _QdRGB_Convert(PyObject *, RGBColorPtr); | #ifdef USE_TOOLBOX_OBJECT_GLUE | f1d19a17b5516502cca2abacf7d6f28e08bff097 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f1d19a17b5516502cca2abacf7d6f28e08bff097/qdsupport.py |
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(RGBColorPtr, QdRGB_Convert); | PyMac_INIT_TOOLBOX_OBJECT_CONVERT(RGBColor, QdRGB_Convert); | #ifdef USE_TOOLBOX_OBJECT_GLUE | f1d19a17b5516502cca2abacf7d6f28e08bff097 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f1d19a17b5516502cca2abacf7d6f28e08bff097/qdsupport.py |
if hex(-16) != '0xfffffff0': raise TestFailed, 'hex(-16)' | if len(hex(-1)) != len(hex(sys.maxint)): raise TestFailed, 'len(hex(-1))' if hex(-16) not in ('0xfffffff0', '0xfffffffffffffff0'): raise TestFailed, 'hex(-16)' | def f(): pass | c059b0dcea2df5ebee4f464e6d6f0b5a0ca8ea95 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c059b0dcea2df5ebee4f464e6d6f0b5a0ca8ea95/test_b1.py |
longopts.sort() | def getopt(args, shortopts, longopts = []): """getopt(args, options[, long_options]) -> opts, args Parses command line options and parameter list. args is the argument list to be parsed, without the leading reference to the running program. Typically, this means "sys.argv[1:]". shortopts is the string of option letters that the script wants to recognize, with options that require an argument followed by a colon (i.e., the same format that Unix getopt() uses). If specified, longopts is a list of strings with the names of the long options which should be supported. The leading '--' characters should not be included in the option name. Options which require an argument should be followed by an equal sign ('='). The return value consists of two elements: the first is a list of (option, value) pairs; the second is the list of program arguments left after the option list was stripped (this is a trailing slice of the first argument). Each option-and-value pair returned has the option as its first element, prefixed with a hyphen (e.g., '-x'), and the option argument as its second element, or an empty string if the option has no argument. The options occur in the list in the same order in which they were found, thus allowing multiple occurrences. Long and short options may be mixed. """ opts = [] if type(longopts) == type(""): longopts = [longopts] else: longopts = list(longopts) longopts.sort() while args and args[0].startswith('-') and args[0] != '-': if args[0] == '--': args = args[1:] break if args[0][:2] == '--': opts, args = do_longs(opts, args[0][2:], longopts, args[1:]) else: opts, args = do_shorts(opts, args[0][1:], shortopts, args[1:]) return opts, args | 4ed29a7b1ad7d8762fc841d1631bef06a58b6d51 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4ed29a7b1ad7d8762fc841d1631bef06a58b6d51/getopt.py |
|
def do_longs(opts, opt, longopts, args): try: i = opt.index('=') except ValueError: optarg = None else: opt, optarg = opt[:i], opt[i+1:] has_arg, opt = long_has_args(opt, longopts) if has_arg: if optarg is None: if not args: raise GetoptError('option --%s requires argument' % opt, opt) optarg, args = args[0], args[1:] elif optarg: raise GetoptError('option --%s must not have an argument' % opt, opt) opts.append(('--' + opt, optarg or '')) return opts, args | 4ed29a7b1ad7d8762fc841d1631bef06a58b6d51 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4ed29a7b1ad7d8762fc841d1631bef06a58b6d51/getopt.py |
||
for i in range(len(longopts)): if longopts[i].startswith(opt): break else: | possibilities = [o for o in longopts if o.startswith(opt)] if not possibilities: | def long_has_args(opt, longopts): for i in range(len(longopts)): if longopts[i].startswith(opt): break else: raise GetoptError('option --%s not recognized' % opt, opt) # opt is a prefix of longopts[i]; find j s.t. opt is a prefix of # each possibility in longopts[i:j] j = i+1 while j < len(longopts) and longopts[j].startswith(opt): j += 1 possibilities = longopts[i:j] # Is there an exact match? if opt in possibilities: return 0, opt elif opt + '=' in possibilities: return 1, opt # No exact match, so better be unique. if len(possibilities) > 1: # XXX since possibilities contains all valid continuations, might be # nice to work them into the error msg raise GetoptError('option --%s not a unique prefix' % opt, opt) assert len(possibilities) == 1 unique_match = possibilities[0] has_arg = unique_match.endswith('=') if has_arg: unique_match = unique_match[:-1] return has_arg, unique_match | 4ed29a7b1ad7d8762fc841d1631bef06a58b6d51 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4ed29a7b1ad7d8762fc841d1631bef06a58b6d51/getopt.py |
j = i+1 while j < len(longopts) and longopts[j].startswith(opt): j += 1 possibilities = longopts[i:j] | def long_has_args(opt, longopts): for i in range(len(longopts)): if longopts[i].startswith(opt): break else: raise GetoptError('option --%s not recognized' % opt, opt) # opt is a prefix of longopts[i]; find j s.t. opt is a prefix of # each possibility in longopts[i:j] j = i+1 while j < len(longopts) and longopts[j].startswith(opt): j += 1 possibilities = longopts[i:j] # Is there an exact match? if opt in possibilities: return 0, opt elif opt + '=' in possibilities: return 1, opt # No exact match, so better be unique. if len(possibilities) > 1: # XXX since possibilities contains all valid continuations, might be # nice to work them into the error msg raise GetoptError('option --%s not a unique prefix' % opt, opt) assert len(possibilities) == 1 unique_match = possibilities[0] has_arg = unique_match.endswith('=') if has_arg: unique_match = unique_match[:-1] return has_arg, unique_match | 4ed29a7b1ad7d8762fc841d1631bef06a58b6d51 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4ed29a7b1ad7d8762fc841d1631bef06a58b6d51/getopt.py |
|
exceptions, this sets `sender' to the string that the SMTP refused | exceptions, this sets `sender' to the string that the SMTP refused. | def __init__(self, code, msg): self.smtp_code = code self.smtp_error = msg self.args = (code, msg) | da063017c315c412a09400d414da00bc3d9b57c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/da063017c315c412a09400d414da00bc3d9b57c2/smtplib.py |
"""All recipient addresses refused. | """All recipient addresses refused. | def __init__(self, code, msg, sender): self.smtp_code = code self.smtp_error = msg self.sender = sender self.args = (code, msg, sender) | da063017c315c412a09400d414da00bc3d9b57c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/da063017c315c412a09400d414da00bc3d9b57c2/smtplib.py |
"""Error during connection establishment""" | """Error during connection establishment.""" | def __init__(self, recipients): self.recipients = recipients self.args = ( recipients,) | da063017c315c412a09400d414da00bc3d9b57c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/da063017c315c412a09400d414da00bc3d9b57c2/smtplib.py |
"""The server refused our HELO reply""" | """The server refused our HELO reply.""" | def __init__(self, recipients): self.recipients = recipients self.args = ( recipients,) | da063017c315c412a09400d414da00bc3d9b57c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/da063017c315c412a09400d414da00bc3d9b57c2/smtplib.py |
Double leading '.', and change Unix newline '\n', or Mac '\r' into | Double leading '.', and change Unix newline '\\n', or Mac '\\r' into | def quotedata(data): """Quote data for email. Double leading '.', and change Unix newline '\n', or Mac '\r' into Internet CRLF end-of-line. """ return re.sub(r'(?m)^\.', '..', re.sub(r'(?:\r\n|\n|\r(?!\n))', CRLF, data)) | da063017c315c412a09400d414da00bc3d9b57c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/da063017c315c412a09400d414da00bc3d9b57c2/smtplib.py |
This is the message given by the server in responce to the | This is the message given by the server in response to the | def quotedata(data): """Quote data for email. Double leading '.', and change Unix newline '\n', or Mac '\r' into Internet CRLF end-of-line. """ return re.sub(r'(?m)^\.', '..', re.sub(r'(?:\r\n|\n|\r(?!\n))', CRLF, data)) | da063017c315c412a09400d414da00bc3d9b57c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/da063017c315c412a09400d414da00bc3d9b57c2/smtplib.py |
This is the message given by the server in responce to the | This is the message given by the server in response to the | def quotedata(data): """Quote data for email. Double leading '.', and change Unix newline '\n', or Mac '\r' into Internet CRLF end-of-line. """ return re.sub(r'(?m)^\.', '..', re.sub(r'(?:\r\n|\n|\r(?!\n))', CRLF, data)) | da063017c315c412a09400d414da00bc3d9b57c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/da063017c315c412a09400d414da00bc3d9b57c2/smtplib.py |
will _after you do an EHLO command_, contain the names of the SMTP service extentions this server supports, and their | will _after you do an EHLO command_, contain the names of the SMTP service extensions this server supports, and their | def quotedata(data): """Quote data for email. Double leading '.', and change Unix newline '\n', or Mac '\r' into Internet CRLF end-of-line. """ return re.sub(r'(?m)^\.', '..', re.sub(r'(?:\r\n|\n|\r(?!\n))', CRLF, data)) | da063017c315c412a09400d414da00bc3d9b57c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/da063017c315c412a09400d414da00bc3d9b57c2/smtplib.py |
Note, all extention names are mapped to lower case in the | Note, all extension names are mapped to lower case in the | def quotedata(data): """Quote data for email. Double leading '.', and change Unix newline '\n', or Mac '\r' into Internet CRLF end-of-line. """ return re.sub(r'(?m)^\.', '..', re.sub(r'(?:\r\n|\n|\r(?!\n))', CRLF, data)) | da063017c315c412a09400d414da00bc3d9b57c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/da063017c315c412a09400d414da00bc3d9b57c2/smtplib.py |
For method docs, see each method's docstrings. In general, there is a method of the same name to perform each SMTP command, and there is a method called 'sendmail' that will do an entire mail transaction. """ | See each method's docstrings for details. In general, there is a method of the same name to perform each SMTP command. There is also a method called 'sendmail' that will do an entire mail transaction. """ | def quotedata(data): """Quote data for email. Double leading '.', and change Unix newline '\n', or Mac '\r' into Internet CRLF end-of-line. """ return re.sub(r'(?m)^\.', '..', re.sub(r'(?:\r\n|\n|\r(?!\n))', CRLF, data)) | da063017c315c412a09400d414da00bc3d9b57c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/da063017c315c412a09400d414da00bc3d9b57c2/smtplib.py |
By default, smtplib.SMTP_PORT is used. An SMTPConnectError is raised if the specified `host' doesn't respond correctly. | By default, smtplib.SMTP_PORT is used. An SMTPConnectError is raised if the specified `host' doesn't respond correctly. | def __init__(self, host = '', port = 0): """Initialize a new instance. | da063017c315c412a09400d414da00bc3d9b57c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/da063017c315c412a09400d414da00bc3d9b57c2/smtplib.py |
one recipient. It returns a dictionary, with one entry for each recipient that was refused. Each entry contains a tuple of the SMTP error code and the accompanying error message sent by the server. | one recipient. It returns a dictionary, with one entry for each recipient that was refused. Each entry contains a tuple of the SMTP error code and the accompanying error message sent by the server. | def sendmail(self, from_addr, to_addrs, msg, mail_options=[], rcpt_options=[]): """This command performs an entire mail transaction. | da063017c315c412a09400d414da00bc3d9b57c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/da063017c315c412a09400d414da00bc3d9b57c2/smtplib.py |
SMTPRecipientsRefused The server rejected for ALL recipients | SMTPRecipientsRefused The server rejected ALL recipients | def sendmail(self, from_addr, to_addrs, msg, mail_options=[], rcpt_options=[]): """This command performs an entire mail transaction. | da063017c315c412a09400d414da00bc3d9b57c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/da063017c315c412a09400d414da00bc3d9b57c2/smtplib.py |
550. If all addresses are accepted, then the method will return an | 550. If all addresses are accepted, then the method will return an | def sendmail(self, from_addr, to_addrs, msg, mail_options=[], rcpt_options=[]): """This command performs an entire mail transaction. | da063017c315c412a09400d414da00bc3d9b57c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/da063017c315c412a09400d414da00bc3d9b57c2/smtplib.py |
text = text.translate(self.whitespace_trans) | if isinstance(text, str): text = text.translate(self.whitespace_trans) elif isinstance(text, unicode): text = text.translate(self.unicode_whitespace_trans) | def _munge_whitespace(self, text): """_munge_whitespace(text : string) -> string | ad25865f946cefe2d3f291298b6cb7e8fc0b2c39 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ad25865f946cefe2d3f291298b6cb7e8fc0b2c39/textwrap.py |
entriesbygid = {} | def test_values(self): entries = grp.getgrall() entriesbyname = {} entriesbygid = {} | 004b7da367c3f8c8345a7897a0587b23d8642f2e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/004b7da367c3f8c8345a7897a0587b23d8642f2e/test_grp.py |
|
self.assertEqual(len(e), 4) self.assertEqual(e[0], e.gr_name) self.assert_(isinstance(e.gr_name, basestring)) self.assertEqual(e[1], e.gr_passwd) self.assert_(isinstance(e.gr_passwd, basestring)) self.assertEqual(e[2], e.gr_gid) self.assert_(isinstance(e.gr_gid, int)) self.assertEqual(e[3], e.gr_mem) self.assert_(isinstance(e.gr_mem, list)) | self.check_value(e) entriesbygid.setdefault(e.gr_gid, []).append(e) entriesbyname.setdefault(e.gr_name, []).append(e) | def test_values(self): entries = grp.getgrall() entriesbyname = {} entriesbygid = {} | 004b7da367c3f8c8345a7897a0587b23d8642f2e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/004b7da367c3f8c8345a7897a0587b23d8642f2e/test_grp.py |
entriesbyname.setdefault(e.gr_name, []).append(e) entriesbygid.setdefault(e.gr_gid, []).append(e) | def test_values(self): entries = grp.getgrall() entriesbyname = {} entriesbygid = {} | 004b7da367c3f8c8345a7897a0587b23d8642f2e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/004b7da367c3f8c8345a7897a0587b23d8642f2e/test_grp.py |
|
self.assert_(grp.getgrgid(e.gr_gid) in entriesbygid[e.gr_gid]) self.assert_(grp.getgrnam(e.gr_name) in entriesbyname[e.gr_name]) | e2 = grp.getgrgid(e.gr_gid) self.check_value(e2) self.assert_(max([self.valueseq(e2, x) \ for x in entriesbygid[e.gr_gid]])) e2 = grp.getgrnam(e.gr_name) self.check_value(e2) self.assert_(max([self.valueseq(e2, x) \ for x in entriesbyname[e.gr_name]])) | def test_values(self): entries = grp.getgrall() entriesbyname = {} entriesbygid = {} | 004b7da367c3f8c8345a7897a0587b23d8642f2e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/004b7da367c3f8c8345a7897a0587b23d8642f2e/test_grp.py |
'initial value %r' % (maxcount,)) | 'initial value %r' % self.maxcount | def v(self): self.nonzero.acquire() if self.count == self.maxcount: raise ValueError, '.v() tried to raise semaphore count above ' \ 'initial value %r' % (maxcount,)) self.count = self.count + 1 self.nonzero.signal() self.nonzero.release() | fc96f630ebfb66bf5d29212c932fa19be98393c7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fc96f630ebfb66bf5d29212c932fa19be98393c7/sync.py |
input = text_file.TextFile('Modules/Setup', join_lines=1) | def build_extensions(self): | a0b32abbe449df441711895f67d1420d93fcd54f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a0b32abbe449df441711895f67d1420d93fcd54f/setup.py |
|
while 1: line = input.readline() if not line: break line = line.split() remove_modules.append( line[0] ) input.close() | for filename in ('Modules/Setup', 'Modules/Setup.local'): input = text_file.TextFile(filename, join_lines=1) while 1: line = input.readline() if not line: break line = line.split() remove_modules.append(line[0]) input.close() | def build_extensions(self): | a0b32abbe449df441711895f67d1420d93fcd54f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a0b32abbe449df441711895f67d1420d93fcd54f/setup.py |
'.mid': 'audio/midi', '.midi': 'audio/midi', | def read_mime_types(file): try: f = open(file) except IOError: return None db = MimeTypes() db.readfp(f) return db.types_map | 0cabee06003d1b33f07c368e748b336d846fcd4a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0cabee06003d1b33f07c368e748b336d846fcd4a/mimetypes.py |
|
'.rtf': 'application/rtf', | def read_mime_types(file): try: f = open(file) except IOError: return None db = MimeTypes() db.readfp(f) return db.types_map | 0cabee06003d1b33f07c368e748b336d846fcd4a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0cabee06003d1b33f07c368e748b336d846fcd4a/mimetypes.py |
|
def runctx(statement, globals, locals, filename=None): """Run statement under profiler, supplying your own globals and locals, optionally saving results in filename. statement and filename have the same semantics as profile.run """ prof = Profile() try: prof = prof.runctx(statement, globals, locals) except SystemExit: pass if filename is not None: prof.dump_stats(filename) else: return prof.print_stats() | 4cf397b8b6cd1fff94953015e85ed3afba0e066e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4cf397b8b6cd1fff94953015e85ed3afba0e066e/profile.py |
||
for dirname in sys.path: fullname = os.path.join(dirname, 'profile.doc') if os.path.exists(fullname): sts = os.system('${PAGER-more} ' + fullname) if sts: print '*** Pager exit status:', sts break else: print 'Sorry, can\'t find the help file "profile.doc"', print 'along the Python search path.' | print "Documentation for the profile module can be found " print "in the Python Library Reference, section 'The Python Profiler'." | def help(): for dirname in sys.path: fullname = os.path.join(dirname, 'profile.doc') if os.path.exists(fullname): sts = os.system('${PAGER-more} ' + fullname) if sts: print '*** Pager exit status:', sts break else: print 'Sorry, can\'t find the help file "profile.doc"', print 'along the Python search path.' | 4cf397b8b6cd1fff94953015e85ed3afba0e066e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4cf397b8b6cd1fff94953015e85ed3afba0e066e/profile.py |
if platform in ('darwin', 'mac'): | if platform in ('darwin', 'mac') and ("--disable-toolbox-glue" not in sysconfig.get_config_var("CONFIG_ARGS")): | def build_extensions(self): | bb523df5026f155f5a81deb758ba0bbaa98e7c42 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bb523df5026f155f5a81deb758ba0bbaa98e7c42/setup.py |
if platform == 'darwin': | if platform == 'darwin' and ("--disable-toolbox-glue" not in sysconfig.get_config_var("CONFIG_ARGS")): | def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') | bb523df5026f155f5a81deb758ba0bbaa98e7c42 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bb523df5026f155f5a81deb758ba0bbaa98e7c42/setup.py |
elif o[-6:] == '.lproj': files = os.listdir(o) for f in files: if f[-4:] == '.nib': nibname = os.path.split(f)[1][:-4] cocoainfo = """ <key>NSMainNibFile</key> <string>%s</string> <key>NSPrincipalClass</key> <string>NSApplication</string>""" % nibname | def process_common_macho(template, progress, code, rsrcname, destname, is_update, raw=0, others=[]): # First make sure the name ends in ".app" if destname[-4:] != '.app': destname = destname + '.app' # Now deduce the short name shortname = os.path.split(destname)[1] if shortname[-4:] == '.app': # Strip the .app suffix shortname = shortname[:-4] # And deduce the .plist and .icns names plistname = None icnsname = None if rsrcname and rsrcname[-5:] == '.rsrc': tmp = rsrcname[:-5] plistname = tmp + '.plist' if os.path.exists(plistname): icnsname = tmp + '.icns' if not os.path.exists(icnsname): icnsname = None else: plistname = None # Start with copying the .app framework if not is_update: exceptlist = ["Contents/Info.plist", "Contents/Resources/English.lproj/InfoPlist.strings", "Contents/Resources/python.rsrc", ] copyapptree(template, destname, exceptlist, progress) # Now either use the .plist file or the default if progress: progress.label('Create info.plist') progress.inc(0) if plistname: shutil.copy2(plistname, os.path.join(destname, 'Contents', 'Info.plist')) if icnsname: icnsdest = os.path.split(icnsname)[1] icnsdest = os.path.join(destname, os.path.join('Contents', 'Resources', icnsdest)) shutil.copy2(icnsname, icnsdest) # XXXX Wrong. This should be parsed from plist file. Also a big hack:-) if shortname == 'PythonIDE': ownertype = 'Pide' else: ownertype = 'PytA' # XXXX Should copy .icns file else: cocoainfo = '' for o in others: if o[-4:] == '.nib': nibname = os.path.split(o)[1][:-4] cocoainfo = """ <key>NSMainNibFile</key> <string>%s</string> <key>NSPrincipalClass</key> <string>NSApplication</string>""" % nibname plistname = os.path.join(template, 'Contents', 'Resources', 'Applet-Info.plist') plistdata = open(plistname).read() plistdata = plistdata % {'appletname':shortname, 'cocoainfo':cocoainfo} ofp = open(os.path.join(destname, 'Contents', 'Info.plist'), 'w') ofp.write(plistdata) ofp.close() ownertype = 'PytA' # Create the PkgInfo file if progress: progress.label('Create PkgInfo') progress.inc(0) ofp = open(os.path.join(destname, 'Contents', 'PkgInfo'), 'wb') ofp.write('APPL' + ownertype) ofp.close() if progress: progress.label("Copy resources...") progress.set(20) resfilename = 'python.rsrc' # XXXX later: '%s.rsrc' % shortname try: output = Res.FSOpenResourceFile( os.path.join(destname, 'Contents', 'Resources', resfilename), u'', WRITE) except MacOS.Error: fsr, dummy = Res.FSCreateResourceFile( os.path.join(destname, 'Contents', 'Resources'), unicode(resfilename), '') output = Res.FSOpenResourceFile(fsr, u'', WRITE) # Copy the resources from the target specific resource template, if any typesfound, ownertype = [], None try: input = macresource.open_pathname(rsrcname) except (MacOS.Error, ValueError): pass if progress: progress.inc(50) else: typesfound, ownertype = copyres(input, output, [], 0, progress) Res.CloseResFile(input) # Check which resource-types we should not copy from the template skiptypes = [] | 5cd382bae9d7d532acc8f4de3ff268700461d6fe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5cd382bae9d7d532acc8f4de3ff268700461d6fe/buildtools.py |
|
stat_function = (os.stat, statcache.stat)[use_statcache] s1, s2 = _sig(stat_function(f1)), _sig(stat_function(f2)) if s1[0]!=stat.S_IFREG or s2[0]!=stat.S_IFREG: return 0 if shallow and s1 == s2: return 1 if s1[1]!=s2[1]: return 0 | if use_statcache: stat_function = statcache.stat else: stat_function = os.stat s1 = _sig(stat_function(f1)) s2 = _sig(stat_function(f2)) if s1[0] != stat.S_IFREG or s2[0] != stat.S_IFREG: return 0 if shallow and s1 == s2: return 1 if s1[1] != s2[1]: return 0 | def cmp(f1, f2, shallow=1,use_statcache=0): """Compare two files. Arguments: f1 -- First file name f2 -- Second file name shallow -- Just check stat signature (do not read the files). defaults to 1. use_statcache -- Do not stat() each file directly: go through the statcache module for more efficiency. Return value: integer -- 1 if the files are the same, 0 otherwise. This function uses a cache for past comparisons and the results, with a cache invalidation mechanism relying on stale signatures. Of course, if 'use_statcache' is true, this mechanism is defeated, and the cache will never grow stale. """ stat_function = (os.stat, statcache.stat)[use_statcache] s1, s2 = _sig(stat_function(f1)), _sig(stat_function(f2)) if s1[0]!=stat.S_IFREG or s2[0]!=stat.S_IFREG: return 0 if shallow and s1 == s2: return 1 if s1[1]!=s2[1]: return 0 result = _cache.get((f1, f2)) if result and (s1, s2)==result[:2]: return result[2] outcome = _do_cmp(f1, f2) _cache[f1, f2] = s1, s2, outcome return outcome | e67ced89ee2947866569c4a47c3a35e513c980cd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e67ced89ee2947866569c4a47c3a35e513c980cd/filecmp.py |
if result and (s1, s2)==result[:2]: | if result and (s1, s2) == result[:2]: | def cmp(f1, f2, shallow=1,use_statcache=0): """Compare two files. Arguments: f1 -- First file name f2 -- Second file name shallow -- Just check stat signature (do not read the files). defaults to 1. use_statcache -- Do not stat() each file directly: go through the statcache module for more efficiency. Return value: integer -- 1 if the files are the same, 0 otherwise. This function uses a cache for past comparisons and the results, with a cache invalidation mechanism relying on stale signatures. Of course, if 'use_statcache' is true, this mechanism is defeated, and the cache will never grow stale. """ stat_function = (os.stat, statcache.stat)[use_statcache] s1, s2 = _sig(stat_function(f1)), _sig(stat_function(f2)) if s1[0]!=stat.S_IFREG or s2[0]!=stat.S_IFREG: return 0 if shallow and s1 == s2: return 1 if s1[1]!=s2[1]: return 0 result = _cache.get((f1, f2)) if result and (s1, s2)==result[:2]: return result[2] outcome = _do_cmp(f1, f2) _cache[f1, f2] = s1, s2, outcome return outcome | e67ced89ee2947866569c4a47c3a35e513c980cd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e67ced89ee2947866569c4a47c3a35e513c980cd/filecmp.py |
print "path =", `path` if "/arse" in path: import pdb; pdb.set_trace() | def write_results_file(self, path, lines, lnotab, lines_hit): """Return a coverage results file in path.""" | 2ac16e538f0380db14afbbf75a366b09089f1651 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2ac16e538f0380db14afbbf75a366b09089f1651/trace.py |
|
raise IOError(errno.EBADF, "write() on read-only GzipFile object") | raise IOError(errno.EBADF, "read() on write-only GzipFile object") | def read(self, size=-1): if self.mode != READ: import errno raise IOError(errno.EBADF, "write() on read-only GzipFile object") | ca05e33210a2873d1779e971fa96e8fe3c9eecf7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ca05e33210a2873d1779e971fa96e8fe3c9eecf7/gzip.py |
elif type(arg) == type(""): | elif isinstance(arg, basestring): | def load_stats(self, arg): if not arg: self.stats = {} elif type(arg) == type(""): f = open(arg, 'rb') self.stats = marshal.load(f) f.close() try: file_stats = os.stat(arg) arg = time.ctime(file_stats.st_mtime) + " " + arg except: # in case this is not unix pass self.files = [ arg ] elif hasattr(arg, 'create_stats'): arg.create_stats() self.stats = arg.stats arg.stats = {} if not self.stats: raise TypeError, "Cannot create or construct a %r object from '%r''" % ( self.__class__, arg) return | d87e451b9e9b355ac75c9c2ed08cde21ba10db5e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d87e451b9e9b355ac75c9c2ed08cde21ba10db5e/pstats.py |
'lambda': ('ref/lambda', 'FUNCTIONS'), | 'lambda': ('ref/lambdas', 'FUNCTIONS'), | def writedocs(dir, pkgpath='', done=None): """Write out HTML documentation for all modules in a directory tree.""" if done is None: done = {} for file in os.listdir(dir): path = os.path.join(dir, file) if ispackage(path): writedocs(path, pkgpath + file + '.', done) elif os.path.isfile(path): modname = inspect.getmodulename(path) if modname: if modname == '__init__': modname = pkgpath[:-1] # remove trailing period else: modname = pkgpath + modname if modname not in done: done[modname] = 1 writedoc(modname) | 9fbf287241e4561acb33255cfb71cba124e273ee /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9fbf287241e4561acb33255cfb71cba124e273ee/pydoc.py |
'pass': 'PASS', | 'pass': ('ref/pass', ''), | def writedocs(dir, pkgpath='', done=None): """Write out HTML documentation for all modules in a directory tree.""" if done is None: done = {} for file in os.listdir(dir): path = os.path.join(dir, file) if ispackage(path): writedocs(path, pkgpath + file + '.', done) elif os.path.isfile(path): modname = inspect.getmodulename(path) if modname: if modname == '__init__': modname = pkgpath[:-1] # remove trailing period else: modname = pkgpath + modname if modname not in done: done[modname] = 1 writedoc(modname) | 9fbf287241e4561acb33255cfb71cba124e273ee /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9fbf287241e4561acb33255cfb71cba124e273ee/pydoc.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.