rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
raise norm_error, 'Cannot use :: immedeately after volume name'
raise norm_error, 'Cannot use :: immediately after volume name'
def normpath(s): """Normalize a pathname. Will return the same result for equivalent paths.""" if ":" not in s: return ":"+s comps = s.split(":") i = 1 while i < len(comps)-1: if comps[i] == "" and comps[i-1] != "": if i > 1: del comps[i-1:i+1] i = i - 1 else: # best way to handle this is to raise an exception raise norm_error, 'Cannot use :: immedeately after volume name' else: i = i + 1 s = ":".join(comps) # remove trailing ":" except for ":" and "Volume:" if s[-1] == ":" and len(comps) > 2 and s != ":"*len(s): s = s[:-1] return s
034cbf135049fc74218a0daeb555ed597d991f3a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/034cbf135049fc74218a0daeb555ed597d991f3a/macpath.py
if hasattr(x, 'im_func'): x = x.im_func if hasattr(x, 'func_code'): x = x.func_code if hasattr(x, 'co_code'): disassemble(x) else: raise TypeError, \ "don't know how to disassemble %s objects" % \ type(x).__name__
raise TypeError, \ "don't know how to disassemble %s objects" % \ type(x).__name__
def dis(x=None): """Disassemble classes, methods, functions, or code. With no argument, disassemble the last traceback. """ if not x: distb() return if type(x) is types.InstanceType: x = x.__class__ if hasattr(x, '__dict__'): items = x.__dict__.items() items.sort() for name, x1 in items: if type(x1) in (types.MethodType, types.FunctionType, types.CodeType): print "Disassembly of %s:" % name try: dis(x1) except TypeError, msg: print "Sorry:", msg print else: if hasattr(x, 'im_func'): x = x.im_func if hasattr(x, 'func_code'): x = x.func_code if hasattr(x, 'co_code'): disassemble(x) else: raise TypeError, \ "don't know how to disassemble %s objects" % \ type(x).__name__
fc53c13dd5de26fa862c812a18b6f36bbee60ea0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/fc53c13dd5de26fa862c812a18b6f36bbee60ea0/dis.py
if sys.platform == 'win32':
if sys.platform == 'win32' or sys.platform.startswith('os2'):
def getpager(): """Decide what method to use for paging through text.""" if type(sys.stdout) is not types.FileType: return plainpager if not sys.stdin.isatty() or not sys.stdout.isatty(): return plainpager if os.environ.get('TERM') in ['dumb', 'emacs']: return plainpager if os.environ.has_key('PAGER'): if sys.platform == 'win32': # pipes completely broken in Windows return lambda text: tempfilepager(plain(text), os.environ['PAGER']) elif os.environ.get('TERM') in ['dumb', 'emacs']: return lambda text: pipepager(plain(text), os.environ['PAGER']) else: return lambda text: pipepager(text, os.environ['PAGER']) if sys.platform == 'win32': return lambda text: tempfilepager(plain(text), 'more <') if hasattr(os, 'system') and os.system('less 2>/dev/null') == 0: return lambda text: pipepager(text, 'less') import tempfile filename = tempfile.mktemp() open(filename, 'w').close() try: if hasattr(os, 'system') and os.system('more %s' % filename) == 0: return lambda text: pipepager(text, 'more') else: return ttypager finally: os.unlink(filename)
54e0eabc2d3343c1ab71f5fb90fdda2f06b606e1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/54e0eabc2d3343c1ab71f5fb90fdda2f06b606e1/pydoc.py
if chunks[0].strip() == '':
if chunks[0].strip() == '' and lines:
def _wrap_chunks(self, chunks): """_wrap_chunks(chunks : [string]) -> [string]
ab73d46e45eae94fb8be040ccb32d3510b8f58fa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ab73d46e45eae94fb8be040ccb32d3510b8f58fa/textwrap.py
"unsupported format character '\000' (0x3000) at index 5")
"unsupported format character '?' (0x3000) at index 5")
def test_exc(formatstr, args, exception, excmsg): try: testformat(formatstr, args) except exception, exc: if str(exc) == excmsg: if verbose: print "yes" else: if verbose: print 'no' print 'Unexpected ', exception, ':', repr(str(exc)) except: if verbose: print 'no' print 'Unexpected exception' raise
c867f74a102a8df376ff55ca4dd9dc9055d16141 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c867f74a102a8df376ff55ca4dd9dc9055d16141/test_format.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:
96b07a9453cea31e40ee00a69838d4fc29ad3d66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/96b07a9453cea31e40ee00a69838d4fc29ad3d66/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:
96b07a9453cea31e40ee00a69838d4fc29ad3d66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/96b07a9453cea31e40ee00a69838d4fc29ad3d66/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:
96b07a9453cea31e40ee00a69838d4fc29ad3d66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/96b07a9453cea31e40ee00a69838d4fc29ad3d66/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:
96b07a9453cea31e40ee00a69838d4fc29ad3d66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/96b07a9453cea31e40ee00a69838d4fc29ad3d66/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:
96b07a9453cea31e40ee00a69838d4fc29ad3d66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/96b07a9453cea31e40ee00a69838d4fc29ad3d66/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:
96b07a9453cea31e40ee00a69838d4fc29ad3d66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/96b07a9453cea31e40ee00a69838d4fc29ad3d66/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:
96b07a9453cea31e40ee00a69838d4fc29ad3d66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/96b07a9453cea31e40ee00a69838d4fc29ad3d66/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:
96b07a9453cea31e40ee00a69838d4fc29ad3d66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/96b07a9453cea31e40ee00a69838d4fc29ad3d66/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)
96b07a9453cea31e40ee00a69838d4fc29ad3d66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/96b07a9453cea31e40ee00a69838d4fc29ad3d66/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"])
96b07a9453cea31e40ee00a69838d4fc29ad3d66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/96b07a9453cea31e40ee00a69838d4fc29ad3d66/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"])
96b07a9453cea31e40ee00a69838d4fc29ad3d66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/96b07a9453cea31e40ee00a69838d4fc29ad3d66/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"])
96b07a9453cea31e40ee00a69838d4fc29ad3d66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/96b07a9453cea31e40ee00a69838d4fc29ad3d66/latex2esis.py
raise ValueError, "overflow in number field"
raise ValueError("overflow in number field")
def itn(n, digits=8, posix=False): """Convert a python number to a number field. """ # POSIX 1003.1-1988 requires numbers to be encoded as a string of # octal digits followed by a null-byte, this allows values up to # (8**(digits-1))-1. GNU tar allows storing numbers greater than # that if necessary. A leading 0200 byte indicates this particular # encoding, the following digits-1 bytes are a big-endian # representation. This allows values up to (256**(digits-1))-1. if 0 <= n < 8 ** (digits - 1): s = "%0*o" % (digits - 1, n) + NUL else: if posix: raise ValueError, "overflow in number field" if n < 0: # XXX We mimic GNU tar's behaviour with negative numbers, # this could raise OverflowError. n = struct.unpack("L", struct.pack("l", n))[0] s = "" for i in xrange(digits - 1): s = chr(n & 0377) + s n >>= 8 s = chr(0200) + s return s
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise IOError, "end of file reached"
raise IOError("end of file reached")
def copyfileobj(src, dst, length=None): """Copy length bytes from fileobj src to fileobj dst. If length is None, copy the entire content. """ if length == 0: return if length is None: shutil.copyfileobj(src, dst) return BUFSIZE = 16 * 1024 blocks, remainder = divmod(length, BUFSIZE) for b in xrange(blocks): buf = src.read(BUFSIZE) if len(buf) < BUFSIZE: raise IOError, "end of file reached" dst.write(buf) if remainder != 0: buf = src.read(remainder) if len(buf) < remainder: raise IOError, "end of file reached" dst.write(buf) return
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise IOError, "end of file reached"
raise IOError("end of file reached")
def copyfileobj(src, dst, length=None): """Copy length bytes from fileobj src to fileobj dst. If length is None, copy the entire content. """ if length == 0: return if length is None: shutil.copyfileobj(src, dst) return BUFSIZE = 16 * 1024 blocks, remainder = divmod(length, BUFSIZE) for b in xrange(blocks): buf = src.read(BUFSIZE) if len(buf) < BUFSIZE: raise IOError, "end of file reached" dst.write(buf) if remainder != 0: buf = src.read(remainder) if len(buf) < remainder: raise IOError, "end of file reached" dst.write(buf) return
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise CompressionError, "zlib module is not available"
raise CompressionError("zlib module is not available")
def __init__(self, name, mode, comptype, fileobj, bufsize): """Construct a _Stream object. """ self._extfileobj = True if fileobj is None: fileobj = _LowLevelFile(name, mode) self._extfileobj = False
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise CompressionError, "bz2 module is not available"
raise CompressionError("bz2 module is not available")
def __init__(self, name, mode, comptype, fileobj, bufsize): """Construct a _Stream object. """ self._extfileobj = True if fileobj is None: fileobj = _LowLevelFile(name, mode) self._extfileobj = False
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise ReadError, "not a gzip file"
raise ReadError("not a gzip file")
def _init_read_gz(self): """Initialize for reading a gzip compressed fileobj. """ self.cmp = self.zlib.decompressobj(-self.zlib.MAX_WBITS) self.dbuf = ""
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise CompressionError, "unsupported compression method"
raise CompressionError("unsupported compression method")
def _init_read_gz(self): """Initialize for reading a gzip compressed fileobj. """ self.cmp = self.zlib.decompressobj(-self.zlib.MAX_WBITS) self.dbuf = ""
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise StreamError, "seeking backwards is not allowed"
raise StreamError("seeking backwards is not allowed")
def seek(self, pos=0): """Set the stream's file pointer to pos. Negative seeking is forbidden. """ if pos - self.pos >= 0: blocks, remainder = divmod(pos - self.pos, self.bufsize) for i in xrange(blocks): self.read(self.bufsize) self.read(remainder) else: raise StreamError, "seeking backwards is not allowed" return self.pos
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise ValueError, "file is closed"
raise ValueError("file is closed")
def _readnormal(self, size=None): """Read operation for regular files. """ if self.closed: raise ValueError, "file is closed" self.fileobj.seek(self.offset + self.pos) bytesleft = self.size - self.pos if size is None: bytestoread = bytesleft else: bytestoread = min(size, bytesleft) self.pos += bytestoread return self.__read(bytestoread)
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise ValueError, "file is closed"
raise ValueError("file is closed")
def _readsparse(self, size=None): """Read operation for sparse files. """ if self.closed: raise ValueError, "file is closed"
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise ValueError, "I/O operation on closed file"
raise ValueError("I/O operation on closed file")
def __iter__(self): """Get an iterator over the file object. """ if self.closed: raise ValueError, "I/O operation on closed file" return self
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise ValueError, "truncated header"
raise ValueError("truncated header")
def frombuf(cls, buf): """Construct a TarInfo object from a 512 byte string buffer. """ if len(buf) != BLOCKSIZE: raise ValueError, "truncated header" if buf.count(NUL) == BLOCKSIZE: raise ValueError, "empty header"
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise ValueError, "empty header"
raise ValueError("empty header")
def frombuf(cls, buf): """Construct a TarInfo object from a 512 byte string buffer. """ if len(buf) != BLOCKSIZE: raise ValueError, "truncated header" if buf.count(NUL) == BLOCKSIZE: raise ValueError, "empty header"
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise ValueError, "invalid header"
raise ValueError("invalid header")
def frombuf(cls, buf): """Construct a TarInfo object from a 512 byte string buffer. """ if len(buf) != BLOCKSIZE: raise ValueError, "truncated header" if buf.count(NUL) == BLOCKSIZE: raise ValueError, "empty header"
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise ValueError, "mode must be 'r', 'a' or 'w'"
raise ValueError("mode must be 'r', 'a' or 'w'")
def __init__(self, name=None, mode="r", fileobj=None): """Open an (uncompressed) tar archive `name'. `mode' is either 'r' to read from an existing archive, 'a' to append data to an existing file or 'w' to create a new file overwriting an existing one. `mode' defaults to 'r'. If `fileobj' is given, it is used for reading or writing data. If it can be determined, `mode' is overridden by `fileobj's mode. `fileobj' is not closed, when TarFile is closed. """ self.name = name
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise ValueError, "nothing to open"
raise ValueError("nothing to open")
def open(cls, name=None, mode="r", fileobj=None, bufsize=20*512): """Open a tar archive for reading, writing or appending. Return an appropriate TarFile class.
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise ReadError, "file could not be opened successfully"
raise ReadError("file could not be opened successfully")
def open(cls, name=None, mode="r", fileobj=None, bufsize=20*512): """Open a tar archive for reading, writing or appending. Return an appropriate TarFile class.
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise CompressionError, "unknown compression type %r" % comptype
raise CompressionError("unknown compression type %r" % comptype)
def open(cls, name=None, mode="r", fileobj=None, bufsize=20*512): """Open a tar archive for reading, writing or appending. Return an appropriate TarFile class.
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise ValueError, "mode must be 'r' or 'w'"
raise ValueError("mode must be 'r' or 'w'")
def open(cls, name=None, mode="r", fileobj=None, bufsize=20*512): """Open a tar archive for reading, writing or appending. Return an appropriate TarFile class.
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise ValueError, "undiscernible mode"
raise ValueError("undiscernible mode")
def open(cls, name=None, mode="r", fileobj=None, bufsize=20*512): """Open a tar archive for reading, writing or appending. Return an appropriate TarFile class.
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise ValueError, "mode must be 'r', 'a' or 'w'"
raise ValueError("mode must be 'r', 'a' or 'w'")
def taropen(cls, name, mode="r", fileobj=None): """Open uncompressed tar archive name for reading or writing. """ if len(mode) > 1 or mode not in "raw": raise ValueError, "mode must be 'r', 'a' or 'w'" return cls(name, mode, fileobj)
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise ValueError, "mode must be 'r' or 'w'"
raise ValueError("mode must be 'r' or 'w'")
def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9): """Open gzip compressed tar archive name for reading or writing. Appending is not allowed. """ if len(mode) > 1 or mode not in "rw": raise ValueError, "mode must be 'r' or 'w'"
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise CompressionError, "gzip module is not available"
raise CompressionError("gzip module is not available")
def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9): """Open gzip compressed tar archive name for reading or writing. Appending is not allowed. """ if len(mode) > 1 or mode not in "rw": raise ValueError, "mode must be 'r' or 'w'"
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise ReadError, "not a gzip file"
raise ReadError("not a gzip file")
def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9): """Open gzip compressed tar archive name for reading or writing. Appending is not allowed. """ if len(mode) > 1 or mode not in "rw": raise ValueError, "mode must be 'r' or 'w'"
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise ValueError, "mode must be 'r' or 'w'."
raise ValueError("mode must be 'r' or 'w'.")
def bz2open(cls, name, mode="r", fileobj=None, compresslevel=9): """Open bzip2 compressed tar archive name for reading or writing. Appending is not allowed. """ if len(mode) > 1 or mode not in "rw": raise ValueError, "mode must be 'r' or 'w'."
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise CompressionError, "bz2 module is not available"
raise CompressionError("bz2 module is not available")
def bz2open(cls, name, mode="r", fileobj=None, compresslevel=9): """Open bzip2 compressed tar archive name for reading or writing. Appending is not allowed. """ if len(mode) > 1 or mode not in "rw": raise ValueError, "mode must be 'r' or 'w'."
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise ReadError, "not a bzip2 file"
raise ReadError("not a bzip2 file")
def bz2open(cls, name, mode="r", fileobj=None, compresslevel=9): """Open bzip2 compressed tar archive name for reading or writing. Appending is not allowed. """ if len(mode) > 1 or mode not in "rw": raise ValueError, "mode must be 'r' or 'w'."
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise KeyError, "filename %r not found" % name
raise KeyError("filename %r not found" % name)
def getmember(self, name): """Return a TarInfo object for member `name'. If `name' can not be found in the archive, KeyError is raised. If a member occurs more than once in the archive, its last occurence is assumed to be the most up-to-date version. """ tarinfo = self._getmember(name) if tarinfo is None: raise KeyError, "filename %r not found" % name return tarinfo
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise ValueError, "file is too large (>= 8 GB)"
raise ValueError("file is too large (>= 8 GB)")
def addfile(self, tarinfo, fileobj=None): """Add the TarInfo object `tarinfo' to the archive. If `fileobj' is given, tarinfo.size bytes are read from it and added to the archive. You can create TarInfo objects using gettarinfo(). On Windows platforms, `fileobj' should always be opened with mode 'rb' to avoid irritation about the file size. """ self._check("aw")
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise ValueError, "linkname is too long (>%d)" \ % (LENGTH_LINK)
raise ValueError("linkname is too long (>%d)" % (LENGTH_LINK))
def addfile(self, tarinfo, fileobj=None): """Add the TarInfo object `tarinfo' to the archive. If `fileobj' is given, tarinfo.size bytes are read from it and added to the archive. You can create TarInfo objects using gettarinfo(). On Windows platforms, `fileobj' should always be opened with mode 'rb' to avoid irritation about the file size. """ self._check("aw")
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise ValueError, "name is too long (>%d)" \ % (LENGTH_NAME)
raise ValueError("name is too long (>%d)" % (LENGTH_NAME))
def addfile(self, tarinfo, fileobj=None): """Add the TarInfo object `tarinfo' to the archive. If `fileobj' is given, tarinfo.size bytes are read from it and added to the archive. You can create TarInfo objects using gettarinfo(). On Windows platforms, `fileobj' should always be opened with mode 'rb' to avoid irritation about the file size. """ self._check("aw")
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise StreamError, "cannot extract (sym)link as file object"
raise StreamError("cannot extract (sym)link as file object")
def extractfile(self, member): """Extract a member from the archive as a file object. `member' may be a filename or a TarInfo object. If `member' is a regular file, a file-like object is returned. If `member' is a link, a file-like object is constructed from the link's target. If `member' is none of the above, None is returned. The file-like object is read-only and provides the following methods: read(), readline(), readlines(), seek() and tell() """ self._check("r")
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise ExtractError, "fifo not supported by system"
raise ExtractError("fifo not supported by system")
def makefifo(self, tarinfo, targetpath): """Make a fifo called targetpath. """ if hasattr(os, "mkfifo"): os.mkfifo(targetpath) else: raise ExtractError, "fifo not supported by system"
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise ExtractError, "special devices not supported by system"
raise ExtractError("special devices not supported by system")
def makedev(self, tarinfo, targetpath): """Make a character or block device called targetpath. """ if not hasattr(os, "mknod") or not hasattr(os, "makedev"): raise ExtractError, "special devices not supported by system"
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise IOError, "link could not be created"
raise IOError("link could not be created")
def makelink(self, tarinfo, targetpath): """Make a (symbolic) link called targetpath. If it cannot be created (platform limitation), we try to make a copy of the referenced file instead of a link. """ linkpath = tarinfo.linkname try: if tarinfo.issym(): os.symlink(linkpath, targetpath) else: # See extract(). os.link(tarinfo._link_target, targetpath) except AttributeError: if tarinfo.issym(): linkpath = os.path.join(os.path.dirname(tarinfo.name), linkpath) linkpath = normpath(linkpath)
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise ExtractError, "could not change owner"
raise ExtractError("could not change owner")
def chown(self, tarinfo, targetpath): """Set owner of targetpath according to tarinfo. """ if pwd and hasattr(os, "geteuid") and os.geteuid() == 0: # We have to be root to do so. try: g = grp.getgrnam(tarinfo.gname)[2] except KeyError: try: g = grp.getgrgid(tarinfo.gid)[2] except KeyError: g = os.getgid() try: u = pwd.getpwnam(tarinfo.uname)[2] except KeyError: try: u = pwd.getpwuid(tarinfo.uid)[2] except KeyError: u = os.getuid() try: if tarinfo.issym() and hasattr(os, "lchown"): os.lchown(targetpath, u, g) else: if sys.platform != "os2emx": os.chown(targetpath, u, g) except EnvironmentError, e: raise ExtractError, "could not change owner"
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise ExtractError, "could not change mode"
raise ExtractError("could not change mode")
def chmod(self, tarinfo, targetpath): """Set file permissions of targetpath according to tarinfo. """ if hasattr(os, 'chmod'): try: os.chmod(targetpath, tarinfo.mode) except EnvironmentError, e: raise ExtractError, "could not change mode"
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise ExtractError, "could not change modification time"
raise ExtractError("could not change modification time")
def utime(self, tarinfo, targetpath): """Set modification time of targetpath according to tarinfo. """ if not hasattr(os, 'utime'): return if sys.platform == "win32" and tarinfo.isdir(): # According to msdn.microsoft.com, it is an error (EACCES) # to use utime() on directories. return try: os.utime(targetpath, (tarinfo.mtime, tarinfo.mtime)) except EnvironmentError, e: raise ExtractError, "could not change modification time"
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
self._dbg(2, "0x%X: %s" % (self.offset, e))
self._dbg(2, "0x%X: empty or invalid block: %s" % (self.offset, e))
def next(self): """Return the next member of the archive as a TarInfo object, when TarFile is opened for reading. Return None if there is no more available. """ self._check("ra") if self.firstmember is not None: m = self.firstmember self.firstmember = None return m
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise ReadError, str(e)
raise ReadError("empty, unreadable or compressed " "file: %s" % e)
def next(self): """Return the next member of the archive as a TarInfo object, when TarFile is opened for reading. Return None if there is no more available. """ self._check("ra") if self.firstmember is not None: m = self.firstmember self.firstmember = None return m
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise IOError, "%s is closed" % self.__class__.__name__
raise IOError("%s is closed" % self.__class__.__name__)
def _check(self, mode=None): """Check if TarFile is still open, and if the operation's mode corresponds to TarFile's mode. """ if self.closed: raise IOError, "%s is closed" % self.__class__.__name__ if mode is not None and self._mode not in mode: raise IOError, "bad operation for mode %r" % self._mode
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise IOError, "bad operation for mode %r" % self._mode
raise IOError("bad operation for mode %r" % self._mode)
def _check(self, mode=None): """Check if TarFile is still open, and if the operation's mode corresponds to TarFile's mode. """ if self.closed: raise IOError, "%s is closed" % self.__class__.__name__ if mode is not None and self._mode not in mode: raise IOError, "bad operation for mode %r" % self._mode
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.py
raise ValueError, "unknown compression constant"
raise ValueError("unknown compression constant")
def __init__(self, file, mode="r", compression=TAR_PLAIN): if compression == TAR_PLAIN: self.tarfile = TarFile.taropen(file, mode) elif compression == TAR_GZIPPED: self.tarfile = TarFile.gzopen(file, mode) else: raise ValueError, "unknown compression constant" if mode[0:1] == "r": members = self.tarfile.getmembers() for m in members: m.filename = m.name m.file_size = m.size m.date_time = time.gmtime(m.mtime)[:6]
e4751e3cdc8c271f24e46a6155f255b6e33da158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e4751e3cdc8c271f24e46a6155f255b6e33da158/tarfile.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.
f8950654e3747d569144781bba5281b1551b176c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f8950654e3747d569144781bba5281b1551b176c/test_compiler.py
current_lang = locale.getlocale(locale.LC_TIME)[0] if current_lang: self.__lang = current_lang else: current_lang = locale.getdefaultlocale()[0] if current_lang: self.__lang = current_lang else: self.__lang = ''
self.__lang = _getlang()
def __calc_lang(self): # Set self.__lang by using locale.getlocale() or # locale.getdefaultlocale(). If both turn up empty, set the attribute # to ''. This is to stop calls to this method and to make sure # strptime() can produce an re object correctly. current_lang = locale.getlocale(locale.LC_TIME)[0] if current_lang: self.__lang = current_lang else: current_lang = locale.getdefaultlocale()[0] if current_lang: self.__lang = current_lang else: self.__lang = ''
80cebc16aa800ec5740e4b9c8b6508bae4cca434 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/80cebc16aa800ec5740e4b9c8b6508bae4cca434/_strptime.py
for whitespace in whitespace_string: format = format.replace(whitespace, r'\s*')
whitespace_replacement = re_compile('\s+') format = whitespace_replacement.sub('\s*', format)
def pattern(self, format): """Return re pattern for the format string.""" processed_format = '' for whitespace in whitespace_string: format = format.replace(whitespace, r'\s*') while format.find('%') != -1: directive_index = format.index('%')+1 processed_format = "%s%s%s" % (processed_format, format[:directive_index-1], self[format[directive_index]]) format = format[directive_index+1:] return "%s%s" % (processed_format, format)
80cebc16aa800ec5740e4b9c8b6508bae4cca434 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/80cebc16aa800ec5740e4b9c8b6508bae4cca434/_strptime.py
format = "(?
def compile(self, format): """Return a compiled re object for the format string.""" format = "(?#%s)%s" % (self.locale_time.lang,format) return re_compile(self.pattern(format), IGNORECASE)
80cebc16aa800ec5740e4b9c8b6508bae4cca434 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/80cebc16aa800ec5740e4b9c8b6508bae4cca434/_strptime.py
locale_time = LocaleTime() compiled_re = TimeRE(locale_time).compile(format) found = compiled_re.match(data_string)
global _locale_cache global _regex_cache locale_time = _locale_cache.locale_time if locale_time.lang != _getlang(): _locale_cache = TimeRE() _regex_cache.clear() format_regex = _regex_cache.get(format) if not format_regex: if len(_regex_cache) > 5: _regex_cache.clear() format_regex = _locale_cache.compile(format) _regex_cache[format] = format_regex found = format_regex.match(data_string)
def strptime(data_string, format="%a %b %d %H:%M:%S %Y"): """Return a time struct based on the input data and the format string.""" locale_time = LocaleTime() compiled_re = TimeRE(locale_time).compile(format) found = compiled_re.match(data_string) if not found: raise ValueError("time data did not match format") year = 1900 month = day = 1 hour = minute = second = 0 tz = -1 # Defaulted to -1 so as to signal using functions to calc values weekday = julian = -1 found_dict = found.groupdict() for group_key in found_dict.iterkeys(): if group_key == 'y': year = int(found_dict['y']) # Open Group specification for strptime() states that a %y #value in the range of [00, 68] is in the century 2000, while #[69,99] is in the century 1900 if year <= 68: year += 2000 else: year += 1900 elif group_key == 'Y': year = int(found_dict['Y']) elif group_key == 'm': month = int(found_dict['m']) elif group_key == 'B': month = _insensitiveindex(locale_time.f_month, found_dict['B']) elif group_key == 'b': month = _insensitiveindex(locale_time.a_month, found_dict['b']) elif group_key == 'd': day = int(found_dict['d']) elif group_key is 'H': hour = int(found_dict['H']) elif group_key == 'I': hour = int(found_dict['I']) ampm = found_dict.get('p', '').lower() # If there was no AM/PM indicator, we'll treat this like AM if ampm in ('', locale_time.am_pm[0].lower()): # We're in AM so the hour is correct unless we're # looking at 12 midnight. # 12 midnight == 12 AM == hour 0 if hour == 12: hour = 0 elif ampm == locale_time.am_pm[1].lower(): # We're in PM so we need to add 12 to the hour unless # we're looking at 12 noon. # 12 noon == 12 PM == hour 12 if hour != 12: hour += 12 elif group_key == 'M': minute = int(found_dict['M']) elif group_key == 'S': second = int(found_dict['S']) elif group_key == 'A': weekday = _insensitiveindex(locale_time.f_weekday, found_dict['A']) elif group_key == 'a': weekday = _insensitiveindex(locale_time.a_weekday, found_dict['a']) elif group_key == 'w': weekday = int(found_dict['w']) if weekday == 0: weekday = 6 else: weekday -= 1 elif group_key == 'j': julian = int(found_dict['j']) elif group_key == 'Z': found_zone = found_dict['Z'].lower() if locale_time.timezone[0] == locale_time.timezone[1]: pass #Deals with bad locale setup where timezone info is # the same; first found on FreeBSD 4.4. elif locale_time.timezone[0].lower() == found_zone: tz = 0 elif locale_time.timezone[1].lower() == found_zone: tz = 1 elif locale_time.timezone[2].lower() == found_zone: tz = -1 #XXX <bc>: If calculating fxns are never exposed to the general #populous then just inline calculations. Also might be able to use #``datetime`` and the methods it provides. if julian == -1: julian = julianday(year, month, day) else: # Assuming that if they bothered to include Julian day it will #be accurate year, month, day = gregorian(julian, year) if weekday == -1: weekday = dayofweek(year, month, day) return time.struct_time((year, month, day, hour, minute, second, weekday, julian, tz))
80cebc16aa800ec5740e4b9c8b6508bae4cca434 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/80cebc16aa800ec5740e4b9c8b6508bae4cca434/_strptime.py
return mbcs_encode(input,self.errors)[0]
return mbcs_encode(input, self.errors)[0]
def encode(self, input, final=False): return mbcs_encode(input,self.errors)[0]
961b91bd3c48af639acbf20bbf15a85e7152ff6e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/961b91bd3c48af639acbf20bbf15a85e7152ff6e/mbcs.py
def _buffer_decode(self, input, errors, final): return mbcs_decode(input,self.errors,final)
_buffer_decode = mbcs_decode
def _buffer_decode(self, input, errors, final): return mbcs_decode(input,self.errors,final)
961b91bd3c48af639acbf20bbf15a85e7152ff6e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/961b91bd3c48af639acbf20bbf15a85e7152ff6e/mbcs.py
class StreamWriter(Codec,codecs.StreamWriter): pass
class StreamWriter(codecs.StreamWriter): encode = mbcs_encode
def _buffer_decode(self, input, errors, final): return mbcs_decode(input,self.errors,final)
961b91bd3c48af639acbf20bbf15a85e7152ff6e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/961b91bd3c48af639acbf20bbf15a85e7152ff6e/mbcs.py
class StreamReader(Codec,codecs.StreamReader): pass class StreamConverter(StreamWriter,StreamReader): encode = codecs.mbcs_decode decode = codecs.mbcs_encode
class StreamReader(codecs.StreamReader): decode = mbcs_decode
def _buffer_decode(self, input, errors, final): return mbcs_decode(input,self.errors,final)
961b91bd3c48af639acbf20bbf15a85e7152ff6e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/961b91bd3c48af639acbf20bbf15a85e7152ff6e/mbcs.py
if '@' in localename:
if '@' in code:
def _parse_localename(localename): """ Parses the locale code for localename and returns the result as tuple (language code, encoding). The localename is normalized and passed through the locale alias engine. A ValueError is raised in case the locale name cannot be parsed. The language code corresponds to RFC 1766. code and encoding can be None in case the values cannot be determined or are unknown to this implementation. """ code = normalize(localename) if '@' in localename: # Deal with locale modifiers code, modifier = code.split('@') if modifier == 'euro' and '.' not in code: # Assume Latin-9 for @euro locales. This is bogus, # since some systems may use other encodings for these # locales. Also, we ignore other modifiers. return code, 'iso-8859-15' if '.' in code: return tuple(code.split('.')[:2]) elif code == 'C': return None, None raise ValueError, 'unknown locale: %s' % localename
b709c2caba3c781d0f4602f28227993e565f0a87 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b709c2caba3c781d0f4602f28227993e565f0a87/locale.py
def getpreferredencoding(do_setlocale = True): """Return the charset that the user is likely using, according to the system configuration.""" if do_setlocale: oldloc = setlocale(LC_CTYPE) setlocale(LC_CTYPE, "") result = nl_langinfo(CODESET) setlocale(LC_CTYPE, oldloc) return result else: return nl_langinfo(CODESET)
b709c2caba3c781d0f4602f28227993e565f0a87 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b709c2caba3c781d0f4602f28227993e565f0a87/locale.py
def getpreferredencoding(do_setlocale = True): """Return the charset that the user is likely using, according to the system configuration.""" if do_setlocale: oldloc = setlocale(LC_CTYPE) setlocale(LC_CTYPE, "") result = nl_langinfo(CODESET) setlocale(LC_CTYPE, oldloc) return result else: return nl_langinfo(CODESET)
b709c2caba3c781d0f4602f28227993e565f0a87 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b709c2caba3c781d0f4602f28227993e565f0a87/locale.py
0x0404: "zh_TW", 0x0804: "zh_CN",
0x0436: "af_ZA", 0x041c: "sq_AL", 0x0401: "ar_SA", 0x0801: "ar_IQ", 0x0c01: "ar_EG", 0x1001: "ar_LY", 0x1401: "ar_DZ", 0x1801: "ar_MA", 0x1c01: "ar_TN", 0x2001: "ar_OM", 0x2401: "ar_YE", 0x2801: "ar_SY", 0x2c01: "ar_JO", 0x3001: "ar_LB", 0x3401: "ar_KW", 0x3801: "ar_AE", 0x3c01: "ar_BH", 0x4001: "ar_QA", 0x042b: "hy_AM", 0x042c: "az_AZ", 0x082c: "az_AZ", 0x042d: "eu_ES", 0x0423: "be_BY", 0x0445: "bn_IN", 0x201a: "bs_BA", 0x141a: "bs_BA", 0x047e: "br_FR", 0x0402: "bg_BG", 0x0403: "ca_ES", 0x0004: "zh_CHS", 0x0404: "zh_TW", 0x0804: "zh_CN", 0x0c04: "zh_HK", 0x1004: "zh_SG", 0x1404: "zh_MO", 0x7c04: "zh_CHT", 0x041a: "hr_HR", 0x101a: "hr_BA", 0x0405: "cs_CZ",
def getpreferredencoding(do_setlocale = True): """Return the charset that the user is likely using, according to the system configuration.""" if do_setlocale: oldloc = setlocale(LC_CTYPE) setlocale(LC_CTYPE, "") result = nl_langinfo(CODESET) setlocale(LC_CTYPE, oldloc) return result else: return nl_langinfo(CODESET)
b709c2caba3c781d0f4602f28227993e565f0a87 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b709c2caba3c781d0f4602f28227993e565f0a87/locale.py
0x0413: "nl_NL", 0x0409: "en_US", 0x0809: "en_UK", 0x0c09: "en_AU", 0x1009: "en_CA", 0x1409: "en_NZ", 0x1809: "en_IE", 0x1c09: "en_ZA",
0x048c: "gbz_AF", 0x0465: "div_MV", 0x0413: "nl_NL", 0x0813: "nl_BE", 0x0409: "en_US", 0x0809: "en_GB", 0x0c09: "en_AU", 0x1009: "en_CA", 0x1409: "en_NZ", 0x1809: "en_IE", 0x1c09: "en_ZA", 0x2009: "en_JA", 0x2409: "en_CB", 0x2809: "en_BZ", 0x2c09: "en_TT", 0x3009: "en_ZW", 0x3409: "en_PH", 0x0425: "et_EE", 0x0438: "fo_FO", 0x0464: "fil_PH",
def getpreferredencoding(do_setlocale = True): """Return the charset that the user is likely using, according to the system configuration.""" if do_setlocale: oldloc = setlocale(LC_CTYPE) setlocale(LC_CTYPE, "") result = nl_langinfo(CODESET) setlocale(LC_CTYPE, oldloc) return result else: return nl_langinfo(CODESET)
b709c2caba3c781d0f4602f28227993e565f0a87 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b709c2caba3c781d0f4602f28227993e565f0a87/locale.py
0x040c: "fr_FR", 0x080c: "fr_BE", 0x0c0c: "fr_CA", 0x100c: "fr_CH", 0x0407: "de_DE",
0x040c: "fr_FR", 0x080c: "fr_BE", 0x0c0c: "fr_CA", 0x100c: "fr_CH", 0x140c: "fr_LU", 0x180c: "fr_MC", 0x0462: "fy_NL", 0x0456: "gl_ES", 0x0437: "ka_GE", 0x0407: "de_DE", 0x0807: "de_CH", 0x0c07: "de_AT", 0x1007: "de_LU", 0x1407: "de_LI",
def getpreferredencoding(do_setlocale = True): """Return the charset that the user is likely using, according to the system configuration.""" if do_setlocale: oldloc = setlocale(LC_CTYPE) setlocale(LC_CTYPE, "") result = nl_langinfo(CODESET) setlocale(LC_CTYPE, oldloc) return result else: return nl_langinfo(CODESET)
b709c2caba3c781d0f4602f28227993e565f0a87 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b709c2caba3c781d0f4602f28227993e565f0a87/locale.py
0x040d: "iw_IL",
0x0447: "gu_IN", 0x040d: "he_IL", 0x0439: "hi_IN", 0x040e: "hu_HU",
def getpreferredencoding(do_setlocale = True): """Return the charset that the user is likely using, according to the system configuration.""" if do_setlocale: oldloc = setlocale(LC_CTYPE) setlocale(LC_CTYPE, "") result = nl_langinfo(CODESET) setlocale(LC_CTYPE, oldloc) return result else: return nl_langinfo(CODESET)
b709c2caba3c781d0f4602f28227993e565f0a87 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b709c2caba3c781d0f4602f28227993e565f0a87/locale.py
0x0410: "it_IT", 0x0411: "ja_JA", 0x0414: "no_NO", 0x0816: "pt_PT", 0x0c0a: "es_ES", 0x0441: "sw_KE", 0x041d: "sv_SE", 0x081d: "sv_FI",
0x0421: "id_ID", 0x045d: "iu_CA", 0x085d: "iu_CA", 0x083c: "ga_IE", 0x0434: "xh_ZA", 0x0435: "zu_ZA", 0x0410: "it_IT", 0x0810: "it_CH", 0x0411: "ja_JP", 0x044b: "kn_IN", 0x043f: "kk_KZ", 0x0457: "kok_IN", 0x0412: "ko_KR", 0x0440: "ky_KG", 0x0426: "lv_LV", 0x0427: "lt_LT", 0x046e: "lb_LU", 0x042f: "mk_MK", 0x043e: "ms_MY", 0x083e: "ms_BN", 0x044c: "ml_IN", 0x043a: "mt_MT", 0x0481: "mi_NZ", 0x047a: "arn_CL", 0x044e: "mr_IN", 0x047c: "moh_CA", 0x0450: "mn_MN", 0x0461: "ne_NP", 0x0414: "nb_NO", 0x0814: "nn_NO", 0x0482: "oc_FR", 0x0448: "or_IN", 0x0463: "ps_AF", 0x0429: "fa_IR", 0x0415: "pl_PL", 0x0416: "pt_BR", 0x0816: "pt_PT", 0x0446: "pa_IN", 0x046b: "quz_BO", 0x086b: "quz_EC", 0x0c6b: "quz_PE", 0x0418: "ro_RO", 0x0417: "rm_CH", 0x0419: "ru_RU", 0x243b: "smn_FI", 0x103b: "smj_NO", 0x143b: "smj_SE", 0x043b: "se_NO", 0x083b: "se_SE", 0x0c3b: "se_FI", 0x203b: "sms_FI", 0x183b: "sma_NO", 0x1c3b: "sma_SE", 0x044f: "sa_IN", 0x0c1a: "sr_SP", 0x1c1a: "sr_BA", 0x081a: "sr_SP", 0x181a: "sr_BA", 0x046c: "ns_ZA", 0x0432: "tn_ZA", 0x041b: "sk_SK", 0x0424: "sl_SI", 0x040a: "es_ES", 0x080a: "es_MX", 0x0c0a: "es_ES", 0x100a: "es_GT", 0x140a: "es_CR", 0x180a: "es_PA", 0x1c0a: "es_DO", 0x200a: "es_VE", 0x240a: "es_CO", 0x280a: "es_PE", 0x2c0a: "es_AR", 0x300a: "es_EC", 0x340a: "es_CL", 0x380a: "es_UR", 0x3c0a: "es_PY", 0x400a: "es_BO", 0x440a: "es_SV", 0x480a: "es_HN", 0x4c0a: "es_NI", 0x500a: "es_PR", 0x0441: "sw_KE", 0x041d: "sv_SE", 0x081d: "sv_FI", 0x045a: "syr_SY", 0x0449: "ta_IN", 0x0444: "tt_RU", 0x044a: "te_IN", 0x041e: "th_TH",
def getpreferredencoding(do_setlocale = True): """Return the charset that the user is likely using, according to the system configuration.""" if do_setlocale: oldloc = setlocale(LC_CTYPE) setlocale(LC_CTYPE, "") result = nl_langinfo(CODESET) setlocale(LC_CTYPE, oldloc) return result else: return nl_langinfo(CODESET)
b709c2caba3c781d0f4602f28227993e565f0a87 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b709c2caba3c781d0f4602f28227993e565f0a87/locale.py
return self.socket.recvfrom(max_packet_size)
return self.socket.recvfrom(self.max_packet_size)
def get_request(self):
db2b70cb99377ced6bca4ef96fcfbc1eaa83e0d3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/db2b70cb99377ced6bca4ef96fcfbc1eaa83e0d3/SocketServer.py
if userhome.endswith('/'): i += 1
userhome = userhome.rstrip('/')
def expanduser(path): """Expand ~ and ~user constructions. If user or $HOME is unknown, do nothing.""" if not path.startswith('~'): return path i = path.find('/', 1) if i < 0: i = len(path) if i == 1: if 'HOME' not in os.environ: import pwd userhome = pwd.getpwuid(os.getuid()).pw_dir else: userhome = os.environ['HOME'] else: import pwd try: pwent = pwd.getpwnam(path[1:i]) except KeyError: return path userhome = pwent.pw_dir if userhome.endswith('/'): i += 1 return userhome + path[i:]
8d1e5bffc1249cdb5a8ced25e6f89328e7366290 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8d1e5bffc1249cdb5a8ced25e6f89328e7366290/posixpath.py
tmp = [] def callit(func=func, args=args, self=self, tmp=tmp):
def callit():
def after(self, ms, func=None, *args): """Call function once after given time.
4696ffbf0935519eb457ea6a786f22631a63ffda /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4696ffbf0935519eb457ea6a786f22631a63ffda/Tkinter.py
self.deletecommand(tmp[0])
self.deletecommand(name)
def callit(func=func, args=args, self=self, tmp=tmp): try: func(*args) finally: try: self.deletecommand(tmp[0]) except TclError: pass
4696ffbf0935519eb457ea6a786f22631a63ffda /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4696ffbf0935519eb457ea6a786f22631a63ffda/Tkinter.py
tmp.append(name)
def callit(func=func, args=args, self=self, tmp=tmp): try: func(*args) finally: try: self.deletecommand(tmp[0]) except TclError: pass
4696ffbf0935519eb457ea6a786f22631a63ffda /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4696ffbf0935519eb457ea6a786f22631a63ffda/Tkinter.py
if auth: h.putheader('Authorization: Basic %s' % auth)
if auth: h.putheader('Authorization', 'Basic %s' % auth)
def open_http(self, url): import httplib if type(url) is type(""): host, selector = splithost(url) user_passwd, host = splituser(host) else: host, selector = url urltype, rest = splittype(selector) if string.lower(urltype) == 'http': realhost, rest = splithost(rest) user_passwd, realhost = splituser(realhost) if user_passwd: selector = "%s://%s%s" % (urltype, realhost, rest) print "proxy via http:", host, selector if not host: raise IOError, ('http error', 'no host given') if user_passwd: import base64 auth = string.strip(base64.encodestring(user_passwd)) else: auth = None h = httplib.HTTP(host) h.putrequest('GET', selector) if auth: h.putheader('Authorization: Basic %s' % auth) for args in self.addheaders: apply(h.putheader, args) h.endheaders() errcode, errmsg, headers = h.getreply() fp = h.getfile() if errcode == 200: return addinfourl(fp, headers, self.openedurl) else: return self.http_error(url, fp, errcode, errmsg, headers)
c5d7e80739fdaed472955ca2d3d4933c27ab879b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c5d7e80739fdaed472955ca2d3d4933c27ab879b/urllib.py
return EOFError, "Reached EOF"
raise EOFError, "Reached EOF"
def _read(self, size=1024): if self.fileobj is None: raise EOFError, "Reached EOF"
2d813e514020a9cf74a19e8b4ba0b98996bb24eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2d813e514020a9cf74a19e8b4ba0b98996bb24eb/gzip.py
key = user, passwd, host, port
key = user, host, port, '/'.join(dirs)
def connect_ftp(self, user, passwd, host, port, dirs): key = user, passwd, host, port if key in self.cache: self.timeout[key] = time.time() + self.delay else: self.cache[key] = ftpwrapper(user, passwd, host, port, dirs) self.timeout[key] = time.time() + self.delay self.check_cache() return self.cache[key]
c533c986e8c2a009d3eb49a44c1b6de28fcd982c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c533c986e8c2a009d3eb49a44c1b6de28fcd982c/urllib2.py
test_classes = (TestBasicOps, TestVariousIteratorArgs, TestGC)
test_classes = (TestBasicOps, TestVariousIteratorArgs, TestGC, RegressionTests)
def test_main(verbose=None): test_classes = (TestBasicOps, TestVariousIteratorArgs, TestGC) test_support.run_unittest(*test_classes) # verify reference counting if verbose and hasattr(sys, "gettotalrefcount"): import gc counts = [None] * 5 for i in xrange(len(counts)): test_support.run_unittest(*test_classes) gc.collect() counts[i] = sys.gettotalrefcount() print counts # doctest the examples in the library reference test_support.run_doctest(sys.modules[__name__], verbose)
a56f6b6600ea8906562cfaa31859b72a53a8c0d7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a56f6b6600ea8906562cfaa31859b72a53a8c0d7/test_itertools.py
class _MultiCallMethod: def __init__(self, call_list, name): self.__call_list = call_list self.__name = name def __getattr__(self, name): return _MultiCallMethod(self.__call_list, "%s.%s" % (self.__name, name)) def __call__(self, *args): self.__call_list.append((self.__name, args)) def MultiCallIterator(results): """Iterates over the results of a multicall. Exceptions are thrown in response to xmlrpc faults.""" for i in results: if type(i) == type({}): raise Fault(i['faultCode'], i['faultString']) elif type(i) == type([]): yield i[0] else: raise ValueError,\ "unexpected type in multicall result" class MultiCall: """server -> a object used to boxcar method calls server should be a ServerProxy object. Methods can be added to the MultiCall using normal method call syntax e.g.: multicall = MultiCall(server_proxy) multicall.add(2,3) multicall.get_address("Guido") To execute the multicall, call the MultiCall object e.g.: add_result, address = multicall() """ def __init__(self, server): self.__server = server self.__call_list = [] def __repr__(self): return "<MultiCall at %x>" % id(self) __str__ = __repr__ def __getattr__(self, name): return _MultiCallMethod(self.__call_list, name) def __call__(self): marshalled_list = [] for name, args in self.__call_list: marshalled_list.append({'methodName' : name, 'params' : args}) return MultiCallIterator(self.__server.system.multicall(marshalled_list))
def end_methodName(self, data): if self._encoding: data = _decode(data, self._encoding) self._methodname = data self._type = "methodName" # no params
45394c281d09de67e16be0d56ff04ddb5b6f6011 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/45394c281d09de67e16be0d56ff04ddb5b6f6011/xmlrpclib.py
def __repr__(self): return ( "<ServerProxy for %s%s>" % (self.__host, self.__handler) )
45394c281d09de67e16be0d56ff04ddb5b6f6011 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/45394c281d09de67e16be0d56ff04ddb5b6f6011/xmlrpclib.py
self.libs = None
self.libraries = None
self.undef = None
cdb20ba56d1c14cdf5a90df2b0cfc94d869c2e55 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cdb20ba56d1c14cdf5a90df2b0cfc94d869c2e55/build_ext.py
if type (self.libs) is StringType: self.libs = [self.libs]
if type (self.libraries) is StringType: self.libraries = [self.libraries]
def finalize_options (self): from distutils import sysconfig
cdb20ba56d1c14cdf5a90df2b0cfc94d869c2e55 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cdb20ba56d1c14cdf5a90df2b0cfc94d869c2e55/build_ext.py
if self.libs is not None: self.compiler.set_libraries (self.libs)
if self.libraries is not None: self.compiler.set_libraries (self.libraries)
if self.undef is not None: for macro in self.undef: self.compiler.undefine_macro (macro)
cdb20ba56d1c14cdf5a90df2b0cfc94d869c2e55 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cdb20ba56d1c14cdf5a90df2b0cfc94d869c2e55/build_ext.py
if self.distribution.libraries: build_clib = self.find_peer ('build_clib') self.libraries = build_clib.get_library_names () or [] self.library_dirs = [build_clib.build_clib] else: self.libraries = [] self.library_dirs = []
if self.undef is not None: for macro in self.undef: self.compiler.undefine_macro (macro)
cdb20ba56d1c14cdf5a90df2b0cfc94d869c2e55 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cdb20ba56d1c14cdf5a90df2b0cfc94d869c2e55/build_ext.py
libraries = (self.libraries + (build_info.get ('libraries') or [])) library_dirs = (self.library_dirs + (build_info.get ('library_dirs') or []))
libraries = build_info.get ('libraries') library_dirs = build_info.get ('library_dirs') rpath = build_info.get ('rpath')
def build_extensions (self, extensions):
cdb20ba56d1c14cdf5a90df2b0cfc94d869c2e55 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cdb20ba56d1c14cdf5a90df2b0cfc94d869c2e55/build_ext.py
self.compiler = new_compiler (compiler=self.compiler,
self.compiler = new_compiler ( compiler="msvc",
def run (self):
f46a688e847dfc6a560ada112c1b3eec1fb74c4d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f46a688e847dfc6a560ada112c1b3eec1fb74c4d/build_ext.py
self.precompile_hook()
def build_extensions (self):
f46a688e847dfc6a560ada112c1b3eec1fb74c4d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f46a688e847dfc6a560ada112c1b3eec1fb74c4d/build_ext.py
self.prelink_hook()
if self.compiler.compiler_type == 'msvc': self.msvc_prelink_hack(sources, ext, extra_args)
def build_extensions (self):
f46a688e847dfc6a560ada112c1b3eec1fb74c4d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f46a688e847dfc6a560ada112c1b3eec1fb74c4d/build_ext.py
def precompile_hook (self): pass def prelink_hook (self):
def msvc_prelink_hack (self, sources, ext, extra_args):
def find_swig (self): """Return the name of the SWIG executable. On Unix, this is just "swig" -- it should be in the PATH. Tries a bit harder on Windows. """
f46a688e847dfc6a560ada112c1b3eec1fb74c4d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f46a688e847dfc6a560ada112c1b3eec1fb74c4d/build_ext.py
if self.compiler.compiler_type == 'msvc': def_file = ext.export_symbol_file if def_file is None: source_dir = os.path.dirname (sources[0]) ext_base = (string.split (ext.name, '.'))[-1] def_file = os.path.join (source_dir, "%s.def" % ext_base) if not os.path.exists (def_file): def_file = None if def_file is not None: extra_args.append ('/DEF:' + def_file) else: modname = string.split (ext.name, '.')[-1] extra_args.append('/export:init%s'%modname) implib_file = os.path.join ( self.build_temp, self.get_ext_libname (ext.name)) extra_args.append ('/IMPLIB:' + implib_file) self.mkpath (os.path.dirname (implib_file))
def_file = ext.export_symbol_file if def_file is None: source_dir = os.path.dirname (sources[0]) ext_base = (string.split (ext.name, '.'))[-1] def_file = os.path.join (source_dir, "%s.def" % ext_base) if not os.path.exists (def_file): def_file = None if def_file is not None: extra_args.append ('/DEF:' + def_file) else: modname = string.split (ext.name, '.')[-1] extra_args.append('/export:init%s' % modname) implib_file = os.path.join ( self.build_temp, self.get_ext_libname (ext.name)) extra_args.append ('/IMPLIB:' + implib_file) self.mkpath (os.path.dirname (implib_file))
def prelink_hook (self):
f46a688e847dfc6a560ada112c1b3eec1fb74c4d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f46a688e847dfc6a560ada112c1b3eec1fb74c4d/build_ext.py
effective = (effective / tabwidth + 1) * tabwidth
effective = (int(effective / tabwidth) + 1) * tabwidth
def classifyws(s, tabwidth): raw = effective = 0 for ch in s: if ch == ' ': raw = raw + 1 effective = effective + 1 elif ch == '\t': raw = raw + 1 effective = (effective / tabwidth + 1) * tabwidth else: break return raw, effective
d91b0d6a65a0b6d0935a4e3ea131fa78c43a690d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d91b0d6a65a0b6d0935a4e3ea131fa78c43a690d/AutoIndent.py
self.sock.send(data)
bytes = len(data) while bytes > 0: sent = self.sock.send(data) if sent == bytes: break data = data[sent:] bytes = bytes - sent
def send(self, data): """Send data to remote.""" self.sock.send(data)
0402dd18cb025b7510760142087c97729702e23a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0402dd18cb025b7510760142087c97729702e23a/imaplib.py