rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
return os.path.join(prefix, "Mac", "Plugins") | return os.path.join(prefix, "Lib", "lib-dynload") | def get_python_lib(plat_specific=0, standard_lib=0, prefix=None): """Return the directory containing the Python library (standard or site additions). If 'plat_specific' is true, return the directory containing platform-specific modules, i.e. any module from a non-pure-Python module distribution; otherwise, return the platform-shared library directory. If 'standard_lib' is true, return the directory containing standard Python library modules; otherwise, return the directory for site-specific modules. If 'prefix' is supplied, use it instead of sys.prefix or sys.exec_prefix -- i.e., ignore 'plat_specific'. """ if prefix is None: prefix = plat_specific and EXEC_PREFIX or PREFIX if os.name == "posix": libpython = os.path.join(prefix, "lib", "python" + sys.version[:3]) if standard_lib: return libpython else: return os.path.join(libpython, "site-packages") elif os.name == "nt": if standard_lib: return os.path.join(prefix, "Lib") else: if sys.version < "2.2": return prefix else: return os.path.join(PREFIX, "Lib", "site-packages") elif os.name == "mac": if plat_specific: if standard_lib: return os.path.join(prefix, "Mac", "Plugins") else: raise DistutilsPlatformError( "OK, where DO site-specific extensions go on the Mac?") else: if standard_lib: return os.path.join(prefix, "Lib") else: raise DistutilsPlatformError( "OK, where DO site-specific modules go on the Mac?") else: raise DistutilsPlatformError( "I don't know where Python installs its library " "on platform '%s'" % os.name) | 212a2e1f9f9a49a796c85493fb079a5ade010a3d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/212a2e1f9f9a49a796c85493fb079a5ade010a3d/sysconfig.py |
raise DistutilsPlatformError( "OK, where DO site-specific extensions go on the Mac?") | return os.path.join(prefix, "Lib", "site-packages") | def get_python_lib(plat_specific=0, standard_lib=0, prefix=None): """Return the directory containing the Python library (standard or site additions). If 'plat_specific' is true, return the directory containing platform-specific modules, i.e. any module from a non-pure-Python module distribution; otherwise, return the platform-shared library directory. If 'standard_lib' is true, return the directory containing standard Python library modules; otherwise, return the directory for site-specific modules. If 'prefix' is supplied, use it instead of sys.prefix or sys.exec_prefix -- i.e., ignore 'plat_specific'. """ if prefix is None: prefix = plat_specific and EXEC_PREFIX or PREFIX if os.name == "posix": libpython = os.path.join(prefix, "lib", "python" + sys.version[:3]) if standard_lib: return libpython else: return os.path.join(libpython, "site-packages") elif os.name == "nt": if standard_lib: return os.path.join(prefix, "Lib") else: if sys.version < "2.2": return prefix else: return os.path.join(PREFIX, "Lib", "site-packages") elif os.name == "mac": if plat_specific: if standard_lib: return os.path.join(prefix, "Mac", "Plugins") else: raise DistutilsPlatformError( "OK, where DO site-specific extensions go on the Mac?") else: if standard_lib: return os.path.join(prefix, "Lib") else: raise DistutilsPlatformError( "OK, where DO site-specific modules go on the Mac?") else: raise DistutilsPlatformError( "I don't know where Python installs its library " "on platform '%s'" % os.name) | 212a2e1f9f9a49a796c85493fb079a5ade010a3d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/212a2e1f9f9a49a796c85493fb079a5ade010a3d/sysconfig.py |
raise DistutilsPlatformError( "OK, where DO site-specific modules go on the Mac?") | return os.path.join(prefix, "Lib", "site-packages") | def get_python_lib(plat_specific=0, standard_lib=0, prefix=None): """Return the directory containing the Python library (standard or site additions). If 'plat_specific' is true, return the directory containing platform-specific modules, i.e. any module from a non-pure-Python module distribution; otherwise, return the platform-shared library directory. If 'standard_lib' is true, return the directory containing standard Python library modules; otherwise, return the directory for site-specific modules. If 'prefix' is supplied, use it instead of sys.prefix or sys.exec_prefix -- i.e., ignore 'plat_specific'. """ if prefix is None: prefix = plat_specific and EXEC_PREFIX or PREFIX if os.name == "posix": libpython = os.path.join(prefix, "lib", "python" + sys.version[:3]) if standard_lib: return libpython else: return os.path.join(libpython, "site-packages") elif os.name == "nt": if standard_lib: return os.path.join(prefix, "Lib") else: if sys.version < "2.2": return prefix else: return os.path.join(PREFIX, "Lib", "site-packages") elif os.name == "mac": if plat_specific: if standard_lib: return os.path.join(prefix, "Mac", "Plugins") else: raise DistutilsPlatformError( "OK, where DO site-specific extensions go on the Mac?") else: if standard_lib: return os.path.join(prefix, "Lib") else: raise DistutilsPlatformError( "OK, where DO site-specific modules go on the Mac?") else: raise DistutilsPlatformError( "I don't know where Python installs its library " "on platform '%s'" % os.name) | 212a2e1f9f9a49a796c85493fb079a5ade010a3d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/212a2e1f9f9a49a796c85493fb079a5ade010a3d/sysconfig.py |
def _isunicode(s): return isinstance(s, UnicodeType) | 4a442937359fa29af8457bd22b2d73fe39327cf8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4a442937359fa29af8457bd22b2d73fe39327cf8/Charset.py |
||
'euc-jp': 'japanese.euc-jp', 'iso-2022-jp': 'japanese.iso-2022-jp', 'shift_jis': 'japanese.shift_jis', 'euc-kr': 'korean.euc-kr', 'ks_c_5601-1987': 'korean.cp949', 'iso-2022-kr': 'korean.iso-2022-kr', 'johab': 'korean.johab', 'gb2132': 'eucgb2312_cn', | 'gb2312': 'eucgb2312_cn', | def _isunicode(s): return isinstance(s, UnicodeType) | 4a442937359fa29af8457bd22b2d73fe39327cf8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4a442937359fa29af8457bd22b2d73fe39327cf8/Charset.py |
'utf-8': 'utf-8', | def _isunicode(s): return isinstance(s, UnicodeType) | 4a442937359fa29af8457bd22b2d73fe39327cf8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4a442937359fa29af8457bd22b2d73fe39327cf8/Charset.py |
|
self.input_codec) | self.output_charset) | def __init__(self, input_charset=DEFAULT_CHARSET): # RFC 2046, $4.1.2 says charsets are not case sensitive input_charset = input_charset.lower() # Set the input charset after filtering through the aliases self.input_charset = ALIASES.get(input_charset, input_charset) # We can try to guess which encoding and conversion to use by the # charset_map dictionary. Try that first, but let the user override # it. henc, benc, conv = CHARSETS.get(self.input_charset, (SHORTEST, BASE64, None)) # Set the attributes, allowing the arguments to override the default. self.header_encoding = henc self.body_encoding = benc self.output_charset = ALIASES.get(conv, conv) # Now set the codecs. If one isn't defined for input_charset, # guess and try a Unicode codec with the same name as input_codec. self.input_codec = CODEC_MAP.get(self.input_charset, self.input_charset) self.output_codec = CODEC_MAP.get(self.output_charset, self.input_codec) | 4a442937359fa29af8457bd22b2d73fe39327cf8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4a442937359fa29af8457bd22b2d73fe39327cf8/Charset.py |
def _parse(source, state, flags=0): # parse regular expression pattern into an operator list. subpattern = SubPattern(state) while 1: if source.next in ("|", ")"): break # end of subpattern this = source.get() if this is None: break # end of pattern if state.flags & SRE_FLAG_VERBOSE: # skip whitespace and comments if this in WHITESPACE: continue if this == "#": while 1: this = source.get() if this in (None, "\n"): break continue if this and this[0] not in SPECIAL_CHARS: subpattern.append((LITERAL, this)) elif this == "[": # character set set = [] | 4781b072014e7150afefddb88a05a210a88b486e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4781b072014e7150afefddb88a05a210a88b486e/sre_parse.py |
||
raise error, "unterminated index" | raise error, "unterminated group name" | def parse_template(source, pattern): # parse 're' replacement string into list of literals and # group references s = Tokenizer(source) p = [] a = p.append while 1: this = s.get() if this is None: break # end of replacement string if this and this[0] == "\\": if this == "\\g": name = "" if s.match("<"): while 1: char = s.get() if char is None: raise error, "unterminated index" if char == ">": break # FIXME: check for valid character name = name + char if not name: raise error, "bad index" try: index = int(name) except ValueError: try: index = pattern.groupindex[name] except KeyError: raise IndexError, "unknown index" a((MARK, index)) elif len(this) > 1 and this[1] in DIGITS: while s.next in DIGITS: this = this + s.get() a((MARK, int(this[1:]))) else: try: a(ESCAPES[this]) except KeyError: for char in this: a((LITERAL, char)) else: a((LITERAL, this)) return p | 4781b072014e7150afefddb88a05a210a88b486e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4781b072014e7150afefddb88a05a210a88b486e/sre_parse.py |
def parse_template(source, pattern): # parse 're' replacement string into list of literals and # group references s = Tokenizer(source) p = [] a = p.append while 1: this = s.get() if this is None: break # end of replacement string if this and this[0] == "\\": if this == "\\g": name = "" if s.match("<"): while 1: char = s.get() if char is None: raise error, "unterminated index" if char == ">": break # FIXME: check for valid character name = name + char if not name: raise error, "bad index" try: index = int(name) except ValueError: try: index = pattern.groupindex[name] except KeyError: raise IndexError, "unknown index" a((MARK, index)) elif len(this) > 1 and this[1] in DIGITS: while s.next in DIGITS: this = this + s.get() a((MARK, int(this[1:]))) else: try: a(ESCAPES[this]) except KeyError: for char in this: a((LITERAL, char)) else: a((LITERAL, this)) return p | 4781b072014e7150afefddb88a05a210a88b486e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4781b072014e7150afefddb88a05a210a88b486e/sre_parse.py |
||
raise error, "bad index" | raise error, "bad group name" | def parse_template(source, pattern): # parse 're' replacement string into list of literals and # group references s = Tokenizer(source) p = [] a = p.append while 1: this = s.get() if this is None: break # end of replacement string if this and this[0] == "\\": if this == "\\g": name = "" if s.match("<"): while 1: char = s.get() if char is None: raise error, "unterminated index" if char == ">": break # FIXME: check for valid character name = name + char if not name: raise error, "bad index" try: index = int(name) except ValueError: try: index = pattern.groupindex[name] except KeyError: raise IndexError, "unknown index" a((MARK, index)) elif len(this) > 1 and this[1] in DIGITS: while s.next in DIGITS: this = this + s.get() a((MARK, int(this[1:]))) else: try: a(ESCAPES[this]) except KeyError: for char in this: a((LITERAL, char)) else: a((LITERAL, this)) return p | 4781b072014e7150afefddb88a05a210a88b486e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4781b072014e7150afefddb88a05a210a88b486e/sre_parse.py |
raise IndexError, "unknown index" | raise IndexError, "unknown group name" | def parse_template(source, pattern): # parse 're' replacement string into list of literals and # group references s = Tokenizer(source) p = [] a = p.append while 1: this = s.get() if this is None: break # end of replacement string if this and this[0] == "\\": if this == "\\g": name = "" if s.match("<"): while 1: char = s.get() if char is None: raise error, "unterminated index" if char == ">": break # FIXME: check for valid character name = name + char if not name: raise error, "bad index" try: index = int(name) except ValueError: try: index = pattern.groupindex[name] except KeyError: raise IndexError, "unknown index" a((MARK, index)) elif len(this) > 1 and this[1] in DIGITS: while s.next in DIGITS: this = this + s.get() a((MARK, int(this[1:]))) else: try: a(ESCAPES[this]) except KeyError: for char in this: a((LITERAL, char)) else: a((LITERAL, this)) return p | 4781b072014e7150afefddb88a05a210a88b486e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4781b072014e7150afefddb88a05a210a88b486e/sre_parse.py |
result = f % val fields = string.split(result, ".") | result = f % abs(val) fields = result.split(".") | def format(f,val,grouping=0): """Formats a value in the same way that the % formatting would use, but takes the current locale into account. Grouping is applied if the third parameter is true.""" result = f % val fields = string.split(result, ".") if grouping: fields[0]=_group(fields[0]) if len(fields)==2: return fields[0]+localeconv()['decimal_point']+fields[1] elif len(fields)==1: return fields[0] else: raise Error, "Too many decimal points in result string" | db786876b6c5ab24c1cd7427fd077545dbb72fee /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/db786876b6c5ab24c1cd7427fd077545dbb72fee/locale.py |
return fields[0]+localeconv()['decimal_point']+fields[1] | res = fields[0]+localeconv()['decimal_point']+fields[1] | def format(f,val,grouping=0): """Formats a value in the same way that the % formatting would use, but takes the current locale into account. Grouping is applied if the third parameter is true.""" result = f % val fields = string.split(result, ".") if grouping: fields[0]=_group(fields[0]) if len(fields)==2: return fields[0]+localeconv()['decimal_point']+fields[1] elif len(fields)==1: return fields[0] else: raise Error, "Too many decimal points in result string" | db786876b6c5ab24c1cd7427fd077545dbb72fee /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/db786876b6c5ab24c1cd7427fd077545dbb72fee/locale.py |
return fields[0] | res = fields[0] | def format(f,val,grouping=0): """Formats a value in the same way that the % formatting would use, but takes the current locale into account. Grouping is applied if the third parameter is true.""" result = f % val fields = string.split(result, ".") if grouping: fields[0]=_group(fields[0]) if len(fields)==2: return fields[0]+localeconv()['decimal_point']+fields[1] elif len(fields)==1: return fields[0] else: raise Error, "Too many decimal points in result string" | db786876b6c5ab24c1cd7427fd077545dbb72fee /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/db786876b6c5ab24c1cd7427fd077545dbb72fee/locale.py |
co_name = frame.f_code.co_name | def user_line(self, frame): | 38f11101d863445eba29612178fb7ba7fd424d8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/38f11101d863445eba29612178fb7ba7fd424d8c/Debugger.py |
|
try: func = frame.f_locals[co_name] if getattr(func, "DebuggerStepThrough", 0): print "XXXX DEBUGGER STEPPING THROUGH" | exclude = ('rpc.py', 'threading.py', '<string>') for rpcfile in exclude: if co_filename.count(rpcfile): | def user_line(self, frame): | 38f11101d863445eba29612178fb7ba7fd424d8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/38f11101d863445eba29612178fb7ba7fd424d8c/Debugger.py |
except: pass if co_filename in (r'.\rpc.py', 'rpc.py','<string>'): self.set_step() return if co_filename.endswith('threading.py'): self.set_step() return | def user_line(self, frame): | 38f11101d863445eba29612178fb7ba7fd424d8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/38f11101d863445eba29612178fb7ba7fd424d8c/Debugger.py |
|
regexp=None, nocase=None, count=None): | regexp=None, nocase=None, count=None, elide=None): | def search(self, pattern, index, stopindex=None, forwards=None, backwards=None, exact=None, regexp=None, nocase=None, count=None): """Search PATTERN beginning from INDEX until STOPINDEX. Return the index of the first character of a match or an empty string.""" args = [self._w, 'search'] if forwards: args.append('-forwards') if backwards: args.append('-backwards') if exact: args.append('-exact') if regexp: args.append('-regexp') if nocase: args.append('-nocase') if count: args.append('-count'); args.append(count) if pattern[0] == '-': args.append('--') args.append(pattern) args.append(index) if stopindex: args.append(stopindex) return self.tk.call(tuple(args)) | 038cad7ee439f1f056170b0c97144cbdb6df6e41 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/038cad7ee439f1f056170b0c97144cbdb6df6e41/Tkinter.py |
retval = os.spawnl(os.P_WAIT, sys.executable, sys.executable, tester, v, fd) | if sys.platform in ('win32'): decorated = '"%s"' % sys.executable tester = '"%s"' % tester else: decorated = sys.executable retval = os.spawnl(os.P_WAIT, sys.executable, decorated, tester, v, fd) | def test_noinherit(self): # _mkstemp_inner file handles are not inherited by child processes if not has_spawnl: return # ugh, can't use TestSkipped. | d4210bc7182c44db6a57d10e1769331b584311e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d4210bc7182c44db6a57d10e1769331b584311e7/test_tempfile.py |
do_char(c, event) | do_char(c, event) | def do_key(self, event): (what, message, when, where, modifiers) = event c = chr(message & charCodeMask) if modifiers & cmdKey: if c == '.': raise self else: result = MenuKey(ord(c)) id = (result>>16) & 0xffff # Hi word item = result & 0xffff # Lo word if id: self.do_rawmenu(id, item, None, event) | 6f47bf44caae86045c784477f77a7b11cbad9aed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6f47bf44caae86045c784477f77a7b11cbad9aed/FrameWork.py |
once and write the results to sys.stdout after the the | once and write the results to sys.stdout after the | def usage(outfile): outfile.write("""Usage: %s [OPTIONS] <file> [ARGS] | 01c623b1a3ad39164a77106b73ab5040026bdaa5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/01c623b1a3ad39164a77106b73ab5040026bdaa5/trace.py |
_combine = { ' ': ' ', '. ': '-', ' .': '+', '..': '^' } | def dump(tag, x, lo, hi): for i in xrange(lo, hi): print tag, x[i], | 2f1aeb950d8b22330f1751e7a0f80c9621e9b1a8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2f1aeb950d8b22330f1751e7a0f80c9621e9b1a8/ndiff.py |
|
def fancy_replace(a, alo, ahi, b, blo, bhi): if TRACE: print '*** fancy_replace', alo, ahi, blo, bhi dump('>', a, alo, ahi) dump('<', b, blo, bhi) # don't synch up unless the lines have a similarity score of at # least cutoff; best_ratio tracks the best score seen so far best_ratio, cutoff = 0.74, 0.75 cruncher = SequenceMatcher(IS_CHARACTER_JUNK) eqi, eqj = None, None # 1st indices of equal lines (if any) # search for the pair that matches best without being identical # (identical lines must be junk lines, & we don't want to synch up # on junk -- unless we have to) for j in xrange(blo, bhi): bj = b[j] cruncher.set_seq2(bj) for i in xrange(alo, ahi): ai = a[i] if ai == bj: if eqi is None: eqi, eqj = i, j continue cruncher.set_seq1(ai) # computing similarity is expensive, so use the quick # upper bounds first -- have seen this speed up messy # compares by a factor of 3. # note that ratio() is only expensive to compute the first # time it's called on a sequence pair; the expensive part # of the computation is cached by cruncher if cruncher.real_quick_ratio() > best_ratio and \ cruncher.quick_ratio() > best_ratio and \ cruncher.ratio() > best_ratio: best_ratio, best_i, best_j = cruncher.ratio(), i, j if best_ratio < cutoff: # no non-identical "pretty close" pair if eqi is None: # no identical pair either -- treat it as a straight replace plain_replace(a, alo, ahi, b, blo, bhi) return # no close pair, but an identical pair -- synch up on that best_i, best_j, best_ratio = eqi, eqj, 1.0 else: # there's a close pair, so forget the identical pair (if any) eqi = None # a[best_i] very similar to b[best_j]; eqi is None iff they're not # identical if TRACE: print '*** best_ratio', best_ratio, best_i, best_j dump('>', a, best_i, best_i+1) dump('<', b, best_j, best_j+1) # pump out diffs from before the synch point fancy_helper(a, alo, best_i, b, blo, best_j) # do intraline marking on the synch pair aelt, belt = a[best_i], b[best_j] if eqi is None: # pump out a '-', '+', '?' triple for the synched lines; atags = btags = "" cruncher.set_seqs(aelt, belt) for tag, ai1, ai2, bj1, bj2 in cruncher.get_opcodes(): la, lb = ai2 - ai1, bj2 - bj1 if tag == 'replace': atags = atags + '.' * la btags = btags + '.' * lb elif tag == 'delete': atags = atags + '.' * la elif tag == 'insert': btags = btags + '.' * lb elif tag == 'equal': atags = atags + ' ' * la btags = btags + ' ' * lb else: raise ValueError, 'unknown tag ' + `tag` la, lb = len(atags), len(btags) if la < lb: atags = atags + ' ' * (lb - la) elif lb < la: btags = btags + ' ' * (la - lb) combined = map(lambda x,y: _combine[x+y], atags, btags) printq(aelt, belt, string.rstrip(string.join(combined, ''))) else: # the synch pair is identical print ' ', aelt, # pump out diffs from after the synch point fancy_helper(a, best_i+1, ahi, b, best_j+1, bhi) | 2f1aeb950d8b22330f1751e7a0f80c9621e9b1a8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2f1aeb950d8b22330f1751e7a0f80c9621e9b1a8/ndiff.py |
||
atags = atags + '.' * la btags = btags + '.' * lb | atags += '^' * la btags += '^' * lb | def fancy_replace(a, alo, ahi, b, blo, bhi): if TRACE: print '*** fancy_replace', alo, ahi, blo, bhi dump('>', a, alo, ahi) dump('<', b, blo, bhi) # don't synch up unless the lines have a similarity score of at # least cutoff; best_ratio tracks the best score seen so far best_ratio, cutoff = 0.74, 0.75 cruncher = SequenceMatcher(IS_CHARACTER_JUNK) eqi, eqj = None, None # 1st indices of equal lines (if any) # search for the pair that matches best without being identical # (identical lines must be junk lines, & we don't want to synch up # on junk -- unless we have to) for j in xrange(blo, bhi): bj = b[j] cruncher.set_seq2(bj) for i in xrange(alo, ahi): ai = a[i] if ai == bj: if eqi is None: eqi, eqj = i, j continue cruncher.set_seq1(ai) # computing similarity is expensive, so use the quick # upper bounds first -- have seen this speed up messy # compares by a factor of 3. # note that ratio() is only expensive to compute the first # time it's called on a sequence pair; the expensive part # of the computation is cached by cruncher if cruncher.real_quick_ratio() > best_ratio and \ cruncher.quick_ratio() > best_ratio and \ cruncher.ratio() > best_ratio: best_ratio, best_i, best_j = cruncher.ratio(), i, j if best_ratio < cutoff: # no non-identical "pretty close" pair if eqi is None: # no identical pair either -- treat it as a straight replace plain_replace(a, alo, ahi, b, blo, bhi) return # no close pair, but an identical pair -- synch up on that best_i, best_j, best_ratio = eqi, eqj, 1.0 else: # there's a close pair, so forget the identical pair (if any) eqi = None # a[best_i] very similar to b[best_j]; eqi is None iff they're not # identical if TRACE: print '*** best_ratio', best_ratio, best_i, best_j dump('>', a, best_i, best_i+1) dump('<', b, best_j, best_j+1) # pump out diffs from before the synch point fancy_helper(a, alo, best_i, b, blo, best_j) # do intraline marking on the synch pair aelt, belt = a[best_i], b[best_j] if eqi is None: # pump out a '-', '+', '?' triple for the synched lines; atags = btags = "" cruncher.set_seqs(aelt, belt) for tag, ai1, ai2, bj1, bj2 in cruncher.get_opcodes(): la, lb = ai2 - ai1, bj2 - bj1 if tag == 'replace': atags = atags + '.' * la btags = btags + '.' * lb elif tag == 'delete': atags = atags + '.' * la elif tag == 'insert': btags = btags + '.' * lb elif tag == 'equal': atags = atags + ' ' * la btags = btags + ' ' * lb else: raise ValueError, 'unknown tag ' + `tag` la, lb = len(atags), len(btags) if la < lb: atags = atags + ' ' * (lb - la) elif lb < la: btags = btags + ' ' * (la - lb) combined = map(lambda x,y: _combine[x+y], atags, btags) printq(aelt, belt, string.rstrip(string.join(combined, ''))) else: # the synch pair is identical print ' ', aelt, # pump out diffs from after the synch point fancy_helper(a, best_i+1, ahi, b, best_j+1, bhi) | 2f1aeb950d8b22330f1751e7a0f80c9621e9b1a8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2f1aeb950d8b22330f1751e7a0f80c9621e9b1a8/ndiff.py |
atags = atags + '.' * la | atags += '-' * la | def fancy_replace(a, alo, ahi, b, blo, bhi): if TRACE: print '*** fancy_replace', alo, ahi, blo, bhi dump('>', a, alo, ahi) dump('<', b, blo, bhi) # don't synch up unless the lines have a similarity score of at # least cutoff; best_ratio tracks the best score seen so far best_ratio, cutoff = 0.74, 0.75 cruncher = SequenceMatcher(IS_CHARACTER_JUNK) eqi, eqj = None, None # 1st indices of equal lines (if any) # search for the pair that matches best without being identical # (identical lines must be junk lines, & we don't want to synch up # on junk -- unless we have to) for j in xrange(blo, bhi): bj = b[j] cruncher.set_seq2(bj) for i in xrange(alo, ahi): ai = a[i] if ai == bj: if eqi is None: eqi, eqj = i, j continue cruncher.set_seq1(ai) # computing similarity is expensive, so use the quick # upper bounds first -- have seen this speed up messy # compares by a factor of 3. # note that ratio() is only expensive to compute the first # time it's called on a sequence pair; the expensive part # of the computation is cached by cruncher if cruncher.real_quick_ratio() > best_ratio and \ cruncher.quick_ratio() > best_ratio and \ cruncher.ratio() > best_ratio: best_ratio, best_i, best_j = cruncher.ratio(), i, j if best_ratio < cutoff: # no non-identical "pretty close" pair if eqi is None: # no identical pair either -- treat it as a straight replace plain_replace(a, alo, ahi, b, blo, bhi) return # no close pair, but an identical pair -- synch up on that best_i, best_j, best_ratio = eqi, eqj, 1.0 else: # there's a close pair, so forget the identical pair (if any) eqi = None # a[best_i] very similar to b[best_j]; eqi is None iff they're not # identical if TRACE: print '*** best_ratio', best_ratio, best_i, best_j dump('>', a, best_i, best_i+1) dump('<', b, best_j, best_j+1) # pump out diffs from before the synch point fancy_helper(a, alo, best_i, b, blo, best_j) # do intraline marking on the synch pair aelt, belt = a[best_i], b[best_j] if eqi is None: # pump out a '-', '+', '?' triple for the synched lines; atags = btags = "" cruncher.set_seqs(aelt, belt) for tag, ai1, ai2, bj1, bj2 in cruncher.get_opcodes(): la, lb = ai2 - ai1, bj2 - bj1 if tag == 'replace': atags = atags + '.' * la btags = btags + '.' * lb elif tag == 'delete': atags = atags + '.' * la elif tag == 'insert': btags = btags + '.' * lb elif tag == 'equal': atags = atags + ' ' * la btags = btags + ' ' * lb else: raise ValueError, 'unknown tag ' + `tag` la, lb = len(atags), len(btags) if la < lb: atags = atags + ' ' * (lb - la) elif lb < la: btags = btags + ' ' * (la - lb) combined = map(lambda x,y: _combine[x+y], atags, btags) printq(aelt, belt, string.rstrip(string.join(combined, ''))) else: # the synch pair is identical print ' ', aelt, # pump out diffs from after the synch point fancy_helper(a, best_i+1, ahi, b, best_j+1, bhi) | 2f1aeb950d8b22330f1751e7a0f80c9621e9b1a8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2f1aeb950d8b22330f1751e7a0f80c9621e9b1a8/ndiff.py |
btags = btags + '.' * lb | btags += '+' * lb | def fancy_replace(a, alo, ahi, b, blo, bhi): if TRACE: print '*** fancy_replace', alo, ahi, blo, bhi dump('>', a, alo, ahi) dump('<', b, blo, bhi) # don't synch up unless the lines have a similarity score of at # least cutoff; best_ratio tracks the best score seen so far best_ratio, cutoff = 0.74, 0.75 cruncher = SequenceMatcher(IS_CHARACTER_JUNK) eqi, eqj = None, None # 1st indices of equal lines (if any) # search for the pair that matches best without being identical # (identical lines must be junk lines, & we don't want to synch up # on junk -- unless we have to) for j in xrange(blo, bhi): bj = b[j] cruncher.set_seq2(bj) for i in xrange(alo, ahi): ai = a[i] if ai == bj: if eqi is None: eqi, eqj = i, j continue cruncher.set_seq1(ai) # computing similarity is expensive, so use the quick # upper bounds first -- have seen this speed up messy # compares by a factor of 3. # note that ratio() is only expensive to compute the first # time it's called on a sequence pair; the expensive part # of the computation is cached by cruncher if cruncher.real_quick_ratio() > best_ratio and \ cruncher.quick_ratio() > best_ratio and \ cruncher.ratio() > best_ratio: best_ratio, best_i, best_j = cruncher.ratio(), i, j if best_ratio < cutoff: # no non-identical "pretty close" pair if eqi is None: # no identical pair either -- treat it as a straight replace plain_replace(a, alo, ahi, b, blo, bhi) return # no close pair, but an identical pair -- synch up on that best_i, best_j, best_ratio = eqi, eqj, 1.0 else: # there's a close pair, so forget the identical pair (if any) eqi = None # a[best_i] very similar to b[best_j]; eqi is None iff they're not # identical if TRACE: print '*** best_ratio', best_ratio, best_i, best_j dump('>', a, best_i, best_i+1) dump('<', b, best_j, best_j+1) # pump out diffs from before the synch point fancy_helper(a, alo, best_i, b, blo, best_j) # do intraline marking on the synch pair aelt, belt = a[best_i], b[best_j] if eqi is None: # pump out a '-', '+', '?' triple for the synched lines; atags = btags = "" cruncher.set_seqs(aelt, belt) for tag, ai1, ai2, bj1, bj2 in cruncher.get_opcodes(): la, lb = ai2 - ai1, bj2 - bj1 if tag == 'replace': atags = atags + '.' * la btags = btags + '.' * lb elif tag == 'delete': atags = atags + '.' * la elif tag == 'insert': btags = btags + '.' * lb elif tag == 'equal': atags = atags + ' ' * la btags = btags + ' ' * lb else: raise ValueError, 'unknown tag ' + `tag` la, lb = len(atags), len(btags) if la < lb: atags = atags + ' ' * (lb - la) elif lb < la: btags = btags + ' ' * (la - lb) combined = map(lambda x,y: _combine[x+y], atags, btags) printq(aelt, belt, string.rstrip(string.join(combined, ''))) else: # the synch pair is identical print ' ', aelt, # pump out diffs from after the synch point fancy_helper(a, best_i+1, ahi, b, best_j+1, bhi) | 2f1aeb950d8b22330f1751e7a0f80c9621e9b1a8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2f1aeb950d8b22330f1751e7a0f80c9621e9b1a8/ndiff.py |
atags = atags + ' ' * la btags = btags + ' ' * lb | atags += ' ' * la btags += ' ' * lb | def fancy_replace(a, alo, ahi, b, blo, bhi): if TRACE: print '*** fancy_replace', alo, ahi, blo, bhi dump('>', a, alo, ahi) dump('<', b, blo, bhi) # don't synch up unless the lines have a similarity score of at # least cutoff; best_ratio tracks the best score seen so far best_ratio, cutoff = 0.74, 0.75 cruncher = SequenceMatcher(IS_CHARACTER_JUNK) eqi, eqj = None, None # 1st indices of equal lines (if any) # search for the pair that matches best without being identical # (identical lines must be junk lines, & we don't want to synch up # on junk -- unless we have to) for j in xrange(blo, bhi): bj = b[j] cruncher.set_seq2(bj) for i in xrange(alo, ahi): ai = a[i] if ai == bj: if eqi is None: eqi, eqj = i, j continue cruncher.set_seq1(ai) # computing similarity is expensive, so use the quick # upper bounds first -- have seen this speed up messy # compares by a factor of 3. # note that ratio() is only expensive to compute the first # time it's called on a sequence pair; the expensive part # of the computation is cached by cruncher if cruncher.real_quick_ratio() > best_ratio and \ cruncher.quick_ratio() > best_ratio and \ cruncher.ratio() > best_ratio: best_ratio, best_i, best_j = cruncher.ratio(), i, j if best_ratio < cutoff: # no non-identical "pretty close" pair if eqi is None: # no identical pair either -- treat it as a straight replace plain_replace(a, alo, ahi, b, blo, bhi) return # no close pair, but an identical pair -- synch up on that best_i, best_j, best_ratio = eqi, eqj, 1.0 else: # there's a close pair, so forget the identical pair (if any) eqi = None # a[best_i] very similar to b[best_j]; eqi is None iff they're not # identical if TRACE: print '*** best_ratio', best_ratio, best_i, best_j dump('>', a, best_i, best_i+1) dump('<', b, best_j, best_j+1) # pump out diffs from before the synch point fancy_helper(a, alo, best_i, b, blo, best_j) # do intraline marking on the synch pair aelt, belt = a[best_i], b[best_j] if eqi is None: # pump out a '-', '+', '?' triple for the synched lines; atags = btags = "" cruncher.set_seqs(aelt, belt) for tag, ai1, ai2, bj1, bj2 in cruncher.get_opcodes(): la, lb = ai2 - ai1, bj2 - bj1 if tag == 'replace': atags = atags + '.' * la btags = btags + '.' * lb elif tag == 'delete': atags = atags + '.' * la elif tag == 'insert': btags = btags + '.' * lb elif tag == 'equal': atags = atags + ' ' * la btags = btags + ' ' * lb else: raise ValueError, 'unknown tag ' + `tag` la, lb = len(atags), len(btags) if la < lb: atags = atags + ' ' * (lb - la) elif lb < la: btags = btags + ' ' * (la - lb) combined = map(lambda x,y: _combine[x+y], atags, btags) printq(aelt, belt, string.rstrip(string.join(combined, ''))) else: # the synch pair is identical print ' ', aelt, # pump out diffs from after the synch point fancy_helper(a, best_i+1, ahi, b, best_j+1, bhi) | 2f1aeb950d8b22330f1751e7a0f80c9621e9b1a8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2f1aeb950d8b22330f1751e7a0f80c9621e9b1a8/ndiff.py |
la, lb = len(atags), len(btags) if la < lb: atags = atags + ' ' * (lb - la) elif lb < la: btags = btags + ' ' * (la - lb) combined = map(lambda x,y: _combine[x+y], atags, btags) printq(aelt, belt, string.rstrip(string.join(combined, ''))) | printq(aelt, belt, atags, btags) | def fancy_replace(a, alo, ahi, b, blo, bhi): if TRACE: print '*** fancy_replace', alo, ahi, blo, bhi dump('>', a, alo, ahi) dump('<', b, blo, bhi) # don't synch up unless the lines have a similarity score of at # least cutoff; best_ratio tracks the best score seen so far best_ratio, cutoff = 0.74, 0.75 cruncher = SequenceMatcher(IS_CHARACTER_JUNK) eqi, eqj = None, None # 1st indices of equal lines (if any) # search for the pair that matches best without being identical # (identical lines must be junk lines, & we don't want to synch up # on junk -- unless we have to) for j in xrange(blo, bhi): bj = b[j] cruncher.set_seq2(bj) for i in xrange(alo, ahi): ai = a[i] if ai == bj: if eqi is None: eqi, eqj = i, j continue cruncher.set_seq1(ai) # computing similarity is expensive, so use the quick # upper bounds first -- have seen this speed up messy # compares by a factor of 3. # note that ratio() is only expensive to compute the first # time it's called on a sequence pair; the expensive part # of the computation is cached by cruncher if cruncher.real_quick_ratio() > best_ratio and \ cruncher.quick_ratio() > best_ratio and \ cruncher.ratio() > best_ratio: best_ratio, best_i, best_j = cruncher.ratio(), i, j if best_ratio < cutoff: # no non-identical "pretty close" pair if eqi is None: # no identical pair either -- treat it as a straight replace plain_replace(a, alo, ahi, b, blo, bhi) return # no close pair, but an identical pair -- synch up on that best_i, best_j, best_ratio = eqi, eqj, 1.0 else: # there's a close pair, so forget the identical pair (if any) eqi = None # a[best_i] very similar to b[best_j]; eqi is None iff they're not # identical if TRACE: print '*** best_ratio', best_ratio, best_i, best_j dump('>', a, best_i, best_i+1) dump('<', b, best_j, best_j+1) # pump out diffs from before the synch point fancy_helper(a, alo, best_i, b, blo, best_j) # do intraline marking on the synch pair aelt, belt = a[best_i], b[best_j] if eqi is None: # pump out a '-', '+', '?' triple for the synched lines; atags = btags = "" cruncher.set_seqs(aelt, belt) for tag, ai1, ai2, bj1, bj2 in cruncher.get_opcodes(): la, lb = ai2 - ai1, bj2 - bj1 if tag == 'replace': atags = atags + '.' * la btags = btags + '.' * lb elif tag == 'delete': atags = atags + '.' * la elif tag == 'insert': btags = btags + '.' * lb elif tag == 'equal': atags = atags + ' ' * la btags = btags + ' ' * lb else: raise ValueError, 'unknown tag ' + `tag` la, lb = len(atags), len(btags) if la < lb: atags = atags + ' ' * (lb - la) elif lb < la: btags = btags + ' ' * (la - lb) combined = map(lambda x,y: _combine[x+y], atags, btags) printq(aelt, belt, string.rstrip(string.join(combined, ''))) else: # the synch pair is identical print ' ', aelt, # pump out diffs from after the synch point fancy_helper(a, best_i+1, ahi, b, best_j+1, bhi) | 2f1aeb950d8b22330f1751e7a0f80c9621e9b1a8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2f1aeb950d8b22330f1751e7a0f80c9621e9b1a8/ndiff.py |
def printq(aline, bline, qline): | def printq(aline, bline, atags, btags): | def printq(aline, bline, qline): common = min(count_leading(aline, "\t"), count_leading(bline, "\t")) common = min(common, count_leading(qline[:common], " ")) qline = "\t" * common + qline[common:] print '-', aline, '+', bline, '?', qline | 2f1aeb950d8b22330f1751e7a0f80c9621e9b1a8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2f1aeb950d8b22330f1751e7a0f80c9621e9b1a8/ndiff.py |
common = min(common, count_leading(qline[:common], " ")) qline = "\t" * common + qline[common:] print '-', aline, '+', bline, '?', qline | common = min(common, count_leading(atags[:common], " ")) print "-", aline, if count_leading(atags, " ") < len(atags): print "?", "\t" * common + atags[common:] print "+", bline, if count_leading(btags, " ") < len(btags): print "?", "\t" * common + btags[common:] | def printq(aline, bline, qline): common = min(count_leading(aline, "\t"), count_leading(bline, "\t")) common = min(common, count_leading(qline[:common], " ")) qline = "\t" * common + qline[common:] print '-', aline, '+', bline, '?', qline | 2f1aeb950d8b22330f1751e7a0f80c9621e9b1a8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2f1aeb950d8b22330f1751e7a0f80c9621e9b1a8/ndiff.py |
if sys.platform == 'mac': _MWERKSDIR="Moes:Applications (Mac OS 9):Metrowerks CodeWarrior 7.0:Metrowerks CodeWarrior" else: _MWERKSDIR="/Volumes/Moes/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/" INCLUDEDIR=os.path.join(_MWERKSDIR, "MacOS Support", "Universal", "Interfaces", "CIncludes") | INCLUDEDIR="/Users/jack/src/Universal/Interfaces/CIncludes" | def _pardir(p): return os.path.split(p)[0] | 10d176f77e04ad95c3e501f8b65a0b9ad931a098 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/10d176f77e04ad95c3e501f8b65a0b9ad931a098/bgenlocations.py |
if sys.platform == 'mac': TOOLBOXDIR=os.path.join(sys.prefix, "Lib", "plat-mac", "Carbon") else: TOOLBOXDIR="/Users/jack/src/python/Lib/plat-mac/Carbon" | TOOLBOXDIR="/Users/jack/src/python/Lib/plat-mac/Carbon" | def _pardir(p): return os.path.split(p)[0] | 10d176f77e04ad95c3e501f8b65a0b9ad931a098 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/10d176f77e04ad95c3e501f8b65a0b9ad931a098/bgenlocations.py |
self.ted.WEInsert(stuff, None, None) | try: self.ted.WEInsert(stuff, None, None) finally: self._buf = "" | def flush(self): stuff = string.split(self._buf, '\n') stuff = string.join(stuff, '\r') self.setselection_at_end() self.ted.WEInsert(stuff, None, None) selstart, selend = self.getselection() self._inputstart = selstart self._buf = "" self.ted.WEClearUndo() self.updatescrollbars() if self._parentwindow.wid.GetWindowPort().QDIsPortBuffered(): self._parentwindow.wid.GetWindowPort().QDFlushPortBuffer(None) | 7e94a9aae3ac7e1d2726dddaac744315313f218a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7e94a9aae3ac7e1d2726dddaac744315313f218a/PyConsole.py |
self._buf = "" | def flush(self): stuff = string.split(self._buf, '\n') stuff = string.join(stuff, '\r') self.setselection_at_end() self.ted.WEInsert(stuff, None, None) selstart, selend = self.getselection() self._inputstart = selstart self._buf = "" self.ted.WEClearUndo() self.updatescrollbars() if self._parentwindow.wid.GetWindowPort().QDIsPortBuffered(): self._parentwindow.wid.GetWindowPort().QDFlushPortBuffer(None) | 7e94a9aae3ac7e1d2726dddaac744315313f218a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7e94a9aae3ac7e1d2726dddaac744315313f218a/PyConsole.py |
|
self.w.outputtext.ted.WEInsert(stuff, None, None) self._buf = "" | try: self.w.outputtext.ted.WEInsert(stuff, None, None) finally: self._buf = "" | def flush(self): self.show() stuff = string.split(self._buf, '\n') stuff = string.join(stuff, '\r') end = self.w.outputtext.ted.WEGetTextLength() self.w.outputtext.setselection(end, end) self.w.outputtext.ted.WEFeatureFlag(WASTEconst.weFReadOnly, 0) self.w.outputtext.ted.WEInsert(stuff, None, None) self._buf = "" self.w.outputtext.updatescrollbars() self.w.outputtext.ted.WEFeatureFlag(WASTEconst.weFReadOnly, 1) if self.w.wid.GetWindowPort().QDIsPortBuffered(): self.w.wid.GetWindowPort().QDFlushPortBuffer(None) | 7e94a9aae3ac7e1d2726dddaac744315313f218a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7e94a9aae3ac7e1d2726dddaac744315313f218a/PyConsole.py |
db.readfp(f) return db.types_map | db.readfp(f, True) return db.types_map[True] | def read_mime_types(file): try: f = open(file) except IOError: return None db = MimeTypes() db.readfp(f) return db.types_map | bb51ed333b623b6acf90a34ec6da9b4d076503e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/bb51ed333b623b6acf90a34ec6da9b4d076503e5/mimetypes.py |
if kind[0] == 'f' and not re.search('\$IN\b', cmd): | if kind[0] == 'f' and not re.search(r'\$IN\b', cmd): | def append(self, cmd, kind): """t.append(cmd, kind) adds a new step at the end.""" if type(cmd) is not type(''): raise TypeError, \ 'Template.append: cmd must be a string' if kind not in stepkinds: raise ValueError, \ 'Template.append: bad kind ' + `kind` if kind == SOURCE: raise ValueError, \ 'Template.append: SOURCE can only be prepended' if self.steps and self.steps[-1][1] == SINK: raise ValueError, \ 'Template.append: already ends with SINK' if kind[0] == 'f' and not re.search('\$IN\b', cmd): raise ValueError, \ 'Template.append: missing $IN in cmd' if kind[1] == 'f' and not re.search('\$OUT\b', cmd): raise ValueError, \ 'Template.append: missing $OUT in cmd' self.steps.append((cmd, kind)) | c09cee4d92acbf77c1ca3a417975762a8ffcf59c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c09cee4d92acbf77c1ca3a417975762a8ffcf59c/pipes.py |
if kind[1] == 'f' and not re.search('\$OUT\b', cmd): | if kind[1] == 'f' and not re.search(r'\$OUT\b', cmd): | def append(self, cmd, kind): """t.append(cmd, kind) adds a new step at the end.""" if type(cmd) is not type(''): raise TypeError, \ 'Template.append: cmd must be a string' if kind not in stepkinds: raise ValueError, \ 'Template.append: bad kind ' + `kind` if kind == SOURCE: raise ValueError, \ 'Template.append: SOURCE can only be prepended' if self.steps and self.steps[-1][1] == SINK: raise ValueError, \ 'Template.append: already ends with SINK' if kind[0] == 'f' and not re.search('\$IN\b', cmd): raise ValueError, \ 'Template.append: missing $IN in cmd' if kind[1] == 'f' and not re.search('\$OUT\b', cmd): raise ValueError, \ 'Template.append: missing $OUT in cmd' self.steps.append((cmd, kind)) | c09cee4d92acbf77c1ca3a417975762a8ffcf59c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c09cee4d92acbf77c1ca3a417975762a8ffcf59c/pipes.py |
if kind[0] == 'f' and not re.search('\$IN\b', cmd): | if kind[0] == 'f' and not re.search(r'\$IN\b', cmd): | def prepend(self, cmd, kind): """t.prepend(cmd, kind) adds a new step at the front.""" if type(cmd) is not type(''): raise TypeError, \ 'Template.prepend: cmd must be a string' if kind not in stepkinds: raise ValueError, \ 'Template.prepend: bad kind ' + `kind` if kind == SINK: raise ValueError, \ 'Template.prepend: SINK can only be appended' if self.steps and self.steps[0][1] == SOURCE: raise ValueError, \ 'Template.prepend: already begins with SOURCE' if kind[0] == 'f' and not re.search('\$IN\b', cmd): raise ValueError, \ 'Template.prepend: missing $IN in cmd' if kind[1] == 'f' and not re.search('\$OUT\b', cmd): raise ValueError, \ 'Template.prepend: missing $OUT in cmd' self.steps.insert(0, (cmd, kind)) | c09cee4d92acbf77c1ca3a417975762a8ffcf59c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c09cee4d92acbf77c1ca3a417975762a8ffcf59c/pipes.py |
if kind[1] == 'f' and not re.search('\$OUT\b', cmd): | if kind[1] == 'f' and not re.search(r'\$OUT\b', cmd): | def prepend(self, cmd, kind): """t.prepend(cmd, kind) adds a new step at the front.""" if type(cmd) is not type(''): raise TypeError, \ 'Template.prepend: cmd must be a string' if kind not in stepkinds: raise ValueError, \ 'Template.prepend: bad kind ' + `kind` if kind == SINK: raise ValueError, \ 'Template.prepend: SINK can only be appended' if self.steps and self.steps[0][1] == SOURCE: raise ValueError, \ 'Template.prepend: already begins with SOURCE' if kind[0] == 'f' and not re.search('\$IN\b', cmd): raise ValueError, \ 'Template.prepend: missing $IN in cmd' if kind[1] == 'f' and not re.search('\$OUT\b', cmd): raise ValueError, \ 'Template.prepend: missing $OUT in cmd' self.steps.insert(0, (cmd, kind)) | c09cee4d92acbf77c1ca3a417975762a8ffcf59c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c09cee4d92acbf77c1ca3a417975762a8ffcf59c/pipes.py |
def urlopen(url, data=None): | def urlopen(url, data=None, proxies=None): | def urlopen(url, data=None): """urlopen(url [, data]) -> open file-like object""" global _urlopener if not _urlopener: _urlopener = FancyURLopener() if data is None: return _urlopener.open(url) else: return _urlopener.open(url, data) | df6eca7eb7b6ac1b00ba524f1d9565881a93b9ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/df6eca7eb7b6ac1b00ba524f1d9565881a93b9ea/urllib.py |
if not _urlopener: _urlopener = FancyURLopener() | if proxies is not None: opener = FancyURLopener(proxies=proxies) elif not _urlopener: opener = FancyURLopener() _urlopener = opener else: opener = _urlopener | def urlopen(url, data=None): """urlopen(url [, data]) -> open file-like object""" global _urlopener if not _urlopener: _urlopener = FancyURLopener() if data is None: return _urlopener.open(url) else: return _urlopener.open(url, data) | df6eca7eb7b6ac1b00ba524f1d9565881a93b9ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/df6eca7eb7b6ac1b00ba524f1d9565881a93b9ea/urllib.py |
return _urlopener.open(url) | return opener.open(url) | def urlopen(url, data=None): """urlopen(url [, data]) -> open file-like object""" global _urlopener if not _urlopener: _urlopener = FancyURLopener() if data is None: return _urlopener.open(url) else: return _urlopener.open(url, data) | df6eca7eb7b6ac1b00ba524f1d9565881a93b9ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/df6eca7eb7b6ac1b00ba524f1d9565881a93b9ea/urllib.py |
return _urlopener.open(url, data) | return opener.open(url, data) | def urlopen(url, data=None): """urlopen(url [, data]) -> open file-like object""" global _urlopener if not _urlopener: _urlopener = FancyURLopener() if data is None: return _urlopener.open(url) else: return _urlopener.open(url, data) | df6eca7eb7b6ac1b00ba524f1d9565881a93b9ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/df6eca7eb7b6ac1b00ba524f1d9565881a93b9ea/urllib.py |
for i in range(0, 256): | for i in [0, 8, 16, 32, 64, 127, 128, 255]: | 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) | 510c97ba2f573bb5336681126ea6aad45a928a52 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/510c97ba2f573bb5336681126ea6aad45a928a52/test_sre.py |
class C: | class Boom: | def test_trashcan(): # "trashcan" is a hack to prevent stack overflow when deallocating # very deeply nested tuples etc. It works in part by abusing the # type pointer and refcount fields, and that can yield horrible # problems when gc tries to traverse the structures. # If this test fails (as it does in 2.0, 2.1 and 2.2), it will # most likely die via segfault. # Note: In 2.3 the possibility for compiling without cyclic gc was # removed, and that in turn allows the trashcan mechanism to work # via much simpler means (e.g., it never abuses the type pointer or # refcount fields anymore). Since it's much less likely to cause a # problem now, the various constants in this expensive (we force a lot # of full collections) test are cut back from the 2.2 version. gc.enable() N = 150 for count in range(2): t = [] for i in range(N): t = [t, Ouch()] u = [] for i in range(N): u = [u, Ouch()] v = {} for i in range(N): v = {1: v, 2: Ouch()} gc.disable() | bf384c256e0513eba7bc59cc5f8fa36b34c62c96 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/bf384c256e0513eba7bc59cc5f8fa36b34c62c96/test_gc.py |
a = C() b = C() | a = Boom() b = Boom() | def test_boom(): a = C() b = C() a.attr = b b.attr = a gc.collect() garbagelen = len(gc.garbage) del a, b # a<->b are in a trash cycle now. Collection will invoke C.__getattr__ # (to see whether a and b have __del__ methods), and __getattr__ deletes # the internal "attr" attributes as a side effect. That causes the # trash cycle to get reclaimed via refcounts falling to 0, thus mutating # the trash graph as a side effect of merely asking whether __del__ # exists. This used to (before 2.3b1) crash Python. expect(gc.collect(), 0, "boom") expect(len(gc.garbage), garbagelen, "boom") | bf384c256e0513eba7bc59cc5f8fa36b34c62c96 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/bf384c256e0513eba7bc59cc5f8fa36b34c62c96/test_gc.py |
def test_boom(): a = C() b = C() a.attr = b b.attr = a gc.collect() garbagelen = len(gc.garbage) del a, b # a<->b are in a trash cycle now. Collection will invoke C.__getattr__ # (to see whether a and b have __del__ methods), and __getattr__ deletes # the internal "attr" attributes as a side effect. That causes the # trash cycle to get reclaimed via refcounts falling to 0, thus mutating # the trash graph as a side effect of merely asking whether __del__ # exists. This used to (before 2.3b1) crash Python. expect(gc.collect(), 0, "boom") expect(len(gc.garbage), garbagelen, "boom") | bf384c256e0513eba7bc59cc5f8fa36b34c62c96 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/bf384c256e0513eba7bc59cc5f8fa36b34c62c96/test_gc.py |
||
print socket.error | try: raise socket.error except socket.error: print "socket.error" | def missing_ok(str): try: getattr(socket, str) except AttributeError: pass | a008fa52be8acac0de95a03e4dc030d444e6b426 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a008fa52be8acac0de95a03e4dc030d444e6b426/test_socket.py |
def run (self): | 56602a14e63ef610d45a4f443c3b7410453895e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/56602a14e63ef610d45a4f443c3b7410453895e8/bdist_rpm.py |
||
srpms = glob.glob(os.path.join(rpm_dir['SRPMS'], "*.rpm")) assert len(srpms) == 1, \ "unexpected number of SRPM files found: %s" % srpms dist_file = ('bdist_rpm', 'any', self._dist_path(srpms[0])) self.distribution.dist_files.append(dist_file) self.move_file(srpms[0], self.dist_dir) | srpm = os.path.join(rpm_dir['SRPMS'], source_rpm) assert(os.path.exists(srpm)) self.move_file(srpm, self.dist_dir) | def run (self): | 56602a14e63ef610d45a4f443c3b7410453895e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/56602a14e63ef610d45a4f443c3b7410453895e8/bdist_rpm.py |
rpms = glob.glob(os.path.join(rpm_dir['RPMS'], "*/*.rpm")) debuginfo = glob.glob(os.path.join(rpm_dir['RPMS'], "*/*debuginfo*.rpm")) if debuginfo: rpms.remove(debuginfo[0]) assert len(rpms) == 1, \ "unexpected number of RPM files found: %s" % rpms dist_file = ('bdist_rpm', get_python_version(), self._dist_path(rpms[0])) self.distribution.dist_files.append(dist_file) self.move_file(rpms[0], self.dist_dir) if debuginfo: dist_file = ('bdist_rpm', get_python_version(), self._dist_path(debuginfo[0])) self.move_file(debuginfo[0], self.dist_dir) | for rpm in binary_rpms: rpm = os.path.join(rpm_dir['RPMS'], rpm) if os.path.exists(rpm): self.move_file(rpm, self.dist_dir) | def run (self): | 56602a14e63ef610d45a4f443c3b7410453895e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/56602a14e63ef610d45a4f443c3b7410453895e8/bdist_rpm.py |
def tag_add(self, tagName, index1, index2=None): | def tag_add(self, tagName, index1, *args): | def tag_add(self, tagName, index1, index2=None): self.tk.call( self._w, 'tag', 'add', tagName, index1, index2) | fa8c3eab79043d7dddafe00242730257db638849 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/fa8c3eab79043d7dddafe00242730257db638849/Tkinter.py |
self._w, 'tag', 'add', tagName, index1, index2) | (self._w, 'tag', 'add', tagName, index1) + args) | def tag_add(self, tagName, index1, index2=None): self.tk.call( self._w, 'tag', 'add', tagName, index1, index2) | fa8c3eab79043d7dddafe00242730257db638849 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/fa8c3eab79043d7dddafe00242730257db638849/Tkinter.py |
if __debug__ and self.debug >= 1: _mesg('new IMAP4 connection, tag=%s' % self.tagpre) | if __debug__: if self.debug >= 1: _mesg('new IMAP4 connection, tag=%s' % self.tagpre) | def __init__(self, host = '', port = IMAP4_PORT): self.host = host self.port = port self.debug = Debug self.state = 'LOGOUT' self.literal = None # A literal argument to a command self.tagged_commands = {} # Tagged commands awaiting response self.untagged_responses = {} # {typ: [data, ...], ...} self.continuation_response = '' # Last continuation response self.tagnum = 0 | 8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024/imaplib.py |
def __init__(self, host = '', port = IMAP4_PORT): self.host = host self.port = port self.debug = Debug self.state = 'LOGOUT' self.literal = None # A literal argument to a command self.tagged_commands = {} # Tagged commands awaiting response self.untagged_responses = {} # {typ: [data, ...], ...} self.continuation_response = '' # Last continuation response self.tagnum = 0 | 8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024/imaplib.py |
||
if __debug__ and self.debug >= 3: _mesg('CAPABILITIES: %s' % `self.capabilities`) | if __debug__: if self.debug >= 3: _mesg('CAPABILITIES: %s' % `self.capabilities`) | def __init__(self, host = '', port = IMAP4_PORT): self.host = host self.port = port self.debug = Debug self.state = 'LOGOUT' self.literal = None # A literal argument to a command self.tagged_commands = {} # Tagged commands awaiting response self.untagged_responses = {} # {typ: [data, ...], ...} self.continuation_response = '' # Last continuation response self.tagnum = 0 | 8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024/imaplib.py |
(typ, [data]) = <instance>.list(user, password) """ typ, dat = self._simple_command('LOGIN', user, password) | (typ, [data]) = <instance>.login(user, password) NB: 'password' will be quoted. """ typ, dat = self._simple_command('LOGIN', user, self._quote(password)) | def login(self, user, password): """Identify client using plaintext password. | 8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024/imaplib.py |
if __debug__ and self.debug >= 3: _dump_ur(self.untagged_responses) | if __debug__: if self.debug >= 3: _dump_ur(self.untagged_responses) | def noop(self): """Send NOOP command. | 8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024/imaplib.py |
if __debug__ and self.debug >= 1: _dump_ur(self.untagged_responses) | if __debug__: if self.debug >= 1: _dump_ur(self.untagged_responses) | def select(self, mailbox='INBOX', readonly=None): """Select a mailbox. | 8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024/imaplib.py |
if __debug__ and self.debug >= 5: _mesg('untagged_responses[%s] %s += %s' % (typ, len(ur.get(typ,'')), dat)) | if __debug__: if self.debug >= 5: _mesg('untagged_responses[%s] %s += ["%s"]' % (typ, len(ur.get(typ,'')), dat)) | def _append_untagged(self, typ, dat): | 8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024/imaplib.py |
for d in args: if d is None: continue if type(d) is type(''): l = len(string.split(d)) else: l = 1 if l == 0 or l > 1 and (d[0],d[-1]) not in (('(',')'),('"','"')): data = '%s "%s"' % (data, d) else: data = '%s %s' % (data, d) | for arg in args: if arg is None: continue data = '%s %s' % (data, self._checkquote(arg)) | def _command(self, name, *args): | 8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024/imaplib.py |
if __debug__ and self.debug >= 4: _mesg('> %s' % data) | def _command(self, name, *args): | 8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024/imaplib.py |
|
if __debug__ and self.debug >= 4: _mesg('write literal size %s' % len(literal)) | if __debug__: if self.debug >= 4: _mesg('write literal size %s' % len(literal)) | def _command(self, name, *args): | 8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024/imaplib.py |
if self.untagged_responses.has_key('BYE') and name != 'LOGOUT': raise self.abort(self.untagged_responses['BYE'][-1]) | self._check_bye() | def _command_complete(self, name, tag): try: typ, data = self._get_tagged_response(tag) except self.abort, val: raise self.abort('command: %s => %s' % (name, val)) except self.error, val: raise self.error('command: %s => %s' % (name, val)) if self.untagged_responses.has_key('BYE') and name != 'LOGOUT': raise self.abort(self.untagged_responses['BYE'][-1]) if typ == 'BAD': raise self.error('%s command error: %s %s' % (name, typ, data)) return typ, data | 8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024/imaplib.py |
if __debug__ and self.debug >= 4: _mesg('read literal size %s' % size) | if __debug__: if self.debug >= 4: _mesg('read literal size %s' % size) | def _get_response(self): | 8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024/imaplib.py |
if __debug__ and self.debug >= 1 and typ in ('NO', 'BAD'): _mesg('%s response: %s' % (typ, dat)) | if __debug__: if self.debug >= 1 and typ in ('NO', 'BAD', 'BYE'): _mesg('%s response: %s' % (typ, dat)) | def _get_response(self): | 8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024/imaplib.py |
if __debug__ and self.debug >= 4: _mesg('< %s' % line) | if __debug__: if self.debug >= 4: _mesg('< %s' % line) else: _log('< %s' % line) | def _get_line(self): | 8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024/imaplib.py |
if __debug__ and self.mo is not None and self.debug >= 5: _mesg("\tmatched r'%s' => %s" % (cre.pattern, `self.mo.groups()`)) | if __debug__: if self.mo is not None and self.debug >= 5: _mesg("\tmatched r'%s' => %s" % (cre.pattern, `self.mo.groups()`)) | def _match(self, cre, s): | 8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024/imaplib.py |
if __debug__ and self.debug >= 5: _mesg('untagged_responses[%s] => %s' % (name, data)) | if __debug__: if self.debug >= 5: _mesg('untagged_responses[%s] => %s' % (name, data)) | def _untagged_response(self, typ, dat, name): | 8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024/imaplib.py |
if dttype is type(1): | if dttype is type(1) or dttype is type(1.1): | def Time2Internaldate(date_time): """Convert 'date_time' to IMAP4 INTERNALDATE representation. Return string in form: '"DD-Mmm-YYYY HH:MM:SS +HHMM"' """ dttype = type(date_time) if dttype is type(1): tt = time.localtime(date_time) elif dttype is type(()): tt = date_time elif dttype is type(""): return date_time # Assume in correct format else: raise ValueError dt = time.strftime("%d-%b-%Y %H:%M:%S", tt) if dt[0] == '0': dt = ' ' + dt[1:] if time.daylight and tt[-1]: zone = -time.altzone else: zone = -time.timezone return '"' + dt + " %+02d%02d" % divmod(zone/60, 60) + '"' | 8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024/imaplib.py |
def _mesg(s): sys.stderr.write('\t'+s+'\n') | def _mesg(s, secs=None): if secs is None: secs = time.time() tm = time.strftime('%M:%S', time.localtime(secs)) sys.stderr.write(' %s.%02d %s\n' % (tm, (secs*100)%100, s)) | def _mesg(s): | 8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024/imaplib.py |
if __debug__ and __name__ == '__main__': | _cmd_log = [] _cmd_log_len = 10 def _log(line): if len(_cmd_log) == _cmd_log_len: del _cmd_log[0] _cmd_log.append((time.time(), line)) def print_log(): _mesg('last %d IMAP4 interactions:' % len(_cmd_log)) for secs,line in _cmd_log: _mesg(line, secs) if __name__ == '__main__': | def _dump_ur(dict): # Dump untagged responses (in `dict'). l = dict.items() if not l: return t = '\n\t\t' j = string.join l = map(lambda x,j=j:'%s: "%s"' % (x[0], x[1][0] and j(x[1], '" "') or ''), l) _mesg('untagged responses dump:%s%s' % (t, j(l, t))) | 8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024/imaplib.py |
_mesg(' %s %s\n => %s %s' % (cmd, args, typ, dat)) | _mesg('%s => %s %s' % (cmd, typ, dat)) | def run(cmd, args): typ, dat = apply(eval('M.%s' % cmd), args) _mesg(' %s %s\n => %s %s' % (cmd, args, typ, dat)) return dat | 8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024/imaplib.py |
uid = string.split(dat[-1])[-1] run('uid', ('FETCH', '%s' % uid, | uid = string.split(dat[-1]) if not uid: continue run('uid', ('FETCH', '%s' % uid[-1], | def run(cmd, args): typ, dat = apply(eval('M.%s' % cmd), args) _mesg(' %s %s\n => %s %s' % (cmd, args, typ, dat)) return dat | 8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8c0622114bc95f9f5b85a8a7e4ed8619bf3ff024/imaplib.py |
for ending in ['.py', '.pyc', '.pyd', '.pyo', 'module.so', 'module.so.1', '.so']: if len(filename) > len(ending) and filename[-len(ending):] == ending: return filename[:-len(ending)] | suffixes = map(lambda (suffix, mode, kind): (len(suffix), suffix), imp.get_suffixes()) suffixes.sort() suffixes.reverse() for length, suffix in suffixes: if len(filename) > length and filename[-length:] == suffix: return filename[:-length] | def modulename(path): """Return the Python module name for a given path, or None.""" filename = os.path.basename(path) for ending in ['.py', '.pyc', '.pyd', '.pyo', 'module.so', 'module.so.1', '.so']: if len(filename) > len(ending) and filename[-len(ending):] == ending: return filename[:-len(ending)] | a2fe103c9b75b20f2cd1362b7ecbd7edff1fc66c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a2fe103c9b75b20f2cd1362b7ecbd7edff1fc66c/pydoc.py |
text = self.escape(cram(x, self.maxstring)) return re.sub(r'((\\[\\abfnrtv]|\\x..|\\u....)+)', r'<font color=" | test = cram(x, self.maxstring) testrepr = repr(test) if '\\' in test and '\\' not in replace(testrepr, (r'\\', '')): return 'r' + testrepr[0] + self.escape(test) + testrepr[0] return re.sub(r'((\\[\\abfnrtv\'"]|\\x..|\\u....)+)', r'<font color=" self.escape(testrepr)) | def repr_string(self, x, level): text = self.escape(cram(x, self.maxstring)) return re.sub(r'((\\[\\abfnrtv]|\\x..|\\u....)+)', r'<font color="#c040c0">\1</font>', repr(text)) | a2fe103c9b75b20f2cd1362b7ecbd7edff1fc66c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a2fe103c9b75b20f2cd1362b7ecbd7edff1fc66c/pydoc.py |
end = self.newBlock() self.set_lineno(node) self.emit('LOAD_GLOBAL', '__debug__') self.emit('JUMP_IF_FALSE', end) self.nextBlock() self.emit('POP_TOP') self.visit(node.test) self.emit('JUMP_IF_TRUE', end) self.nextBlock() self.emit('POP_TOP') self.emit('LOAD_GLOBAL', 'AssertionError') if node.fail: self.visit(node.fail) self.emit('RAISE_VARARGS', 2) else: self.emit('RAISE_VARARGS', 1) self.nextBlock(end) self.emit('POP_TOP') | if __debug__: end = self.newBlock() self.set_lineno(node) self.nextBlock() self.visit(node.test) self.emit('JUMP_IF_TRUE', end) self.nextBlock() self.emit('POP_TOP') self.emit('LOAD_GLOBAL', 'AssertionError') if node.fail: self.visit(node.fail) self.emit('RAISE_VARARGS', 2) else: self.emit('RAISE_VARARGS', 1) self.nextBlock(end) self.emit('POP_TOP') | def visitAssert(self, node): # XXX would be interesting to implement this via a # transformation of the AST before this stage end = self.newBlock() self.set_lineno(node) # XXX __debug__ and AssertionError appear to be special cases # -- they are always loaded as globals even if there are local # names. I guess this is a sort of renaming op. self.emit('LOAD_GLOBAL', '__debug__') self.emit('JUMP_IF_FALSE', end) self.nextBlock() self.emit('POP_TOP') self.visit(node.test) self.emit('JUMP_IF_TRUE', end) self.nextBlock() self.emit('POP_TOP') self.emit('LOAD_GLOBAL', 'AssertionError') if node.fail: self.visit(node.fail) self.emit('RAISE_VARARGS', 2) else: self.emit('RAISE_VARARGS', 1) self.nextBlock(end) self.emit('POP_TOP') | 2876f5ad212d56819cb2d87c73bd6f4dfaa985bc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2876f5ad212d56819cb2d87c73bd6f4dfaa985bc/pycodegen.py |
result = pdb.Pdb.trace_dispatch(self, *args) sys.stdout = save_stdout return result | try: return pdb.Pdb.trace_dispatch(self, *args) finally: sys.stdout = save_stdout | def trace_dispatch(self, *args): # Redirect stdout to the given stream. save_stdout = sys.stdout sys.stdout = self.__out # Call Pdb's trace dispatch method. result = pdb.Pdb.trace_dispatch(self, *args) # Restore stdout. sys.stdout = save_stdout return result | d7bbbbc594544318bc6d0f28cb376a11a326c22f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d7bbbbc594544318bc6d0f28cb376a11a326c22f/doctest.py |
"[TARGETDIR]Lib;[TARGETDIR]DLLs;[TARGETDIR]lib-tk", "REGISTRY"), | r"[TARGETDIR]Lib;[TARGETDIR]DLLs;[TARGETDIR]Lib\lib-tk", "REGISTRY"), | # File extensions, associated with the REGISTRY.def component | f13337dd387d323a875f0d45a95c5974066cc225 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f13337dd387d323a875f0d45a95c5974066cc225/msi.py |
t = threading.Thread(target = self.finish_request, | t = threading.Thread(target = self.process_request_thread, | def process_request(self, request, client_address): """Start a new thread to process the request.""" import threading t = threading.Thread(target = self.finish_request, args = (request, client_address)) t.start() | a5343ccd28245d96feb21d1457802b97a76aa210 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a5343ccd28245d96feb21d1457802b97a76aa210/SocketServer.py |
print 'Skip', path,'- Up-to-date' | print 'Skip', dstfile,'- Up-to-date' | def hexbincwprojects(creator): """Compact and hexbin all files remembered with a given creator""" print 'Please start project mgr with signature', creator,'-' sys.stdin.readline() try: mgr = MwShell(creator) except 'foo': print 'Not handled:', creator return for fss in project_files[creator]: srcfile = fss.as_pathname() dstfile = srcfile + '.hqx' if os.path.exists(dstfile) and \ os.stat(dstfile)[8] > os.stat(srcfile)[8]: print 'Skip', path,'- Up-to-date' continue print 'Compacting', dstfile mgr.open(fss) mgr.Reset_File_Paths() mgr.Remove_Binaries() mgr.Close_Project() print 'Binhexing', dstfile binhex.binhex(srcfile, dstfile) mgr.quit() | 54500bb79fb744d9725168f5acaaf3612c221aa8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/54500bb79fb744d9725168f5acaaf3612c221aa8/binhextree.py |
linelen = 0 | def write(s, output=output, lineEnd='\n'): # RFC 1521 requires that the line ending in a space or tab must have # that trailing character encoded. if s and s[-1:] in ' \t': output.write(s[:-1] + quote(s[-1]) + lineEnd) else: output.write(s + lineEnd) | dac67ac8bf994b336748283fa25602639c6a9bf4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dac67ac8bf994b336748283fa25602639c6a9bf4/quopri.py |
|
if linelen + len(c) >= MAXLINESIZE: if prevline is not None: write(prevline) prevline = EMPTYSTRING.join(outline) linelen = 0 outline = [] | def write(s, output=output, lineEnd='\n'): # RFC 1521 requires that the line ending in a space or tab must have # that trailing character encoded. if s and s[-1:] in ' \t': output.write(s[:-1] + quote(s[-1]) + lineEnd) else: output.write(s + lineEnd) | dac67ac8bf994b336748283fa25602639c6a9bf4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dac67ac8bf994b336748283fa25602639c6a9bf4/quopri.py |
|
linelen += len(c) | def write(s, output=output, lineEnd='\n'): # RFC 1521 requires that the line ending in a space or tab must have # that trailing character encoded. if s and s[-1:] in ' \t': output.write(s[:-1] + quote(s[-1]) + lineEnd) else: output.write(s + lineEnd) | dac67ac8bf994b336748283fa25602639c6a9bf4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dac67ac8bf994b336748283fa25602639c6a9bf4/quopri.py |
|
prevline = EMPTYSTRING.join(outline) linelen = 0 outline = [] | thisline = EMPTYSTRING.join(outline) while len(thisline) > MAXLINESIZE: write(thisline[:MAXLINESIZE-1], lineEnd='=\n') thisline = thisline[MAXLINESIZE-1:] prevline = thisline | def write(s, output=output, lineEnd='\n'): # RFC 1521 requires that the line ending in a space or tab must have # that trailing character encoded. if s and s[-1:] in ' \t': output.write(s[:-1] + quote(s[-1]) + lineEnd) else: output.write(s + lineEnd) | dac67ac8bf994b336748283fa25602639c6a9bf4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dac67ac8bf994b336748283fa25602639c6a9bf4/quopri.py |
def MultiCallIterator(results): | class MultiCallIterator: | def MultiCallIterator(results): """Iterates over the results of a multicall. Exceptions are thrown in response to xmlrpc faults.""" for i in results: if type(i) == type({}): raise Fault(i['faultCode'], i['faultString']) elif type(i) == type([]): yield i[0] else: raise ValueError,\ "unexpected type in multicall result" | 12237b3a19336636ae40f687fab2e3fdd7c35b4b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/12237b3a19336636ae40f687fab2e3fdd7c35b4b/xmlrpclib.py |
for i in results: if type(i) == type({}): raise Fault(i['faultCode'], i['faultString']) elif type(i) == type([]): yield i[0] | def __init__(self, results): self.results = results def __getitem__(self, i): item = self.results[i] if type(item) == type({}): raise Fault(item['faultCode'], item['faultString']) elif type(item) == type([]): return item[0] | def MultiCallIterator(results): """Iterates over the results of a multicall. Exceptions are thrown in response to xmlrpc faults.""" for i in results: if type(i) == type({}): raise Fault(i['faultCode'], i['faultString']) elif type(i) == type([]): yield i[0] else: raise ValueError,\ "unexpected type in multicall result" | 12237b3a19336636ae40f687fab2e3fdd7c35b4b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/12237b3a19336636ae40f687fab2e3fdd7c35b4b/xmlrpclib.py |
server = ServerProxy("http://betty.userland.com") | server = ServerProxy("http://time.xmlrpc.com/RPC2") | def __getattr__(self, name): # magic method dispatcher return _Method(self.__request, name) | 12237b3a19336636ae40f687fab2e3fdd7c35b4b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/12237b3a19336636ae40f687fab2e3fdd7c35b4b/xmlrpclib.py |
print server.examples.getStateName(41) | print server.currentTime.getCurrentTime() | def __getattr__(self, name): # magic method dispatcher return _Method(self.__request, name) | 12237b3a19336636ae40f687fab2e3fdd7c35b4b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/12237b3a19336636ae40f687fab2e3fdd7c35b4b/xmlrpclib.py |
magic = unpack('<i', buf[:4])[0] | magic = unpack('<i', buf[:4])[0] & MASK | def _parse(self, fp): """Override this method to support alternative .mo formats.""" unpack = struct.unpack filename = getattr(fp, 'name', '') # Parse the .mo file header, which consists of 5 little endian 32 # bit words. self._catalog = catalog = {} buf = fp.read() # Are we big endian or little endian? magic = unpack('<i', buf[:4])[0] if magic == self.LE_MAGIC: version, msgcount, masteridx, transidx = unpack('<4i', buf[4:20]) ii = '<ii' elif magic == self.BE_MAGIC: version, msgcount, masteridx, transidx = unpack('>4i', buf[4:20]) ii = '>ii' else: raise IOError(0, 'Bad magic number', filename) # # Now put all messages from the .mo file buffer into the catalog # dictionary. for i in xrange(0, msgcount): mlen, moff = unpack(ii, buf[masteridx:masteridx+8]) mend = moff + mlen tlen, toff = unpack(ii, buf[transidx:transidx+8]) tend = toff + tlen if mend < len(buf) and tend < len(buf): tmsg = buf[toff:tend] catalog[buf[moff:mend]] = tmsg else: raise IOError(0, 'File is corrupt', filename) # See if we're looking at GNU .mo conventions for metadata if mlen == 0 and tmsg.lower().startswith('project-id-version:'): # Catalog description for item in tmsg.split('\n'): item = item.strip() if not item: continue k, v = item.split(':', 1) k = k.strip().lower() v = v.strip() self._info[k] = v if k == 'content-type': self._charset = v.split('charset=')[1] # advance to next entry in the seek tables masteridx += 8 transidx += 8 | 9a2d9d7f04f2ed08574c670bb5ee8ead2a4048ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9a2d9d7f04f2ed08574c670bb5ee8ead2a4048ce/gettext.py |
msgcount &= MASK masteridx &= MASK transidx &= MASK | def _parse(self, fp): """Override this method to support alternative .mo formats.""" unpack = struct.unpack filename = getattr(fp, 'name', '') # Parse the .mo file header, which consists of 5 little endian 32 # bit words. self._catalog = catalog = {} buf = fp.read() # Are we big endian or little endian? magic = unpack('<i', buf[:4])[0] if magic == self.LE_MAGIC: version, msgcount, masteridx, transidx = unpack('<4i', buf[4:20]) ii = '<ii' elif magic == self.BE_MAGIC: version, msgcount, masteridx, transidx = unpack('>4i', buf[4:20]) ii = '>ii' else: raise IOError(0, 'Bad magic number', filename) # # Now put all messages from the .mo file buffer into the catalog # dictionary. for i in xrange(0, msgcount): mlen, moff = unpack(ii, buf[masteridx:masteridx+8]) mend = moff + mlen tlen, toff = unpack(ii, buf[transidx:transidx+8]) tend = toff + tlen if mend < len(buf) and tend < len(buf): tmsg = buf[toff:tend] catalog[buf[moff:mend]] = tmsg else: raise IOError(0, 'File is corrupt', filename) # See if we're looking at GNU .mo conventions for metadata if mlen == 0 and tmsg.lower().startswith('project-id-version:'): # Catalog description for item in tmsg.split('\n'): item = item.strip() if not item: continue k, v = item.split(':', 1) k = k.strip().lower() v = v.strip() self._info[k] = v if k == 'content-type': self._charset = v.split('charset=')[1] # advance to next entry in the seek tables masteridx += 8 transidx += 8 | 9a2d9d7f04f2ed08574c670bb5ee8ead2a4048ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9a2d9d7f04f2ed08574c670bb5ee8ead2a4048ce/gettext.py |
|
mend = moff + mlen | moff &= MASK mend = moff + (mlen & MASK) | def _parse(self, fp): """Override this method to support alternative .mo formats.""" unpack = struct.unpack filename = getattr(fp, 'name', '') # Parse the .mo file header, which consists of 5 little endian 32 # bit words. self._catalog = catalog = {} buf = fp.read() # Are we big endian or little endian? magic = unpack('<i', buf[:4])[0] if magic == self.LE_MAGIC: version, msgcount, masteridx, transidx = unpack('<4i', buf[4:20]) ii = '<ii' elif magic == self.BE_MAGIC: version, msgcount, masteridx, transidx = unpack('>4i', buf[4:20]) ii = '>ii' else: raise IOError(0, 'Bad magic number', filename) # # Now put all messages from the .mo file buffer into the catalog # dictionary. for i in xrange(0, msgcount): mlen, moff = unpack(ii, buf[masteridx:masteridx+8]) mend = moff + mlen tlen, toff = unpack(ii, buf[transidx:transidx+8]) tend = toff + tlen if mend < len(buf) and tend < len(buf): tmsg = buf[toff:tend] catalog[buf[moff:mend]] = tmsg else: raise IOError(0, 'File is corrupt', filename) # See if we're looking at GNU .mo conventions for metadata if mlen == 0 and tmsg.lower().startswith('project-id-version:'): # Catalog description for item in tmsg.split('\n'): item = item.strip() if not item: continue k, v = item.split(':', 1) k = k.strip().lower() v = v.strip() self._info[k] = v if k == 'content-type': self._charset = v.split('charset=')[1] # advance to next entry in the seek tables masteridx += 8 transidx += 8 | 9a2d9d7f04f2ed08574c670bb5ee8ead2a4048ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9a2d9d7f04f2ed08574c670bb5ee8ead2a4048ce/gettext.py |
tend = toff + tlen if mend < len(buf) and tend < len(buf): | toff &= MASK tend = toff + (tlen & MASK) if mend < buflen and tend < buflen: | def _parse(self, fp): """Override this method to support alternative .mo formats.""" unpack = struct.unpack filename = getattr(fp, 'name', '') # Parse the .mo file header, which consists of 5 little endian 32 # bit words. self._catalog = catalog = {} buf = fp.read() # Are we big endian or little endian? magic = unpack('<i', buf[:4])[0] if magic == self.LE_MAGIC: version, msgcount, masteridx, transidx = unpack('<4i', buf[4:20]) ii = '<ii' elif magic == self.BE_MAGIC: version, msgcount, masteridx, transidx = unpack('>4i', buf[4:20]) ii = '>ii' else: raise IOError(0, 'Bad magic number', filename) # # Now put all messages from the .mo file buffer into the catalog # dictionary. for i in xrange(0, msgcount): mlen, moff = unpack(ii, buf[masteridx:masteridx+8]) mend = moff + mlen tlen, toff = unpack(ii, buf[transidx:transidx+8]) tend = toff + tlen if mend < len(buf) and tend < len(buf): tmsg = buf[toff:tend] catalog[buf[moff:mend]] = tmsg else: raise IOError(0, 'File is corrupt', filename) # See if we're looking at GNU .mo conventions for metadata if mlen == 0 and tmsg.lower().startswith('project-id-version:'): # Catalog description for item in tmsg.split('\n'): item = item.strip() if not item: continue k, v = item.split(':', 1) k = k.strip().lower() v = v.strip() self._info[k] = v if k == 'content-type': self._charset = v.split('charset=')[1] # advance to next entry in the seek tables masteridx += 8 transidx += 8 | 9a2d9d7f04f2ed08574c670bb5ee8ead2a4048ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9a2d9d7f04f2ed08574c670bb5ee8ead2a4048ce/gettext.py |
library_dirs=None): | library_dirs=None, build_info=None): | def link_shared_lib (self, objects, output_libname, libraries=None, library_dirs=None): # XXX should we sanity check the library name? (eg. no # slashes) self.link_shared_object (objects, "lib%s%s" % (output_libname, SO)) | 65f4a3b1738dbe7c32a3fd4bad84c7c4d4a30d45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/65f4a3b1738dbe7c32a3fd4bad84c7c4d4a30d45/unixccompiler.py |
self.link_shared_object (objects, "lib%s%s" % (output_libname, SO)) | self.link_shared_object (objects, "lib%s%s" % \ (output_libname, self._shared_lib_ext), build_info=build_info) | def link_shared_lib (self, objects, output_libname, libraries=None, library_dirs=None): # XXX should we sanity check the library name? (eg. no # slashes) self.link_shared_object (objects, "lib%s%s" % (output_libname, SO)) | 65f4a3b1738dbe7c32a3fd4bad84c7c4d4a30d45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/65f4a3b1738dbe7c32a3fd4bad84c7c4d4a30d45/unixccompiler.py |
library_dirs=None): | library_dirs=None, build_info=None): | def link_shared_object (self, objects, output_filename, libraries=None, library_dirs=None): | 65f4a3b1738dbe7c32a3fd4bad84c7c4d4a30d45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/65f4a3b1738dbe7c32a3fd4bad84c7c4d4a30d45/unixccompiler.py |
if build_info is None: build_info = {} | def link_shared_object (self, objects, output_filename, libraries=None, library_dirs=None): | 65f4a3b1738dbe7c32a3fd4bad84c7c4d4a30d45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/65f4a3b1738dbe7c32a3fd4bad84c7c4d4a30d45/unixccompiler.py |
|
outnames.append (re.sub (r'\.(c|C|cc|cxx)$', '.o', inname)) | outnames.append ( re.sub (r'\.(c|C|cc|cxx|cpp)$', self._obj_ext, inname)) | def object_filenames (self, source_filenames): outnames = [] for inname in source_filenames: outnames.append (re.sub (r'\.(c|C|cc|cxx)$', '.o', inname)) return outnames | 65f4a3b1738dbe7c32a3fd4bad84c7c4d4a30d45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/65f4a3b1738dbe7c32a3fd4bad84c7c4d4a30d45/unixccompiler.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.