rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
self.restore_files() | self.restore_files() | def s_apply(self, func, args=(), kw=None): | ce7c76df1b92a89c9b48d025af1313d1dcf28c4f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ce7c76df1b92a89c9b48d025af1313d1dcf28c4f/rexec.py |
try: try: s = raw_input('>>> ') except EOFError: print break if s and s[0] != ' s = s + '\n' c = compile(s, '<stdin>', 'single') r.r_exec(c) except SystemExit, n: sys.exit(n) except: traceback.print_exc() | try: try: s = raw_input('>>> ') except EOFError: print break if s and s[0] != ' s = s + '\n' c = compile(s, '<stdin>', 'single') r.r_exec(c) except SystemExit, n: sys.exit(n) except: traceback.print_exc() | def test(): import traceback r = RExec(verbose=('-v' in sys.argv[1:])) print "*** RESTRICTED *** Python", sys.version print sys.copyright while 1: try: try: s = raw_input('>>> ') except EOFError: print break if s and s[0] != '#': s = s + '\n' c = compile(s, '<stdin>', 'single') r.r_exec(c) except SystemExit, n: sys.exit(n) except: traceback.print_exc() | ce7c76df1b92a89c9b48d025af1313d1dcf28c4f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ce7c76df1b92a89c9b48d025af1313d1dcf28c4f/rexec.py |
ValueError if 'pathname' is absolute (starts with '/') or contains local directory separators (unless the local separator is '/', of course). | ValueError on non-Unix-ish systems if 'pathname' either starts or ends with a slash. | def convert_path (pathname): """Return 'pathname' as a name that will work on the native filesystem, i.e. split it on '/' and put it back together again using the current directory separator. Needed because filenames in the setup script are always supplied in Unix style, and have to be converted to the local convention before we can actually use them in the filesystem. Raises ValueError if 'pathname' is absolute (starts with '/') or contains local directory separators (unless the local separator is '/', of course). """ if os.sep == '/': return pathname if pathname[0] == '/': raise ValueError, "path '%s' cannot be absolute" % pathname if pathname[-1] == '/': raise ValueError, "path '%s' cannot end with '/'" % pathname paths = string.split(pathname, '/') return apply(os.path.join, paths) | 4df8e311969d7cb0fee813c5665a966937397bba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4df8e311969d7cb0fee813c5665a966937397bba/util.py |
occurrence of '$' followed by a name, or a name enclosed in braces, is considered a variable. Every variable is substituted by the value found in the 'local_vars' dictionary, or in 'os.environ' if it's not in 'local_vars'. 'os.environ' is first checked/ augmented to guarantee that it contains certain values: see '_check_environ()'. Raise ValueError for any variables not found in either 'local_vars' or 'os.environ'. | occurrence of '$' followed by a name is considered a variable, and variable is substituted by the value found in the 'local_vars' dictionary, or in 'os.environ' if it's not in 'local_vars'. 'os.environ' is first checked/augmented to guarantee that it contains certain values: see 'check_environ()'. Raise ValueError for any variables not found in either 'local_vars' or 'os.environ'. | def subst_vars (str, local_vars): """Perform shell/Perl-style variable substitution on 'string'. Every occurrence of '$' followed by a name, or a name enclosed in braces, is considered a variable. Every variable is substituted by the value found in the 'local_vars' dictionary, or in 'os.environ' if it's not in 'local_vars'. 'os.environ' is first checked/ augmented to guarantee that it contains certain values: see '_check_environ()'. Raise ValueError for any variables not found in either 'local_vars' or 'os.environ'. """ check_environ() def _subst (match, local_vars=local_vars): var_name = match.group(1) if local_vars.has_key(var_name): return str(local_vars[var_name]) else: return os.environ[var_name] return re.sub(r'\$([a-zA-Z_][a-zA-Z_0-9]*)', _subst, str) | 4df8e311969d7cb0fee813c5665a966937397bba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4df8e311969d7cb0fee813c5665a966937397bba/util.py |
return re.sub(r'\$([a-zA-Z_][a-zA-Z_0-9]*)', _subst, str) | try: return re.sub(r'\$([a-zA-Z_][a-zA-Z_0-9]*)', _subst, str) except KeyError, var: raise ValueError, "invalid variable '$%s'" % var | def _subst (match, local_vars=local_vars): var_name = match.group(1) if local_vars.has_key(var_name): return str(local_vars[var_name]) else: return os.environ[var_name] | 4df8e311969d7cb0fee813c5665a966937397bba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4df8e311969d7cb0fee813c5665a966937397bba/util.py |
Single = group("^'", "[^\]'") Double = group('^"', '[^\]"') Single3 = group("^'''", "[^\]'''") Double3 = group('^"""', '[^\]"""') | Single = group("[^'\]", "[\].") + "*'" Double = group('[^"\]', '[\].') + '*"' Single3 = group("[^'\]","[\].","'[^'\]","'[\].","''[^'\]","''[\].") + "*'''" Double3 = group('[^"\]','[\].','"[^"\]','"[\].','""[^"\]','""[\].') + '*"""' | def group(*choices): return '\(' + string.join(choices, '\|') + '\)' | da67869f766cef01e3126399eb209553c39dc565 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/da67869f766cef01e3126399eb209553c39dc565/tokenize.py |
String = group("'" + group('[\].', "[^\n'\]") + "*'", '"' + group('[\].', '[^\n"\]') + '*"') | String = group("'" + group("[^\n'\]", "[\].") + "*'", '"' + group('[^\n"\]', '[\].') + '*"') | def group(*choices): return '\(' + string.join(choices, '\|') + '\)' | da67869f766cef01e3126399eb209553c39dc565 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/da67869f766cef01e3126399eb209553c39dc565/tokenize.py |
contstr = '' | contstr, needcont = '', 0 | def tokenize(readline, tokeneater=printtoken): lnum = parenlev = continued = 0 namechars, numchars = string.letters + '_', string.digits contstr = '' indents = [0] while 1: # loop over lines in stream line = readline() lnum = lnum + 1 pos, max = 0, len(line) if contstr: # continued string if not line: raise TokenError, "EOF within multi-line string" if endprog.search(line) >= 0: pos = end = endprog.regs[0][1] tokeneater(STRING, contstr + line[:end], strstart, (lnum, end), line) contstr = '' else: contstr = contstr + line continue elif parenlev == 0 and not continued: # new statement if not line: break column = 0 while pos < max: # measure leading whitespace if line[pos] == ' ': column = column + 1 elif line[pos] == '\t': column = (column/tabsize + 1)*tabsize elif line[pos] == '\f': column = 0 else: break pos = pos + 1 if pos == max: break if line[pos] in '#\r\n': # skip comments or blank lines tokeneater((NEWLINE, COMMENT)[line[pos] == '#'], line[pos:], (lnum, pos), (lnum, len(line)), line) continue if column > indents[-1]: # count indents or dedents indents.append(column) tokeneater(INDENT, line[:pos], (lnum, 0), (lnum, pos), line) while column < indents[-1]: indents = indents[:-1] tokeneater(DEDENT, line[:pos], (lnum, 0), (lnum, pos), line) else: # continued statement if not line: raise TokenError, "EOF within multi-line statement" continued = 0 while pos < max: if pseudoprog.match(line, pos) > 0: # scan for tokens start, end = pseudoprog.regs[1] spos, epos = (lnum, start), (lnum, end) token, initial = line[start:end], line[start] pos = end if initial in namechars: # ordinary name tokeneater(NAME, token, spos, epos, line) elif initial in numchars: # ordinary number tokeneater(NUMBER, token, spos, epos, line) elif initial in '\r\n': tokeneater(NEWLINE, token, spos, epos, line) elif initial == '#': tokeneater(COMMENT, token, spos, epos, line) elif initial == '\\': # continued stmt continued = 1 elif token in ('\'\'\'', '"""'): # triple-quoted endprog = endprogs[token] if endprog.search(line, pos) >= 0: # all on one line pos = endprog.regs[0][1] token = line[start:pos] tokeneater(STRING, token, spos, (lnum, pos), line) else: strstart = (lnum, start) # multiple lines contstr = line[start:] break elif initial in '\'"': if token[-1] == '\n': # continued string strstart = (lnum, start) endprog, contstr = endprogs[initial], line[start:] break else: # ordinary string tokeneater(STRING, token, spos, epos, line) else: if initial in '([{': parenlev = parenlev + 1 elif initial in ')]}': parenlev = parenlev - 1 tokeneater(OP, token, spos, epos, line) else: tokeneater(ERRORTOKEN, line[pos], spos, (lnum, pos+1), line) pos = pos + 1 for indent in indents[1:]: # pop remaining indent levels tokeneater(DEDENT, '', (lnum, 0), (lnum, 0), '') | da67869f766cef01e3126399eb209553c39dc565 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/da67869f766cef01e3126399eb209553c39dc565/tokenize.py |
if not line: raise TokenError, "EOF within multi-line string" if endprog.search(line) >= 0: | if not line: raise TokenError, ("EOF in multi-line string", strstart) if endprog.match(line) >= 0: | def tokenize(readline, tokeneater=printtoken): lnum = parenlev = continued = 0 namechars, numchars = string.letters + '_', string.digits contstr = '' indents = [0] while 1: # loop over lines in stream line = readline() lnum = lnum + 1 pos, max = 0, len(line) if contstr: # continued string if not line: raise TokenError, "EOF within multi-line string" if endprog.search(line) >= 0: pos = end = endprog.regs[0][1] tokeneater(STRING, contstr + line[:end], strstart, (lnum, end), line) contstr = '' else: contstr = contstr + line continue elif parenlev == 0 and not continued: # new statement if not line: break column = 0 while pos < max: # measure leading whitespace if line[pos] == ' ': column = column + 1 elif line[pos] == '\t': column = (column/tabsize + 1)*tabsize elif line[pos] == '\f': column = 0 else: break pos = pos + 1 if pos == max: break if line[pos] in '#\r\n': # skip comments or blank lines tokeneater((NEWLINE, COMMENT)[line[pos] == '#'], line[pos:], (lnum, pos), (lnum, len(line)), line) continue if column > indents[-1]: # count indents or dedents indents.append(column) tokeneater(INDENT, line[:pos], (lnum, 0), (lnum, pos), line) while column < indents[-1]: indents = indents[:-1] tokeneater(DEDENT, line[:pos], (lnum, 0), (lnum, pos), line) else: # continued statement if not line: raise TokenError, "EOF within multi-line statement" continued = 0 while pos < max: if pseudoprog.match(line, pos) > 0: # scan for tokens start, end = pseudoprog.regs[1] spos, epos = (lnum, start), (lnum, end) token, initial = line[start:end], line[start] pos = end if initial in namechars: # ordinary name tokeneater(NAME, token, spos, epos, line) elif initial in numchars: # ordinary number tokeneater(NUMBER, token, spos, epos, line) elif initial in '\r\n': tokeneater(NEWLINE, token, spos, epos, line) elif initial == '#': tokeneater(COMMENT, token, spos, epos, line) elif initial == '\\': # continued stmt continued = 1 elif token in ('\'\'\'', '"""'): # triple-quoted endprog = endprogs[token] if endprog.search(line, pos) >= 0: # all on one line pos = endprog.regs[0][1] token = line[start:pos] tokeneater(STRING, token, spos, (lnum, pos), line) else: strstart = (lnum, start) # multiple lines contstr = line[start:] break elif initial in '\'"': if token[-1] == '\n': # continued string strstart = (lnum, start) endprog, contstr = endprogs[initial], line[start:] break else: # ordinary string tokeneater(STRING, token, spos, epos, line) else: if initial in '([{': parenlev = parenlev + 1 elif initial in ')]}': parenlev = parenlev - 1 tokeneater(OP, token, spos, epos, line) else: tokeneater(ERRORTOKEN, line[pos], spos, (lnum, pos+1), line) pos = pos + 1 for indent in indents[1:]: # pop remaining indent levels tokeneater(DEDENT, '', (lnum, 0), (lnum, 0), '') | da67869f766cef01e3126399eb209553c39dc565 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/da67869f766cef01e3126399eb209553c39dc565/tokenize.py |
if pos == max: break | if pos == max: break | def tokenize(readline, tokeneater=printtoken): lnum = parenlev = continued = 0 namechars, numchars = string.letters + '_', string.digits contstr = '' indents = [0] while 1: # loop over lines in stream line = readline() lnum = lnum + 1 pos, max = 0, len(line) if contstr: # continued string if not line: raise TokenError, "EOF within multi-line string" if endprog.search(line) >= 0: pos = end = endprog.regs[0][1] tokeneater(STRING, contstr + line[:end], strstart, (lnum, end), line) contstr = '' else: contstr = contstr + line continue elif parenlev == 0 and not continued: # new statement if not line: break column = 0 while pos < max: # measure leading whitespace if line[pos] == ' ': column = column + 1 elif line[pos] == '\t': column = (column/tabsize + 1)*tabsize elif line[pos] == '\f': column = 0 else: break pos = pos + 1 if pos == max: break if line[pos] in '#\r\n': # skip comments or blank lines tokeneater((NEWLINE, COMMENT)[line[pos] == '#'], line[pos:], (lnum, pos), (lnum, len(line)), line) continue if column > indents[-1]: # count indents or dedents indents.append(column) tokeneater(INDENT, line[:pos], (lnum, 0), (lnum, pos), line) while column < indents[-1]: indents = indents[:-1] tokeneater(DEDENT, line[:pos], (lnum, 0), (lnum, pos), line) else: # continued statement if not line: raise TokenError, "EOF within multi-line statement" continued = 0 while pos < max: if pseudoprog.match(line, pos) > 0: # scan for tokens start, end = pseudoprog.regs[1] spos, epos = (lnum, start), (lnum, end) token, initial = line[start:end], line[start] pos = end if initial in namechars: # ordinary name tokeneater(NAME, token, spos, epos, line) elif initial in numchars: # ordinary number tokeneater(NUMBER, token, spos, epos, line) elif initial in '\r\n': tokeneater(NEWLINE, token, spos, epos, line) elif initial == '#': tokeneater(COMMENT, token, spos, epos, line) elif initial == '\\': # continued stmt continued = 1 elif token in ('\'\'\'', '"""'): # triple-quoted endprog = endprogs[token] if endprog.search(line, pos) >= 0: # all on one line pos = endprog.regs[0][1] token = line[start:pos] tokeneater(STRING, token, spos, (lnum, pos), line) else: strstart = (lnum, start) # multiple lines contstr = line[start:] break elif initial in '\'"': if token[-1] == '\n': # continued string strstart = (lnum, start) endprog, contstr = endprogs[initial], line[start:] break else: # ordinary string tokeneater(STRING, token, spos, epos, line) else: if initial in '([{': parenlev = parenlev + 1 elif initial in ')]}': parenlev = parenlev - 1 tokeneater(OP, token, spos, epos, line) else: tokeneater(ERRORTOKEN, line[pos], spos, (lnum, pos+1), line) pos = pos + 1 for indent in indents[1:]: # pop remaining indent levels tokeneater(DEDENT, '', (lnum, 0), (lnum, 0), '') | da67869f766cef01e3126399eb209553c39dc565 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/da67869f766cef01e3126399eb209553c39dc565/tokenize.py |
tokeneater(DEDENT, line[:pos], (lnum, 0), (lnum, pos), line) | tokeneater(DEDENT, '', (lnum, pos), (lnum, pos), line) | def tokenize(readline, tokeneater=printtoken): lnum = parenlev = continued = 0 namechars, numchars = string.letters + '_', string.digits contstr = '' indents = [0] while 1: # loop over lines in stream line = readline() lnum = lnum + 1 pos, max = 0, len(line) if contstr: # continued string if not line: raise TokenError, "EOF within multi-line string" if endprog.search(line) >= 0: pos = end = endprog.regs[0][1] tokeneater(STRING, contstr + line[:end], strstart, (lnum, end), line) contstr = '' else: contstr = contstr + line continue elif parenlev == 0 and not continued: # new statement if not line: break column = 0 while pos < max: # measure leading whitespace if line[pos] == ' ': column = column + 1 elif line[pos] == '\t': column = (column/tabsize + 1)*tabsize elif line[pos] == '\f': column = 0 else: break pos = pos + 1 if pos == max: break if line[pos] in '#\r\n': # skip comments or blank lines tokeneater((NEWLINE, COMMENT)[line[pos] == '#'], line[pos:], (lnum, pos), (lnum, len(line)), line) continue if column > indents[-1]: # count indents or dedents indents.append(column) tokeneater(INDENT, line[:pos], (lnum, 0), (lnum, pos), line) while column < indents[-1]: indents = indents[:-1] tokeneater(DEDENT, line[:pos], (lnum, 0), (lnum, pos), line) else: # continued statement if not line: raise TokenError, "EOF within multi-line statement" continued = 0 while pos < max: if pseudoprog.match(line, pos) > 0: # scan for tokens start, end = pseudoprog.regs[1] spos, epos = (lnum, start), (lnum, end) token, initial = line[start:end], line[start] pos = end if initial in namechars: # ordinary name tokeneater(NAME, token, spos, epos, line) elif initial in numchars: # ordinary number tokeneater(NUMBER, token, spos, epos, line) elif initial in '\r\n': tokeneater(NEWLINE, token, spos, epos, line) elif initial == '#': tokeneater(COMMENT, token, spos, epos, line) elif initial == '\\': # continued stmt continued = 1 elif token in ('\'\'\'', '"""'): # triple-quoted endprog = endprogs[token] if endprog.search(line, pos) >= 0: # all on one line pos = endprog.regs[0][1] token = line[start:pos] tokeneater(STRING, token, spos, (lnum, pos), line) else: strstart = (lnum, start) # multiple lines contstr = line[start:] break elif initial in '\'"': if token[-1] == '\n': # continued string strstart = (lnum, start) endprog, contstr = endprogs[initial], line[start:] break else: # ordinary string tokeneater(STRING, token, spos, epos, line) else: if initial in '([{': parenlev = parenlev + 1 elif initial in ')]}': parenlev = parenlev - 1 tokeneater(OP, token, spos, epos, line) else: tokeneater(ERRORTOKEN, line[pos], spos, (lnum, pos+1), line) pos = pos + 1 for indent in indents[1:]: # pop remaining indent levels tokeneater(DEDENT, '', (lnum, 0), (lnum, 0), '') | da67869f766cef01e3126399eb209553c39dc565 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/da67869f766cef01e3126399eb209553c39dc565/tokenize.py |
if not line: raise TokenError, "EOF within multi-line statement" | if not line: raise TokenError, ("EOF in multi-line statement", (lnum, 0)) | def tokenize(readline, tokeneater=printtoken): lnum = parenlev = continued = 0 namechars, numchars = string.letters + '_', string.digits contstr = '' indents = [0] while 1: # loop over lines in stream line = readline() lnum = lnum + 1 pos, max = 0, len(line) if contstr: # continued string if not line: raise TokenError, "EOF within multi-line string" if endprog.search(line) >= 0: pos = end = endprog.regs[0][1] tokeneater(STRING, contstr + line[:end], strstart, (lnum, end), line) contstr = '' else: contstr = contstr + line continue elif parenlev == 0 and not continued: # new statement if not line: break column = 0 while pos < max: # measure leading whitespace if line[pos] == ' ': column = column + 1 elif line[pos] == '\t': column = (column/tabsize + 1)*tabsize elif line[pos] == '\f': column = 0 else: break pos = pos + 1 if pos == max: break if line[pos] in '#\r\n': # skip comments or blank lines tokeneater((NEWLINE, COMMENT)[line[pos] == '#'], line[pos:], (lnum, pos), (lnum, len(line)), line) continue if column > indents[-1]: # count indents or dedents indents.append(column) tokeneater(INDENT, line[:pos], (lnum, 0), (lnum, pos), line) while column < indents[-1]: indents = indents[:-1] tokeneater(DEDENT, line[:pos], (lnum, 0), (lnum, pos), line) else: # continued statement if not line: raise TokenError, "EOF within multi-line statement" continued = 0 while pos < max: if pseudoprog.match(line, pos) > 0: # scan for tokens start, end = pseudoprog.regs[1] spos, epos = (lnum, start), (lnum, end) token, initial = line[start:end], line[start] pos = end if initial in namechars: # ordinary name tokeneater(NAME, token, spos, epos, line) elif initial in numchars: # ordinary number tokeneater(NUMBER, token, spos, epos, line) elif initial in '\r\n': tokeneater(NEWLINE, token, spos, epos, line) elif initial == '#': tokeneater(COMMENT, token, spos, epos, line) elif initial == '\\': # continued stmt continued = 1 elif token in ('\'\'\'', '"""'): # triple-quoted endprog = endprogs[token] if endprog.search(line, pos) >= 0: # all on one line pos = endprog.regs[0][1] token = line[start:pos] tokeneater(STRING, token, spos, (lnum, pos), line) else: strstart = (lnum, start) # multiple lines contstr = line[start:] break elif initial in '\'"': if token[-1] == '\n': # continued string strstart = (lnum, start) endprog, contstr = endprogs[initial], line[start:] break else: # ordinary string tokeneater(STRING, token, spos, epos, line) else: if initial in '([{': parenlev = parenlev + 1 elif initial in ')]}': parenlev = parenlev - 1 tokeneater(OP, token, spos, epos, line) else: tokeneater(ERRORTOKEN, line[pos], spos, (lnum, pos+1), line) pos = pos + 1 for indent in indents[1:]: # pop remaining indent levels tokeneater(DEDENT, '', (lnum, 0), (lnum, 0), '') | da67869f766cef01e3126399eb209553c39dc565 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/da67869f766cef01e3126399eb209553c39dc565/tokenize.py |
spos, epos = (lnum, start), (lnum, end) | spos, epos, pos = (lnum, start), (lnum, end), end | def tokenize(readline, tokeneater=printtoken): lnum = parenlev = continued = 0 namechars, numchars = string.letters + '_', string.digits contstr = '' indents = [0] while 1: # loop over lines in stream line = readline() lnum = lnum + 1 pos, max = 0, len(line) if contstr: # continued string if not line: raise TokenError, "EOF within multi-line string" if endprog.search(line) >= 0: pos = end = endprog.regs[0][1] tokeneater(STRING, contstr + line[:end], strstart, (lnum, end), line) contstr = '' else: contstr = contstr + line continue elif parenlev == 0 and not continued: # new statement if not line: break column = 0 while pos < max: # measure leading whitespace if line[pos] == ' ': column = column + 1 elif line[pos] == '\t': column = (column/tabsize + 1)*tabsize elif line[pos] == '\f': column = 0 else: break pos = pos + 1 if pos == max: break if line[pos] in '#\r\n': # skip comments or blank lines tokeneater((NEWLINE, COMMENT)[line[pos] == '#'], line[pos:], (lnum, pos), (lnum, len(line)), line) continue if column > indents[-1]: # count indents or dedents indents.append(column) tokeneater(INDENT, line[:pos], (lnum, 0), (lnum, pos), line) while column < indents[-1]: indents = indents[:-1] tokeneater(DEDENT, line[:pos], (lnum, 0), (lnum, pos), line) else: # continued statement if not line: raise TokenError, "EOF within multi-line statement" continued = 0 while pos < max: if pseudoprog.match(line, pos) > 0: # scan for tokens start, end = pseudoprog.regs[1] spos, epos = (lnum, start), (lnum, end) token, initial = line[start:end], line[start] pos = end if initial in namechars: # ordinary name tokeneater(NAME, token, spos, epos, line) elif initial in numchars: # ordinary number tokeneater(NUMBER, token, spos, epos, line) elif initial in '\r\n': tokeneater(NEWLINE, token, spos, epos, line) elif initial == '#': tokeneater(COMMENT, token, spos, epos, line) elif initial == '\\': # continued stmt continued = 1 elif token in ('\'\'\'', '"""'): # triple-quoted endprog = endprogs[token] if endprog.search(line, pos) >= 0: # all on one line pos = endprog.regs[0][1] token = line[start:pos] tokeneater(STRING, token, spos, (lnum, pos), line) else: strstart = (lnum, start) # multiple lines contstr = line[start:] break elif initial in '\'"': if token[-1] == '\n': # continued string strstart = (lnum, start) endprog, contstr = endprogs[initial], line[start:] break else: # ordinary string tokeneater(STRING, token, spos, epos, line) else: if initial in '([{': parenlev = parenlev + 1 elif initial in ')]}': parenlev = parenlev - 1 tokeneater(OP, token, spos, epos, line) else: tokeneater(ERRORTOKEN, line[pos], spos, (lnum, pos+1), line) pos = pos + 1 for indent in indents[1:]: # pop remaining indent levels tokeneater(DEDENT, '', (lnum, 0), (lnum, 0), '') | da67869f766cef01e3126399eb209553c39dc565 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/da67869f766cef01e3126399eb209553c39dc565/tokenize.py |
pos = end | def tokenize(readline, tokeneater=printtoken): lnum = parenlev = continued = 0 namechars, numchars = string.letters + '_', string.digits contstr = '' indents = [0] while 1: # loop over lines in stream line = readline() lnum = lnum + 1 pos, max = 0, len(line) if contstr: # continued string if not line: raise TokenError, "EOF within multi-line string" if endprog.search(line) >= 0: pos = end = endprog.regs[0][1] tokeneater(STRING, contstr + line[:end], strstart, (lnum, end), line) contstr = '' else: contstr = contstr + line continue elif parenlev == 0 and not continued: # new statement if not line: break column = 0 while pos < max: # measure leading whitespace if line[pos] == ' ': column = column + 1 elif line[pos] == '\t': column = (column/tabsize + 1)*tabsize elif line[pos] == '\f': column = 0 else: break pos = pos + 1 if pos == max: break if line[pos] in '#\r\n': # skip comments or blank lines tokeneater((NEWLINE, COMMENT)[line[pos] == '#'], line[pos:], (lnum, pos), (lnum, len(line)), line) continue if column > indents[-1]: # count indents or dedents indents.append(column) tokeneater(INDENT, line[:pos], (lnum, 0), (lnum, pos), line) while column < indents[-1]: indents = indents[:-1] tokeneater(DEDENT, line[:pos], (lnum, 0), (lnum, pos), line) else: # continued statement if not line: raise TokenError, "EOF within multi-line statement" continued = 0 while pos < max: if pseudoprog.match(line, pos) > 0: # scan for tokens start, end = pseudoprog.regs[1] spos, epos = (lnum, start), (lnum, end) token, initial = line[start:end], line[start] pos = end if initial in namechars: # ordinary name tokeneater(NAME, token, spos, epos, line) elif initial in numchars: # ordinary number tokeneater(NUMBER, token, spos, epos, line) elif initial in '\r\n': tokeneater(NEWLINE, token, spos, epos, line) elif initial == '#': tokeneater(COMMENT, token, spos, epos, line) elif initial == '\\': # continued stmt continued = 1 elif token in ('\'\'\'', '"""'): # triple-quoted endprog = endprogs[token] if endprog.search(line, pos) >= 0: # all on one line pos = endprog.regs[0][1] token = line[start:pos] tokeneater(STRING, token, spos, (lnum, pos), line) else: strstart = (lnum, start) # multiple lines contstr = line[start:] break elif initial in '\'"': if token[-1] == '\n': # continued string strstart = (lnum, start) endprog, contstr = endprogs[initial], line[start:] break else: # ordinary string tokeneater(STRING, token, spos, epos, line) else: if initial in '([{': parenlev = parenlev + 1 elif initial in ')]}': parenlev = parenlev - 1 tokeneater(OP, token, spos, epos, line) else: tokeneater(ERRORTOKEN, line[pos], spos, (lnum, pos+1), line) pos = pos + 1 for indent in indents[1:]: # pop remaining indent levels tokeneater(DEDENT, '', (lnum, 0), (lnum, 0), '') | da67869f766cef01e3126399eb209553c39dc565 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/da67869f766cef01e3126399eb209553c39dc565/tokenize.py |
|
elif initial in numchars: | elif initial in numchars \ or (initial == '.' and token != '.'): | def tokenize(readline, tokeneater=printtoken): lnum = parenlev = continued = 0 namechars, numchars = string.letters + '_', string.digits contstr = '' indents = [0] while 1: # loop over lines in stream line = readline() lnum = lnum + 1 pos, max = 0, len(line) if contstr: # continued string if not line: raise TokenError, "EOF within multi-line string" if endprog.search(line) >= 0: pos = end = endprog.regs[0][1] tokeneater(STRING, contstr + line[:end], strstart, (lnum, end), line) contstr = '' else: contstr = contstr + line continue elif parenlev == 0 and not continued: # new statement if not line: break column = 0 while pos < max: # measure leading whitespace if line[pos] == ' ': column = column + 1 elif line[pos] == '\t': column = (column/tabsize + 1)*tabsize elif line[pos] == '\f': column = 0 else: break pos = pos + 1 if pos == max: break if line[pos] in '#\r\n': # skip comments or blank lines tokeneater((NEWLINE, COMMENT)[line[pos] == '#'], line[pos:], (lnum, pos), (lnum, len(line)), line) continue if column > indents[-1]: # count indents or dedents indents.append(column) tokeneater(INDENT, line[:pos], (lnum, 0), (lnum, pos), line) while column < indents[-1]: indents = indents[:-1] tokeneater(DEDENT, line[:pos], (lnum, 0), (lnum, pos), line) else: # continued statement if not line: raise TokenError, "EOF within multi-line statement" continued = 0 while pos < max: if pseudoprog.match(line, pos) > 0: # scan for tokens start, end = pseudoprog.regs[1] spos, epos = (lnum, start), (lnum, end) token, initial = line[start:end], line[start] pos = end if initial in namechars: # ordinary name tokeneater(NAME, token, spos, epos, line) elif initial in numchars: # ordinary number tokeneater(NUMBER, token, spos, epos, line) elif initial in '\r\n': tokeneater(NEWLINE, token, spos, epos, line) elif initial == '#': tokeneater(COMMENT, token, spos, epos, line) elif initial == '\\': # continued stmt continued = 1 elif token in ('\'\'\'', '"""'): # triple-quoted endprog = endprogs[token] if endprog.search(line, pos) >= 0: # all on one line pos = endprog.regs[0][1] token = line[start:pos] tokeneater(STRING, token, spos, (lnum, pos), line) else: strstart = (lnum, start) # multiple lines contstr = line[start:] break elif initial in '\'"': if token[-1] == '\n': # continued string strstart = (lnum, start) endprog, contstr = endprogs[initial], line[start:] break else: # ordinary string tokeneater(STRING, token, spos, epos, line) else: if initial in '([{': parenlev = parenlev + 1 elif initial in ')]}': parenlev = parenlev - 1 tokeneater(OP, token, spos, epos, line) else: tokeneater(ERRORTOKEN, line[pos], spos, (lnum, pos+1), line) pos = pos + 1 for indent in indents[1:]: # pop remaining indent levels tokeneater(DEDENT, '', (lnum, 0), (lnum, 0), '') | da67869f766cef01e3126399eb209553c39dc565 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/da67869f766cef01e3126399eb209553c39dc565/tokenize.py |
if endprog.search(line, pos) >= 0: | if endprog.match(line, pos) >= 0: | def tokenize(readline, tokeneater=printtoken): lnum = parenlev = continued = 0 namechars, numchars = string.letters + '_', string.digits contstr = '' indents = [0] while 1: # loop over lines in stream line = readline() lnum = lnum + 1 pos, max = 0, len(line) if contstr: # continued string if not line: raise TokenError, "EOF within multi-line string" if endprog.search(line) >= 0: pos = end = endprog.regs[0][1] tokeneater(STRING, contstr + line[:end], strstart, (lnum, end), line) contstr = '' else: contstr = contstr + line continue elif parenlev == 0 and not continued: # new statement if not line: break column = 0 while pos < max: # measure leading whitespace if line[pos] == ' ': column = column + 1 elif line[pos] == '\t': column = (column/tabsize + 1)*tabsize elif line[pos] == '\f': column = 0 else: break pos = pos + 1 if pos == max: break if line[pos] in '#\r\n': # skip comments or blank lines tokeneater((NEWLINE, COMMENT)[line[pos] == '#'], line[pos:], (lnum, pos), (lnum, len(line)), line) continue if column > indents[-1]: # count indents or dedents indents.append(column) tokeneater(INDENT, line[:pos], (lnum, 0), (lnum, pos), line) while column < indents[-1]: indents = indents[:-1] tokeneater(DEDENT, line[:pos], (lnum, 0), (lnum, pos), line) else: # continued statement if not line: raise TokenError, "EOF within multi-line statement" continued = 0 while pos < max: if pseudoprog.match(line, pos) > 0: # scan for tokens start, end = pseudoprog.regs[1] spos, epos = (lnum, start), (lnum, end) token, initial = line[start:end], line[start] pos = end if initial in namechars: # ordinary name tokeneater(NAME, token, spos, epos, line) elif initial in numchars: # ordinary number tokeneater(NUMBER, token, spos, epos, line) elif initial in '\r\n': tokeneater(NEWLINE, token, spos, epos, line) elif initial == '#': tokeneater(COMMENT, token, spos, epos, line) elif initial == '\\': # continued stmt continued = 1 elif token in ('\'\'\'', '"""'): # triple-quoted endprog = endprogs[token] if endprog.search(line, pos) >= 0: # all on one line pos = endprog.regs[0][1] token = line[start:pos] tokeneater(STRING, token, spos, (lnum, pos), line) else: strstart = (lnum, start) # multiple lines contstr = line[start:] break elif initial in '\'"': if token[-1] == '\n': # continued string strstart = (lnum, start) endprog, contstr = endprogs[initial], line[start:] break else: # ordinary string tokeneater(STRING, token, spos, epos, line) else: if initial in '([{': parenlev = parenlev + 1 elif initial in ')]}': parenlev = parenlev - 1 tokeneater(OP, token, spos, epos, line) else: tokeneater(ERRORTOKEN, line[pos], spos, (lnum, pos+1), line) pos = pos + 1 for indent in indents[1:]: # pop remaining indent levels tokeneater(DEDENT, '', (lnum, 0), (lnum, 0), '') | da67869f766cef01e3126399eb209553c39dc565 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/da67869f766cef01e3126399eb209553c39dc565/tokenize.py |
endprog, contstr = endprogs[initial], line[start:] | endprog = endprogs[initial] contstr, needcont = line[start:], 1 | def tokenize(readline, tokeneater=printtoken): lnum = parenlev = continued = 0 namechars, numchars = string.letters + '_', string.digits contstr = '' indents = [0] while 1: # loop over lines in stream line = readline() lnum = lnum + 1 pos, max = 0, len(line) if contstr: # continued string if not line: raise TokenError, "EOF within multi-line string" if endprog.search(line) >= 0: pos = end = endprog.regs[0][1] tokeneater(STRING, contstr + line[:end], strstart, (lnum, end), line) contstr = '' else: contstr = contstr + line continue elif parenlev == 0 and not continued: # new statement if not line: break column = 0 while pos < max: # measure leading whitespace if line[pos] == ' ': column = column + 1 elif line[pos] == '\t': column = (column/tabsize + 1)*tabsize elif line[pos] == '\f': column = 0 else: break pos = pos + 1 if pos == max: break if line[pos] in '#\r\n': # skip comments or blank lines tokeneater((NEWLINE, COMMENT)[line[pos] == '#'], line[pos:], (lnum, pos), (lnum, len(line)), line) continue if column > indents[-1]: # count indents or dedents indents.append(column) tokeneater(INDENT, line[:pos], (lnum, 0), (lnum, pos), line) while column < indents[-1]: indents = indents[:-1] tokeneater(DEDENT, line[:pos], (lnum, 0), (lnum, pos), line) else: # continued statement if not line: raise TokenError, "EOF within multi-line statement" continued = 0 while pos < max: if pseudoprog.match(line, pos) > 0: # scan for tokens start, end = pseudoprog.regs[1] spos, epos = (lnum, start), (lnum, end) token, initial = line[start:end], line[start] pos = end if initial in namechars: # ordinary name tokeneater(NAME, token, spos, epos, line) elif initial in numchars: # ordinary number tokeneater(NUMBER, token, spos, epos, line) elif initial in '\r\n': tokeneater(NEWLINE, token, spos, epos, line) elif initial == '#': tokeneater(COMMENT, token, spos, epos, line) elif initial == '\\': # continued stmt continued = 1 elif token in ('\'\'\'', '"""'): # triple-quoted endprog = endprogs[token] if endprog.search(line, pos) >= 0: # all on one line pos = endprog.regs[0][1] token = line[start:pos] tokeneater(STRING, token, spos, (lnum, pos), line) else: strstart = (lnum, start) # multiple lines contstr = line[start:] break elif initial in '\'"': if token[-1] == '\n': # continued string strstart = (lnum, start) endprog, contstr = endprogs[initial], line[start:] break else: # ordinary string tokeneater(STRING, token, spos, epos, line) else: if initial in '([{': parenlev = parenlev + 1 elif initial in ')]}': parenlev = parenlev - 1 tokeneater(OP, token, spos, epos, line) else: tokeneater(ERRORTOKEN, line[pos], spos, (lnum, pos+1), line) pos = pos + 1 for indent in indents[1:]: # pop remaining indent levels tokeneater(DEDENT, '', (lnum, 0), (lnum, 0), '') | da67869f766cef01e3126399eb209553c39dc565 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/da67869f766cef01e3126399eb209553c39dc565/tokenize.py |
tokeneater(ERRORTOKEN, line[pos], spos, (lnum, pos+1), line) | tokeneater(ERRORTOKEN, line[pos], (lnum, pos), (lnum, pos+1), line) | def tokenize(readline, tokeneater=printtoken): lnum = parenlev = continued = 0 namechars, numchars = string.letters + '_', string.digits contstr = '' indents = [0] while 1: # loop over lines in stream line = readline() lnum = lnum + 1 pos, max = 0, len(line) if contstr: # continued string if not line: raise TokenError, "EOF within multi-line string" if endprog.search(line) >= 0: pos = end = endprog.regs[0][1] tokeneater(STRING, contstr + line[:end], strstart, (lnum, end), line) contstr = '' else: contstr = contstr + line continue elif parenlev == 0 and not continued: # new statement if not line: break column = 0 while pos < max: # measure leading whitespace if line[pos] == ' ': column = column + 1 elif line[pos] == '\t': column = (column/tabsize + 1)*tabsize elif line[pos] == '\f': column = 0 else: break pos = pos + 1 if pos == max: break if line[pos] in '#\r\n': # skip comments or blank lines tokeneater((NEWLINE, COMMENT)[line[pos] == '#'], line[pos:], (lnum, pos), (lnum, len(line)), line) continue if column > indents[-1]: # count indents or dedents indents.append(column) tokeneater(INDENT, line[:pos], (lnum, 0), (lnum, pos), line) while column < indents[-1]: indents = indents[:-1] tokeneater(DEDENT, line[:pos], (lnum, 0), (lnum, pos), line) else: # continued statement if not line: raise TokenError, "EOF within multi-line statement" continued = 0 while pos < max: if pseudoprog.match(line, pos) > 0: # scan for tokens start, end = pseudoprog.regs[1] spos, epos = (lnum, start), (lnum, end) token, initial = line[start:end], line[start] pos = end if initial in namechars: # ordinary name tokeneater(NAME, token, spos, epos, line) elif initial in numchars: # ordinary number tokeneater(NUMBER, token, spos, epos, line) elif initial in '\r\n': tokeneater(NEWLINE, token, spos, epos, line) elif initial == '#': tokeneater(COMMENT, token, spos, epos, line) elif initial == '\\': # continued stmt continued = 1 elif token in ('\'\'\'', '"""'): # triple-quoted endprog = endprogs[token] if endprog.search(line, pos) >= 0: # all on one line pos = endprog.regs[0][1] token = line[start:pos] tokeneater(STRING, token, spos, (lnum, pos), line) else: strstart = (lnum, start) # multiple lines contstr = line[start:] break elif initial in '\'"': if token[-1] == '\n': # continued string strstart = (lnum, start) endprog, contstr = endprogs[initial], line[start:] break else: # ordinary string tokeneater(STRING, token, spos, epos, line) else: if initial in '([{': parenlev = parenlev + 1 elif initial in ')]}': parenlev = parenlev - 1 tokeneater(OP, token, spos, epos, line) else: tokeneater(ERRORTOKEN, line[pos], spos, (lnum, pos+1), line) pos = pos + 1 for indent in indents[1:]: # pop remaining indent levels tokeneater(DEDENT, '', (lnum, 0), (lnum, 0), '') | da67869f766cef01e3126399eb209553c39dc565 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/da67869f766cef01e3126399eb209553c39dc565/tokenize.py |
tokenize(open(sys.argv[-1]).readline) | if len(sys.argv) > 1: tokenize(open(sys.argv[1]).readline) else: tokenize(syss.tdin.readline) | def tokenize(readline, tokeneater=printtoken): lnum = parenlev = continued = 0 namechars, numchars = string.letters + '_', string.digits contstr = '' indents = [0] while 1: # loop over lines in stream line = readline() lnum = lnum + 1 pos, max = 0, len(line) if contstr: # continued string if not line: raise TokenError, "EOF within multi-line string" if endprog.search(line) >= 0: pos = end = endprog.regs[0][1] tokeneater(STRING, contstr + line[:end], strstart, (lnum, end), line) contstr = '' else: contstr = contstr + line continue elif parenlev == 0 and not continued: # new statement if not line: break column = 0 while pos < max: # measure leading whitespace if line[pos] == ' ': column = column + 1 elif line[pos] == '\t': column = (column/tabsize + 1)*tabsize elif line[pos] == '\f': column = 0 else: break pos = pos + 1 if pos == max: break if line[pos] in '#\r\n': # skip comments or blank lines tokeneater((NEWLINE, COMMENT)[line[pos] == '#'], line[pos:], (lnum, pos), (lnum, len(line)), line) continue if column > indents[-1]: # count indents or dedents indents.append(column) tokeneater(INDENT, line[:pos], (lnum, 0), (lnum, pos), line) while column < indents[-1]: indents = indents[:-1] tokeneater(DEDENT, line[:pos], (lnum, 0), (lnum, pos), line) else: # continued statement if not line: raise TokenError, "EOF within multi-line statement" continued = 0 while pos < max: if pseudoprog.match(line, pos) > 0: # scan for tokens start, end = pseudoprog.regs[1] spos, epos = (lnum, start), (lnum, end) token, initial = line[start:end], line[start] pos = end if initial in namechars: # ordinary name tokeneater(NAME, token, spos, epos, line) elif initial in numchars: # ordinary number tokeneater(NUMBER, token, spos, epos, line) elif initial in '\r\n': tokeneater(NEWLINE, token, spos, epos, line) elif initial == '#': tokeneater(COMMENT, token, spos, epos, line) elif initial == '\\': # continued stmt continued = 1 elif token in ('\'\'\'', '"""'): # triple-quoted endprog = endprogs[token] if endprog.search(line, pos) >= 0: # all on one line pos = endprog.regs[0][1] token = line[start:pos] tokeneater(STRING, token, spos, (lnum, pos), line) else: strstart = (lnum, start) # multiple lines contstr = line[start:] break elif initial in '\'"': if token[-1] == '\n': # continued string strstart = (lnum, start) endprog, contstr = endprogs[initial], line[start:] break else: # ordinary string tokeneater(STRING, token, spos, epos, line) else: if initial in '([{': parenlev = parenlev + 1 elif initial in ')]}': parenlev = parenlev - 1 tokeneater(OP, token, spos, epos, line) else: tokeneater(ERRORTOKEN, line[pos], spos, (lnum, pos+1), line) pos = pos + 1 for indent in indents[1:]: # pop remaining indent levels tokeneater(DEDENT, '', (lnum, 0), (lnum, 0), '') | da67869f766cef01e3126399eb209553c39dc565 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/da67869f766cef01e3126399eb209553c39dc565/tokenize.py |
self.assert_(len(items) == 0, "iterator did not touch all items") | self.assert_(len(items) == 0, "iteritems() did not touch all items") | def check_iters(self, dict): # item iterator: items = dict.items() for item in dict.iteritems(): items.remove(item) self.assert_(len(items) == 0, "iterator did not touch all items") | 8cf786abca87acad839a551c587de4b96e7714bc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8cf786abca87acad839a551c587de4b96e7714bc/test_weakref.py |
self.assert_(len(keys) == 0, "iterator did not touch all keys") | self.assert_(len(keys) == 0, "__iter__() did not touch all keys") keys = dict.keys() for k in dict.iterkeys(): keys.remove(k) self.assert_(len(keys) == 0, "iterkeys() did not touch all keys") | def check_iters(self, dict): # item iterator: items = dict.items() for item in dict.iteritems(): items.remove(item) self.assert_(len(items) == 0, "iterator did not touch all items") | 8cf786abca87acad839a551c587de4b96e7714bc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8cf786abca87acad839a551c587de4b96e7714bc/test_weakref.py |
self.assert_(len(values) == 0, "iterator did not touch all values") | self.assert_(len(values) == 0, "itervalues() did not touch all values") | def check_iters(self, dict): # item iterator: items = dict.items() for item in dict.iteritems(): items.remove(item) self.assert_(len(items) == 0, "iterator did not touch all items") | 8cf786abca87acad839a551c587de4b96e7714bc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8cf786abca87acad839a551c587de4b96e7714bc/test_weakref.py |
srcfinfo = srcfss.GetFInfo() Res.FSpCreateResFile(dstfss, srcfinfo.Creator, srcfinfo.Type, -1) | if os.path.isdir(src): cr, tp = 'MACS', 'fdrp' else: cr, tp = srcfss.GetCreatorType() Res.FSpCreateResFile(dstfss, cr, tp, -1) | def mkalias(src, dst, relative=None): """Create a finder alias""" srcfss = macfs.FSSpec(src) dstfss = macfs.FSSpec(dst) if relative: relativefss = macfs.FSSpec(relative) # ik mag er geen None in stoppen :-( alias = srcfss.NewAlias(relativefss) else: alias = srcfss.NewAlias() srcfinfo = srcfss.GetFInfo() Res.FSpCreateResFile(dstfss, srcfinfo.Creator, srcfinfo.Type, -1) h = Res.FSpOpenResFile(dstfss, 3) resource = Res.Resource(alias.data) resource.AddResource('alis', 0, '') Res.CloseResFile(h) dstfinfo = dstfss.GetFInfo() dstfinfo.Flags = dstfinfo.Flags|0x8000 # Alias flag dstfss.SetFInfo(dstfinfo) | 8eef70803264e9213661f618d954bae5ce701df1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8eef70803264e9213661f618d954bae5ce701df1/macostools.py |
print_lines is the default callback.''' | print_line() is the default callback.''' | def retrlines(self, cmd, callback = None): '''Retrieve data in line mode. The argument is a RETR or LIST command. The callback function (2nd argument) is called for each line, with trailing CRLF stripped. This creates a new port for you. print_lines is the default callback.''' if not callback: callback = print_line resp = self.sendcmd('TYPE A') conn = self.transfercmd(cmd) fp = conn.makefile('rb') while 1: line = fp.readline() if self.debugging > 2: print '*retr*', `line` if not line: break if line[-2:] == CRLF: line = line[:-2] elif line[-1:] == '\n': line = line[:-1] callback(line) fp.close() conn.close() return self.voidresp() | e2d72904f4b8acda75d14b479372490dc6790fd4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e2d72904f4b8acda75d14b479372490dc6790fd4/ftplib.py |
except: | except (ValueError, OverflowError): | def mimify(infile, outfile): """Convert 8bit parts of a MIME mail message to quoted-printable.""" if type(infile) == type(''): ifile = open(infile) if type(outfile) == type('') and infile == outfile: import os d, f = os.path.split(infile) os.rename(infile, os.path.join(d, ',' + f)) else: ifile = infile if type(outfile) == type(''): ofile = open(outfile, 'w') else: ofile = outfile nifile = File(ifile, None) mimify_part(nifile, ofile, 0) ofile.flush() | 2b3850cc4c8612f3f2ea023f941fd2850019f39c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2b3850cc4c8612f3f2ea023f941fd2850019f39c/mimify.py |
name = alogger.name namelen = len(name) | def _fixupChildren(self, ph, alogger): """ Ensure that children of the placeholder ph are connected to the specified logger. """ #for c in ph.loggers: for c in ph.loggerMap.keys(): if string.find(c.parent.name, alogger.name) <> 0: alogger.parent = c.parent c.parent = alogger | f8f829c83d1d32b60f7987e4618eaa1ec6fb92f1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f8f829c83d1d32b60f7987e4618eaa1ec6fb92f1/__init__.py |
|
if string.find(c.parent.name, alogger.name) <> 0: | if c.parent.name[:namelen] != name: | def _fixupChildren(self, ph, alogger): """ Ensure that children of the placeholder ph are connected to the specified logger. """ #for c in ph.loggers: for c in ph.loggerMap.keys(): if string.find(c.parent.name, alogger.name) <> 0: alogger.parent = c.parent c.parent = alogger | f8f829c83d1d32b60f7987e4618eaa1ec6fb92f1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f8f829c83d1d32b60f7987e4618eaa1ec6fb92f1/__init__.py |
return self.version or "???" | return self.version or "0.0.0" | def get_version(self): return self.version or "???" | 3e647cd650224e45c789fa4c57c254eb880b5718 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3e647cd650224e45c789fa4c57c254eb880b5718/dist.py |
if "badsyntax" in basename: | if "badsyntax" in basename or "bad_coding" in basename: | def testCompileLibrary(self): # A simple but large test. Compile all the code in the # standard library and its test suite. This doesn't verify # that any of the code is correct, merely the compiler is able # to generate some kind of code for it. | 49f5078a5a35f51aa635873c081ecf63cfaa14da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/49f5078a5a35f51aa635873c081ecf63cfaa14da/test_compiler.py |
class ResFunction(ResMixIn, OSErrFunctionGenerator): pass class ResMethod(ResMixIn, OSErrMethodGenerator): pass | class ResFunction(ResMixIn, OSErrWeakLinkFunctionGenerator): pass class ResMethod(ResMixIn, OSErrWeakLinkMethodGenerator): pass | def checkit(self): if self.returntype.__class__ != OSErrType: OutLbrace() Output("OSErr _err = ResError();") Output("if (_err != noErr) return PyMac_Error(_err);") OutRbrace() FunctionGenerator.checkit(self) # XXX | b95621ead98e435d835aac9d1fe9da7ffa395c2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b95621ead98e435d835aac9d1fe9da7ffa395c2c/ressupport.py |
def test_wide(self): | def test_width(self): | def test_wide(self): self.assertEqual(u''.width(), 0) self.assertEqual(u'abcd'.width(), 4) self.assertEqual(u'\u0187\u01c9'.width(), 2) self.assertEqual(u'\u2460\u2329'.width(), 3) self.assertEqual(u'\u2329\u2460'.width(), 3) self.assertEqual(u'\ud55c\uae00'.width(), 4) self.assertEqual(u'\ud55c\u2606\uae00'.width(), 5) | 61a2426ed5954dced14485f52eb201f225883428 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/61a2426ed5954dced14485f52eb201f225883428/test_unicode.py |
if l[:2] == ' | if l[:2] == ' | def make(filename, outfile): ID = 1 STR = 2 # Compute .mo name from .po name and arguments if filename.endswith('.po'): infile = filename else: infile = filename + '.po' if outfile is None: outfile = os.path.splitext(infile)[0] + '.mo' try: lines = open(infile).readlines() except IOError, msg: print >> sys.stderr, msg sys.exit(1) section = None fuzzy = 0 # Parse the catalog lno = 0 for l in lines: lno += 1 # If we get a comment line after a msgstr, this is a new entry if l[0] == '#' and section == STR: add(msgid, msgstr, fuzzy) section = None fuzzy = 0 # Record a fuzzy mark if l[:2] == '#,' and l.find('fuzzy'): fuzzy = 1 # Skip comments if l[0] == '#': continue # Now we are in a msgid section, output previous section if l.startswith('msgid'): if section == STR: add(msgid, msgstr, fuzzy) section = ID l = l[5:] msgid = msgstr = '' # Now we are in a msgstr section elif l.startswith('msgstr'): section = STR l = l[6:] # Skip empty lines l = l.strip() if not l: continue # XXX: Does this always follow Python escape semantics? l = eval(l) if section == ID: msgid += l elif section == STR: msgstr += l else: print >> sys.stderr, 'Syntax error on %s:%d' % (infile, lno), \ 'before:' print >> sys.stderr, l sys.exit(1) # Add last entry if section == STR: add(msgid, msgstr, fuzzy) # Compute output output = generate() try: open(outfile,"wb").write(output) except IOError,msg: print >> sys.stderr, msg | 0f73b7ad799270a4e9478dc956a2749c4eec1d07 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0f73b7ad799270a4e9478dc956a2749c4eec1d07/msgfmt.py |
information. The application must not attempt to read from the array outside of the specified range.""" | information.""" | def ignorableWhitespace(self, whitespace): """Receive notification of ignorable whitespace in element content. | e73fb173683c400ff8a98f2539eb8a9f265ac3f3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e73fb173683c400ff8a98f2539eb8a9f265ac3f3/handler.py |
raise ValueError, "Mode " + mode + " not supported" | raise IOError, "Mode " + mode + " not supported" | def __init__(self, filename=None, mode=None, compresslevel=9, fileobj=None): if fileobj is None: fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') if filename is None: if hasattr(fileobj, 'name'): filename = fileobj.name else: filename = '' if mode is None: if hasattr(fileobj, 'mode'): mode = fileobj.mode else: mode = 'rb' | 62349f0de7061fe4c8f1c7a0a245d8c1a0b44e47 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/62349f0de7061fe4c8f1c7a0a245d8c1a0b44e47/gzip.py |
replacement = convert_entityref(name) | replacement = self.convert_entityref(name) | def handle_entityref(self, name): """Handle entity references, no need to override.""" replacement = convert_entityref(name) if replacement is None: self.unknown_entityref(name) else: self.handle_data(convert_entityref(name)) | d0e431320c21ee87fa02ce4c5937422d7f23207f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d0e431320c21ee87fa02ce4c5937422d7f23207f/sgmllib.py |
self.handle_data(convert_entityref(name)) | self.handle_data(self.convert_entityref(name)) | def handle_entityref(self, name): """Handle entity references, no need to override.""" replacement = convert_entityref(name) if replacement is None: self.unknown_entityref(name) else: self.handle_data(convert_entityref(name)) | d0e431320c21ee87fa02ce4c5937422d7f23207f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d0e431320c21ee87fa02ce4c5937422d7f23207f/sgmllib.py |
def getlongresp(self): | def getlongresp(self,fileHandle=None): | def getlongresp(self): """Internal: get a response plus following text from the server. Raise various errors if the response indicates an error.""" resp = self.getresp() if resp[:3] not in LONGRESP: raise NNTPReplyError(resp) list = [] while 1: line = self.getline() if line == '.': break if line[:2] == '..': line = line[1:] list.append(line) return resp, list | 44c4a31652010ba7410edfd742ab3fd8fdd4fa90 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/44c4a31652010ba7410edfd742ab3fd8fdd4fa90/nntplib.py |
resp = self.getresp() if resp[:3] not in LONGRESP: raise NNTPReplyError(resp) list = [] while 1: line = self.getline() if line == '.': break if line[:2] == '..': line = line[1:] list.append(line) | openedFile = None try: if isinstance(fileHandle, types.StringType): openedFile = fileHandle = open(fileHandle, "w") resp = self.getresp() if resp[:3] not in LONGRESP: raise NNTPReplyError(resp) list = [] while 1: line = self.getline() if line == '.': break if line[:2] == '..': line = line[1:] if fileHandle: fileHandle.write(line + "\n") else: list.append(line) finally: if openedFile: openedFile.close() | def getlongresp(self): """Internal: get a response plus following text from the server. Raise various errors if the response indicates an error.""" resp = self.getresp() if resp[:3] not in LONGRESP: raise NNTPReplyError(resp) list = [] while 1: line = self.getline() if line == '.': break if line[:2] == '..': line = line[1:] list.append(line) return resp, list | 44c4a31652010ba7410edfd742ab3fd8fdd4fa90 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/44c4a31652010ba7410edfd742ab3fd8fdd4fa90/nntplib.py |
def longcmd(self, line): | def longcmd(self, line, fileHandle=None): | def longcmd(self, line): """Internal: send a command and get the response plus following text.""" self.putcmd(line) return self.getlongresp() | 44c4a31652010ba7410edfd742ab3fd8fdd4fa90 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/44c4a31652010ba7410edfd742ab3fd8fdd4fa90/nntplib.py |
return self.getlongresp() | return self.getlongresp(fileHandle) | def longcmd(self, line): """Internal: send a command and get the response plus following text.""" self.putcmd(line) return self.getlongresp() | 44c4a31652010ba7410edfd742ab3fd8fdd4fa90 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/44c4a31652010ba7410edfd742ab3fd8fdd4fa90/nntplib.py |
def artcmd(self, line): | def artcmd(self, line, fileHandle=None): | def artcmd(self, line): """Internal: process a HEAD, BODY or ARTICLE command.""" resp, list = self.longcmd(line) resp, nr, id = self.statparse(resp) return resp, nr, id, list | 44c4a31652010ba7410edfd742ab3fd8fdd4fa90 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/44c4a31652010ba7410edfd742ab3fd8fdd4fa90/nntplib.py |
resp, list = self.longcmd(line) | resp, list = self.longcmd(line,fileHandle) | def artcmd(self, line): """Internal: process a HEAD, BODY or ARTICLE command.""" resp, list = self.longcmd(line) resp, nr, id = self.statparse(resp) return resp, nr, id, list | 44c4a31652010ba7410edfd742ab3fd8fdd4fa90 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/44c4a31652010ba7410edfd742ab3fd8fdd4fa90/nntplib.py |
def body(self, id): | def body(self, id, fileHandle=None): | def body(self, id): """Process a BODY command. Argument: - id: article number or message id Returns: - resp: server response if successful - nr: article number - id: message id - list: the lines of the article's body""" | 44c4a31652010ba7410edfd742ab3fd8fdd4fa90 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/44c4a31652010ba7410edfd742ab3fd8fdd4fa90/nntplib.py |
- list: the lines of the article's body""" return self.artcmd('BODY ' + id) | - list: the lines of the article's body or an empty list if fileHandle was used""" return self.artcmd('BODY ' + id, fileHandle) | def body(self, id): """Process a BODY command. Argument: - id: article number or message id Returns: - resp: server response if successful - nr: article number - id: message id - list: the lines of the article's body""" | 44c4a31652010ba7410edfd742ab3fd8fdd4fa90 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/44c4a31652010ba7410edfd742ab3fd8fdd4fa90/nntplib.py |
dotted_req_host = "."+req_host | req_host = "."+req_host | def domain_return_ok(self, domain, request): # Liberal check of. This is here as an optimization to avoid # having to load lots of MSIE cookie files unless necessary. req_host, erhn = eff_request_host(request) if not req_host.startswith("."): dotted_req_host = "."+req_host if not erhn.startswith("."): dotted_erhn = "."+erhn if not (dotted_req_host.endswith(domain) or dotted_erhn.endswith(domain)): #debug(" request domain %s does not match cookie domain %s", # req_host, domain) return False | d3f0456e3abc1706f864c3fb05e5399e43fdc4ad /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d3f0456e3abc1706f864c3fb05e5399e43fdc4ad/cookielib.py |
dotted_erhn = "."+erhn if not (dotted_req_host.endswith(domain) or dotted_erhn.endswith(domain)): | erhn = "."+erhn if not (req_host.endswith(domain) or erhn.endswith(domain)): | def domain_return_ok(self, domain, request): # Liberal check of. This is here as an optimization to avoid # having to load lots of MSIE cookie files unless necessary. req_host, erhn = eff_request_host(request) if not req_host.startswith("."): dotted_req_host = "."+req_host if not erhn.startswith("."): dotted_erhn = "."+erhn if not (dotted_req_host.endswith(domain) or dotted_erhn.endswith(domain)): #debug(" request domain %s does not match cookie domain %s", # req_host, domain) return False | d3f0456e3abc1706f864c3fb05e5399e43fdc4ad /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d3f0456e3abc1706f864c3fb05e5399e43fdc4ad/cookielib.py |
raise DistutilsClasserror, \ | raise DistutilsClassError, \ | def parse_command_line (self, args): """Parse the setup script's command line: set any Distribution attributes tied to command-line options, create all command objects, and set their options from the command-line. 'args' must be a list of command-line arguments, most likely 'sys.argv[1:]' (see the 'setup()' function). This list is first processed for "global options" -- options that set attributes of the Distribution instance. Then, it is alternately scanned for Distutils command and options for that command. Each new command terminates the options for the previous command. The allowed options for a command are determined by the 'options' attribute of the command object -- thus, we instantiate (and cache) every command object here, in order to access its 'options' attribute. Any error in that 'options' attribute raises DistutilsGetoptError; any error on the command-line raises DistutilsArgError. If no Distutils commands were found on the command line, raises DistutilsArgError. Return true if command-line successfully parsed and we should carry on with executing commands; false if no errors but we shouldn't execute commands (currently, this only happens if user asks for help).""" | 9653070d3f870605162afdab0f9ff4537ce87aa6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9653070d3f870605162afdab0f9ff4537ce87aa6/core.py |
print 'setcmapinfo:', stuff | def setcmapinfo(self): stuff = 0, 0, 0, 0, 0 if self.format in ('rgb8', 'grey'): stuff = 8, 0, 0, 0, 0 if self.format == 'grey4': stuff = 4, 0, 0, 0, 0 if self.format == 'grey2': stuff = 2, 0, 0, 0, 0 if self.format == 'mono': stuff = 1, 0, 0, 0, 0 print 'setcmapinfo:', stuff self.c0bits, self.c1bits, self.c2bits, \ self.offset, self.chrompack = stuff | 4ca12eb46118103ad461fc01d5aa7127056c852b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4ca12eb46118103ad461fc01d5aa7127056c852b/VFile.py |
|
self.send_error(501, "Unsupported method (%s)" % `mname`) | self.send_error(501, "Unsupported method (%s)" % `command`) | def handle(self): """Handle a single HTTP request. | dbf698c5612e53e6ecc83e6c8e22ecce1c3b1c9c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/dbf698c5612e53e6ecc83e6c8e22ecce1c3b1c9c/BaseHTTPServer.py |
def add_header(self, _name, _value, **_params): """Extended header setting. | afab162cfe6e637d6e2cdfda66a0de849b54195f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/afab162cfe6e637d6e2cdfda66a0de849b54195f/Message.py |
||
j = string.index(rawdata, '>', i) except string.index_error: return -1 attrs = [] tagfind = regex.compile('[a-zA-Z][a-zA-Z0-9]*') attrfind = regex.compile( '[ \t\n]+\([a-zA-Z_][a-zA-Z_0-9]*\)' + '\([ \t\n]*=[ \t\n]*' + '\(\'[^\']*\'\|"[^"]*"\|[-a-zA-Z0-9./:+*%?!()_ k = tagfind.match(rawdata, i+1) if k < 0: raise RuntimeError, 'unexpected call to parse_starttag' k = i+1+k tag = string.lower(rawdata[i+1:k]) while k < j: l = attrfind.match(rawdata, k) if l < 0: break attrname, rest, attrvalue = attrfind.group(1, 2, 3) if not rest: attrvalue = attrname elif attrvalue[:1] == '\'' == attrvalue[-1:] or \ attrvalue[:1] == '"' == attrvalue[-1:]: attrvalue = attrvalue[1:-1] attrs.append((string.lower(attrname), attrvalue)) k = k + l j = j+1 try: method = getattr(self, 'start_' + tag) | method = getattr(self, 'end_' + tag) | def parse_starttag(self, i): rawdata = self.rawdata try: j = string.index(rawdata, '>', i) except string.index_error: return -1 # Now parse the data between i+1 and j into a tag and attrs attrs = [] tagfind = regex.compile('[a-zA-Z][a-zA-Z0-9]*') attrfind = regex.compile( '[ \t\n]+\([a-zA-Z_][a-zA-Z_0-9]*\)' + '\([ \t\n]*=[ \t\n]*' + '\(\'[^\']*\'\|"[^"]*"\|[-a-zA-Z0-9./:+*%?!()_#]*\)\)?') k = tagfind.match(rawdata, i+1) if k < 0: raise RuntimeError, 'unexpected call to parse_starttag' k = i+1+k tag = string.lower(rawdata[i+1:k]) while k < j: l = attrfind.match(rawdata, k) if l < 0: break attrname, rest, attrvalue = attrfind.group(1, 2, 3) if not rest: attrvalue = attrname elif attrvalue[:1] == '\'' == attrvalue[-1:] or \ attrvalue[:1] == '"' == attrvalue[-1:]: attrvalue = attrvalue[1:-1] attrs.append((string.lower(attrname), attrvalue)) k = k + l j = j+1 try: method = getattr(self, 'start_' + tag) except AttributeError: try: method = getattr(self, 'do_' + tag) except AttributeError: self.unknown_starttag(tag, attrs) return j-i method(attrs) return j-i self.stack.append(tag) method(attrs) return j-i | 405f97f14e8d0830cb0c1f6bd902252c38367248 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/405f97f14e8d0830cb0c1f6bd902252c38367248/sgmllib.py |
try: method = getattr(self, 'do_' + tag) except AttributeError: self.unknown_starttag(tag, attrs) return j-i method(attrs) return j-i self.stack.append(tag) method(attrs) return j-i def parse_endtag(self, data): if data[:2] <> '</' or data[-1:] <> '>': raise RuntimeError, 'unexpected call to parse_endtag' tag = string.lower(string.strip(data[2:-1])) try: method = getattr(self, 'end_' + tag) except AttributeError: self.unknown_endtag(tag) return if self.stack and self.stack[-1] == tag: del self.stack[-1] else: self.report_unbalanced(tag) found = None for i in range(len(self.stack)): if self.stack[i] == tag: found = i if found <> None: del self.stack[found:] method() def report_unbalanced(self, tag): if self.verbose: print '*** Unbalanced </' + tag + '>' print '*** Stack:', self.stack def handle_charref(self, name): try: n = string.atoi(name) except string.atoi_error: self.unknown_charref(name) return if not 0 <= n <= 255: self.unknown_charref(name) return self.handle_data(chr(n)) entitydefs = \ {'lt': '<', 'gt': '>', 'amp': '&', 'quot': '"', 'apos': '\''} def handle_entityref(self, name): table = self.entitydefs if table.has_key(name): self.handle_data(table[name]) else: self.unknown_entityref(name) return def handle_data(self, data): pass def handle_comment(self, data): pass def unknown_starttag(self, tag, attrs): pass def unknown_endtag(self, tag): pass def unknown_charref(self, ref): pass def unknown_entityref(self, ref): pass class TestSGML(SGMLParser): def handle_data(self, data): r = repr(data) if len(r) > 72: r = r[:35] + '...' + r[-35:] print 'data:', r def handle_comment(self, data): r = repr(data) if len(r) > 68: r = r[:32] + '...' + r[-32:] print 'comment:', r def unknown_starttag(self, tag, attrs): print 'start tag: <' + tag, for name, value in attrs: print name + '=' + '"' + value + '"', print '>' def unknown_endtag(self, tag): print 'end tag: </' + tag + '>' def unknown_entityref(self, ref): print '*** unknown entity ref: &' + ref + ';' def unknown_charref(self, ref): print '*** unknown char ref: & def test(): | self.unknown_endtag(tag) return found = len(self.stack) for i in range(found): if self.stack[i] == tag: found = i while len(self.stack) > found: tag = self.stack[-1] try: method = getattr(self, 'end_' + tag) except AttributeError: method = None if method: self.handle_endtag(tag, method) else: self.unknown_endtag(tag) del self.stack[-1] def handle_starttag(self, tag, method, attrs): method(attrs) def handle_endtag(self, tag, method): method() def report_unbalanced(self, tag): if self.verbose: print '*** Unbalanced </' + tag + '>' print '*** Stack:', self.stack def handle_charref(self, name): try: n = string.atoi(name) except string.atoi_error: self.unknown_charref(name) return if not 0 <= n <= 255: self.unknown_charref(name) return self.handle_data(chr(n)) entitydefs = \ {'lt': '<', 'gt': '>', 'amp': '&', 'quot': '"', 'apos': '\''} def handle_entityref(self, name): table = self.entitydefs if table.has_key(name): self.handle_data(table[name]) else: self.unknown_entityref(name) return def handle_data(self, data): pass def handle_comment(self, data): pass def unknown_starttag(self, tag, attrs): pass def unknown_endtag(self, tag): pass def unknown_charref(self, ref): pass def unknown_entityref(self, ref): pass class TestSGMLParser(SGMLParser): def __init__(self, verbose=0): self.testdata = "" SGMLParser.__init__(self, verbose) def handle_data(self, data): self.testdata = self.testdata + data if len(`self.testdata`) >= 70: self.flush() def flush(self): data = self.testdata if data: self.testdata = "" print 'data:', `data` def handle_comment(self, data): self.flush() r = `data` if len(r) > 68: r = r[:32] + '...' + r[-32:] print 'comment:', r def unknown_starttag(self, tag, attrs): self.flush() if not attrs: print 'start tag: <' + tag + '>' else: print 'start tag: <' + tag, for name, value in attrs: print name + '=' + '"' + value + '"', print '>' def unknown_endtag(self, tag): self.flush() print 'end tag: </' + tag + '>' def unknown_entityref(self, ref): self.flush() print '*** unknown entity ref: &' + ref + ';' def unknown_charref(self, ref): self.flush() print '*** unknown char ref: & def close(self): SGMLParser.close(self) self.flush() def test(args = None): import sys if not args: args = sys.argv[1:] if args and args[0] == '-s': args = args[1:] klass = SGMLParser else: klass = TestSGMLParser if args: file = args[0] else: | def parse_starttag(self, i): rawdata = self.rawdata try: j = string.index(rawdata, '>', i) except string.index_error: return -1 # Now parse the data between i+1 and j into a tag and attrs attrs = [] tagfind = regex.compile('[a-zA-Z][a-zA-Z0-9]*') attrfind = regex.compile( '[ \t\n]+\([a-zA-Z_][a-zA-Z_0-9]*\)' + '\([ \t\n]*=[ \t\n]*' + '\(\'[^\']*\'\|"[^"]*"\|[-a-zA-Z0-9./:+*%?!()_#]*\)\)?') k = tagfind.match(rawdata, i+1) if k < 0: raise RuntimeError, 'unexpected call to parse_starttag' k = i+1+k tag = string.lower(rawdata[i+1:k]) while k < j: l = attrfind.match(rawdata, k) if l < 0: break attrname, rest, attrvalue = attrfind.group(1, 2, 3) if not rest: attrvalue = attrname elif attrvalue[:1] == '\'' == attrvalue[-1:] or \ attrvalue[:1] == '"' == attrvalue[-1:]: attrvalue = attrvalue[1:-1] attrs.append((string.lower(attrname), attrvalue)) k = k + l j = j+1 try: method = getattr(self, 'start_' + tag) except AttributeError: try: method = getattr(self, 'do_' + tag) except AttributeError: self.unknown_starttag(tag, attrs) return j-i method(attrs) return j-i self.stack.append(tag) method(attrs) return j-i | 405f97f14e8d0830cb0c1f6bd902252c38367248 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/405f97f14e8d0830cb0c1f6bd902252c38367248/sgmllib.py |
f = open(file, 'r') x = TestSGML() while 1: line = f.readline() if not line: x.close() break x.feed(line) | if file == '-': f = sys.stdin else: try: f = open(file, 'r') except IOError, msg: print file, ":", msg sys.exit(1) data = f.read() if f is not sys.stdin: f.close() x = klass() for c in data: x.feed(c) x.close() | def test(): file = 'test.html' f = open(file, 'r') x = TestSGML() while 1: line = f.readline() if not line: x.close() break x.feed(line) | 405f97f14e8d0830cb0c1f6bd902252c38367248 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/405f97f14e8d0830cb0c1f6bd902252c38367248/sgmllib.py |
test() | test() | def test(): file = 'test.html' f = open(file, 'r') x = TestSGML() while 1: line = f.readline() if not line: x.close() break x.feed(line) | 405f97f14e8d0830cb0c1f6bd902252c38367248 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/405f97f14e8d0830cb0c1f6bd902252c38367248/sgmllib.py |
def remove_option(section, option): | def remove_option(self, section, option): | def remove_option(section, option): """Remove an option.""" if not section or section == "DEFAULT": sectdict = self.__defaults else: try: sectdict = self.__sections[section] except KeyError: raise NoSectionError(section) existed = sectdict.has_key(key) if existed: del sectdict[key] return existed | 4d00c3e84c95acc135aa85c6f588fdbdee987a3c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4d00c3e84c95acc135aa85c6f588fdbdee987a3c/ConfigParser.py |
def remove_section(section): | def remove_section(self, section): | def remove_section(section): """Remove a file section.""" if self.__sections.has_key(section): del self.__sections[section] return 1 else: return 0 | 4d00c3e84c95acc135aa85c6f588fdbdee987a3c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4d00c3e84c95acc135aa85c6f588fdbdee987a3c/ConfigParser.py |
def __init__(self, text): | def __init__(self, text, fileclass=StringIO.StringIO): | def __init__(self, text): self.text = text | fed454b4fc4aaf7f877d2b702314f8e5a8fa7d13 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fed454b4fc4aaf7f877d2b702314f8e5a8fa7d13/test_httplib.py |
return StringIO.StringIO(self.text) | return self.fileclass(self.text) class NoEOFStringIO(StringIO.StringIO): """Like StringIO, but raises AssertionError on EOF. This is used below to test that httplib doesn't try to read more from the underlying file than it should. """ def read(self, n=-1): data = StringIO.StringIO.read(self, n) if data == '': raise AssertionError('caller tried to read past EOF') return data def readline(self, length=None): data = StringIO.StringIO.readline(self, length) if data == '': raise AssertionError('caller tried to read past EOF') return data | def makefile(self, mode, bufsize=None): if mode != 'r' and mode != 'rb': raise httplib.UnimplementedFileMode() return StringIO.StringIO(self.text) | fed454b4fc4aaf7f877d2b702314f8e5a8fa7d13 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fed454b4fc4aaf7f877d2b702314f8e5a8fa7d13/test_httplib.py |
import sys | def makefile(self, mode, bufsize=None): if mode != 'r' and mode != 'rb': raise httplib.UnimplementedFileMode() return StringIO.StringIO(self.text) | fed454b4fc4aaf7f877d2b702314f8e5a8fa7d13 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fed454b4fc4aaf7f877d2b702314f8e5a8fa7d13/test_httplib.py |
|
>>> msg = ''' | >>> msg = '''\\ | def sendmail(self, from_addr, to_addrs, msg, mail_options=[], rcpt_options=[]): """This command performs an entire mail transaction. | 296646968c09f6eca3eaf88f3df0455c016e8877 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/296646968c09f6eca3eaf88f3df0455c016e8877/smtplib.py |
want = int((have - 1) // self.indentwidth) * self.indentwidth | want = ((have - 1) // self.indentwidth) * self.indentwidth | def smart_backspace_event(self, event): text = self.text first, last = self.editwin.get_selection_indices() if first and last: text.delete(first, last) text.mark_set("insert", first) return "break" # Delete whitespace left, until hitting a real char or closest # preceding virtual tab stop. chars = text.get("insert linestart", "insert") if chars == '': if text.compare("insert", ">", "1.0"): # easy: delete preceding newline text.delete("insert-1c") else: text.bell() # at start of buffer return "break" if chars[-1] not in " \t": # easy: delete preceding real char text.delete("insert-1c") return "break" # Ick. It may require *inserting* spaces if we back up over a # tab character! This is written to be clear, not fast. expand, tabwidth = string.expandtabs, self.tabwidth have = len(expand(chars, tabwidth)) assert have > 0 want = int((have - 1) // self.indentwidth) * self.indentwidth ncharsdeleted = 0 while 1: chars = chars[:-1] ncharsdeleted = ncharsdeleted + 1 have = len(expand(chars, tabwidth)) if have <= want or chars[-1] not in " \t": break text.undo_block_start() text.delete("insert-%dc" % ncharsdeleted, "insert") if have < want: text.insert("insert", ' ' * (want - have)) text.undo_block_stop() return "break" | 2745774110347bdb6b4ea59522d0d615b7c29311 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2745774110347bdb6b4ea59522d0d615b7c29311/AutoIndent.py |
file = open(filename) | try: file = open(filename) except IOError: return None | def synopsis(filename, cache={}): """Get the one-line summary out of a module file.""" mtime = os.stat(filename).st_mtime lastupdate, result = cache.get(filename, (0, None)) if lastupdate < mtime: info = inspect.getmoduleinfo(filename) file = open(filename) if info and 'b' in info[2]: # binary modules have to be imported try: module = imp.load_module('__temp__', file, filename, info[1:]) except: return None result = split(module.__doc__ or '', '\n')[0] del sys.modules['__temp__'] else: # text modules can be directly examined line = file.readline() while line[:1] == '#' or not strip(line): line = file.readline() if not line: break line = strip(line) if line[:4] == 'r"""': line = line[1:] if line[:3] == '"""': line = line[3:] if line[-1:] == '\\': line = line[:-1] while not strip(line): line = file.readline() if not line: break result = strip(split(line, '"""')[0]) else: result = None file.close() cache[filename] = (mtime, result) return result | 3cdbbe3e8f2ff5bc293c51458f9eb11ffe046a12 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3cdbbe3e8f2ff5bc293c51458f9eb11ffe046a12/pydoc.py |
(fd, filename) = tempfile.mkstemp() file = os.fdopen(fd, 'w') | filename = tempfile.mktemp() file = open(filename, 'w') | def tempfilepager(text, cmd): """Page through text by invoking a program on a temporary file.""" import tempfile (fd, filename) = tempfile.mkstemp() file = os.fdopen(fd, 'w') file.write(text) file.close() try: os.system(cmd + ' ' + filename) finally: os.unlink(filename) | 0658cdeb1c79d1ad97cfbbef96e5612d4b0454de /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0658cdeb1c79d1ad97cfbbef96e5612d4b0454de/pydoc.py |
r.append(name, value) | r.append((name, value)) | def parse_qsl(qs, keep_blank_values=0, strict_parsing=0): """Parse a query given as a string argument. Arguments: qs: URL-encoded query string to be parsed keep_blank_values: flag indicating whether blank values in URL encoded queries should be treated as blank strings. A true value inicates that blanks should be retained as blank strings. The default false value indicates that blank values are to be ignored and treated as if they were not included. strict_parsing: flag indicating what to do with parsing errors. If false (the default), errors are silently ignored. If true, errors raise a ValueError exception. Returns a list, as God intended. """ name_value_pairs = string.splitfields(qs, '&') r=[] for name_value in name_value_pairs: nv = string.splitfields(name_value, '=') if len(nv) != 2: if strict_parsing: raise ValueError, "bad query field: %s" % `name_value` continue name = urllib.unquote(string.replace(nv[0], '+', ' ')) value = urllib.unquote(string.replace(nv[1], '+', ' ')) r.append(name, value) return r | 7ecc1292794c552973f85da5ed49085e5d9c70ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7ecc1292794c552973f85da5ed49085e5d9c70ea/cgi.py |
if code in self.BUGGY_RANGE_CHECK: | if not PY_STRUCT_RANGE_CHECKING and code in self.BUGGY_RANGE_CHECK: | def test_one(self, x, pack=struct.pack, unpack=struct.unpack, unhexlify=binascii.unhexlify): if verbose: print "trying std", self.formatpair, "on", x, "==", hex(x) | a56d0e01b2ecf3584f45cd2cf9734a6deb61fecd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a56d0e01b2ecf3584f45cd2cf9734a6deb61fecd/test_struct.py |
def __init__(self, screenName=None, baseName=None, className='Tk'): | def __init__(self, screenName=None, baseName=None, className='Tix'): | def __init__(self, screenName=None, baseName=None, className='Tk'): Tkinter.Tk.__init__(self, screenName, baseName, className) tixlib = os.environ.get('TIX_LIBRARY') if tixlib is not None: self.tk.eval('global auto_path; lappend auto_path {%s}' % tixlib) self.tk.eval('global tcl_pkgPath; lappend tcl_pkgPath {%s}' % tixlib) # Load Tix - this should work dynamically or statically # If it's static, lib/tix8.1/pkgIndex.tcl should have 'load {} Tix' # If it's dynamic, it should have 'load libtix8.1.8.2.so Tix' self.tk.eval('package require Tix') | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
def __init__(self, screenName=None, baseName=None, className='Tk'): Tkinter.Tk.__init__(self, screenName, baseName, className) tixlib = os.environ.get('TIX_LIBRARY') if tixlib is not None: self.tk.eval('global auto_path; lappend auto_path {%s}' % tixlib) self.tk.eval('global tcl_pkgPath; lappend tcl_pkgPath {%s}' % tixlib) # Load Tix - this should work dynamically or statically # If it's static, lib/tix8.1/pkgIndex.tcl should have 'load {} Tix' # If it's dynamic, it should have 'load libtix8.1.8.2.so Tix' self.tk.eval('package require Tix') | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
||
class TixWidget(Widget): | class TixWidget(Tkinter.Widget): | def slaves(self): return map(self._nametowidget, self.tk.splitlist( self.tk.call( 'tixForm', 'slaves', self._w))) | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
1) It is possible to give a list of options which must be part of | 1) It is possible to give a list of options which must be part of | def slaves(self): return map(self._nametowidget, self.tk.splitlist( self.tk.call( 'tixForm', 'slaves', self._w))) | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
def __getattr__(self, name): if self.subwidget_list.has_key(name): return self.subwidget_list[name] raise AttributeError, name | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
||
def set_silent(self, value): self.tk.call('tixSetSilent', self._w, value) | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
||
def subwidget(self, name): n = self._subwidget_name(name) if not n: raise TclError, "Subwidget " + name + " not child of " + self._name # Remove header of name and leading dot n = n[len(self._w)+1:] return self._nametowidget(n) | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
||
def subwidgets_all(self): names = self._subwidget_names() if not names: return [] retlist = [] for name in names: name = name[len(self._w)+1:] try: retlist.append(self._nametowidget(name)) except: # some of the widgets are unknown e.g. border in LabelFrame pass return retlist | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
||
def _subwidget_name(self,name): try: return self.tk.call(self._w, 'subwidget', name) except TclError: return None | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
||
def _subwidget_names(self): try: x = self.tk.call(self._w, 'subwidgets', '-all') return self.tk.split(x) except TclError: return None | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
||
"""ButtonBox - A container for pushbuttons""" | """ButtonBox - A container for pushbuttons. Subwidgets are the buttons added with the add method. """ | def unbind_widget(self, widget): self.tk.call(self._w, 'unbind', widget._w) | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
"""ComboBox - an Entry field with a dropdown menu | """ComboBox - an Entry field with a dropdown menu. The user can select a choice by either typing in the entry subwdget or selecting from the listbox subwidget. | def invoke(self, name): if self.subwidget_list.has_key(name): self.tk.call(self._w, 'invoke', name) | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
slistbox ScrolledListBox tick Button } cross Button } present if created with the fancy option""" | slistbox ScrolledListBox tick Button cross Button : present if created with the fancy option""" | def invoke(self, name): if self.subwidget_list.has_key(name): self.tk.call(self._w, 'invoke', name) | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
"""Control - An entry field with value change arrows. | """Control - An entry field with value change arrows. The user can adjust the value by pressing the two arrow buttons or by entering the value directly into the entry. The new value will be checked against the user-defined upper and lower limits. | def pick(self, index): self.tk.call(self._w, 'pick', index) | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
"""DirList - Directory Listing. | """DirList - displays a list view of a directory, its previous directories and its sub-directories. The user can choose one of the directories displayed in the list or change to another directory. | def update(self): self.tk.call(self._w, 'update') | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
"""DirList - Directory Listing in a hierarchical view. | """DirTree - Directory Listing in a hierarchical view. Displays a tree view of a directory, its previous directories and its sub-directories. The user can choose one of the directories displayed in the list or change to another directory. | def chdir(self, dir): self.tk.call(self._w, 'chdir', dir) | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
It is generally used for the user to choose a file. FileSelectBox stores the files mostly recently selected into a ComboBox widget so that they can be quickly selected again. | def popdown(self): self.tk.call(self._w, 'popdown') | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
|
"""FileEntry - Entry field with button that invokes a FileSelectDialog | """FileEntry - Entry field with button that invokes a FileSelectDialog. The user can type in the filename manually. Alternatively, the user can press the button widget that sits next to the entry, which will bring up a file selection dialog. | def popdown(self): self.tk.call(self._w, 'popdown') | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
"""HList - Hierarchy display. | """HList - Hierarchy display widget can be used to display any data that have a hierarchical structure, for example, file system directory trees. The list entries are indented and connected by branch lines according to their places in the hierachy. | def file_dialog(self): # XXX return python object pass | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
"""LabelEntry - Entry field with label. | """LabelEntry - Entry field with label. Packages an entry widget and a label into one mega widget. It can beused be used to simplify the creation of ``entry-form'' type of interface. | def __init__ (self,master=None,cnf={}, **kw): TixWidget.__init__(self, master, 'tixInputOnly', None, cnf, kw) | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
"""LabelFrame - Labelled Frame container. | """LabelFrame - Labelled Frame container. Packages a frame widget and a label into one mega widget. To create widgets inside a LabelFrame widget, one creates the new widgets relative to the frame subwidget and manage them inside the frame subwidget. | def __init__ (self,master=None,cnf={}, **kw): TixWidget.__init__(self, master, 'tixLabelEntry', ['labelside','options'], cnf, kw) self.subwidget_list['label'] = _dummyLabel(self, 'label') self.subwidget_list['entry'] = _dummyEntry(self, 'entry') | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
<pages> g/p widgets added dynamically""" | <pages> page widgets added dynamically with the add method""" | def __init__ (self,master=None,cnf={}, **kw): TixWidget.__init__(self, master, 'tixLabelFrame', ['labelside','options'], cnf, kw) self.subwidget_list['label'] = _dummyLabel(self, 'label') self.subwidget_list['frame'] = _dummyFrame(self, 'frame') | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
"""OptionMenu - Option menu widget. | """OptionMenu - creates a menu button of options. | def raised(self): return self.tk.call(self._w, 'raised') | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
"""PanedWindow - Multi-pane container widget. Panes are resizable. | """PanedWindow - Multi-pane container widget allows the user to interactively manipulate the sizes of several panes. The panes can be arranged either vertically or horizontally.The user changes the sizes of the panes by dragging the resize handle between two panes. | def enable(self, name): self.tk.call(self._w, 'enable', name) | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
<panes> g/p widgets added dynamically""" | <panes> g/p widgets added dynamically with the add method.""" | def enable(self, name): self.tk.call(self._w, 'enable', name) | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
"""PopupMenu widget. | """PopupMenu widget can be used as a replacement of the tk_popup command. The advantage of the Tix PopupMenu widget is it requires less application code to manipulate. | def panes(self): names = self.tk.call(self._w, 'panes') ret = [] for x in names: ret.append(self.subwidget(x)) return ret | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
"""Incomplete - no documentation in Tix for this !!!""" | """Internal widget to draw resize handles on Scrolled widgets.""" | def post_widget(self, widget, x, y): self.tk.call(self._w, 'post', widget._w, x, y) | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
"""ScrolledHList - HList with scrollbars.""" | """ScrolledHList - HList with automatic scrollbars.""" | def attach_widget(self, widget): self.tk.call(self._w, 'attachwidget', widget._w) | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
"""ScrolledListBox - Listbox with scrollbars.""" | """ScrolledListBox - Listbox with automatic scrollbars.""" | def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixScrolledHList', ['options'], cnf, kw) self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
"""ScrolledText - Text with scrollbars.""" | """ScrolledText - Text with automatic scrollbars.""" | def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixScrolledListBox', ['options'], cnf, kw) self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox') self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
"""ScrolledTList - TList with scrollbars.""" | """ScrolledTList - TList with automatic scrollbars.""" | def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixScrolledText', ['options'], cnf, kw) self.subwidget_list['text'] = _dummyText(self, 'text') self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
"""ScrolledWindow - Window with scrollbars.""" | """ScrolledWindow - Window with automatic scrollbars.""" | def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixScrolledTList', ['options'], cnf, kw) self.subwidget_list['tlist'] = _dummyTList(self, 'tlist') self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
"""Select - Container for buttons. Can enforce radio buttons etc. Subwidgets are buttons added dynamically""" | """Select - Container of button subwidgets. It can be used to provide radio-box or check-box style of selection options for the user. Subwidgets are buttons added dynamically using the add method.""" | def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixScrolledWindow', ['options'], cnf, kw) self.subwidget_list['window'] = _dummyFrame(self, 'window') self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
"""TList - Hierarchy display. | """TList - Hierarchy display widget which can be used to display data in a tabular format. The list entries of a TList widget are similar to the entries in the Tk listbox widget. The main differences are (1) the TList widget can display the list entries in a two dimensional format and (2) you can use graphical images as well as multiple colors and fonts for the list entries. | def invoke(self, name): if self.subwidget_list.has_key(name): self.tk.call(self._w, 'invoke', name) | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
"""Tree - The tixTree widget (general purpose DirList like widget)""" | """Tree - The tixTree widget can be used to display hierachical data in a tree form. The user can adjust the view of the tree by opening or closing parts of the tree.""" | def yview(self, *args): apply(self.tk.call, (self._w, 'yview') + args) | 01c920b9b56baabd2e1dd945affd1c17c1669b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c920b9b56baabd2e1dd945affd1c17c1669b20/Tix.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.