rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
eq(int(time.mktime(timetup[:9])), 1044470846)
t = int(time.mktime(timetup[:9])) eq(time.localtime(t)[:6], timetup[:6])
def test_parsedate_acceptable_to_time_functions(self): eq = self.assertEqual timetup = Utils.parsedate('5 Feb 2003 13:47:26 -0800') eq(int(time.mktime(timetup)), 1044470846) eq(int(time.strftime('%Y', timetup)), 2003) timetup = Utils.parsedate_tz('5 Feb 2003 13:47:26 -0800') eq(int(time.mktime(timetup[:9])), 1044470846) eq(int(time.strftime('%Y', timetup[:9])), 2003)
08562c411899c7a6afd61f96417afe027bfc1dbb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/08562c411899c7a6afd61f96417afe027bfc1dbb/test_email.py
func, targs, kargs = _exithandlers[-1]
func, targs, kargs = _exithandlers.pop()
def _run_exitfuncs(): """run any registered exit functions _exithandlers is traversed in reverse order so functions are executed last in, first out. """ while _exithandlers: func, targs, kargs = _exithandlers[-1] apply(func, targs, kargs) _exithandlers.remove(_exithandlers[-1])
8fc77ecde389e20fd025d5003983a980621388d4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8fc77ecde389e20fd025d5003983a980621388d4/atexit.py
_exithandlers.remove(_exithandlers[-1])
def _run_exitfuncs(): """run any registered exit functions _exithandlers is traversed in reverse order so functions are executed last in, first out. """ while _exithandlers: func, targs, kargs = _exithandlers[-1] apply(func, targs, kargs) _exithandlers.remove(_exithandlers[-1])
8fc77ecde389e20fd025d5003983a980621388d4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8fc77ecde389e20fd025d5003983a980621388d4/atexit.py
ofp.write("-%s\n" % encode(text))
ofp.write("- %s \n" % encode(text))
def subconvert(line, ofp, table, discards, autoclosing, knownempty, endchar=None): stack = [] while line: if line[0] == endchar and not stack: return line[1:] m = _comment_rx.match(line) if m: text = m.group(1) if text: ofp.write("(COMMENT\n") ofp.write("-%s\n" % encode(text)) ofp.write(")COMMENT\n") ofp.write("-\\n\n") else: ofp.write("-\\n\n") line = line[m.end():] continue m = _begin_env_rx.match(line) if m: # re-write to use the macro handler line = r"\%s%s" % (m.group(1), line[m.end():]) continue m =_end_env_rx.match(line) if m: # end of environment envname = m.group(1) if envname == "document": # special magic for n in stack[1:]: if n not in autoclosing: raise LaTeXFormatError("open element on stack: " + `n`) # should be more careful, but this is easier to code: stack = [] ofp.write(")document\n") elif envname == stack[-1]: ofp.write(")%s\n" % envname) del stack[-1] else:
177c5005c27b072f67098dea66be9f3528dd0fe8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/177c5005c27b072f67098dea66be9f3528dd0fe8/latex2esis.py
line = r"\%s%s" % (m.group(1), line[m.end():])
line = r"\%s %s" % (m.group(1), line[m.end():])
def subconvert(line, ofp, table, discards, autoclosing, knownempty, endchar=None): stack = [] while line: if line[0] == endchar and not stack: return line[1:] m = _comment_rx.match(line) if m: text = m.group(1) if text: ofp.write("(COMMENT\n") ofp.write("-%s\n" % encode(text)) ofp.write(")COMMENT\n") ofp.write("-\\n\n") else: ofp.write("-\\n\n") line = line[m.end():] continue m = _begin_env_rx.match(line) if m: # re-write to use the macro handler line = r"\%s%s" % (m.group(1), line[m.end():]) continue m =_end_env_rx.match(line) if m: # end of environment envname = m.group(1) if envname == "document": # special magic for n in stack[1:]: if n not in autoclosing: raise LaTeXFormatError("open element on stack: " + `n`) # should be more careful, but this is easier to code: stack = [] ofp.write(")document\n") elif envname == stack[-1]: ofp.write(")%s\n" % envname) del stack[-1] else:
177c5005c27b072f67098dea66be9f3528dd0fe8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/177c5005c27b072f67098dea66be9f3528dd0fe8/latex2esis.py
def subconvert(line, ofp, table, discards, autoclosing, knownempty, endchar=None): stack = [] while line: if line[0] == endchar and not stack: return line[1:] m = _comment_rx.match(line) if m: text = m.group(1) if text: ofp.write("(COMMENT\n") ofp.write("-%s\n" % encode(text)) ofp.write(")COMMENT\n") ofp.write("-\\n\n") else: ofp.write("-\\n\n") line = line[m.end():] continue m = _begin_env_rx.match(line) if m: # re-write to use the macro handler line = r"\%s%s" % (m.group(1), line[m.end():]) continue m =_end_env_rx.match(line) if m: # end of environment envname = m.group(1) if envname == "document": # special magic for n in stack[1:]: if n not in autoclosing: raise LaTeXFormatError("open element on stack: " + `n`) # should be more careful, but this is easier to code: stack = [] ofp.write(")document\n") elif envname == stack[-1]: ofp.write(")%s\n" % envname) del stack[-1] else:
177c5005c27b072f67098dea66be9f3528dd0fe8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/177c5005c27b072f67098dea66be9f3528dd0fe8/latex2esis.py
real_ofp = ofp
def subconvert(line, ofp, table, discards, autoclosing, knownempty, endchar=None): stack = [] while line: if line[0] == endchar and not stack: return line[1:] m = _comment_rx.match(line) if m: text = m.group(1) if text: ofp.write("(COMMENT\n") ofp.write("-%s\n" % encode(text)) ofp.write(")COMMENT\n") ofp.write("-\\n\n") else: ofp.write("-\\n\n") line = line[m.end():] continue m = _begin_env_rx.match(line) if m: # re-write to use the macro handler line = r"\%s%s" % (m.group(1), line[m.end():]) continue m =_end_env_rx.match(line) if m: # end of environment envname = m.group(1) if envname == "document": # special magic for n in stack[1:]: if n not in autoclosing: raise LaTeXFormatError("open element on stack: " + `n`) # should be more careful, but this is easier to code: stack = [] ofp.write(")document\n") elif envname == stack[-1]: ofp.write(")%s\n" % envname) del stack[-1] else:
177c5005c27b072f67098dea66be9f3528dd0fe8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/177c5005c27b072f67098dea66be9f3528dd0fe8/latex2esis.py
if type(conversion) is type(""): line = "&%s;%s" % (conversion, line[m.end(1):]) continue
def subconvert(line, ofp, table, discards, autoclosing, knownempty, endchar=None): stack = [] while line: if line[0] == endchar and not stack: return line[1:] m = _comment_rx.match(line) if m: text = m.group(1) if text: ofp.write("(COMMENT\n") ofp.write("-%s\n" % encode(text)) ofp.write(")COMMENT\n") ofp.write("-\\n\n") else: ofp.write("-\\n\n") line = line[m.end():] continue m = _begin_env_rx.match(line) if m: # re-write to use the macro handler line = r"\%s%s" % (m.group(1), line[m.end():]) continue m =_end_env_rx.match(line) if m: # end of environment envname = m.group(1) if envname == "document": # special magic for n in stack[1:]: if n not in autoclosing: raise LaTeXFormatError("open element on stack: " + `n`) # should be more careful, but this is easier to code: stack = [] ofp.write(")document\n") elif envname == stack[-1]: ofp.write(")%s\n" % envname) del stack[-1] else:
177c5005c27b072f67098dea66be9f3528dd0fe8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/177c5005c27b072f67098dea66be9f3528dd0fe8/latex2esis.py
line = line[m.end() - 1:]
line = line[m.end(1):] elif empty: line = line[m.end(1):]
def subconvert(line, ofp, table, discards, autoclosing, knownempty, endchar=None): stack = [] while line: if line[0] == endchar and not stack: return line[1:] m = _comment_rx.match(line) if m: text = m.group(1) if text: ofp.write("(COMMENT\n") ofp.write("-%s\n" % encode(text)) ofp.write(")COMMENT\n") ofp.write("-\\n\n") else: ofp.write("-\\n\n") line = line[m.end():] continue m = _begin_env_rx.match(line) if m: # re-write to use the macro handler line = r"\%s%s" % (m.group(1), line[m.end():]) continue m =_end_env_rx.match(line) if m: # end of environment envname = m.group(1) if envname == "document": # special magic for n in stack[1:]: if n not in autoclosing: raise LaTeXFormatError("open element on stack: " + `n`) # should be more careful, but this is easier to code: stack = [] ofp.write(")document\n") elif envname == stack[-1]: ofp.write(")%s\n" % envname) del stack[-1] else:
177c5005c27b072f67098dea66be9f3528dd0fe8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/177c5005c27b072f67098dea66be9f3528dd0fe8/latex2esis.py
if type(conversion) is not type(""): ofp.write("(%s\n" % macroname)
ofp.write("(%s\n" % macroname)
def subconvert(line, ofp, table, discards, autoclosing, knownempty, endchar=None): stack = [] while line: if line[0] == endchar and not stack: return line[1:] m = _comment_rx.match(line) if m: text = m.group(1) if text: ofp.write("(COMMENT\n") ofp.write("-%s\n" % encode(text)) ofp.write(")COMMENT\n") ofp.write("-\\n\n") else: ofp.write("-\\n\n") line = line[m.end():] continue m = _begin_env_rx.match(line) if m: # re-write to use the macro handler line = r"\%s%s" % (m.group(1), line[m.end():]) continue m =_end_env_rx.match(line) if m: # end of environment envname = m.group(1) if envname == "document": # special magic for n in stack[1:]: if n not in autoclosing: raise LaTeXFormatError("open element on stack: " + `n`) # should be more careful, but this is easier to code: stack = [] ofp.write(")document\n") elif envname == stack[-1]: ofp.write(")%s\n" % envname) del stack[-1] else:
177c5005c27b072f67098dea66be9f3528dd0fe8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/177c5005c27b072f67098dea66be9f3528dd0fe8/latex2esis.py
def subconvert(line, ofp, table, discards, autoclosing, knownempty, endchar=None): stack = [] while line: if line[0] == endchar and not stack: return line[1:] m = _comment_rx.match(line) if m: text = m.group(1) if text: ofp.write("(COMMENT\n") ofp.write("-%s\n" % encode(text)) ofp.write(")COMMENT\n") ofp.write("-\\n\n") else: ofp.write("-\\n\n") line = line[m.end():] continue m = _begin_env_rx.match(line) if m: # re-write to use the macro handler line = r"\%s%s" % (m.group(1), line[m.end():]) continue m =_end_env_rx.match(line) if m: # end of environment envname = m.group(1) if envname == "document": # special magic for n in stack[1:]: if n not in autoclosing: raise LaTeXFormatError("open element on stack: " + `n`) # should be more careful, but this is easier to code: stack = [] ofp.write(")document\n") elif envname == stack[-1]: ofp.write(")%s\n" % envname) del stack[-1] else:
177c5005c27b072f67098dea66be9f3528dd0fe8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/177c5005c27b072f67098dea66be9f3528dd0fe8/latex2esis.py
return subconvert(ifp.read(), ofp, table, discards, autoclosing, d.has_key)
try: subconvert(ifp.read(), ofp, table, discards, autoclosing, d.has_key) except IOError, (err, msg): if err != errno.EPIPE: raise
def convert(ifp, ofp, table={}, discards=(), autoclosing=(), knownempties=()): d = {} for gi in knownempties: d[gi] = gi return subconvert(ifp.read(), ofp, table, discards, autoclosing, d.has_key)
177c5005c27b072f67098dea66be9f3528dd0fe8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/177c5005c27b072f67098dea66be9f3528dd0fe8/latex2esis.py
"ABC": "ABC", "ASCII": "ASCII", "C": "C", "Cpp": "Cpp", "EOF": "EOF", "e": "backslash", "ldots": "ldots", "NULL": "NULL", "POSIX": "POSIX", "UNIX": "Unix",
"ABC": ([], 0, 1), "ASCII": ([], 0, 1), "C": ([], 0, 1), "Cpp": ([], 0, 1), "EOF": ([], 0, 1), "e": ([], 0, 1), "ldots": ([], 0, 1), "NULL": ([], 0, 1), "POSIX": ([], 0, 1), "UNIX": ([], 0, 1),
def main(): if len(sys.argv) == 2: ifp = open(sys.argv[1]) ofp = sys.stdout elif len(sys.argv) == 3: ifp = open(sys.argv[1]) ofp = open(sys.argv[2], "w") else: usage() sys.exit(2) convert(ifp, ofp, { # entries are name # -> ([list of attribute names], first_is_optional, empty) "cfuncdesc": (["type", "name", ("args",)], 0, 0), "chapter": ([("title",)], 0, 0), "chapter*": ([("title",)], 0, 0), "classdesc": (["name", ("constructor-args",)], 0, 0), "ctypedesc": (["name"], 0, 0), "cvardesc": (["type", "name"], 0, 0), "datadesc": (["name"], 0, 0), "declaremodule": (["id", "type", "name"], 1, 1), "deprecated": (["release"], 0, 1), "documentclass": (["classname"], 0, 1), "excdesc": (["name"], 0, 0), "funcdesc": (["name", ("args",)], 0, 0), "funcdescni": (["name", ("args",)], 0, 0), "indexii": (["ie1", "ie2"], 0, 1), "indexiii": (["ie1", "ie2", "ie3"], 0, 1), "indexiv": (["ie1", "ie2", "ie3", "ie4"], 0, 1), "input": (["source"], 0, 1), "item": ([("leader",)], 1, 0), "label": (["id"], 0, 1), "manpage": (["name", "section"], 0, 1), "memberdesc": (["class", "name"], 1, 0), "methoddesc": (["class", "name", ("args",)], 1, 0), "methoddescni": (["class", "name", ("args",)], 1, 0), "opcodedesc": (["name", "var"], 0, 0), "par": ([], 0, 1), "rfc": (["number"], 0, 1), "section": ([("title",)], 0, 0), "seemodule": (["ref", "name"], 1, 0), "tableii": (["colspec", "style", "head1", "head2"], 0, 0), "tableiii": (["colspec", "style", "head1", "head2", "head3"], 0, 0), "tableiv": (["colspec", "style", "head1", "head2", "head3", "head4"], 0, 0), "versionadded": (["version"], 0, 1), "versionchanged": (["version"], 0, 1), # "ABC": "ABC", "ASCII": "ASCII", "C": "C", "Cpp": "Cpp", "EOF": "EOF", "e": "backslash", "ldots": "ldots", "NULL": "NULL", "POSIX": "POSIX", "UNIX": "Unix", # # Things that will actually be going away! # "fi": ([], 0, 1), "ifhtml": ([], 0, 1), "makeindex": ([], 0, 1), "makemodindex": ([], 0, 1), "maketitle": ([], 0, 1), "noindent": ([], 0, 1), "tableofcontents": ([], 0, 1), }, discards=["fi", "ifhtml", "makeindex", "makemodindex", "maketitle", "noindent", "tableofcontents"], autoclosing=["chapter", "section", "subsection", "subsubsection", "paragraph", "subparagraph", ], knownempties=["rfc", "declaremodule", "appendix", "maketitle", "makeindex", "makemodindex", "localmoduletable", "manpage", "input"])
177c5005c27b072f67098dea66be9f3528dd0fe8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/177c5005c27b072f67098dea66be9f3528dd0fe8/latex2esis.py
knownempties=["rfc", "declaremodule", "appendix",
knownempties=["appendix",
def main(): if len(sys.argv) == 2: ifp = open(sys.argv[1]) ofp = sys.stdout elif len(sys.argv) == 3: ifp = open(sys.argv[1]) ofp = open(sys.argv[2], "w") else: usage() sys.exit(2) convert(ifp, ofp, { # entries are name # -> ([list of attribute names], first_is_optional, empty) "cfuncdesc": (["type", "name", ("args",)], 0, 0), "chapter": ([("title",)], 0, 0), "chapter*": ([("title",)], 0, 0), "classdesc": (["name", ("constructor-args",)], 0, 0), "ctypedesc": (["name"], 0, 0), "cvardesc": (["type", "name"], 0, 0), "datadesc": (["name"], 0, 0), "declaremodule": (["id", "type", "name"], 1, 1), "deprecated": (["release"], 0, 1), "documentclass": (["classname"], 0, 1), "excdesc": (["name"], 0, 0), "funcdesc": (["name", ("args",)], 0, 0), "funcdescni": (["name", ("args",)], 0, 0), "indexii": (["ie1", "ie2"], 0, 1), "indexiii": (["ie1", "ie2", "ie3"], 0, 1), "indexiv": (["ie1", "ie2", "ie3", "ie4"], 0, 1), "input": (["source"], 0, 1), "item": ([("leader",)], 1, 0), "label": (["id"], 0, 1), "manpage": (["name", "section"], 0, 1), "memberdesc": (["class", "name"], 1, 0), "methoddesc": (["class", "name", ("args",)], 1, 0), "methoddescni": (["class", "name", ("args",)], 1, 0), "opcodedesc": (["name", "var"], 0, 0), "par": ([], 0, 1), "rfc": (["number"], 0, 1), "section": ([("title",)], 0, 0), "seemodule": (["ref", "name"], 1, 0), "tableii": (["colspec", "style", "head1", "head2"], 0, 0), "tableiii": (["colspec", "style", "head1", "head2", "head3"], 0, 0), "tableiv": (["colspec", "style", "head1", "head2", "head3", "head4"], 0, 0), "versionadded": (["version"], 0, 1), "versionchanged": (["version"], 0, 1), # "ABC": "ABC", "ASCII": "ASCII", "C": "C", "Cpp": "Cpp", "EOF": "EOF", "e": "backslash", "ldots": "ldots", "NULL": "NULL", "POSIX": "POSIX", "UNIX": "Unix", # # Things that will actually be going away! # "fi": ([], 0, 1), "ifhtml": ([], 0, 1), "makeindex": ([], 0, 1), "makemodindex": ([], 0, 1), "maketitle": ([], 0, 1), "noindent": ([], 0, 1), "tableofcontents": ([], 0, 1), }, discards=["fi", "ifhtml", "makeindex", "makemodindex", "maketitle", "noindent", "tableofcontents"], autoclosing=["chapter", "section", "subsection", "subsubsection", "paragraph", "subparagraph", ], knownempties=["rfc", "declaremodule", "appendix", "maketitle", "makeindex", "makemodindex", "localmoduletable", "manpage", "input"])
177c5005c27b072f67098dea66be9f3528dd0fe8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/177c5005c27b072f67098dea66be9f3528dd0fe8/latex2esis.py
"localmoduletable", "manpage", "input"])
"localmoduletable"])
def main(): if len(sys.argv) == 2: ifp = open(sys.argv[1]) ofp = sys.stdout elif len(sys.argv) == 3: ifp = open(sys.argv[1]) ofp = open(sys.argv[2], "w") else: usage() sys.exit(2) convert(ifp, ofp, { # entries are name # -> ([list of attribute names], first_is_optional, empty) "cfuncdesc": (["type", "name", ("args",)], 0, 0), "chapter": ([("title",)], 0, 0), "chapter*": ([("title",)], 0, 0), "classdesc": (["name", ("constructor-args",)], 0, 0), "ctypedesc": (["name"], 0, 0), "cvardesc": (["type", "name"], 0, 0), "datadesc": (["name"], 0, 0), "declaremodule": (["id", "type", "name"], 1, 1), "deprecated": (["release"], 0, 1), "documentclass": (["classname"], 0, 1), "excdesc": (["name"], 0, 0), "funcdesc": (["name", ("args",)], 0, 0), "funcdescni": (["name", ("args",)], 0, 0), "indexii": (["ie1", "ie2"], 0, 1), "indexiii": (["ie1", "ie2", "ie3"], 0, 1), "indexiv": (["ie1", "ie2", "ie3", "ie4"], 0, 1), "input": (["source"], 0, 1), "item": ([("leader",)], 1, 0), "label": (["id"], 0, 1), "manpage": (["name", "section"], 0, 1), "memberdesc": (["class", "name"], 1, 0), "methoddesc": (["class", "name", ("args",)], 1, 0), "methoddescni": (["class", "name", ("args",)], 1, 0), "opcodedesc": (["name", "var"], 0, 0), "par": ([], 0, 1), "rfc": (["number"], 0, 1), "section": ([("title",)], 0, 0), "seemodule": (["ref", "name"], 1, 0), "tableii": (["colspec", "style", "head1", "head2"], 0, 0), "tableiii": (["colspec", "style", "head1", "head2", "head3"], 0, 0), "tableiv": (["colspec", "style", "head1", "head2", "head3", "head4"], 0, 0), "versionadded": (["version"], 0, 1), "versionchanged": (["version"], 0, 1), # "ABC": "ABC", "ASCII": "ASCII", "C": "C", "Cpp": "Cpp", "EOF": "EOF", "e": "backslash", "ldots": "ldots", "NULL": "NULL", "POSIX": "POSIX", "UNIX": "Unix", # # Things that will actually be going away! # "fi": ([], 0, 1), "ifhtml": ([], 0, 1), "makeindex": ([], 0, 1), "makemodindex": ([], 0, 1), "maketitle": ([], 0, 1), "noindent": ([], 0, 1), "tableofcontents": ([], 0, 1), }, discards=["fi", "ifhtml", "makeindex", "makemodindex", "maketitle", "noindent", "tableofcontents"], autoclosing=["chapter", "section", "subsection", "subsubsection", "paragraph", "subparagraph", ], knownempties=["rfc", "declaremodule", "appendix", "maketitle", "makeindex", "makemodindex", "localmoduletable", "manpage", "input"])
177c5005c27b072f67098dea66be9f3528dd0fe8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/177c5005c27b072f67098dea66be9f3528dd0fe8/latex2esis.py
except IOError:
except IOError, reason:
def main(self):
3879423c63f7bb484ee8fdc03b7b41c9c64eebc7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3879423c63f7bb484ee8fdc03b7b41c9c64eebc7/pybench.py
except IOError:
except IOError, reason:
def main(self):
3879423c63f7bb484ee8fdc03b7b41c9c64eebc7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3879423c63f7bb484ee8fdc03b7b41c9c64eebc7/pybench.py
auth = base64.encodestring(auth)
auth = base64.encodestring(urllib.unquote(auth))
def get_host_info(self, host):
c053b0b24eb51792e19423614e896230b6d00f43 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c053b0b24eb51792e19423614e896230b6d00f43/xmlrpclib.py
def test_remove(self): d = deque('abcdefghcij') d.remove('c') self.assertEqual(d, deque('abdefghcij')) d.remove('c') self.assertEqual(d, deque('abdefghij')) self.assertRaises(ValueError, d.remove, 'c') self.assertEqual(d, deque('abdefghij'))
48c31247d537b70439da1f978c4e676fbb7e1ff8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/48c31247d537b70439da1f978c4e676fbb7e1ff8/test_deque.py
__version__ = "1.0b2"
__version__ = "1.0b3"
def _stringify(string): return string
4720263687630e06c907178060d725cc8a64cd6d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4720263687630e06c907178060d725cc8a64cd6d/xmlrpclib.py
class Error:
class Error(Exception):
def _stringify(string): return string
4720263687630e06c907178060d725cc8a64cd6d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4720263687630e06c907178060d725cc8a64cd6d/xmlrpclib.py
t = type(value) if not isinstance(t, StringType): if not isinstance(t, TupleType):
if not isinstance(value, StringType): if not isinstance(value, TupleType):
def __init__(self, value=0): t = type(value) if not isinstance(t, StringType): if not isinstance(t, TupleType): if value == 0: value = time.time() value = time.localtime(value) value = time.strftime("%Y%m%dT%H:%M:%S", value) self.value = value
4720263687630e06c907178060d725cc8a64cd6d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4720263687630e06c907178060d725cc8a64cd6d/xmlrpclib.py
"<Server proxy for %s%s>" %
"<ServerProxy for %s%s>" %
def __repr__(self): return ( "<Server proxy for %s%s>" % (self.__host, self.__handler) )
4720263687630e06c907178060d725cc8a64cd6d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4720263687630e06c907178060d725cc8a64cd6d/xmlrpclib.py
server = Server("http://betty.userland.com")
server = ServerProxy("http://betty.userland.com")
def __getattr__(self, name): # magic method dispatcher return _Method(self.__request, name)
4720263687630e06c907178060d725cc8a64cd6d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4720263687630e06c907178060d725cc8a64cd6d/xmlrpclib.py
self.fail("Error testing host resolution mechanisms.")
self.fail("Error testing host resolution mechanisms. (fqdn: %s, all: %s)" % (fqdn, repr(all_host_names)))
def testHostnameRes(self): # Testing hostname resolution mechanisms hostname = socket.gethostname() try: ip = socket.gethostbyname(hostname) except socket.error: # Probably name lookup wasn't set up right; skip this test return self.assert_(ip.find('.') >= 0, "Error resolving host to ip.") try: hname, aliases, ipaddrs = socket.gethostbyaddr(ip) except socket.error: # Probably a similar problem as above; skip this test return all_host_names = [hostname, hname] + aliases fqhn = socket.getfqdn() if not fqhn in all_host_names: self.fail("Error testing host resolution mechanisms.")
42fb873022a325cb54b084a6f4eefa14b654fdd6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/42fb873022a325cb54b084a6f4eefa14b654fdd6/test_socket.py
e.append(fd) if obj.readable():
is_r = obj.readable() is_w = obj.writable() if is_r:
def poll(timeout=0.0, map=None): if map is None: map = socket_map if map: r = []; w = []; e = [] for fd, obj in map.items(): e.append(fd) if obj.readable(): r.append(fd) if obj.writable(): w.append(fd) if [] == r == w == e: time.sleep(timeout) else: try: r, w, e = select.select(r, w, e, timeout) except select.error, err: if err[0] != EINTR: raise else: return for fd in r: obj = map.get(fd) if obj is None: continue read(obj) for fd in w: obj = map.get(fd) if obj is None: continue write(obj) for fd in e: obj = map.get(fd) if obj is None: continue _exception(obj)
ac5dde0e16e1c251c36ab88e828574f613ff39be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ac5dde0e16e1c251c36ab88e828574f613ff39be/asyncore.py
if obj.writable():
if is_w:
def poll(timeout=0.0, map=None): if map is None: map = socket_map if map: r = []; w = []; e = [] for fd, obj in map.items(): e.append(fd) if obj.readable(): r.append(fd) if obj.writable(): w.append(fd) if [] == r == w == e: time.sleep(timeout) else: try: r, w, e = select.select(r, w, e, timeout) except select.error, err: if err[0] != EINTR: raise else: return for fd in r: obj = map.get(fd) if obj is None: continue read(obj) for fd in w: obj = map.get(fd) if obj is None: continue write(obj) for fd in e: obj = map.get(fd) if obj is None: continue _exception(obj)
ac5dde0e16e1c251c36ab88e828574f613ff39be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ac5dde0e16e1c251c36ab88e828574f613ff39be/asyncore.py
flags = select.POLLERR | select.POLLHUP | select.POLLNVAL
flags = 0
def poll2(timeout=0.0, map=None): # Use the poll() support added to the select module in Python 2.0 if map is None: map = socket_map if timeout is not None: # timeout is in milliseconds timeout = int(timeout*1000) pollster = select.poll() if map: for fd, obj in map.items(): flags = select.POLLERR | select.POLLHUP | select.POLLNVAL if obj.readable(): flags |= select.POLLIN | select.POLLPRI if obj.writable(): flags |= select.POLLOUT if flags: pollster.register(fd, flags) try: r = pollster.poll(timeout) except select.error, err: if err[0] != EINTR: raise r = [] for fd, flags in r: obj = map.get(fd) if obj is None: continue readwrite(obj, flags)
ac5dde0e16e1c251c36ab88e828574f613ff39be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ac5dde0e16e1c251c36ab88e828574f613ff39be/asyncore.py
def buffer_inherit(): import binascii if verbose: print "Testing that buffer interface is inherited ..." class MyStr(str): pass base = 'abc' m = MyStr(base) vereq(binascii.b2a_hex(m), binascii.b2a_hex(base)) class MyUni(unicode): pass base = u'abc' m = MyUni(base) vereq(binascii.b2a_hex(m), binascii.b2a_hex(base)) class MyInt(int): pass m = MyInt(42) try: binascii.b2a_hex(m) raise TestFailed('subclass of int should not have a buffer interface') except TypeError: pass
def __getattr__(self, name): if name in ("spam", "foo", "bar"): return "hello" raise AttributeError, name
3d28667854fa7f283f47bc06ed70c79d65cccf86 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3d28667854fa7f283f47bc06ed70c79d65cccf86/test_descr.py
if completekey: try: import readline readline.set_completer(self.complete) readline.parse_and_bind(completekey+": complete") except ImportError: pass
self.completekey = completekey
def __init__(self, completekey='tab'): """Instantiate a line-oriented interpreter framework.
2560f400c851ebae20b0da5ff3b04be7a823f0f3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2560f400c851ebae20b0da5ff3b04be7a823f0f3/cmd.py
pass
if self.completekey: try: import readline self.old_completer = readline.get_completer() readline.set_completer(self.complete) readline.parse_and_bind(self.completekey+": complete") except ImportError: pass
def preloop(self): """Hook method executed once when the cmdloop() method is called.""" pass
2560f400c851ebae20b0da5ff3b04be7a823f0f3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2560f400c851ebae20b0da5ff3b04be7a823f0f3/cmd.py
pass
if self.completekey: try: import readline readline.set_completer(self.old_completer) except ImportError: pass
def postloop(self): """Hook method executed once when the cmdloop() method is about to return.
2560f400c851ebae20b0da5ff3b04be7a823f0f3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2560f400c851ebae20b0da5ff3b04be7a823f0f3/cmd.py
def add_suffix(self, suffix, importer): assert isinstance(importer, SuffixImporter) self.suffixes.append((suffix, importer))
def add_suffix(self, suffix, importFunc): assert callable(importFunc) self.fs_imp.add_suffix(suffix, importFunc)
def add_suffix(self, suffix, importer): assert isinstance(importer, SuffixImporter) self.suffixes.append((suffix, importer))
16abaf4fd2ed34d4b3b71d740cdef6686032295c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/16abaf4fd2ed34d4b3b71d740cdef6686032295c/imputil.py
def __init__(self):
clsFilesystemImporter = None def __init__(self, fs_imp=None):
def __init__(self): # we're definitely going to be importing something in the future, # so let's just load the OS-related facilities. if not _os_stat: _os_bootstrap()
16abaf4fd2ed34d4b3b71d740cdef6686032295c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/16abaf4fd2ed34d4b3b71d740cdef6686032295c/imputil.py
self.suffixes = [ ]
def __init__(self): # we're definitely going to be importing something in the future, # so let's just load the OS-related facilities. if not _os_stat: _os_bootstrap()
16abaf4fd2ed34d4b3b71d740cdef6686032295c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/16abaf4fd2ed34d4b3b71d740cdef6686032295c/imputil.py
self.suffixes.append((desc[0], DynLoadSuffixImporter(desc))) self.suffixes.append(('.py', PySuffixImporter())) self.fs_imp = _FilesystemImporter(self.suffixes)
self.add_suffix(desc[0], DynLoadSuffixImporter(desc).import_file) self.add_suffix('.py', py_suffix_importer)
def __init__(self): # we're definitely going to be importing something in the future, # so let's just load the OS-related facilities. if not _os_stat: _os_bootstrap()
16abaf4fd2ed34d4b3b71d740cdef6686032295c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/16abaf4fd2ed34d4b3b71d740cdef6686032295c/imputil.py
def install(self): sys.path.insert(0, self)
def install(self): sys.path.insert(0, self)
16abaf4fd2ed34d4b3b71d740cdef6686032295c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/16abaf4fd2ed34d4b3b71d740cdef6686032295c/imputil.py
if len(result) == 2: result = result + ({},)
def _import_one(self, parent, modname, fqname): "Import a single module."
16abaf4fd2ed34d4b3b71d740cdef6686032295c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/16abaf4fd2ed34d4b3b71d740cdef6686032295c/imputil.py
def __init__(self, suffixes): self.suffixes = suffixes
def __init__(self): self.suffixes = [ ] def add_suffix(self, suffix, importFunc): assert callable(importFunc) self.suffixes.append((suffix, importFunc))
def __init__(self, suffixes): # this list is shared with the ImportManager. self.suffixes = suffixes
16abaf4fd2ed34d4b3b71d740cdef6686032295c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/16abaf4fd2ed34d4b3b71d740cdef6686032295c/imputil.py
for suffix, importer in self.suffixes:
for suffix, importFunc in self.suffixes:
def _import_pathname(self, pathname, fqname): if _os_path_isdir(pathname): result = self._import_pathname(_os_path_join(pathname, '__init__'), fqname) if result: values = result[2] values['__pkgdir__'] = pathname values['__path__'] = [ pathname ] return 1, result[1], values return None
16abaf4fd2ed34d4b3b71d740cdef6686032295c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/16abaf4fd2ed34d4b3b71d740cdef6686032295c/imputil.py
return importer.import_file(filename, finfo, fqname)
return importFunc(filename, finfo, fqname)
def _import_pathname(self, pathname, fqname): if _os_path_isdir(pathname): result = self._import_pathname(_os_path_join(pathname, '__init__'), fqname) if result: values = result[2] values['__pkgdir__'] = pathname values['__path__'] = [ pathname ] return 1, result[1], values return None
16abaf4fd2ed34d4b3b71d740cdef6686032295c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/16abaf4fd2ed34d4b3b71d740cdef6686032295c/imputil.py
class SuffixImporter: def import_file(self, filename, finfo, fqname): raise RuntimeError class PySuffixImporter(SuffixImporter): def import_file(self, filename, finfo, fqname): file = filename[:-3] + _suffix t_py = long(finfo[8]) t_pyc = _timestamp(file) code = None if t_pyc is not None and t_pyc >= t_py: f = open(file, 'rb') if f.read(4) == imp.get_magic(): t = struct.unpack('<I', f.read(4))[0] if t == t_py: code = marshal.load(f) f.close() if code is None: file = filename code = _compile(file, t_py) return 0, code, { '__file__' : file } class DynLoadSuffixImporter(SuffixImporter):
def py_suffix_importer(filename, finfo, fqname): file = filename[:-3] + _suffix t_py = long(finfo[8]) t_pyc = _timestamp(file) code = None if t_pyc is not None and t_pyc >= t_py: f = open(file, 'rb') if f.read(4) == imp.get_magic(): t = struct.unpack('<I', f.read(4))[0] if t == t_py: code = marshal.load(f) f.close() if code is None: file = filename code = _compile(file, t_py) return 0, code, { '__file__' : file } class DynLoadSuffixImporter:
def _import_pathname(self, pathname, fqname): if _os_path_isdir(pathname): result = self._import_pathname(_os_path_join(pathname, '__init__'), fqname) if result: values = result[2] values['__pkgdir__'] = pathname values['__path__'] = [ pathname ] return 1, result[1], values return None
16abaf4fd2ed34d4b3b71d740cdef6686032295c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/16abaf4fd2ed34d4b3b71d740cdef6686032295c/imputil.py
self.assertTrue(data.endswith('\n'))
self.assertTrue(data == '' or data.endswith('\n'))
def verify_valid_flag(self, cmd_line): data = self.start_python(cmd_line) self.assertTrue(data.endswith('\n')) self.assertTrue('Traceback' not in data)
ebcd88ed1b918ebdb086de4d1b285788e61f76eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ebcd88ed1b918ebdb086de4d1b285788e61f76eb/test_cmd_line.py
self.assertRaises(ValueError, msg.get_content_maintype)
self.assertEqual(msg.get_content_maintype(), 'text')
def test_get_content_maintype_error(self): msg = Message() msg['Content-Type'] = 'no-slash-in-this-string' self.assertRaises(ValueError, msg.get_content_maintype)
0df35b27d6942d0d674ed2fa0a88c9074c29c169 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0df35b27d6942d0d674ed2fa0a88c9074c29c169/test_email.py
self.assertRaises(ValueError, msg.get_content_subtype)
self.assertEqual(msg.get_content_subtype(), 'plain')
def test_get_content_subtype_error(self): msg = Message() msg['Content-Type'] = 'no-slash-in-this-string' self.assertRaises(ValueError, msg.get_content_subtype)
0df35b27d6942d0d674ed2fa0a88c9074c29c169 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0df35b27d6942d0d674ed2fa0a88c9074c29c169/test_email.py
def test_strptime(self): tt = time.gmtime(self.t) for directive in ('a', 'A', 'b', 'B', 'c', 'd', 'H', 'I', 'j', 'm', 'M', 'p', 'S', 'U', 'w', 'W', 'x', 'X', 'y', 'Y', 'Z', '%'): format = ' %' + directive try: time.strptime(time.strftime(format, tt), format) except ValueError: self.fail('conversion specifier: %r failed.' % format)
477877f138be6e56db275ee5acd346cf85c32383 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/477877f138be6e56db275ee5acd346cf85c32383/test_time.py
print "found", `title[start:m.end()]`
def clean_title(title): title = raisebox_rx.sub("", title) title = hackscore_rx.sub(r"\\_", title) pos = 0 while 1: m = title_rx.search(title, pos) if m: start = m.start() print "found", `title[start:m.end()]` if title[start:start+15] != "\\textunderscore": title = title[:start] + title[m.end():] pos = start + 1 else: break title = string.translate(title, title_trans, "{}") print `title` return title
0649cc1a40e66bd198591c94ac25b28052f3aff6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0649cc1a40e66bd198591c94ac25b28052f3aff6/toc2bkm.py
print `title`
def clean_title(title): title = raisebox_rx.sub("", title) title = hackscore_rx.sub(r"\\_", title) pos = 0 while 1: m = title_rx.search(title, pos) if m: start = m.start() print "found", `title[start:m.end()]` if title[start:start+15] != "\\textunderscore": title = title[:start] + title[m.end():] pos = start + 1 else: break title = string.translate(title, title_trans, "{}") print `title` return title
0649cc1a40e66bd198591c94ac25b28052f3aff6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0649cc1a40e66bd198591c94ac25b28052f3aff6/toc2bkm.py
if sys.platform.startswith("win"): lookfor = " denied"
if sys.platform == 'win32': expected_exit_code = 2
def test_directories(self): # Does this test make sense? The message for "< ." may depend on # the command shell, and the message for "." depends on the OS. if sys.platform.startswith("win"): # On WinXP w/ cmd.exe, # "< ." gives "Access is denied.\n" # "." gives "C:\\Code\\python\\PCbuild\\python.exe: " + # "can't open file '.':" + # "[Errno 13] Permission denied\n" lookfor = " denied" # common to both cases else: # This is what the test looked for originally, on all platforms. lookfor = "is a directory" self.assertTrue(lookfor in self.start_python('.')) self.assertTrue(lookfor in self.start_python('< .'))
a9010e76a9db9081f0994642378f95ae80b2ae00 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a9010e76a9db9081f0994642378f95ae80b2ae00/test_cmd_line.py
lookfor = "is a directory" self.assertTrue(lookfor in self.start_python('.')) self.assertTrue(lookfor in self.start_python('< .'))
expected_exit_code = 0 self.assertEqual(self.exit_code('.'), expected_exit_code) self.assertTrue(self.exit_code('< .') != 0)
def test_directories(self): # Does this test make sense? The message for "< ." may depend on # the command shell, and the message for "." depends on the OS. if sys.platform.startswith("win"): # On WinXP w/ cmd.exe, # "< ." gives "Access is denied.\n" # "." gives "C:\\Code\\python\\PCbuild\\python.exe: " + # "can't open file '.':" + # "[Errno 13] Permission denied\n" lookfor = " denied" # common to both cases else: # This is what the test looked for originally, on all platforms. lookfor = "is a directory" self.assertTrue(lookfor in self.start_python('.')) self.assertTrue(lookfor in self.start_python('< .'))
a9010e76a9db9081f0994642378f95ae80b2ae00 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a9010e76a9db9081f0994642378f95ae80b2ae00/test_cmd_line.py
if os.path.isdir(dir) and dir not in dirlist:
if dir is not None and os.path.isdir(dir) and dir not in dirlist:
def add_dir_to_list(dirlist, dir): """Add the directory 'dir' to the list 'dirlist' (at the front) if 1) 'dir' is not already in 'dirlist' 2) 'dir' actually exists, and is a directory.""" if os.path.isdir(dir) and dir not in dirlist: dirlist.insert(0, dir)
0c0dd4bf44a5c1beef2034eb1ffd78f19e5aac1e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0c0dd4bf44a5c1beef2034eb1ffd78f19e5aac1e/setup.py
if platform == 'darwin':
if platform in ('darwin', 'mac'):
def build_extensions(self):
0c0dd4bf44a5c1beef2034eb1ffd78f19e5aac1e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0c0dd4bf44a5c1beef2034eb1ffd78f19e5aac1e/setup.py
input = text_file.TextFile('Modules/Setup', join_lines=1) remove_modules = [] while 1: line = input.readline() if not line: break line = line.split() remove_modules.append( line[0] ) input.close() for ext in self.extensions[:]: if ext.name in remove_modules: self.extensions.remove(ext)
if platform != 'mac': input = text_file.TextFile('Modules/Setup', join_lines=1) remove_modules = [] while 1: line = input.readline() if not line: break line = line.split() remove_modules.append( line[0] ) input.close() for ext in self.extensions[:]: if ext.name in remove_modules: self.extensions.remove(ext)
def build_extensions(self):
0c0dd4bf44a5c1beef2034eb1ffd78f19e5aac1e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0c0dd4bf44a5c1beef2034eb1ffd78f19e5aac1e/setup.py
if platform in ['darwin', 'beos']:
if platform in ['darwin', 'beos', 'mac']:
def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
0c0dd4bf44a5c1beef2034eb1ffd78f19e5aac1e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0c0dd4bf44a5c1beef2034eb1ffd78f19e5aac1e/setup.py
By default, the diff control lines (those with *** or ---) are
By default, the diff control lines (those with ---, +++, or @@) are
def unified_diff(a, b, fromfile='', tofile='', fromfiledate='', tofiledate='', n=3, lineterm='\n'): r""" Compare two sequences of lines; generate the delta as a unified diff. Unified diffs are a compact way of showing line changes and a few lines of context. The number of context lines is set by 'n' which defaults to three. By default, the diff control lines (those with *** or ---) are created with a trailing newline. This is helpful so that inputs created from file.readlines() result in diffs that are suitable for file.writelines() since both the inputs and outputs have trailing newlines. For inputs that do not have trailing newlines, set the lineterm argument to "" so that the output will be uniformly newline free. The unidiff format normally has a header for filenames and modification times. Any or all of these may be specified using strings for 'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'. The modification times are normally expressed in the format returned by time.ctime(). Example: >>> for line in unified_diff('one two three four'.split(), ... 'zero one tree four'.split(), 'Original', 'Current', ... 'Sat Jan 26 23:30:50 1991', 'Fri Jun 06 10:20:52 2003', ... lineterm=''): ... print line --- Original Sat Jan 26 23:30:50 1991 +++ Current Fri Jun 06 10:20:52 2003 @@ -1,4 +1,4 @@ +zero one -two -three +tree four """ started = False for group in SequenceMatcher(None,a,b).get_grouped_opcodes(n): if not started: yield '--- %s %s%s' % (fromfile, fromfiledate, lineterm) yield '+++ %s %s%s' % (tofile, tofiledate, lineterm) started = True i1, i2, j1, j2 = group[0][1], group[-1][2], group[0][3], group[-1][4] yield "@@ -%d,%d +%d,%d @@%s" % (i1+1, i2-i1, j1+1, j2-j1, lineterm) for tag, i1, i2, j1, j2 in group: if tag == 'equal': for line in a[i1:i2]: yield ' ' + line continue if tag == 'replace' or tag == 'delete': for line in a[i1:i2]: yield '-' + line if tag == 'replace' or tag == 'insert': for line in b[j1:j2]: yield '+' + line
96f750098bec0878a49a31d422414badd77e4142 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/96f750098bec0878a49a31d422414badd77e4142/difflib.py
return bool()
"""Return true if the scope uses exec""" return bool(self._table.optimized & (OPT_EXEC | OPT_BARE_EXEC)) def has_import_star(self): """Return true if the scope uses import *""" return bool(self._table.optimized & OPT_IMPORT_STAR)
def has_exec(self): return bool()
c33b20ca43dc82a32480aafacb7c39fb3aef37b0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c33b20ca43dc82a32480aafacb7c39fb3aef37b0/symtable.py
return bool(self.flag & DEF_STAR)
return bool(self.__flags & DEF_STAR)
def is_vararg(self): return bool(self.flag & DEF_STAR)
c33b20ca43dc82a32480aafacb7c39fb3aef37b0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c33b20ca43dc82a32480aafacb7c39fb3aef37b0/symtable.py
return bool(self.__flags & DEF_STARSTAR)
return bool(self.__flags & DEF_DOUBLESTAR)
def is_keywordarg(self): return bool(self.__flags & DEF_STARSTAR)
c33b20ca43dc82a32480aafacb7c39fb3aef37b0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c33b20ca43dc82a32480aafacb7c39fb3aef37b0/symtable.py
('dbserv2.theopalgroup.com', '/mediumfile'), ('dbserv2.theopalgroup.com', '/smallfile'),
def test(): """Test this module. A hodge podge of tests collected here, because they have too many external dependencies for the regular test suite. """ import sys import getopt opts, args = getopt.getopt(sys.argv[1:], 'd') dl = 0 for o, a in opts: if o == '-d': dl = dl + 1 host = 'www.python.org' selector = '/' if args[0:]: host = args[0] if args[1:]: selector = args[1] h = HTTP() h.set_debuglevel(dl) h.connect(host) h.putrequest('GET', selector) h.endheaders() status, reason, headers = h.getreply() print 'status =', status print 'reason =', reason print "read", len(h.getfile().read()) print if headers: for header in headers.headers: print header.strip() print # minimal test that code to extract host from url works class HTTP11(HTTP): _http_vsn = 11 _http_vsn_str = 'HTTP/1.1' h = HTTP11('www.python.org') h.putrequest('GET', 'http://www.python.org/~jeremy/') h.endheaders() h.getreply() h.close() if hasattr(socket, 'ssl'): for host, selector in (('sourceforge.net', '/projects/python'), ('dbserv2.theopalgroup.com', '/mediumfile'), ('dbserv2.theopalgroup.com', '/smallfile'), ): print "https://%s%s" % (host, selector) hs = HTTPS() hs.set_debuglevel(dl) hs.connect(host) hs.putrequest('GET', selector) hs.endheaders() status, reason, headers = hs.getreply() print 'status =', status print 'reason =', reason print "read", len(hs.getfile().read()) print if headers: for header in headers.headers: print header.strip() print # Test a buggy server -- returns garbled status line. # http://www.yahoo.com/promotions/mom_com97/supermom.html c = HTTPConnection("promotions.yahoo.com") c.set_debuglevel(1) c.connect() c.request("GET", "/promotions/mom_com97/supermom.html") r = c.getresponse() print r.status, r.version lines = r.read().split("\n") print "\n".join(lines[:5]) c = HTTPConnection("promotions.yahoo.com", strict=1) c.set_debuglevel(1) c.connect() c.request("GET", "/promotions/mom_com97/supermom.html") try: r = c.getresponse() except BadStatusLine, err: print "strict mode failed as expected" print err else: print "XXX strict mode should have failed" for strict in 0, 1: h = HTTP(strict=strict) h.connect("promotions.yahoo.com") h.putrequest('GET', "/promotions/mom_com97/supermom.html") h.endheaders() status, reason, headers = h.getreply() assert (strict and status == -1) or status == 200, (strict, status)
48018f43c4ca1640451420db8a9ff0d86cdbc85d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/48018f43c4ca1640451420db8a9ff0d86cdbc85d/httplib.py
c = HTTPConnection("promotions.yahoo.com") c.set_debuglevel(1) c.connect() c.request("GET", "/promotions/mom_com97/supermom.html") r = c.getresponse() print r.status, r.version lines = r.read().split("\n") print "\n".join(lines[:5]) c = HTTPConnection("promotions.yahoo.com", strict=1) c.set_debuglevel(1) c.connect() c.request("GET", "/promotions/mom_com97/supermom.html") try: r = c.getresponse() except BadStatusLine, err: print "strict mode failed as expected" print err else: print "XXX strict mode should have failed" for strict in 0, 1: h = HTTP(strict=strict) h.connect("promotions.yahoo.com") h.putrequest('GET', "/promotions/mom_com97/supermom.html") h.endheaders() status, reason, headers = h.getreply() assert (strict and status == -1) or status == 200, (strict, status)
def test(): """Test this module. A hodge podge of tests collected here, because they have too many external dependencies for the regular test suite. """ import sys import getopt opts, args = getopt.getopt(sys.argv[1:], 'd') dl = 0 for o, a in opts: if o == '-d': dl = dl + 1 host = 'www.python.org' selector = '/' if args[0:]: host = args[0] if args[1:]: selector = args[1] h = HTTP() h.set_debuglevel(dl) h.connect(host) h.putrequest('GET', selector) h.endheaders() status, reason, headers = h.getreply() print 'status =', status print 'reason =', reason print "read", len(h.getfile().read()) print if headers: for header in headers.headers: print header.strip() print # minimal test that code to extract host from url works class HTTP11(HTTP): _http_vsn = 11 _http_vsn_str = 'HTTP/1.1' h = HTTP11('www.python.org') h.putrequest('GET', 'http://www.python.org/~jeremy/') h.endheaders() h.getreply() h.close() if hasattr(socket, 'ssl'): for host, selector in (('sourceforge.net', '/projects/python'), ('dbserv2.theopalgroup.com', '/mediumfile'), ('dbserv2.theopalgroup.com', '/smallfile'), ): print "https://%s%s" % (host, selector) hs = HTTPS() hs.set_debuglevel(dl) hs.connect(host) hs.putrequest('GET', selector) hs.endheaders() status, reason, headers = hs.getreply() print 'status =', status print 'reason =', reason print "read", len(hs.getfile().read()) print if headers: for header in headers.headers: print header.strip() print # Test a buggy server -- returns garbled status line. # http://www.yahoo.com/promotions/mom_com97/supermom.html c = HTTPConnection("promotions.yahoo.com") c.set_debuglevel(1) c.connect() c.request("GET", "/promotions/mom_com97/supermom.html") r = c.getresponse() print r.status, r.version lines = r.read().split("\n") print "\n".join(lines[:5]) c = HTTPConnection("promotions.yahoo.com", strict=1) c.set_debuglevel(1) c.connect() c.request("GET", "/promotions/mom_com97/supermom.html") try: r = c.getresponse() except BadStatusLine, err: print "strict mode failed as expected" print err else: print "XXX strict mode should have failed" for strict in 0, 1: h = HTTP(strict=strict) h.connect("promotions.yahoo.com") h.putrequest('GET', "/promotions/mom_com97/supermom.html") h.endheaders() status, reason, headers = h.getreply() assert (strict and status == -1) or status == 200, (strict, status)
48018f43c4ca1640451420db8a9ff0d86cdbc85d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/48018f43c4ca1640451420db8a9ff0d86cdbc85d/httplib.py
self.draw.bind(fred, "<Any-Enter>", self.mouseEnter) self.draw.bind(fred, "<Any-Leave>", self.mouseLeave)
self.draw.tag_bind(fred, "<Any-Enter>", self.mouseEnter) self.draw.tag_bind(fred, "<Any-Leave>", self.mouseLeave)
def createWidgets(self):
3744bdda5592bbbe5606c13f61f2c4665be6179a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3744bdda5592bbbe5606c13f61f2c4665be6179a/canvas-moving-w-mouse.py
name = basename(in_file)
name = os.path.basename(in_file)
def encode(in_file, out_file, name=None, mode=None): """Uuencode file""" # # If in_file is a pathname open it and change defaults # if in_file == '-': in_file = sys.stdin elif type(in_file) == type(''): if name == None: name = basename(in_file) if mode == None: try: mode = os.path.stat(in_file)[0] except AttributeError: pass in_file = open(in_file, 'rb') # # Open out_file if it is a pathname # if out_file == '-': out_file = sys.stdout elif type(out_file) == type(''): out_file = open(out_file, 'w') # # Set defaults for name and mode # if name == None: name = '-' if mode == None: mode = 0666 # # Write the data # out_file.write('begin %o %s\n' % ((mode&0777),name)) str = in_file.read(45) while len(str) > 0: out_file.write(binascii.b2a_uu(str)) str = in_file.read(45) out_file.write(' \nend\n')
cf962aae5edbfda52e2312d56623696721202411 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/cf962aae5edbfda52e2312d56623696721202411/uu.py
mode = os.path.stat(in_file)[0]
mode = os.stat(in_file)[0]
def encode(in_file, out_file, name=None, mode=None): """Uuencode file""" # # If in_file is a pathname open it and change defaults # if in_file == '-': in_file = sys.stdin elif type(in_file) == type(''): if name == None: name = basename(in_file) if mode == None: try: mode = os.path.stat(in_file)[0] except AttributeError: pass in_file = open(in_file, 'rb') # # Open out_file if it is a pathname # if out_file == '-': out_file = sys.stdout elif type(out_file) == type(''): out_file = open(out_file, 'w') # # Set defaults for name and mode # if name == None: name = '-' if mode == None: mode = 0666 # # Write the data # out_file.write('begin %o %s\n' % ((mode&0777),name)) str = in_file.read(45) while len(str) > 0: out_file.write(binascii.b2a_uu(str)) str = in_file.read(45) out_file.write(' \nend\n')
cf962aae5edbfda52e2312d56623696721202411 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/cf962aae5edbfda52e2312d56623696721202411/uu.py
_apply = apply
def join(words, sep = ' '): """join(list [,sep]) -> string Return a string composed of the words in list, with intervening occurences of sep. The default separator is a single space. (joinfields and join are synonymous) """ return sep.join(words)
4e577568f34ac8283d2070929bf3c3090b3e722f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4e577568f34ac8283d2070929bf3c3090b3e722f/string.py
return _apply(s.index, args)
return s.index(*args)
def index(s, *args): """index(s, sub [,start [,end]]) -> int Like find but raises ValueError when the substring is not found. """ return _apply(s.index, args)
4e577568f34ac8283d2070929bf3c3090b3e722f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4e577568f34ac8283d2070929bf3c3090b3e722f/string.py
return _apply(s.rindex, args)
return s.rindex(*args)
def rindex(s, *args): """rindex(s, sub [,start [,end]]) -> int Like rfind but raises ValueError when the substring is not found. """ return _apply(s.rindex, args)
4e577568f34ac8283d2070929bf3c3090b3e722f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4e577568f34ac8283d2070929bf3c3090b3e722f/string.py
return _apply(s.count, args)
return s.count(*args)
def count(s, *args): """count(s, sub[, start[,end]]) -> int Return the number of occurrences of substring sub in string s[start:end]. Optional arguments start and end are interpreted as in slice notation. """ return _apply(s.count, args)
4e577568f34ac8283d2070929bf3c3090b3e722f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4e577568f34ac8283d2070929bf3c3090b3e722f/string.py
return _apply(s.find, args)
return s.find(*args)
def find(s, *args): """find(s, sub [,start [,end]]) -> in Return the lowest index in s where substring sub is found, such that sub is contained within s[start,end]. Optional arguments start and end are interpreted as in slice notation. Return -1 on failure. """ return _apply(s.find, args)
4e577568f34ac8283d2070929bf3c3090b3e722f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4e577568f34ac8283d2070929bf3c3090b3e722f/string.py
return _apply(s.rfind, args)
return s.rfind(*args)
def rfind(s, *args): """rfind(s, sub [,start [,end]]) -> int Return the highest index in s where substring sub is found, such that sub is contained within s[start,end]. Optional arguments start and end are interpreted as in slice notation. Return -1 on failure. """ return _apply(s.rfind, args)
4e577568f34ac8283d2070929bf3c3090b3e722f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4e577568f34ac8283d2070929bf3c3090b3e722f/string.py
n = width - len(s) if n <= 0: return s return s + ' '*n
return s.ljust(width)
def ljust(s, width): """ljust(s, width) -> string Return a left-justified version of s, in a field of the specified width, padded with spaces as needed. The string is never truncated. """ n = width - len(s) if n <= 0: return s return s + ' '*n
4e577568f34ac8283d2070929bf3c3090b3e722f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4e577568f34ac8283d2070929bf3c3090b3e722f/string.py
n = width - len(s) if n <= 0: return s return ' '*n + s
return s.rjust(width)
def rjust(s, width): """rjust(s, width) -> string Return a right-justified version of s, in a field of the specified width, padded with spaces as needed. The string is never truncated. """ n = width - len(s) if n <= 0: return s return ' '*n + s
4e577568f34ac8283d2070929bf3c3090b3e722f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4e577568f34ac8283d2070929bf3c3090b3e722f/string.py
n = width - len(s) if n <= 0: return s half = n/2 if n%2 and width%2: half = half+1 return ' '*half + s + ' '*(n-half)
return s.center(width)
def center(s, width): """center(s, width) -> string Return a center version of s, in a field of the specified width. padded with spaces as needed. The string is never truncated. """ n = width - len(s) if n <= 0: return s half = n/2 if n%2 and width%2: # This ensures that center(center(s, i), j) = center(s, j) half = half+1 return ' '*half + s + ' '*(n-half)
4e577568f34ac8283d2070929bf3c3090b3e722f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4e577568f34ac8283d2070929bf3c3090b3e722f/string.py
res = line = '' for c in s: if c == '\t': c = ' '*(tabsize - len(line) % tabsize) line = line + c if c == '\n': res = res + line line = '' return res + line
return s.expandtabs(tabsize)
def expandtabs(s, tabsize=8): """expandtabs(s [,tabsize]) -> string Return a copy of the string s with all tab characters replaced by the appropriate number of spaces, depending on the current column, and the tabsize (default 8). """ res = line = '' for c in s: if c == '\t': c = ' '*(tabsize - len(line) % tabsize) line = line + c if c == '\n': res = res + line line = '' return res + line
4e577568f34ac8283d2070929bf3c3090b3e722f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4e577568f34ac8283d2070929bf3c3090b3e722f/string.py
try: ''.upper except AttributeError: from stringold import *
def replace(s, old, new, maxsplit=-1): """replace (str, old, new[, maxsplit]) -> string Return a copy of string str with all occurrences of substring old replaced by new. If the optional argument maxsplit is given, only the first maxsplit occurrences are replaced. """ return s.replace(old, new, maxsplit)
4e577568f34ac8283d2070929bf3c3090b3e722f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4e577568f34ac8283d2070929bf3c3090b3e722f/string.py
parts = split(path, '.')
parts = [part for part in split(path, '.') if part]
def locate(path, forceload=0): """Locate an object by name or dotted path, importing as necessary.""" parts = split(path, '.') module, n = None, 0 while n < len(parts): nextmodule = safeimport(join(parts[:n+1], '.'), forceload) if nextmodule: module, n = nextmodule, n + 1 else: break if module: object = module for part in parts[n:]: try: object = getattr(object, part) except AttributeError: return None return object else: import __builtin__ if hasattr(__builtin__, path): return getattr(__builtin__, path)
c48fb29249b30e0a8c51f479659ba7be35789076 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c48fb29249b30e0a8c51f479659ba7be35789076/pydoc.py
Keywords are width, height, startx and starty
Keywords are width, height, startx and starty:
def setup(**geometry): """ Sets the size and position of the main window. Keywords are width, height, startx and starty width: either a size in pixels or a fraction of the screen. Default is 50% of screen. height: either the height in pixels or a fraction of the screen. Default is 75% of screen. Setting either width or height to None before drawing will force use of default geometry as in older versions of turtle.py startx: starting position in pixels from the left edge of the screen. Default is to center window. Setting startx to None is the default and centers window horizontally on screen. starty: starting position in pixels from the top edge of the screen. Default is to center window. Setting starty to None is the default and centers window vertically on screen. Examples: >>> setup (width=200, height=200, startx=0, starty=0) sets window to 200x200 pixels, in upper left of screen >>> setup(width=.75, height=0.5, startx=None, starty=None) sets window to 75% of screen by 50% of screen and centers >>> setup(width=None) forces use of default geometry as in older versions of turtle.py """ global _width, _height, _startx, _starty width = geometry.get('width',_width) if width >= 0 or width == None: _width = width else: raise ValueError, "width can not be less than 0" height = geometry.get('height',_height) if height >= 0 or height == None: _height = height else: raise ValueError, "height can not be less than 0" startx = geometry.get('startx', _startx) if startx >= 0 or startx == None: _startx = _startx else: raise ValueError, "startx can not be less than 0" starty = geometry.get('starty', _starty) if starty >= 0 or starty == None: _starty = starty else: raise ValueError, "startx can not be less than 0" if _root and _width and _height: if 0 < _width <= 1: _width = _root.winfo_screenwidth() * +width if 0 < _height <= 1: _height = _root.winfo_screenheight() * _height # center window on screen if _startx is None: _startx = (_root.winfo_screenwidth() - _width) / 2 if _starty is None: _starty = (_root.winfo_screenheight() - _height) / 2 _root.geometry("%dx%d+%d+%d" % (_width, _height, _startx, _starty))
29610c54bd931177c82d81d09204149c628fbfab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/29610c54bd931177c82d81d09204149c628fbfab/turtle.py
""" set the window title.
"""Set the window title.
def title(title): """ set the window title. By default this is set to 'Turtle Graphics' Example: >>> title("My Window") """ global _title _title = title
29610c54bd931177c82d81d09204149c628fbfab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/29610c54bd931177c82d81d09204149c628fbfab/turtle.py
raise ErrorDuringImport(filename, sys.exc_info())
raise ErrorDuringImport(path, sys.exc_info())
def locate(path): """Locate an object by name (or dotted path), importing as necessary.""" if not path: # special case: imp.find_module('') strangely succeeds return None if type(path) is not types.StringType: return path parts = split(path, '.') n = len(parts) while n > 0: path = join(parts[:n], '.') try: module = freshimport(path) except: # Did the error occur before or after the module was found? (exc, value, tb) = info = sys.exc_info() if sys.modules.has_key(path): # An error occured while executing the imported module. raise ErrorDuringImport(sys.modules[path].__file__, info) elif exc is SyntaxError: # A SyntaxError occurred before we could execute the module. raise ErrorDuringImport(value.filename, info) elif exc is ImportError and \ split(lower(str(value)))[:2] == ['no', 'module']: # The module was not found. n = n - 1 continue else: # Some other error occurred before executing the module. raise ErrorDuringImport(filename, sys.exc_info()) try: x = module for p in parts[n:]: x = getattr(x, p) return x except AttributeError: n = n - 1 continue if hasattr(__builtins__, path): return getattr(__builtins__, path) return None
edee5756dee69ce72ea65b4b58546bc82199ab82 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/edee5756dee69ce72ea65b4b58546bc82199ab82/pydoc.py
return (action, pattern, dir, dir_pattern)
return (action, patterns, dir, dir_pattern)
def _parse_template_line (self, line): words = string.split (line) action = words[0]
5cba2326315af1d8de35a28c989edb607eb87993 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5cba2326315af1d8de35a28c989edb607eb87993/filelist.py
def test_string_charset(self): eq = self.assertEqual h = Header() h.append('hello', 'iso-8859-1') eq(h, '=?iso-8859-1?q?hello?=')
a2514107d552bcb0a7643b1041492d91c73a47ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a2514107d552bcb0a7643b1041492d91c73a47ab/test_email.py
chunk = Chunk().init(self._file)
try: chunk = Chunk().init(self._file) except EOFError: if formlength == 8: print 'Warning: FORM chunk size too large' formlength = 0 break raise EOFError
def initfp(self, file): self._file = file self._version = 0 self._decomp = None self._markers = [] self._soundpos = 0 form = self._file.read(4) if form != 'FORM': raise Error, 'file does not start with FORM id' formlength = _read_long(self._file) if formlength <= 0: raise Error, 'invalid FORM chunk data size' formdata = self._file.read(4) formlength = formlength - 4 if formdata == 'AIFF': self._aifc = 0 elif formdata == 'AIFC': self._aifc = 1 else: raise Error, 'not an AIFF or AIFF-C file' self._comm_chunk_read = 0 while formlength > 0: self._ssnd_seek_needed = 1 chunk = Chunk().init(self._file) formlength = formlength - 8 - chunk.chunksize if chunk.chunksize & 1: formlength = formlength - 1 if chunk.chunkname == 'COMM': self._read_comm_chunk(chunk) self._comm_chunk_read = 1 elif chunk.chunkname == 'SSND': self._ssnd_chunk = chunk dummy = chunk.read(8) self._ssnd_seek_needed = 0 elif chunk.chunkname == 'FVER': self._version = _read_long(chunk) elif chunk.chunkname == 'MARK': self._readmark(chunk) elif chunk.chunkname in _skiplist: pass else: raise Error, 'unrecognized chunk type '+chunk.chunkname if formlength > 0: chunk.skip() if not self._comm_chunk_read or not self._ssnd_chunk: raise Error, 'COMM chunk and/or SSND chunk missing' if self._aifc and self._decomp: params = [CL.ORIGINAL_FORMAT, 0, \ CL.BITS_PER_COMPONENT, 0, \ CL.FRAME_RATE, self._framerate] if self._nchannels == AL.MONO: params[1] = CL.MONO else: params[1] = CL.STEREO_INTERLEAVED if self._sampwidth == AL.SAMPLE_8: params[3] = 8 elif self._sampwidth == AL.SAMPLE_16: params[3] = 16 else: params[3] = 24 self._decomp.SetParams(params) return self
b069c08f98ae61a17dd6e17dca6a0e398edf09c5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b069c08f98ae61a17dd6e17dca6a0e398edf09c5/aifc.py
from distutils.ccompiler import new_compiler from distutils.sysconfig import customize_compiler
def build_extensions(self): from distutils.ccompiler import new_compiler from distutils.sysconfig import customize_compiler
1fcdc25ab92d9b084a08284526b263586c9ebe57 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1fcdc25ab92d9b084a08284526b263586c9ebe57/setup.py
compiler = os.environ.get('CC') linker_so = os.environ.get('LDSHARED') args = {} if compiler is not None: args['compiler_so'] = compiler if linker_so is not None: args['linker_so'] = linker_so + ' -shared' self.compiler.set_executables(**args)
def build_extensions(self): from distutils.ccompiler import new_compiler from distutils.sysconfig import customize_compiler
1fcdc25ab92d9b084a08284526b263586c9ebe57 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1fcdc25ab92d9b084a08284526b263586c9ebe57/setup.py
exts.append( Extension('unicodedata', ['unicodedata.c', 'unicodedatabase.c']) )
exts.append( Extension('unicodedata', ['unicodedata.c', 'unicodedatabase.c']) )
def detect_modules(self): # Ensure that /usr/local is always used if '/usr/local/lib' not in self.compiler.library_dirs: self.compiler.library_dirs.append('/usr/local/lib') if '/usr/local/include' not in self.compiler.include_dirs: self.compiler.include_dirs.append( '/usr/local/include' )
1fcdc25ab92d9b084a08284526b263586c9ebe57 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1fcdc25ab92d9b084a08284526b263586c9ebe57/setup.py
def detect_modules(self): # Ensure that /usr/local is always used if '/usr/local/lib' not in self.compiler.library_dirs: self.compiler.library_dirs.append('/usr/local/lib') if '/usr/local/include' not in self.compiler.include_dirs: self.compiler.include_dirs.append( '/usr/local/include' )
1fcdc25ab92d9b084a08284526b263586c9ebe57 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1fcdc25ab92d9b084a08284526b263586c9ebe57/setup.py
def detect_modules(self): # Ensure that /usr/local is always used if '/usr/local/lib' not in self.compiler.library_dirs: self.compiler.library_dirs.append('/usr/local/lib') if '/usr/local/include' not in self.compiler.include_dirs: self.compiler.include_dirs.append( '/usr/local/include' )
1fcdc25ab92d9b084a08284526b263586c9ebe57 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1fcdc25ab92d9b084a08284526b263586c9ebe57/setup.py
def detect_modules(self): # Ensure that /usr/local is always used if '/usr/local/lib' not in self.compiler.library_dirs: self.compiler.library_dirs.append('/usr/local/lib') if '/usr/local/include' not in self.compiler.include_dirs: self.compiler.include_dirs.append( '/usr/local/include' )
1fcdc25ab92d9b084a08284526b263586c9ebe57 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1fcdc25ab92d9b084a08284526b263586c9ebe57/setup.py
def detect_modules(self): # Ensure that /usr/local is always used if '/usr/local/lib' not in self.compiler.library_dirs: self.compiler.library_dirs.append('/usr/local/lib') if '/usr/local/include' not in self.compiler.include_dirs: self.compiler.include_dirs.append( '/usr/local/include' )
1fcdc25ab92d9b084a08284526b263586c9ebe57 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1fcdc25ab92d9b084a08284526b263586c9ebe57/setup.py
def main(): setup(name = 'Python standard library', version = '%d.%d' % sys.version_info[:2], cmdclass = {'build_ext':PyBuildExt}, # The struct module is defined here, because build_ext won't be # called unless there's at least one extension module defined. ext_modules=[Extension('struct', ['structmodule.c'])] )
1fcdc25ab92d9b084a08284526b263586c9ebe57 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1fcdc25ab92d9b084a08284526b263586c9ebe57/setup.py
xid = self.unpack_uint(xid)
xid = self.unpack_uint()
def unpack_callheader(self): xid = self.unpack_uint(xid) temp = self.unpack_enum() if temp <> CALL: raise BadRPCFormat, 'no CALL but %r' % (temp,) temp = self.unpack_uint() if temp <> RPCVERSION: raise BadRPCVerspion, 'bad RPC version %r' % (temp,) prog = self.unpack_uint() vers = self.unpack_uint() proc = self.unpack_uint() cred = self.unpack_auth() verf = self.unpack_auth() return xid, prog, vers, proc, cred, verf # Caller must add procedure-specific part of call
e6b5917a3f1232d3676928a6fb5ae07cc948f164 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e6b5917a3f1232d3676928a6fb5ae07cc948f164/rpc.py
if temp <> CALL:
if temp != CALL:
def unpack_callheader(self): xid = self.unpack_uint(xid) temp = self.unpack_enum() if temp <> CALL: raise BadRPCFormat, 'no CALL but %r' % (temp,) temp = self.unpack_uint() if temp <> RPCVERSION: raise BadRPCVerspion, 'bad RPC version %r' % (temp,) prog = self.unpack_uint() vers = self.unpack_uint() proc = self.unpack_uint() cred = self.unpack_auth() verf = self.unpack_auth() return xid, prog, vers, proc, cred, verf # Caller must add procedure-specific part of call
e6b5917a3f1232d3676928a6fb5ae07cc948f164 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e6b5917a3f1232d3676928a6fb5ae07cc948f164/rpc.py
if temp <> RPCVERSION: raise BadRPCVerspion, 'bad RPC version %r' % (temp,)
if temp != RPCVERSION: raise BadRPCVersion, 'bad RPC version %r' % (temp,)
def unpack_callheader(self): xid = self.unpack_uint(xid) temp = self.unpack_enum() if temp <> CALL: raise BadRPCFormat, 'no CALL but %r' % (temp,) temp = self.unpack_uint() if temp <> RPCVERSION: raise BadRPCVerspion, 'bad RPC version %r' % (temp,) prog = self.unpack_uint() vers = self.unpack_uint() proc = self.unpack_uint() cred = self.unpack_auth() verf = self.unpack_auth() return xid, prog, vers, proc, cred, verf # Caller must add procedure-specific part of call
e6b5917a3f1232d3676928a6fb5ae07cc948f164 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e6b5917a3f1232d3676928a6fb5ae07cc948f164/rpc.py
if mtype <> REPLY:
if mtype != REPLY:
def unpack_replyheader(self): xid = self.unpack_uint() mtype = self.unpack_enum() if mtype <> REPLY: raise RuntimeError, 'no REPLY but %r' % (mtype,) stat = self.unpack_enum() if stat == MSG_DENIED: stat = self.unpack_enum() if stat == RPC_MISMATCH: low = self.unpack_uint() high = self.unpack_uint() raise RuntimeError, \ 'MSG_DENIED: RPC_MISMATCH: %r' % ((low, high),) if stat == AUTH_ERROR: stat = self.unpack_uint() raise RuntimeError, \ 'MSG_DENIED: AUTH_ERROR: %r' % (stat,) raise RuntimeError, 'MSG_DENIED: %r' % (stat,) if stat <> MSG_ACCEPTED: raise RuntimeError, \ 'Neither MSG_DENIED nor MSG_ACCEPTED: %r' % (stat,) verf = self.unpack_auth() stat = self.unpack_enum() if stat == PROG_UNAVAIL: raise RuntimeError, 'call failed: PROG_UNAVAIL' if stat == PROG_MISMATCH: low = self.unpack_uint() high = self.unpack_uint() raise RuntimeError, \ 'call failed: PROG_MISMATCH: %r' % ((low, high),) if stat == PROC_UNAVAIL: raise RuntimeError, 'call failed: PROC_UNAVAIL' if stat == GARBAGE_ARGS: raise RuntimeError, 'call failed: GARBAGE_ARGS' if stat <> SUCCESS: raise RuntimeError, 'call failed: %r' % (stat,) return xid, verf # Caller must get procedure-specific part of reply
e6b5917a3f1232d3676928a6fb5ae07cc948f164 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e6b5917a3f1232d3676928a6fb5ae07cc948f164/rpc.py
if stat <> MSG_ACCEPTED:
if stat != MSG_ACCEPTED:
def unpack_replyheader(self): xid = self.unpack_uint() mtype = self.unpack_enum() if mtype <> REPLY: raise RuntimeError, 'no REPLY but %r' % (mtype,) stat = self.unpack_enum() if stat == MSG_DENIED: stat = self.unpack_enum() if stat == RPC_MISMATCH: low = self.unpack_uint() high = self.unpack_uint() raise RuntimeError, \ 'MSG_DENIED: RPC_MISMATCH: %r' % ((low, high),) if stat == AUTH_ERROR: stat = self.unpack_uint() raise RuntimeError, \ 'MSG_DENIED: AUTH_ERROR: %r' % (stat,) raise RuntimeError, 'MSG_DENIED: %r' % (stat,) if stat <> MSG_ACCEPTED: raise RuntimeError, \ 'Neither MSG_DENIED nor MSG_ACCEPTED: %r' % (stat,) verf = self.unpack_auth() stat = self.unpack_enum() if stat == PROG_UNAVAIL: raise RuntimeError, 'call failed: PROG_UNAVAIL' if stat == PROG_MISMATCH: low = self.unpack_uint() high = self.unpack_uint() raise RuntimeError, \ 'call failed: PROG_MISMATCH: %r' % ((low, high),) if stat == PROC_UNAVAIL: raise RuntimeError, 'call failed: PROC_UNAVAIL' if stat == GARBAGE_ARGS: raise RuntimeError, 'call failed: GARBAGE_ARGS' if stat <> SUCCESS: raise RuntimeError, 'call failed: %r' % (stat,) return xid, verf # Caller must get procedure-specific part of reply
e6b5917a3f1232d3676928a6fb5ae07cc948f164 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e6b5917a3f1232d3676928a6fb5ae07cc948f164/rpc.py
if stat <> SUCCESS:
if stat != SUCCESS:
def unpack_replyheader(self): xid = self.unpack_uint() mtype = self.unpack_enum() if mtype <> REPLY: raise RuntimeError, 'no REPLY but %r' % (mtype,) stat = self.unpack_enum() if stat == MSG_DENIED: stat = self.unpack_enum() if stat == RPC_MISMATCH: low = self.unpack_uint() high = self.unpack_uint() raise RuntimeError, \ 'MSG_DENIED: RPC_MISMATCH: %r' % ((low, high),) if stat == AUTH_ERROR: stat = self.unpack_uint() raise RuntimeError, \ 'MSG_DENIED: AUTH_ERROR: %r' % (stat,) raise RuntimeError, 'MSG_DENIED: %r' % (stat,) if stat <> MSG_ACCEPTED: raise RuntimeError, \ 'Neither MSG_DENIED nor MSG_ACCEPTED: %r' % (stat,) verf = self.unpack_auth() stat = self.unpack_enum() if stat == PROG_UNAVAIL: raise RuntimeError, 'call failed: PROG_UNAVAIL' if stat == PROG_MISMATCH: low = self.unpack_uint() high = self.unpack_uint() raise RuntimeError, \ 'call failed: PROG_MISMATCH: %r' % ((low, high),) if stat == PROC_UNAVAIL: raise RuntimeError, 'call failed: PROC_UNAVAIL' if stat == GARBAGE_ARGS: raise RuntimeError, 'call failed: GARBAGE_ARGS' if stat <> SUCCESS: raise RuntimeError, 'call failed: %r' % (stat,) return xid, verf # Caller must get procedure-specific part of reply
e6b5917a3f1232d3676928a6fb5ae07cc948f164 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e6b5917a3f1232d3676928a6fb5ae07cc948f164/rpc.py
if errno <> 114:
if errno != 114:
def bindresvport(sock, host): global last_resv_port_tried FIRST, LAST = 600, 1024 # Range of ports to try if last_resv_port_tried == None: import os last_resv_port_tried = FIRST + os.getpid() % (LAST-FIRST) for i in range(last_resv_port_tried, LAST) + \ range(FIRST, last_resv_port_tried): last_resv_port_tried = i try: sock.bind((host, i)) return last_resv_port_tried except socket.error, (errno, msg): if errno <> 114: raise socket.error, (errno, msg) raise RuntimeError, 'can\'t assign reserved port'
e6b5917a3f1232d3676928a6fb5ae07cc948f164 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e6b5917a3f1232d3676928a6fb5ae07cc948f164/rpc.py
if xid <> self.lastxid:
if xid != self.lastxid:
def do_call(self): call = self.packer.get_buf() sendrecord(self.sock, call) reply = recvrecord(self.sock) u = self.unpacker u.reset(reply) xid, verf = u.unpack_replyheader() if xid <> self.lastxid: # Can't really happen since this is TCP... raise RuntimeError, 'wrong xid in reply %r instead of %r' % ( xid, self.lastxid)
e6b5917a3f1232d3676928a6fb5ae07cc948f164 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e6b5917a3f1232d3676928a6fb5ae07cc948f164/rpc.py
if xid <> self.lastxid:
if xid != self.lastxid:
def do_call(self): call = self.packer.get_buf() self.sock.send(call) try: from select import select except ImportError: print 'WARNING: select not found, RPC may hang' select = None BUFSIZE = 8192 # Max UDP buffer size timeout = 1 count = 5 while 1: r, w, x = [self.sock], [], [] if select: r, w, x = select(r, w, x, timeout) if self.sock not in r: count = count - 1 if count < 0: raise RuntimeError, 'timeout' if timeout < 25: timeout = timeout *2
e6b5917a3f1232d3676928a6fb5ae07cc948f164 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e6b5917a3f1232d3676928a6fb5ae07cc948f164/rpc.py
if xid <> self.lastxid:
if xid != self.lastxid:
def dummy(): pass
e6b5917a3f1232d3676928a6fb5ae07cc948f164 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e6b5917a3f1232d3676928a6fb5ae07cc948f164/rpc.py
if temp <> CALL:
if temp != CALL:
def handle(self, call): # Don't use unpack_header but parse the header piecewise # XXX I have no idea if I am using the right error responses! self.unpacker.reset(call) self.packer.reset() xid = self.unpacker.unpack_uint() self.packer.pack_uint(xid) temp = self.unpacker.unpack_enum() if temp <> CALL: return None # Not worthy of a reply self.packer.pack_uint(REPLY) temp = self.unpacker.unpack_uint() if temp <> RPCVERSION: self.packer.pack_uint(MSG_DENIED) self.packer.pack_uint(RPC_MISMATCH) self.packer.pack_uint(RPCVERSION) self.packer.pack_uint(RPCVERSION) return self.packer.get_buf() self.packer.pack_uint(MSG_ACCEPTED) self.packer.pack_auth((AUTH_NULL, make_auth_null())) prog = self.unpacker.unpack_uint() if prog <> self.prog: self.packer.pack_uint(PROG_UNAVAIL) return self.packer.get_buf() vers = self.unpacker.unpack_uint() if vers <> self.vers: self.packer.pack_uint(PROG_MISMATCH) self.packer.pack_uint(self.vers) self.packer.pack_uint(self.vers) return self.packer.get_buf() proc = self.unpacker.unpack_uint() methname = 'handle_' + repr(proc) try: meth = getattr(self, methname) except AttributeError: self.packer.pack_uint(PROC_UNAVAIL) return self.packer.get_buf() cred = self.unpacker.unpack_auth() verf = self.unpacker.unpack_auth() try: meth() # Unpack args, call turn_around(), pack reply except (EOFError, GarbageArgs): # Too few or too many arguments self.packer.reset() self.packer.pack_uint(xid) self.packer.pack_uint(REPLY) self.packer.pack_uint(MSG_ACCEPTED) self.packer.pack_auth((AUTH_NULL, make_auth_null())) self.packer.pack_uint(GARBAGE_ARGS) return self.packer.get_buf()
e6b5917a3f1232d3676928a6fb5ae07cc948f164 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e6b5917a3f1232d3676928a6fb5ae07cc948f164/rpc.py