rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
if self.debugging > 1: print '*put*', `line` | if self.debugging > 1: print '*put*', self.sanitize(line) | def putline(self, line): line = line + CRLF if self.debugging > 1: print '*put*', `line` self.sock.send(line) | ebaf104665158f0dd215062b699e7f1a2b4580b7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ebaf104665158f0dd215062b699e7f1a2b4580b7/ftplib.py |
if self.debugging: print '*cmd*', `line` | if self.debugging: print '*cmd*', self.sanitize(line) | def putcmd(self, line): if self.debugging: print '*cmd*', `line` self.putline(line) | ebaf104665158f0dd215062b699e7f1a2b4580b7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ebaf104665158f0dd215062b699e7f1a2b4580b7/ftplib.py |
print '*get*', `line` | print '*get*', self.sanitize(line) | def getline(self): line = self.file.readline() if self.debugging > 1: print '*get*', `line` if not line: raise EOFError if line[-2:] == CRLF: line = line[:-2] elif line[-1:] in CRLF: line = line[:-1] return line | ebaf104665158f0dd215062b699e7f1a2b4580b7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ebaf104665158f0dd215062b699e7f1a2b4580b7/ftplib.py |
if self.debugging: print '*resp*', `resp` | if self.debugging: print '*resp*', self.sanitize(resp) | def getresp(self): resp = self.getmultiline() if self.debugging: print '*resp*', `resp` self.lastresp = resp[:3] c = resp[:1] if c == '4': raise error_temp, resp if c == '5': raise error_perm, resp if c not in '123': raise error_proto, resp return resp | ebaf104665158f0dd215062b699e7f1a2b4580b7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ebaf104665158f0dd215062b699e7f1a2b4580b7/ftplib.py |
if self.debugging > 1: print '*put urgent*', `line` | if self.debugging > 1: print '*put urgent*', self.sanitize(line) | def abort(self): line = 'ABOR' + CRLF if self.debugging > 1: print '*put urgent*', `line` self.sock.send(line, MSG_OOB) resp = self.getmultiline() if resp[:3] not in ('426', '226'): raise error_proto, resp | ebaf104665158f0dd215062b699e7f1a2b4580b7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ebaf104665158f0dd215062b699e7f1a2b4580b7/ftplib.py |
os.close(r2w[rd]) | os.close(r2w[rd]) ; os.close( rd ) p.unregister( r2w[rd] ) p.unregister( rd ) | def test_poll1(): """Basic functional test of poll object Create a bunch of pipe and test that poll works with them. """ print 'Running poll test 1' p = select.poll() NUM_PIPES = 12 MSG = " This is a test." MSG_LEN = len(MSG) readers = [] writers = [] r2w = {} w2r = {} for i in range(NUM_PIPES): rd, wr = os.pipe() p.register(rd, select.POLLIN) p.register(wr, select.POLLOUT) readers.append(rd) writers.append(wr) r2w[rd] = wr w2r[wr] = rd while writers: ready = p.poll() ready_writers = find_ready_matching(ready, select.POLLOUT) if not ready_writers: raise RuntimeError, "no pipes ready for writing" wr = random.choice(ready_writers) os.write(wr, MSG) ready = p.poll() ready_readers = find_ready_matching(ready, select.POLLIN) if not ready_readers: raise RuntimeError, "no pipes ready for reading" rd = random.choice(ready_readers) buf = os.read(rd, MSG_LEN) assert len(buf) == MSG_LEN print buf os.close(r2w[rd]) writers.remove(r2w[rd]) poll_unit_tests() print 'Poll test 1 complete' | d50a1877ee51a275a132c05d89bac12958811a5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d50a1877ee51a275a132c05d89bac12958811a5d/test_poll.py |
if fdlist[0] == (p.fileno(),select.POLLHUP): | fd, flags = fdlist[0] if flags & select.POLLHUP: | def test_poll2(): print 'Running poll test 2' cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 1; done' p = os.popen(cmd, 'r') pollster = select.poll() pollster.register( p, select.POLLIN ) for tout in (0, 1000, 2000, 4000, 8000, 16000) + (-1,)*10: if verbose: print 'timeout =', tout fdlist = pollster.poll(tout) if (fdlist == []): continue if fdlist[0] == (p.fileno(),select.POLLHUP): line = p.readline() if line != "": print 'error: pipe seems to be closed, but still returns data' continue elif fdlist[0] == (p.fileno(),select.POLLIN): line = p.readline() if verbose: print `line` if not line: if verbose: print 'EOF' break continue else: print 'Unexpected return value from select.poll:', fdlist p.close() print 'Poll test 2 complete' | d50a1877ee51a275a132c05d89bac12958811a5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d50a1877ee51a275a132c05d89bac12958811a5d/test_poll.py |
elif fdlist[0] == (p.fileno(),select.POLLIN): | elif flags & select.POLLIN: | def test_poll2(): print 'Running poll test 2' cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 1; done' p = os.popen(cmd, 'r') pollster = select.poll() pollster.register( p, select.POLLIN ) for tout in (0, 1000, 2000, 4000, 8000, 16000) + (-1,)*10: if verbose: print 'timeout =', tout fdlist = pollster.poll(tout) if (fdlist == []): continue if fdlist[0] == (p.fileno(),select.POLLHUP): line = p.readline() if line != "": print 'error: pipe seems to be closed, but still returns data' continue elif fdlist[0] == (p.fileno(),select.POLLIN): line = p.readline() if verbose: print `line` if not line: if verbose: print 'EOF' break continue else: print 'Unexpected return value from select.poll:', fdlist p.close() print 'Poll test 2 complete' | d50a1877ee51a275a132c05d89bac12958811a5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d50a1877ee51a275a132c05d89bac12958811a5d/test_poll.py |
self.text = text = Text(text_frame, name='text', padx=5, wrap=None, | self.text = text = Text(text_frame, name='text', padx=5, wrap='none', | def __init__(self, flist=None, filename=None, key=None, root=None): currentTheme=idleConf.CurrentTheme() self.flist = flist root = root or flist.root self.root = root self.menubar = Menu(root) self.top = top = self.Toplevel(root, menu=self.menubar) if flist: self.vars = flist.vars #self.top.instanceDict makes flist.inversedict avalable to #configDialog.py so it can access all EditorWindow instaces self.top.instanceDict=flist.inversedict self.recentFilesPath=os.path.join(idleConf.GetUserCfgDir(), 'recent-files.lst') self.break_set = False self.vbar = vbar = Scrollbar(top, name='vbar') self.text_frame = text_frame = Frame(top) self.text = text = Text(text_frame, name='text', padx=5, wrap=None, foreground=idleConf.GetHighlight(currentTheme, 'normal',fgBg='fg'), background=idleConf.GetHighlight(currentTheme, 'normal',fgBg='bg'), highlightcolor=idleConf.GetHighlight(currentTheme, 'hilite',fgBg='fg'), highlightbackground=idleConf.GetHighlight(currentTheme, 'hilite',fgBg='bg'), insertbackground=idleConf.GetHighlight(currentTheme, 'cursor',fgBg='fg'), width=idleConf.GetOption('main','EditorWindow','width'), height=idleConf.GetOption('main','EditorWindow','height') ) | a1dee069831c5551dc28d90d495ab5de967c17d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a1dee069831c5551dc28d90d495ab5de967c17d5/EditorWindow.py |
setattr (self, 'install_' + key, scheme[key]) | attrname = 'install_' + key if getattr(self, attrname) is None: setattr(self, attrname, scheme[key]) | def select_scheme (self, name): # it's the caller's problem if they supply a bad name! scheme = INSTALL_SCHEMES[name] for key in ('purelib', 'platlib', 'scripts', 'data'): setattr (self, 'install_' + key, scheme[key]) | 17f641c1439585d10a7d03cd22067e2dd0db3ccf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/17f641c1439585d10a7d03cd22067e2dd0db3ccf/install.py |
raise ValueError("time data did not match format") | raise ValueError("time data did not match format: data=%s fmt=%s" % (data_string, format)) | def strptime(data_string, format="%a %b %d %H:%M:%S %Y"): """Return a time struct based on the input data and the format string.""" global _locale_cache global _regex_cache locale_time = _locale_cache.locale_time # If the language changes, caches are invalidated, so clear them if locale_time.lang != _getlang(): _locale_cache = TimeRE() _regex_cache.clear() format_regex = _regex_cache.get(format) if not format_regex: # Limit regex cache size to prevent major bloating of the module; # The value 5 is arbitrary if len(_regex_cache) > 5: _regex_cache.clear() format_regex = _locale_cache.compile(format) _regex_cache[format] = format_regex found = format_regex.match(data_string) if not found: raise ValueError("time data did not match format") if len(data_string) != found.end(): raise ValueError("unconverted data remains: %s" % data_string[found.end():]) year = 1900 month = day = 1 hour = minute = second = 0 tz = -1 # weekday and julian defaulted to -1 so as to signal need to calculate values weekday = julian = -1 found_dict = found.groupdict() for group_key in found_dict.iterkeys(): if group_key == 'y': year = int(found_dict['y']) # Open Group specification for strptime() states that a %y #value in the range of [00, 68] is in the century 2000, while #[69,99] is in the century 1900 if year <= 68: year += 2000 else: year += 1900 elif group_key == 'Y': year = int(found_dict['Y']) elif group_key == 'm': month = int(found_dict['m']) elif group_key == 'B': month = _insensitiveindex(locale_time.f_month, found_dict['B']) elif group_key == 'b': month = _insensitiveindex(locale_time.a_month, found_dict['b']) elif group_key == 'd': day = int(found_dict['d']) elif group_key == 'H': hour = int(found_dict['H']) elif group_key == 'I': hour = int(found_dict['I']) ampm = found_dict.get('p', '').lower() # If there was no AM/PM indicator, we'll treat this like AM if ampm in ('', locale_time.am_pm[0].lower()): # We're in AM so the hour is correct unless we're # looking at 12 midnight. # 12 midnight == 12 AM == hour 0 if hour == 12: hour = 0 elif ampm == locale_time.am_pm[1].lower(): # We're in PM so we need to add 12 to the hour unless # we're looking at 12 noon. # 12 noon == 12 PM == hour 12 if hour != 12: hour += 12 elif group_key == 'M': minute = int(found_dict['M']) elif group_key == 'S': second = int(found_dict['S']) elif group_key == 'A': weekday = _insensitiveindex(locale_time.f_weekday, found_dict['A']) elif group_key == 'a': weekday = _insensitiveindex(locale_time.a_weekday, found_dict['a']) elif group_key == 'w': weekday = int(found_dict['w']) if weekday == 0: weekday = 6 else: weekday -= 1 elif group_key == 'j': julian = int(found_dict['j']) elif group_key == 'Z': # Since -1 is default value only need to worry about setting tz if # it can be something other than -1. found_zone = found_dict['Z'].lower() if locale_time.timezone[0] == locale_time.timezone[1] and \ time.daylight: pass #Deals with bad locale setup where timezone info is # the same; first found on FreeBSD 4.4. elif found_zone in ("utc", "gmt"): tz = 0 elif locale_time.timezone[2].lower() == found_zone: tz = 0 elif time.daylight and \ locale_time.timezone[3].lower() == found_zone: tz = 1 # Cannot pre-calculate datetime_date() since can change in Julian #calculation and thus could have different value for the day of the week #calculation if julian == -1: # Need to add 1 to result since first day of the year is 1, not 0. julian = datetime_date(year, month, day).toordinal() - \ datetime_date(year, 1, 1).toordinal() + 1 else: # Assume that if they bothered to include Julian day it will #be accurate datetime_result = datetime_date.fromordinal((julian - 1) + datetime_date(year, 1, 1).toordinal()) year = datetime_result.year month = datetime_result.month day = datetime_result.day if weekday == -1: weekday = datetime_date(year, month, day).weekday() return time.struct_time((year, month, day, hour, minute, second, weekday, julian, tz)) | 4a6302b6fe1a0acb85267677a9be2ee925cf8248 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4a6302b6fe1a0acb85267677a9be2ee925cf8248/_strptime.py |
- list: list of article ids""" | - list: list of message ids""" | def newnews(self, group, date, time, file=None): """Process a NEWNEWS command. Arguments: - group: group name or '*' - date: string 'yymmdd' indicating the date - time: string 'hhmmss' indicating the time Return: - resp: server response if successful - list: list of article ids""" | 5dbda75a0208d1e1acd1d3bf26c4c44df0897dae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5dbda75a0208d1e1acd1d3bf26c4c44df0897dae/nntplib.py |
- id: the article id""" | - id: the message id""" | def stat(self, id): """Process a STAT command. Argument: - id: article number or message id Returns: - resp: server response if successful - nr: the article number - id: the article id""" | 5dbda75a0208d1e1acd1d3bf26c4c44df0897dae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5dbda75a0208d1e1acd1d3bf26c4c44df0897dae/nntplib.py |
self.file = self.make_file('') | self.file = self.__file = StringIO() | def read_lines(self): """Internal: read lines until EOF or outerboundary.""" self.file = self.make_file('') if self.outerboundary: self.read_lines_to_outerboundary() else: self.read_lines_to_eof() | 52b8c29ca7172b4a6821e3e34b293562f3ae9a3f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/52b8c29ca7172b4a6821e3e34b293562f3ae9a3f/cgi.py |
self.file.write(line) | self.__write(line) | def read_lines_to_eof(self): """Internal: read lines until EOF.""" while 1: line = self.fp.readline() if not line: self.done = -1 break self.file.write(line) | 52b8c29ca7172b4a6821e3e34b293562f3ae9a3f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/52b8c29ca7172b4a6821e3e34b293562f3ae9a3f/cgi.py |
self.file.write(odelim + line) | self.__write(odelim + line) | def read_lines_to_outerboundary(self): """Internal: read lines until outerboundary.""" next = "--" + self.outerboundary last = next + "--" delim = "" while 1: line = self.fp.readline() if not line: self.done = -1 break if line[:2] == "--": strippedline = line.strip() if strippedline == next: break if strippedline == last: self.done = 1 break odelim = delim if line[-2:] == "\r\n": delim = "\r\n" line = line[:-2] elif line[-1] == "\n": delim = "\n" line = line[:-1] else: delim = "" self.file.write(odelim + line) | 52b8c29ca7172b4a6821e3e34b293562f3ae9a3f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/52b8c29ca7172b4a6821e3e34b293562f3ae9a3f/cgi.py |
if err[0] = errno.EINTR: | if err[0] == errno.EINTR: | def makefile(self, mode, bufsize=None): """Return a readable file-like object with data from socket. | f3623f310e92ddb499e020635fe4977aae38a719 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f3623f310e92ddb499e020635fe4977aae38a719/httplib.py |
[frozenmain_c, frozen_c], target) | [frozenmain_c, os.path.basename(frozen_c)], os.path.basename(target)) | def main(): # overridable context prefix = None # settable with -p option exec_prefix = None # settable with -P option extensions = [] path = sys.path[:] modargs = 0 debug = 1 odir = '' win = sys.platform[:3] == 'win' # modules that are imported by the Python runtime implicits = ["site", "exceptions"] # output files frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' # normally derived from script name makefile = 'Makefile' subsystem = 'console' # parse command line try: opts, args = getopt.getopt(sys.argv[1:], 'de:hmo:p:P:qs:w') except getopt.error, msg: usage('getopt error: ' + str(msg)) # proces option arguments for o, a in opts: if o == '-h': print __doc__ return if o == '-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 # 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 ishome: print "(Using Python source directory)" binlib = exec_prefix incldir = os.path.join(prefix, 'Include') config_c_in = os.path.join(prefix, 'Modules', 'config.c.in') frozenmain_c = os.path.join(prefix, 'Python', 'frozenmain.c') makefile_in = os.path.join(exec_prefix, 'Modules', 'Makefile') else: binlib = os.path.join(exec_prefix, 'lib', 'python%s' % version, 'config') incldir = os.path.join(prefix, 'include', 'python%s' % version) config_c_in = os.path.join(binlib, 'config.c.in') frozenmain_c = os.path.join(binlib, 'frozenmain.c') makefile_in = os.path.join(binlib, 'Makefile') supp_sources = [] defines = [] includes = ['-I' + incldir, '-I' + binlib] # sanity check of directories and files for dir in [prefix, exec_prefix, binlib, incldir] + extensions: if not os.path.exists(dir): usage('needed directory %s not found' % dir) if not os.path.isdir(dir): usage('%s: not a directory' % dir) if win: files = supp_sources else: files = [config_c_in, makefile_in] + supp_sources for file in supp_sources: if not os.path.exists(file): usage('needed file %s not found' % file) if not os.path.isfile(file): usage('%s: not a plain file' % file) if not win: for dir in extensions: setup = os.path.join(dir, 'Setup') if not os.path.exists(setup): usage('needed file %s not found' % setup) if not os.path.isfile(setup): usage('%s: not a plain file' % setup) # check that enough arguments are passed if not args: usage('at least one filename argument required') # check that file arguments exist for arg in args: if arg == '-m': 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) if modargs: break # process non-option arguments scriptfile = args[0] modules = args[1:] # derive target name from script name base = os.path.basename(scriptfile) base, ext = os.path.splitext(base) if base: if base != scriptfile: target = base else: target = base + '.bin' # handle -o option base_frozen_c = frozen_c base_config_c = config_c base_target = target if odir and not os.path.isdir(odir): try: os.mkdir(odir) print "Created output directory", odir except os.error, msg: usage('%s: mkdir failed (%s)' % (odir, str(msg))) if odir: frozen_c = os.path.join(odir, frozen_c) config_c = os.path.join(odir, config_c) target = os.path.join(odir, target) makefile = os.path.join(odir, makefile) # Actual work starts here... # collect all modules of the program dir = os.path.dirname(scriptfile) path[0] = dir mf = modulefinder.ModuleFinder(path, debug) 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) mf.run_script(scriptfile) if debug > 0: mf.report() print dict = mf.modules # generate output for frozen modules backup = frozen_c + '~' try: os.rename(frozen_c, backup) except os.error: backup = None outfp = open(frozen_c, 'w') try: makefreeze.makefreeze(outfp, dict, debug) if win and subsystem == 'windows': import winmakemakefile outfp.write(winmakemakefile.WINMAINTEMPLATE) finally: outfp.close() if backup: if cmp.cmp(backup, frozen_c): sys.stderr.write('%s not changed, not written\n' % frozen_c) os.unlink(frozen_c) os.rename(backup, frozen_c) # windows gets different treatment if win: # Taking a shortcut here... import winmakemakefile outfp = open(makefile, 'w') try: winmakemakefile.makemakefile(outfp, locals(), [frozenmain_c, frozen_c], target) finally: outfp.close() return # generate config.c and Makefile 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) addfiles = [] if unknown: addfiles, addmods = \ checkextensions.checkextensions(unknown, extensions) for mod in addmods: unknown.remove(mod) builtins = builtins + addmods if unknown: sys.stderr.write('Warning: unknown modules remain: %s\n' % string.join(unknown)) builtins.sort() infp = open(config_c_in) backup = config_c + '~' try: os.rename(config_c, backup) except os.error: backup = None outfp = open(config_c, 'w') try: makeconfig.makeconfig(infp, outfp, builtins) finally: outfp.close() infp.close() if backup: if cmp.cmp(backup, config_c): sys.stderr.write('%s not changed, not written\n' % config_c) os.unlink(config_c) os.rename(backup, config_c) cflags = defines + includes + ['$(OPT)'] 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'] = string.join(cflags) # override files = ['$(OPT)', '$(LDFLAGS)', base_config_c, base_frozen_c] + \ supp_sources + addfiles + libs + \ ['$(MODLIBS)', '$(LIBS)', '$(SYSLIBS)'] backup = makefile + '~' if os.path.exists(makefile): try: os.unlink(backup) except os.error: pass try: os.rename(makefile, backup) except os.error: backup = None outfp = open(makefile, 'w') try: makemakefile.makemakefile(outfp, somevars, files, base_target) finally: outfp.close() if backup: if not cmp.cmp(backup, makefile): print 'previous Makefile saved as', backup else: sys.stderr.write('%s not changed, not written\n' % makefile) os.unlink(makefile) os.rename(backup, makefile) # Done! if odir: print 'Now run "make" in', odir, print 'to build the target:', base_target else: print 'Now run "make" to build the target:', base_target | 31d53ed93c82419a9b640daa86d162a6edcdc129 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/31d53ed93c82419a9b640daa86d162a6edcdc129/freeze.py |
format = ' %' + directive | format = '%' + directive strf_output = time.strftime(format, tt) | def test_strptime(self): tt = time.gmtime(self.t) for directive in ('a', 'A', 'b', 'B', 'c', 'd', 'H', 'I', 'j', 'm', 'M', 'p', 'S', 'U', 'w', 'W', 'x', 'X', 'y', 'Y', 'Z', '%'): format = ' %' + directive try: time.strptime(time.strftime(format, tt), format) except ValueError: self.fail('conversion specifier: %r failed.' % format) | e042601251e74a1c5bac287c936daa076b1f9a80 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e042601251e74a1c5bac287c936daa076b1f9a80/test_time.py |
time.strptime(time.strftime(format, tt), format) | time.strptime(strf_output, format) | def test_strptime(self): tt = time.gmtime(self.t) for directive in ('a', 'A', 'b', 'B', 'c', 'd', 'H', 'I', 'j', 'm', 'M', 'p', 'S', 'U', 'w', 'W', 'x', 'X', 'y', 'Y', 'Z', '%'): format = ' %' + directive try: time.strptime(time.strftime(format, tt), format) except ValueError: self.fail('conversion specifier: %r failed.' % format) | e042601251e74a1c5bac287c936daa076b1f9a80 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e042601251e74a1c5bac287c936daa076b1f9a80/test_time.py |
self.fail('conversion specifier: %r failed.' % format) | self.fail("conversion specifier %r failed with '%s' input." % (format, strf_output)) | def test_strptime(self): tt = time.gmtime(self.t) for directive in ('a', 'A', 'b', 'B', 'c', 'd', 'H', 'I', 'j', 'm', 'M', 'p', 'S', 'U', 'w', 'W', 'x', 'X', 'y', 'Y', 'Z', '%'): format = ' %' + directive try: time.strptime(time.strftime(format, tt), format) except ValueError: self.fail('conversion specifier: %r failed.' % format) | e042601251e74a1c5bac287c936daa076b1f9a80 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e042601251e74a1c5bac287c936daa076b1f9a80/test_time.py |
if type(commandlist) == type(()) and len(commandlist[0]) > 1: | if type(commandlist[0]) == type(()) and len(commandlist[0]) > 1: | def GetArgv(optionlist=None, commandlist=None, addoldfile=1, addnewfile=1, addfolder=1, id=ARGV_ID): d = GetNewDialog(id, -1) if not d: print "Can't get DLOG resource with id =", id return | 0bb0a90b200ef40f812b70c2623c7062cd39f3b3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0bb0a90b200ef40f812b70c2623c7062cd39f3b3/EasyDialogs.py |
if type(optionlist) == type(()): option = optionlist[idx][0] else: option = optionlist[idx] | option = optionlist[idx] if type(option) == type(()): option = option[0] | def GetArgv(optionlist=None, commandlist=None, addoldfile=1, addnewfile=1, addfolder=1, id=ARGV_ID): d = GetNewDialog(id, -1) if not d: print "Can't get DLOG resource with id =", id return | 0bb0a90b200ef40f812b70c2623c7062cd39f3b3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0bb0a90b200ef40f812b70c2623c7062cd39f3b3/EasyDialogs.py |
if 0 <= idx < len(commandlist) and type(commandlist) == type(()) and \ | if 0 <= idx < len(commandlist) and type(commandlist[idx]) == type(()) and \ | def GetArgv(optionlist=None, commandlist=None, addoldfile=1, addnewfile=1, addfolder=1, id=ARGV_ID): d = GetNewDialog(id, -1) if not d: print "Can't get DLOG resource with id =", id return | 0bb0a90b200ef40f812b70c2623c7062cd39f3b3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0bb0a90b200ef40f812b70c2623c7062cd39f3b3/EasyDialogs.py |
if type(commandlist) == type(()): stringstoadd = [commandlist[idx][0]] else: stringstoadd = [commandlist[idx]] | command = commandlist[idx] if type(command) == type(()): command = command[0] stringstoadd = [command] | def GetArgv(optionlist=None, commandlist=None, addoldfile=1, addnewfile=1, addfolder=1, id=ARGV_ID): d = GetNewDialog(id, -1) if not d: print "Can't get DLOG resource with id =", id return | 0bb0a90b200ef40f812b70c2623c7062cd39f3b3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0bb0a90b200ef40f812b70c2623c7062cd39f3b3/EasyDialogs.py |
if not grouping:return s | if not grouping:return (s, 0) | def _group(s): conv=localeconv() grouping=conv['grouping'] if not grouping:return s result="" seps = 0 spaces = "" if s[-1] == ' ': sp = s.find(' ') spaces = s[sp:] s = s[:sp] while s and grouping: # if grouping is -1, we are done if grouping[0]==CHAR_MAX: break # 0: re-use last group ad infinitum elif grouping[0]!=0: #process last group group=grouping[0] grouping=grouping[1:] if result: result=s[-group:]+conv['thousands_sep']+result seps += 1 else: result=s[-group:] s=s[:-group] if s and s[-1] not in "0123456789": # the leading string is only spaces and signs return s+result+spaces,seps if not result: return s+spaces,seps if s: result=s+conv['thousands_sep']+result seps += 1 return result+spaces,seps | 67addfe2a87d22458323e268d2bcc7406e6febc2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/67addfe2a87d22458323e268d2bcc7406e6febc2/locale.py |
print sys.exc_value | def test(name, input, output): f = getattr(strop, name) try: value = f(input) except: value = sys.exc_type print sys.exc_value if value != output: print f, `input`, `output`, `value` | 6592f88fc0598aa465f214de0dd4eb5c58229976 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6592f88fc0598aa465f214de0dd4eb5c58229976/test_strop.py |
|
if line == '?': line = 'help' elif line == '!': | if not line: return self.emptyline() elif line[0] == '?': line = 'help ' + line[1:] elif line[0] == '!': | def onecmd(self, line): line = string.strip(line) if line == '?': line = 'help' elif line == '!': if hasattr(self, 'do_shell'): line = 'shell' else: return self.default(line) elif not line: return self.emptyline() self.lastcmd = line i, n = 0, len(line) while i < n and line[i] in self.identchars: i = i+1 cmd, arg = line[:i], string.strip(line[i:]) if cmd == '': return self.default(line) else: try: func = getattr(self, 'do_' + cmd) except AttributeError: return self.default(line) return func(arg) | 5f1b27084aacc2975b3f94e7b225215066f4e1e2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5f1b27084aacc2975b3f94e7b225215066f4e1e2/cmd.py |
line = 'shell' | line = 'shell ' + line[1:] | def onecmd(self, line): line = string.strip(line) if line == '?': line = 'help' elif line == '!': if hasattr(self, 'do_shell'): line = 'shell' else: return self.default(line) elif not line: return self.emptyline() self.lastcmd = line i, n = 0, len(line) while i < n and line[i] in self.identchars: i = i+1 cmd, arg = line[:i], string.strip(line[i:]) if cmd == '': return self.default(line) else: try: func = getattr(self, 'do_' + cmd) except AttributeError: return self.default(line) return func(arg) | 5f1b27084aacc2975b3f94e7b225215066f4e1e2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5f1b27084aacc2975b3f94e7b225215066f4e1e2/cmd.py |
elif not line: return self.emptyline() | def onecmd(self, line): line = string.strip(line) if line == '?': line = 'help' elif line == '!': if hasattr(self, 'do_shell'): line = 'shell' else: return self.default(line) elif not line: return self.emptyline() self.lastcmd = line i, n = 0, len(line) while i < n and line[i] in self.identchars: i = i+1 cmd, arg = line[:i], string.strip(line[i:]) if cmd == '': return self.default(line) else: try: func = getattr(self, 'do_' + cmd) except AttributeError: return self.default(line) return func(arg) | 5f1b27084aacc2975b3f94e7b225215066f4e1e2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5f1b27084aacc2975b3f94e7b225215066f4e1e2/cmd.py |
|
SyntaxError: 'yield' outside function (<doctest test.test_generators.__test__.coroutine[10]>, line 1) | SyntaxError: 'yield' outside function (<doctest test.test_generators.__test__.coroutine[21]>, line 1) | >>> def f(): list(i for i in [(yield 26)]) | 0d62a062066a4cbc8aabab9c305d60ebf7922c8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0d62a062066a4cbc8aabab9c305d60ebf7922c8c/test_generators.py |
SyntaxError: 'return' with argument inside generator (<doctest test.test_generators.__test__.coroutine[11]>, line 1) | SyntaxError: 'return' with argument inside generator (<doctest test.test_generators.__test__.coroutine[22]>, line 1) | >>> def f(): return lambda x=(yield): 1 | 0d62a062066a4cbc8aabab9c305d60ebf7922c8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0d62a062066a4cbc8aabab9c305d60ebf7922c8c/test_generators.py |
SyntaxError: assignment to yield expression not possible (<doctest test.test_generators.__test__.coroutine[12]>, line 1) | SyntaxError: assignment to yield expression not possible (<doctest test.test_generators.__test__.coroutine[23]>, line 1) >>> def f(): (yield bar) = y Traceback (most recent call last): ... SyntaxError: can't assign to yield expression (<doctest test.test_generators.__test__.coroutine[24]>, line 1) >>> def f(): (yield bar) += y Traceback (most recent call last): ... SyntaxError: augmented assignment to yield expression not possible (<doctest test.test_generators.__test__.coroutine[25]>, line 1) | >>> def f(): x = yield = y | 0d62a062066a4cbc8aabab9c305d60ebf7922c8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0d62a062066a4cbc8aabab9c305d60ebf7922c8c/test_generators.py |
g['SO'] = '.ppc.slb' | g['SO'] = '.ppc.slb' | def _init_mac(): """Initialize the module as appropriate for Macintosh systems""" g = {} # set basic install directories g['LIBDEST'] = get_python_lib(plat_specific=0, standard_lib=1) g['BINLIBDEST'] = get_python_lib(plat_specific=1, standard_lib=1) # XXX hmmm.. a normal install puts include files here g['INCLUDEPY'] = get_python_inc(plat_specific=0) import MacOS if not hasattr(MacOS, 'runtimemodel'): g['SO'] = '.ppc.slb' else: g['SO'] = '.%s.slb' % MacOS.runtimemodel # XXX are these used anywhere? g['install_lib'] = os.path.join(EXEC_PREFIX, "Lib") g['install_platlib'] = os.path.join(EXEC_PREFIX, "Mac", "Lib") global _config_vars _config_vars = g | 99f9baa33190482784900970fd3e1c76e7cb48d6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/99f9baa33190482784900970fd3e1c76e7cb48d6/sysconfig.py |
libraries, extradirs, extraexportsymbols) | libraries, extradirs, extraexportsymbols, outputdir) | def genpluginproject(architecture, module, project=None, projectdir=None, sources=[], sourcedirs=[], libraries=[], extradirs=[], extraexportsymbols=[], outputdir=":::Lib:lib-dynload"): if architecture == "all": # For the time being we generate two project files. Not as nice as # a single multitarget project, but easier to implement for now. genpluginproject("ppc", module, project, projectdir, sources, sourcedirs, libraries, extradirs, extraexportsymbols) genpluginproject("carbon", module, project, projectdir, sources, sourcedirs, libraries, extradirs, extraexportsymbols) return templatename = "template-%s" % architecture targetname = "%s.%s" % (module, architecture) dllname = "%s.%s.slb" % (module, architecture) if not project: if architecture != "ppc": project = "%s.%s.mcp"%(module, architecture) else: project = "%s.mcp"%module if not projectdir: projectdir = PROJECTDIR if not sources: sources = [module + 'module.c'] if not sourcedirs: for moduledir in MODULEDIRS: if '%' in moduledir: moduledir = moduledir % module fn = os.path.join(projectdir, os.path.join(moduledir, sources[0])) if os.path.exists(fn): moduledir, sourcefile = os.path.split(fn) sourcedirs = [relpath(projectdir, moduledir)] sources[0] = sourcefile break else: print "Warning: %s: sourcefile not found: %s"%(module, sources[0]) sourcedirs = [] if architecture == "carbon": prefixname = "mwerks_carbonplugin_config.h" else: prefixname = "mwerks_plugin_config.h" dict = { "sysprefix" : relpath(projectdir, sys.prefix), "sources" : sources, "extrasearchdirs" : sourcedirs + extradirs, "libraries": libraries, "mac_outputdir" : outputdir, "extraexportsymbols" : extraexportsymbols, "mac_targetname" : targetname, "mac_dllname" : dllname, "prefixname" : prefixname, } mkcwproject.mkproject(os.path.join(projectdir, project), module, dict, force=FORCEREBUILD, templatename=templatename) | 7586b049ba2cfbf6a67b2deaeadb36603a1bb346 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7586b049ba2cfbf6a67b2deaeadb36603a1bb346/genpluginprojects.py |
libraries, extradirs, extraexportsymbols) | libraries, extradirs, extraexportsymbols, outputdir) | def genpluginproject(architecture, module, project=None, projectdir=None, sources=[], sourcedirs=[], libraries=[], extradirs=[], extraexportsymbols=[], outputdir=":::Lib:lib-dynload"): if architecture == "all": # For the time being we generate two project files. Not as nice as # a single multitarget project, but easier to implement for now. genpluginproject("ppc", module, project, projectdir, sources, sourcedirs, libraries, extradirs, extraexportsymbols) genpluginproject("carbon", module, project, projectdir, sources, sourcedirs, libraries, extradirs, extraexportsymbols) return templatename = "template-%s" % architecture targetname = "%s.%s" % (module, architecture) dllname = "%s.%s.slb" % (module, architecture) if not project: if architecture != "ppc": project = "%s.%s.mcp"%(module, architecture) else: project = "%s.mcp"%module if not projectdir: projectdir = PROJECTDIR if not sources: sources = [module + 'module.c'] if not sourcedirs: for moduledir in MODULEDIRS: if '%' in moduledir: moduledir = moduledir % module fn = os.path.join(projectdir, os.path.join(moduledir, sources[0])) if os.path.exists(fn): moduledir, sourcefile = os.path.split(fn) sourcedirs = [relpath(projectdir, moduledir)] sources[0] = sourcefile break else: print "Warning: %s: sourcefile not found: %s"%(module, sources[0]) sourcedirs = [] if architecture == "carbon": prefixname = "mwerks_carbonplugin_config.h" else: prefixname = "mwerks_plugin_config.h" dict = { "sysprefix" : relpath(projectdir, sys.prefix), "sources" : sources, "extrasearchdirs" : sourcedirs + extradirs, "libraries": libraries, "mac_outputdir" : outputdir, "extraexportsymbols" : extraexportsymbols, "mac_targetname" : targetname, "mac_dllname" : dllname, "prefixname" : prefixname, } mkcwproject.mkproject(os.path.join(projectdir, project), module, dict, force=FORCEREBUILD, templatename=templatename) | 7586b049ba2cfbf6a67b2deaeadb36603a1bb346 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7586b049ba2cfbf6a67b2deaeadb36603a1bb346/genpluginprojects.py |
genpluginproject("ppc", "Icn", libraries=["IconServicesLib"]) | genpluginproject("ppc", "Icn", libraries=["IconServicesLib"], outputdir="::Lib:Carbon") | def genpluginproject(architecture, module, project=None, projectdir=None, sources=[], sourcedirs=[], libraries=[], extradirs=[], extraexportsymbols=[], outputdir=":::Lib:lib-dynload"): if architecture == "all": # For the time being we generate two project files. Not as nice as # a single multitarget project, but easier to implement for now. genpluginproject("ppc", module, project, projectdir, sources, sourcedirs, libraries, extradirs, extraexportsymbols) genpluginproject("carbon", module, project, projectdir, sources, sourcedirs, libraries, extradirs, extraexportsymbols) return templatename = "template-%s" % architecture targetname = "%s.%s" % (module, architecture) dllname = "%s.%s.slb" % (module, architecture) if not project: if architecture != "ppc": project = "%s.%s.mcp"%(module, architecture) else: project = "%s.mcp"%module if not projectdir: projectdir = PROJECTDIR if not sources: sources = [module + 'module.c'] if not sourcedirs: for moduledir in MODULEDIRS: if '%' in moduledir: moduledir = moduledir % module fn = os.path.join(projectdir, os.path.join(moduledir, sources[0])) if os.path.exists(fn): moduledir, sourcefile = os.path.split(fn) sourcedirs = [relpath(projectdir, moduledir)] sources[0] = sourcefile break else: print "Warning: %s: sourcefile not found: %s"%(module, sources[0]) sourcedirs = [] if architecture == "carbon": prefixname = "mwerks_carbonplugin_config.h" else: prefixname = "mwerks_plugin_config.h" dict = { "sysprefix" : relpath(projectdir, sys.prefix), "sources" : sources, "extrasearchdirs" : sourcedirs + extradirs, "libraries": libraries, "mac_outputdir" : outputdir, "extraexportsymbols" : extraexportsymbols, "mac_targetname" : targetname, "mac_dllname" : dllname, "prefixname" : prefixname, } mkcwproject.mkproject(os.path.join(projectdir, project), module, dict, force=FORCEREBUILD, templatename=templatename) | 7586b049ba2cfbf6a67b2deaeadb36603a1bb346 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7586b049ba2cfbf6a67b2deaeadb36603a1bb346/genpluginprojects.py |
counter = 0 | def gettempprefix(): """Function to calculate a prefix of the filename to use.""" global template, _pid if os.name == 'posix' and _pid and _pid != os.getpid(): # Our pid changed; we must have forked -- zap the template template = None if template is None: if os.name == 'posix': _pid = os.getpid() template = '@' + `_pid` + '.' elif os.name == 'nt': template = '~' + `os.getpid()` + '-' elif os.name == 'mac': template = 'Python-Tmp-' else: template = 'tmp' # XXX might choose a better one return template | 1baa22aff0a9cde81e2b19b36662e7987b83356b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1baa22aff0a9cde81e2b19b36662e7987b83356b/tempfile.py |
|
global counter | def mktemp(suffix=""): """User-callable function to return a unique temporary file name.""" global counter dir = gettempdir() pre = gettempprefix() while 1: counter = counter + 1 file = os.path.join(dir, pre + `counter` + suffix) if not os.path.exists(file): return file | 1baa22aff0a9cde81e2b19b36662e7987b83356b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1baa22aff0a9cde81e2b19b36662e7987b83356b/tempfile.py |
|
counter = counter + 1 file = os.path.join(dir, pre + `counter` + suffix) | i = _counter.get_next() file = os.path.join(dir, pre + str(i) + suffix) | def mktemp(suffix=""): """User-callable function to return a unique temporary file name.""" global counter dir = gettempdir() pre = gettempprefix() while 1: counter = counter + 1 file = os.path.join(dir, pre + `counter` + suffix) if not os.path.exists(file): return file | 1baa22aff0a9cde81e2b19b36662e7987b83356b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1baa22aff0a9cde81e2b19b36662e7987b83356b/tempfile.py |
d0 = base.replace(minute=3, tzinfo=OperandDependentOffset()) d1 = base.replace(minute=9, tzinfo=OperandDependentOffset()) d2 = base.replace(minute=11, tzinfo=OperandDependentOffset()) for x in d0, d1, d2: for y in d0, d1, d2: got = cmp(x, y) if (x is d0 or x is d1) and (y is d0 or y is d1): expected = 0 elif x is y is d2: expected = 0 elif x is d2: expected = -1 else: assert y is d2 expected = 1 self.assertEqual(got, expected) | if cls is not timetz: d0 = base.replace(minute=3, tzinfo=OperandDependentOffset()) d1 = base.replace(minute=9, tzinfo=OperandDependentOffset()) d2 = base.replace(minute=11, tzinfo=OperandDependentOffset()) for x in d0, d1, d2: for y in d0, d1, d2: got = cmp(x, y) if (x is d0 or x is d1) and (y is d0 or y is d1): expected = 0 elif x is y is d2: expected = 0 elif x is d2: expected = -1 else: assert y is d2 expected = 1 self.assertEqual(got, expected) | def utcoffset(self, t): if t.minute < 10: return t.minute # d0 and d1 equal after adjustment else: return 59 # d2 off in the weeds | bad8ff089a04372465c3143a3567b9712673c155 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/bad8ff089a04372465c3143a3567b9712673c155/test_datetime.py |
if dt is None or isinstance(dt, time) or dt.tzinfo is None: | if dt is None or dt.tzinfo is None: | def dst(self, dt): if dt is None or isinstance(dt, time) or dt.tzinfo is None: # An exception instead may be sensible here, in one or more of # the cases. return ZERO | bad8ff089a04372465c3143a3567b9712673c155 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/bad8ff089a04372465c3143a3567b9712673c155/test_datetime.py |
cdll.load('libGL.so', mode=RTLD_GLOBAL) cdll.load('libGLU.so') | if os.path.exists('/usr/lib/libGL.so'): cdll.load('libGL.so', mode=RTLD_GLOBAL) if os.path.exists('/usr/lib/libGLU.so'): cdll.load('libGLU.so') | def test_GL(self): cdll.load('libGL.so', mode=RTLD_GLOBAL) cdll.load('libGLU.so') | 23e408603cffc2c1e515230deb7239e95f6173cb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/23e408603cffc2c1e515230deb7239e95f6173cb/test_posix.py |
gp.pixmode(GL.PM_RTOL, 1) | gl.pixmode(GL.PM_RTOL, 1) | def showpartframe(self, data, chromdata, (x,y,w,h)): pmsize = self.bpp xpf, ypf = self.xpf, self.ypf if self.upside_down: gl.pixmode(GL.PM_TTOB, 1) if self.mirror_image: gp.pixmode(GL.PM_RTOL, 1) if self.format in ('jpeg', 'jpeggrey'): import jpeg data, width, height, bytes = jpeg.decompress(data) pmsize = bytes*8 elif self.format == 'compress': if not self.decompressor: import cl, CL scheme = cl.QueryScheme(self.compressheader) self.decompressor = cl.OpenDecompressor(scheme) headersize = self.decompressor.ReadHeader(self.compressheader) width = self.decompressor.GetParam(CL.IMAGE_WIDTH) height = self.decompressor.GetParam(CL.IMAGE_HEIGHT) params = [CL.ORIGINAL_FORMAT, CL.RGBX, \ CL.ORIENTATION, CL.BOTTOM_UP, \ CL.FRAME_BUFFER_SIZE, width*height*CL.BytesPerPixel(CL.RGBX)] self.decompressor.SetParams(params) data = self.decompressor.Decompress(1, data) elif self.format in ('mono', 'grey4'): if self.mustunpack: if self.format == 'mono': data = imageop.mono2grey(data, \ w/xpf, h/ypf, 0x20, 0xdf) elif self.format == 'grey4': data = imageop.grey42grey(data, \ w/xpf, h/ypf) pmsize = 8 elif self.format == 'grey2': data = imageop.grey22grey(data, w/xpf, h/ypf) pmsize = 8 if not self.colormapinited: self.initcolormap() if self.fixcolor0: gl.mapcolor(self.color0) self.fixcolor0 = 0 xfactor = yfactor = self.magnify xfactor = xfactor * xpf yfactor = yfactor * ypf if chromdata and not self.skipchrom: cp = self.chrompack cx = int(x*xfactor*cp) + self.xorigin cy = int(y*yfactor*cp) + self.yorigin cw = (w+cp-1)/cp ch = (h+cp-1)/cp gl.rectzoom(xfactor*cp, yfactor*cp) gl.pixmode(GL.PM_SIZE, 16) gl.writemask(self.mask - ((1 << self.c0bits) - 1)) gl.lrectwrite(cx, cy, cx + cw - 1, cy + ch - 1, \ chromdata) # if pmsize < 32: gl.writemask((1 << self.c0bits) - 1) gl.pixmode(GL.PM_SIZE, pmsize) w = w/xpf h = h/ypf x = x/xpf y = y/ypf gl.rectzoom(xfactor, yfactor) x = int(x*xfactor)+self.xorigin y = int(y*yfactor)+self.yorigin gl.lrectwrite(x, y, x + w - 1, y + h - 1, data) gl.gflush() | f993d287946d9fc4d9d7172bf66cce44c253851e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f993d287946d9fc4d9d7172bf66cce44c253851e/VFile.py |
def testPackageRequire(self): tcl = self.interp tcl.eval('package require Tclx') tcl.eval('keylset a b.c 1') self.assertEqual(tcl.eval('keylget a b.c'),'1') | def testPackageRequire(self): tcl = self.interp tcl.eval('package require Tclx') tcl.eval('keylset a b.c 1') self.assertEqual(tcl.eval('keylget a b.c'),'1') | 1c5701d36ce4185f2a7dec408d1dc75abb87bca6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1c5701d36ce4185f2a7dec408d1dc75abb87bca6/test_tcl.py |
|
if sys.platform.startswith('win'): | if sys.platform.startswith('win') or sys.platform.startswith('darwin'): | def testLoadTkFailure(self): import os old_display = None import sys if sys.platform.startswith('win'): return # no failure possible on windows? if 'DISPLAY' in os.environ: old_display = os.environ['DISPLAY'] del os.environ['DISPLAY'] # on some platforms, deleting environment variables # doesn't actually carry through to the process level # because they don't support unsetenv # If that's the case, abort. display = os.popen('echo $DISPLAY').read().strip() if display: return try: tcl = Tcl() self.assertRaises(TclError, tcl.winfo_geometry) self.assertRaises(TclError, tcl.loadtk) finally: if old_display is not None: os.environ['DISPLAY'] = old_display | 1c5701d36ce4185f2a7dec408d1dc75abb87bca6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1c5701d36ce4185f2a7dec408d1dc75abb87bca6/test_tcl.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') | 5399c6d3d4cf9496b46ce9f37975d6c8107a743d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5399c6d3d4cf9496b46ce9f37975d6c8107a743d/setup.py |
||
env_val = os.getenv(env_var) | env_val = sysconfig.get_config_var(env_var) | 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') | 5399c6d3d4cf9496b46ce9f37975d6c8107a743d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5399c6d3d4cf9496b46ce9f37975d6c8107a743d/setup.py |
elif sys.platform[:5] == "hp-ux": | elif sys.platform[:5] == "hp-ux": | def runtime_library_dir_option(self, dir): # XXX Hackish, at the very least. See Python bug #445902: # http://sourceforge.net/tracker/index.php # ?func=detail&aid=445902&group_id=5470&atid=105470 # Linkers on different platforms need different options to # specify that directories need to be added to the list of # directories searched for dependencies when a dynamic library # is sought. GCC has to be told to pass the -R option through # to the linker, whereas other compilers just know this. # Other compilers may need something slightly different. At # this time, there's no way to determine this information from # the configuration data stored in the Python installation, so # we use this hack. compiler = os.path.basename(sysconfig.get_config_var("CC")) if sys.platform[:6] == "darwin": # MacOSX's linker doesn't understand the -R flag at all return "-L" + dir elif sys.platform[:5] == "hp-ux": return "+s -L" + dir elif compiler[:3] == "gcc" or compiler[:3] == "g++": return "-Wl,-R" + dir else: return "-R" + dir | 19c0d943e952b57ded7c7dbad228092b347649b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/19c0d943e952b57ded7c7dbad228092b347649b2/unixccompiler.py |
elif compiler[:3] == "gcc" or compiler[:3] == "g++": | elif compiler[:3] == "gcc" or compiler[:3] == "g++": | def runtime_library_dir_option(self, dir): # XXX Hackish, at the very least. See Python bug #445902: # http://sourceforge.net/tracker/index.php # ?func=detail&aid=445902&group_id=5470&atid=105470 # Linkers on different platforms need different options to # specify that directories need to be added to the list of # directories searched for dependencies when a dynamic library # is sought. GCC has to be told to pass the -R option through # to the linker, whereas other compilers just know this. # Other compilers may need something slightly different. At # this time, there's no way to determine this information from # the configuration data stored in the Python installation, so # we use this hack. compiler = os.path.basename(sysconfig.get_config_var("CC")) if sys.platform[:6] == "darwin": # MacOSX's linker doesn't understand the -R flag at all return "-L" + dir elif sys.platform[:5] == "hp-ux": return "+s -L" + dir elif compiler[:3] == "gcc" or compiler[:3] == "g++": return "-Wl,-R" + dir else: return "-R" + dir | 19c0d943e952b57ded7c7dbad228092b347649b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/19c0d943e952b57ded7c7dbad228092b347649b2/unixccompiler.py |
def __init__(self): | def __init__(self, allow_none): | def __init__(self): self.funcs = {} self.instance = None | 10a16dea7422a578a2d49a778c5aceb54d2126d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/10a16dea7422a578a2d49a778c5aceb54d2126d2/SimpleXMLRPCServer.py |
response = xmlrpclib.dumps(response, methodresponse=1) | response = xmlrpclib.dumps(response, methodresponse=1, allow_none = self.allow_none) | def _marshaled_dispatch(self, data, dispatch_method = None): """Dispatches an XML-RPC method from marshalled (XML) data. | 10a16dea7422a578a2d49a778c5aceb54d2126d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/10a16dea7422a578a2d49a778c5aceb54d2126d2/SimpleXMLRPCServer.py |
logRequests=1): | logRequests=1, allow_none=False): | def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler, logRequests=1): self.logRequests = logRequests | 10a16dea7422a578a2d49a778c5aceb54d2126d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/10a16dea7422a578a2d49a778c5aceb54d2126d2/SimpleXMLRPCServer.py |
SimpleXMLRPCDispatcher.__init__(self) | SimpleXMLRPCDispatcher.__init__(self, allow_none) | def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler, logRequests=1): self.logRequests = logRequests | 10a16dea7422a578a2d49a778c5aceb54d2126d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/10a16dea7422a578a2d49a778c5aceb54d2126d2/SimpleXMLRPCServer.py |
def __init__(self): SimpleXMLRPCDispatcher.__init__(self) | def __init__(self, allow_none=False): SimpleXMLRPCDispatcher.__init__(self, allow_none) | def __init__(self): SimpleXMLRPCDispatcher.__init__(self) | 10a16dea7422a578a2d49a778c5aceb54d2126d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/10a16dea7422a578a2d49a778c5aceb54d2126d2/SimpleXMLRPCServer.py |
def test_getitem(self): class GetItem(object): | def _getitem_helper(self, base): class GetItem(base): | def test_getitem(self): class GetItem(object): def __len__(self): return maxint def __getitem__(self, key): return key def __getslice__(self, i, j): return i, j x = GetItem() self.assertEqual(x[self.pos], self.pos) self.assertEqual(x[self.neg], self.neg) self.assertEqual(x[self.neg:self.pos], (-1, maxint)) self.assertEqual(x[self.neg:self.pos:1].indices(maxint), (0, maxint, 1)) | 1872b1c01f343f4cbfa7696ce95beae8278ce210 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1872b1c01f343f4cbfa7696ce95beae8278ce210/test_index.py |
def __div__(self, other): return "B.__div__" def __rdiv__(self, other): return "B.__rdiv__" vereq(B(1) / 1, "B.__div__") vereq(1 / B(1), "B.__rdiv__") | def __floordiv__(self, other): return "B.__floordiv__" def __rfloordiv__(self, other): return "B.__rfloordiv__" vereq(B(1) // 1, "B.__floordiv__") vereq(1 // B(1), "B.__rfloordiv__") | def __div__(self, other): return "B.__div__" | f389c7727362321a91dbaff13b7e1cef6cbaa3d8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f389c7727362321a91dbaff13b7e1cef6cbaa3d8/test_descr.py |
def __div__(self, other): return "C.__div__" def __rdiv__(self, other): return "C.__rdiv__" vereq(C() / 1, "C.__div__") vereq(1 / C(), "C.__rdiv__") | def __floordiv__(self, other): return "C.__floordiv__" def __rfloordiv__(self, other): return "C.__rfloordiv__" vereq(C() // 1, "C.__floordiv__") vereq(1 // C(), "C.__rfloordiv__") | def __div__(self, other): return "C.__div__" | f389c7727362321a91dbaff13b7e1cef6cbaa3d8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f389c7727362321a91dbaff13b7e1cef6cbaa3d8/test_descr.py |
def __div__(self, other): return "D.__div__" def __rdiv__(self, other): return "D.__rdiv__" vereq(D() / C(), "D.__div__") vereq(C() / D(), "D.__rdiv__") | def __floordiv__(self, other): return "D.__floordiv__" def __rfloordiv__(self, other): return "D.__rfloordiv__" vereq(D() // C(), "D.__floordiv__") vereq(C() // D(), "D.__rfloordiv__") | def __div__(self, other): return "D.__div__" | f389c7727362321a91dbaff13b7e1cef6cbaa3d8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f389c7727362321a91dbaff13b7e1cef6cbaa3d8/test_descr.py |
vereq(E.__rdiv__, C.__rdiv__) vereq(E() / 1, "C.__div__") vereq(1 / E(), "C.__rdiv__") vereq(E() / C(), "C.__div__") vereq(C() / E(), "C.__div__") | vereq(E.__rfloordiv__, C.__rfloordiv__) vereq(E() // 1, "C.__floordiv__") vereq(1 // E(), "C.__rfloordiv__") vereq(E() // C(), "C.__floordiv__") vereq(C() // E(), "C.__floordiv__") | def __rdiv__(self, other): return "D.__rdiv__" | f389c7727362321a91dbaff13b7e1cef6cbaa3d8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f389c7727362321a91dbaff13b7e1cef6cbaa3d8/test_descr.py |
timeout = int(timeout*1000) | if timeout is not None: timeout = int(timeout*1000) | def poll2 (timeout=0.0, map=None): import poll if map is None: map=socket_map # timeout is in milliseconds timeout = int(timeout*1000) if map: l = [] for fd, obj in map.items(): flags = 0 if obj.readable(): flags = poll.POLLIN if obj.writable(): flags = flags | poll.POLLOUT if flags: l.append ((fd, flags)) r = poll.poll (l, timeout) for fd, flags in r: try: obj = map[fd] try: if (flags & poll.POLLIN): obj.handle_read_event() if (flags & poll.POLLOUT): obj.handle_write_event() except ExitNow: raise ExitNow except: obj.handle_error() except KeyError: pass | f6cc07cffe902d8faef5f3cce7a2ea8cda939e02 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f6cc07cffe902d8faef5f3cce7a2ea8cda939e02/asyncore.py |
timeout = int(timeout*1000) | if timeout is not None: timeout = int(timeout*1000) | def poll3 (timeout=0.0, map=None): # Use the poll() support added to the select module in Python 2.0 if map is None: map=socket_map # timeout is in milliseconds timeout = int(timeout*1000) pollster = select.poll() if map: for fd, obj in map.items(): flags = 0 if obj.readable(): flags = select.POLLIN if obj.writable(): flags = flags | select.POLLOUT if flags: pollster.register(fd, flags) r = pollster.poll (timeout) for fd, flags in r: try: obj = map[fd] try: if (flags & select.POLLIN): obj.handle_read_event() if (flags & select.POLLOUT): obj.handle_write_event() except ExitNow: raise ExitNow except: obj.handle_error() except KeyError: pass | f6cc07cffe902d8faef5f3cce7a2ea8cda939e02 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f6cc07cffe902d8faef5f3cce7a2ea8cda939e02/asyncore.py |
"".join(map(lambda i: "0123456789ABCDEF"[i], digits)) + "L" | "".join(map(lambda i: "0123456789abcdef"[i], digits)) + "L" | def slow_format(self, x, base): if (x, base) == (0, 8): # this is an oddball! return "0L" digits = [] sign = 0 if x < 0: sign, x = 1, -x while x: x, r = divmod(x, base) digits.append(int(r)) digits.reverse() digits = digits or [0] return '-'[:sign] + \ {8: '0', 10: '', 16: '0x'}[base] + \ "".join(map(lambda i: "0123456789ABCDEF"[i], digits)) + "L" | 3296e696db4e46f63f7a5348ac977b2b0a32ecbc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3296e696db4e46f63f7a5348ac977b2b0a32ecbc/test_long.py |
if not self.have_fork: for k in ('QUERY_STRING', 'REMOTE_HOST', 'CONTENT_LENGTH', 'HTTP_USER_AGENT', 'HTTP_COOKIE'): env.setdefault(k, "") | for k in ('QUERY_STRING', 'REMOTE_HOST', 'CONTENT_LENGTH', 'HTTP_USER_AGENT', 'HTTP_COOKIE'): env.setdefault(k, "") | def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = rest.rfind('?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = rest.find('/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scriptname) if not os.path.exists(scriptfile): self.send_error(404, "No such CGI script (%r)" % scriptname) return if not os.path.isfile(scriptfile): self.send_error(403, "CGI script is not a plain file (%r)" % scriptname) return ispy = self.is_python(scriptname) if not ispy: if not (self.have_fork or self.have_popen2 or self.have_popen3): self.send_error(403, "CGI script is not a Python script (%r)" % scriptname) return if not self.is_executable(scriptfile): self.send_error(403, "CGI script is not executable (%r)" % scriptname) return | 70ec0b42b581014f5c8c9092720a26a1988ce0e9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/70ec0b42b581014f5c8c9092720a26a1988ce0e9/CGIHTTPServer.py |
'UNICODE': ('ref/unicode', 'encodings unicode TYPES STRING'), | 'UNICODE': ('ref/strings', 'encodings unicode TYPES STRING'), | 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: modname = pkgpath + modname if not modname in done: done[modname] = 1 writedoc(modname) | f98159c376bd133a0e66a7f8ebf25a0a4516d955 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f98159c376bd133a0e66a7f8ebf25a0a4516d955/pydoc.py |
'BOOLEAN': ('ref/lambda', 'EXPRESSIONS TRUTHVALUE'), | 'BOOLEAN': ('ref/Booleans', 'EXPRESSIONS TRUTHVALUE'), | 'METHODS': ('lib/typesmethods', 'class def CLASSES TYPES'), | f98159c376bd133a0e66a7f8ebf25a0a4516d955 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f98159c376bd133a0e66a7f8ebf25a0a4516d955/pydoc.py |
self.fileobj.write(struct.pack("<L", self.pos)) | self.fileobj.write(struct.pack("<L", self.pos & 0xffffFFFFL)) | def close(self): """Close the _Stream object. No operation should be done on it afterwards. """ if self.closed: return | 10a444965dd537f4fc0483e960941cfdac8b2e11 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/10a444965dd537f4fc0483e960941cfdac8b2e11/tarfile.py |
exts.append( Extension('_md5', ['md5module.c', 'md5c.c']) ) | exts.append( Extension('_md5', ['md5module.c', 'md5.c']) ) | def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') | 8e39ec78bcede7291e0573fc522425221eb05475 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8e39ec78bcede7291e0573fc522425221eb05475/setup.py |
return HEAD % self.variables | s = HEAD % self.variables if self.uplink: if self.uptitle: link = ('<link rel="up" href="%s" title="%s">' % (self.uplink, self.uptitle)) else: link = '<link rel="up" href="%s">' % self.uplink repl = " %s\n</head>" % link s = s.replace("</head>", repl, 1) return s | def get_header(self): return HEAD % self.variables | f10584cb112c89da87d7d4b524851226ee7f9406 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f10584cb112c89da87d7d4b524851226ee7f9406/support.py |
urllib.urlopen, "http://www.sadflkjsasadf.com/") | urllib.urlopen, "http://www.python.invalid/") | def test_bad_address(self): # Make sure proper exception is raised when connecting to a bogus # address. self.assertRaises(IOError, urllib.urlopen, "http://www.sadflkjsasadf.com/") | 0aab0020573771e224ebc0e94b2c5adf565fb4f6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0aab0020573771e224ebc0e94b2c5adf565fb4f6/test_urllibnet.py |
test(r"""sre.match(r"\%03o" % i, chr(i)) != None""", 1) test(r"""sre.match(r"\%03o0" % i, chr(i)+"0") != None""", 1) test(r"""sre.match(r"\%03o8" % i, chr(i)+"8") != None""", 1) test(r"""sre.match(r"\x%02x" % i, chr(i)) != None""", 1) test(r"""sre.match(r"\x%02x0" % i, chr(i)+"0") != None""", 1) test(r"""sre.match(r"\x%02xz" % i, chr(i)+"z") != None""", 1) | test(r"""sre.match(r"\%03o" % i, chr(i)) is not None""", 1) test(r"""sre.match(r"\%03o0" % i, chr(i)+"0") is not None""", 1) test(r"""sre.match(r"\%03o8" % i, chr(i)+"8") is not None""", 1) test(r"""sre.match(r"\x%02x" % i, chr(i)) is not None""", 1) test(r"""sre.match(r"\x%02x0" % i, chr(i)+"0") is not None""", 1) test(r"""sre.match(r"\x%02xz" % i, chr(i)+"z") is not None""", 1) | def test(expression, result, exception=None): try: r = eval(expression) except: if exception: if not isinstance(sys.exc_value, exception): print expression, "FAILED" # display name, not actual value if exception is sre.error: print "expected", "sre.error" else: print "expected", exception.__name__ print "got", sys.exc_type.__name__, str(sys.exc_value) else: print expression, "FAILED" traceback.print_exc(file=sys.stdout) else: if exception: print expression, "FAILED" if exception is sre.error: print "expected", "sre.error" else: print "expected", exception.__name__ print "got result", repr(r) else: if r != result: print expression, "FAILED" print "expected", repr(result) print "got result", repr(r) | 538f05c94dcf9e4ebe4779ccdc86ba238d885dc6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/538f05c94dcf9e4ebe4779ccdc86ba238d885dc6/test_sre.py |
test(r"""sre.match(sre.escape(chr(i)), chr(i)) != None""", 1) | test(r"""sre.match(sre.escape(chr(i)), chr(i)) is not None""", 1) | def bump_num(matchobj): int_value = int(matchobj.group(0)) return str(int_value + 1) | 538f05c94dcf9e4ebe4779ccdc86ba238d885dc6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/538f05c94dcf9e4ebe4779ccdc86ba238d885dc6/test_sre.py |
test(r"""pat.match(p) != None""", 1) | test(r"""pat.match(p) is not None""", 1) | def bump_num(matchobj): int_value = int(matchobj.group(0)) return str(int_value + 1) | 538f05c94dcf9e4ebe4779ccdc86ba238d885dc6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/538f05c94dcf9e4ebe4779ccdc86ba238d885dc6/test_sre.py |
def _verify(name, expected): computed = eval(name) | def _verify(name, computed, expected): | def _verify(name, expected): computed = eval(name) if abs(computed - expected) > 1e-7: raise ValueError( "computed value for %s deviates too much " "(computed %g, expected %g)" % (name, computed, expected)) | dc47a89ff19b932c1c794422a5223847b4e64f0e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dc47a89ff19b932c1c794422a5223847b4e64f0e/random.py |
_verify('NV_MAGICCONST', 1.71552776992141) | _verify('NV_MAGICCONST', NV_MAGICCONST, 1.71552776992141) | def _verify(name, expected): computed = eval(name) if abs(computed - expected) > 1e-7: raise ValueError( "computed value for %s deviates too much " "(computed %g, expected %g)" % (name, computed, expected)) | dc47a89ff19b932c1c794422a5223847b4e64f0e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dc47a89ff19b932c1c794422a5223847b4e64f0e/random.py |
_verify('TWOPI', 6.28318530718) | _verify('TWOPI', TWOPI, 6.28318530718) | def _verify(name, expected): computed = eval(name) if abs(computed - expected) > 1e-7: raise ValueError( "computed value for %s deviates too much " "(computed %g, expected %g)" % (name, computed, expected)) | dc47a89ff19b932c1c794422a5223847b4e64f0e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dc47a89ff19b932c1c794422a5223847b4e64f0e/random.py |
_verify('LOG4', 1.38629436111989) | _verify('LOG4', LOG4, 1.38629436111989) | def _verify(name, expected): computed = eval(name) if abs(computed - expected) > 1e-7: raise ValueError( "computed value for %s deviates too much " "(computed %g, expected %g)" % (name, computed, expected)) | dc47a89ff19b932c1c794422a5223847b4e64f0e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dc47a89ff19b932c1c794422a5223847b4e64f0e/random.py |
_verify('SG_MAGICCONST', 2.50407739677627) | _verify('SG_MAGICCONST', SG_MAGICCONST, 2.50407739677627) | def _verify(name, expected): computed = eval(name) if abs(computed - expected) > 1e-7: raise ValueError( "computed value for %s deviates too much " "(computed %g, expected %g)" % (name, computed, expected)) | dc47a89ff19b932c1c794422a5223847b4e64f0e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dc47a89ff19b932c1c794422a5223847b4e64f0e/random.py |
(code, resp) = self.docmd(encode_base64(user, eol="")) | (code, resp) = self.docmd(encode_base64(password, eol="")) | def encode_plain(user, password): return encode_base64("%s\0%s\0%s" % (user, user, password), eol="") | 49c05d39e3a5f609a13322bbbbd507a2bc3fc252 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/49c05d39e3a5f609a13322bbbbd507a2bc3fc252/smtplib.py |
class IEEEOperationsTestCase(unittest.TestCase): if float.__getformat__("double").startswith("IEEE"): def test_double_infinity(self): big = 4.8e159 pro = big*big self.assertEquals(repr(pro), 'inf') sqr = big**2 self.assertEquals(repr(sqr), 'inf') | def test_float_specials_do_unpack(self): for fmt, data in [('>f', BE_FLOAT_INF), ('>f', BE_FLOAT_NAN), ('<f', LE_FLOAT_INF), ('<f', LE_FLOAT_NAN)]: struct.unpack(fmt, data) | 348dc88097412cc229254f20f2759ce4cd192261 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/348dc88097412cc229254f20f2759ce4cd192261/test_float.py |
|
IEEEFormatTestCase, IEEEOperationsTestCase, ) | IEEEFormatTestCase) | def test_main(): test_support.run_unittest( FormatFunctionsTestCase, UnknownFormatTestCase, IEEEFormatTestCase, IEEEOperationsTestCase, ) | 348dc88097412cc229254f20f2759ce4cd192261 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/348dc88097412cc229254f20f2759ce4cd192261/test_float.py |
element = _encode(element) | def beginElement(self, element): self.stack.append(element) element = _encode(element) self.writeln("<%s>" % element) self.indentLevel += 1 | 10263d6e6b14fb55bca63735f2508ee8e269526c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/10263d6e6b14fb55bca63735f2508ee8e269526c/plistlib.py |
|
element = _encode(element) | def simpleElement(self, element, value=None): if value: element = _encode(element) value = _encode(value) self.writeln("<%s>%s</%s>" % (element, value, element)) else: self.writeln("<%s/>" % element) | 10263d6e6b14fb55bca63735f2508ee8e269526c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/10263d6e6b14fb55bca63735f2508ee8e269526c/plistlib.py |
|
"""Dict wrapper for convenient acces of values through attributes.""" | """Dict wrapper for convenient access of values through attributes.""" | def writeArray(self, array): self.beginElement("array") for value in array: self.writeValue(value) self.endElement("array") | 10263d6e6b14fb55bca63735f2508ee8e269526c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/10263d6e6b14fb55bca63735f2508ee8e269526c/plistlib.py |
Foo="Doodah", aList=["A", "B", 12, 32.1, [1, 2, 3]], aFloat = 0.1, anInt = 728, aDict=Dict( aString="<hello & hi there!>", SomeUnicodeValue=u'M\xe4ssig, Ma\xdf', someTrueValue=True, someFalseValue=False, ), someData = Data("hello there!"), someMoreData = Data("hello there! " * 10), aDate = Date(time.mktime(time.gmtime())), | aString="Doodah", aList=["A", "B", 12, 32.1, [1, 2, 3]], aFloat = 0.1, anInt = 728, aDict=Dict( anotherString="<hello & hi there!>", aUnicodeValue=u'M\xe4ssig, Ma\xdf', aTrueValue=True, aFalseValue=False, ), someData = Data("<binary gunk>"), someMoreData = Data("<lots of binary gunk>" * 10), aDate = Date(time.mktime(time.gmtime())), | def __repr__(self): if self: return "True" else: return "False" | 10263d6e6b14fb55bca63735f2508ee8e269526c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/10263d6e6b14fb55bca63735f2508ee8e269526c/plistlib.py |
while n > 0 and line[n-1] in (' ', '\t'): | while n > 0 and line[n-1] in " \t\r": | def decode(input, output): """Read 'input', apply quoted-printable decoding, and write to 'output'. 'input' and 'output' are files with readline() and write() methods.""" new = '' while 1: line = input.readline() if not line: break i, n = 0, len(line) if n > 0 and line[n-1] == '\n': partial = 0; n = n-1 # Strip trailing whitespace while n > 0 and line[n-1] in (' ', '\t'): n = n-1 else: partial = 1 while i < n: c = line[i] if c != ESCAPE: new = new + c; i = i+1 elif i+1 == n and not partial: partial = 1; break elif i+1 < n and line[i+1] == ESCAPE: new = new + ESCAPE; i = i+2 elif i+2 < n and ishex(line[i+1]) and ishex(line[i+2]): new = new + chr(unhex(line[i+1:i+3])); i = i+3 else: # Bad escape sequence -- leave it in new = new + c; i = i+1 if not partial: output.write(new + '\n') new = '' if new: output.write(new) | 14b90a498ff4c06c9879b9362542a263ae0b9b05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/14b90a498ff4c06c9879b9362542a263ae0b9b05/quopri.py |
data, width, height, bytesperpixel = jpeg.decompress(data) | data, width, height, bytesperpixel = jpeg.decompress(img) | def jpeggrey2grey(img, width, height): import jpeg data, width, height, bytesperpixel = jpeg.decompress(data) if bytesperpixel <> 1: raise RuntimeError, 'not grayscale jpeg' return data | be6d77a9b8b4e97ff2892eddb9c54c5d81a79e39 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/be6d77a9b8b4e97ff2892eddb9c54c5d81a79e39/imgconv.py |
data, width, height, bytesperpixel = jpeg.decompress(data) | data, width, height, bytesperpixel = jpeg.decompress(img) | def jpeg2rgb(img, width, height): import cl, CL import jpeg data, width, height, bytesperpixel = jpeg.decompress(data) if bytesperpixel <> 4: raise RuntimeError, 'not rgb jpeg' return data | be6d77a9b8b4e97ff2892eddb9c54c5d81a79e39 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/be6d77a9b8b4e97ff2892eddb9c54c5d81a79e39/imgconv.py |
('grey', 'jpeggrey',grey2jpeggrey, NOT_LOSSY), \ | ('grey', 'jpeggrey',grey2jpeggrey, LOSSY), \ | def jpeg2rgb(img, width, height): import cl, CL import jpeg data, width, height, bytesperpixel = jpeg.decompress(data) if bytesperpixel <> 4: raise RuntimeError, 'not rgb jpeg' return data | be6d77a9b8b4e97ff2892eddb9c54c5d81a79e39 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/be6d77a9b8b4e97ff2892eddb9c54c5d81a79e39/imgconv.py |
('rgb', 'jpeg', rgb2jpeg, NOT_LOSSY), \ | ('rgb', 'jpeg', rgb2jpeg, LOSSY), \ | def jpeg2rgb(img, width, height): import cl, CL import jpeg data, width, height, bytesperpixel = jpeg.decompress(data) if bytesperpixel <> 4: raise RuntimeError, 'not rgb jpeg' return data | be6d77a9b8b4e97ff2892eddb9c54c5d81a79e39 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/be6d77a9b8b4e97ff2892eddb9c54c5d81a79e39/imgconv.py |
[3:] intact. [0] = Time that needs to be charged to the parent frame's function. It is used so that a function call will not have to access the timing data for the parent frame. [1] = Total time spent in this frame's function, excluding time in subfunctions [2] = Cumulative time spent in this frame's function, including time in all subfunctions to this frame (but excluding this frame!). [3] = Name of the function that corresponds to this frame. [4] = Actual frame that we correspond to (used to sync exception handling) [5] = Our parent 6-tuple (corresponds to frame.f_back) | [-2:] intact (frame and previous tuple). In case an internal error is detected, the -3 element is used as the function name. [ 0] = Time that needs to be charged to the parent frame's function. It is used so that a function call will not have to access the timing data for the parent frame. [ 1] = Total time spent in this frame's function, excluding time in subfunctions [ 2] = Cumulative time spent in this frame's function, including time in all subfunctions to this frame. [-3] = Name of the function that corresponds to this frame. [-2] = Actual frame that we correspond to (used to sync exception handling) [-1] = Our parent 6-tuple (corresponds to frame.f_back) | def _get_time_times(timer=os.times): t = timer() return t[0] + t[1] | df5cfd884d5da8a9a0b620b232f9ecfea6f77224 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/df5cfd884d5da8a9a0b620b232f9ecfea6f77224/profile.py |
self.timings[]. The index is always the name stored in self.cur[4]. | self.timings[]. The index is always the name stored in self.cur[-3]. | def _get_time_times(timer=os.times): t = timer() return t[0] + t[1] | df5cfd884d5da8a9a0b620b232f9ecfea6f77224 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/df5cfd884d5da8a9a0b620b232f9ecfea6f77224/profile.py |
if self.cur and frame.f_back is not self.cur[4]: | if self.cur and frame.f_back is not self.cur[-2]: | def trace_dispatch_call(self, frame, t): if self.cur and frame.f_back is not self.cur[4]: rt, rtt, rct, rfn, rframe, rcur = self.cur if not isinstance(rframe, Profile.fake_frame): if rframe.f_back is not frame.f_back: print rframe, rframe.f_back print frame, frame.f_back raise "Bad call", self.cur[3] self.trace_dispatch_return(rframe, 0) if self.cur and frame.f_back is not self.cur[4]: raise "Bad call[2]", self.cur[3] fcode = frame.f_code fn = (fcode.co_filename, fcode.co_firstlineno, fcode.co_name) self.cur = (t, 0, 0, fn, frame, self.cur) timings = self.timings if timings.has_key(fn): cc, ns, tt, ct, callers = timings[fn] timings[fn] = cc, ns + 1, tt, ct, callers else: timings[fn] = 0, 0, 0, 0, {} return 1 | df5cfd884d5da8a9a0b620b232f9ecfea6f77224 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/df5cfd884d5da8a9a0b620b232f9ecfea6f77224/profile.py |
raise "Bad call", self.cur[3] | raise "Bad call", self.cur[-3] | def trace_dispatch_call(self, frame, t): if self.cur and frame.f_back is not self.cur[4]: rt, rtt, rct, rfn, rframe, rcur = self.cur if not isinstance(rframe, Profile.fake_frame): if rframe.f_back is not frame.f_back: print rframe, rframe.f_back print frame, frame.f_back raise "Bad call", self.cur[3] self.trace_dispatch_return(rframe, 0) if self.cur and frame.f_back is not self.cur[4]: raise "Bad call[2]", self.cur[3] fcode = frame.f_code fn = (fcode.co_filename, fcode.co_firstlineno, fcode.co_name) self.cur = (t, 0, 0, fn, frame, self.cur) timings = self.timings if timings.has_key(fn): cc, ns, tt, ct, callers = timings[fn] timings[fn] = cc, ns + 1, tt, ct, callers else: timings[fn] = 0, 0, 0, 0, {} return 1 | df5cfd884d5da8a9a0b620b232f9ecfea6f77224 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/df5cfd884d5da8a9a0b620b232f9ecfea6f77224/profile.py |
if self.cur and frame.f_back is not self.cur[4]: raise "Bad call[2]", self.cur[3] | if self.cur and frame.f_back is not self.cur[-2]: raise "Bad call[2]", self.cur[-3] | def trace_dispatch_call(self, frame, t): if self.cur and frame.f_back is not self.cur[4]: rt, rtt, rct, rfn, rframe, rcur = self.cur if not isinstance(rframe, Profile.fake_frame): if rframe.f_back is not frame.f_back: print rframe, rframe.f_back print frame, frame.f_back raise "Bad call", self.cur[3] self.trace_dispatch_return(rframe, 0) if self.cur and frame.f_back is not self.cur[4]: raise "Bad call[2]", self.cur[3] fcode = frame.f_code fn = (fcode.co_filename, fcode.co_firstlineno, fcode.co_name) self.cur = (t, 0, 0, fn, frame, self.cur) timings = self.timings if timings.has_key(fn): cc, ns, tt, ct, callers = timings[fn] timings[fn] = cc, ns + 1, tt, ct, callers else: timings[fn] = 0, 0, 0, 0, {} return 1 | df5cfd884d5da8a9a0b620b232f9ecfea6f77224 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/df5cfd884d5da8a9a0b620b232f9ecfea6f77224/profile.py |
if frame is not self.cur[4]: if frame is self.cur[4].f_back: self.trace_dispatch_return(self.cur[4], 0) | if frame is not self.cur[-2]: if frame is self.cur[-2].f_back: self.trace_dispatch_return(self.cur[-2], 0) | def trace_dispatch_return(self, frame, t): if frame is not self.cur[4]: if frame is self.cur[4].f_back: self.trace_dispatch_return(self.cur[4], 0) else: raise "Bad return", self.cur[3] | df5cfd884d5da8a9a0b620b232f9ecfea6f77224 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/df5cfd884d5da8a9a0b620b232f9ecfea6f77224/profile.py |
raise "Bad return", self.cur[3] | raise "Bad return", self.cur[-3] | def trace_dispatch_return(self, frame, t): if frame is not self.cur[4]: if frame is self.cur[4].f_back: self.trace_dispatch_return(self.cur[4], 0) else: raise "Bad return", self.cur[3] | df5cfd884d5da8a9a0b620b232f9ecfea6f77224 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/df5cfd884d5da8a9a0b620b232f9ecfea6f77224/profile.py |
if self.cur[5]: return | if self.cur[-1]: return | def set_cmd(self, cmd): if self.cur[5]: return # already set self.cmd = cmd self.simulate_call(cmd) | df5cfd884d5da8a9a0b620b232f9ecfea6f77224 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/df5cfd884d5da8a9a0b620b232f9ecfea6f77224/profile.py |
pframe = self.cur[4] | pframe = self.cur[-2] | def simulate_call(self, name): code = self.fake_code('profile', 0, name) if self.cur: pframe = self.cur[4] else: pframe = None frame = self.fake_frame(code, pframe) a = self.dispatch['call'](self, frame, 0) return | df5cfd884d5da8a9a0b620b232f9ecfea6f77224 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/df5cfd884d5da8a9a0b620b232f9ecfea6f77224/profile.py |
while self.cur[5]: | while self.cur[-1]: | def simulate_cmd_complete(self): get_time = self.get_time t = get_time() - self.t while self.cur[5]: # We *can* cause assertion errors here if # dispatch_trace_return checks for a frame match! a = self.dispatch['return'](self, self.cur[4], t) t = 0 self.t = get_time() - t | df5cfd884d5da8a9a0b620b232f9ecfea6f77224 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/df5cfd884d5da8a9a0b620b232f9ecfea6f77224/profile.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.