rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
import tempfile filename = tempfile.mktemp() self.__tempfiles.append(filename)
import tempfile filename = tempfile.mktemp() self.__tempfiles.append(filename)
def retrieve(self, url, filename=None): url = unwrap(url) if self.tempcache and self.tempcache.has_key(url): return self.tempcache[url] type, url1 = splittype(url) if not filename and (not type or type == 'file'): try: fp = self.open_local_file(url1) del fp return url2pathname(splithost(url1)[1]), None except IOError, ...
fcea3a44cb5bc4ca94c174353aba37f481e83a11 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fcea3a44cb5bc4ca94c174353aba37f481e83a11/urllib.py
realhost = None
realhost = None
def open_http(self, url, data=None): import httplib if type(url) is type(""): host, selector = splithost(url) user_passwd, host = splituser(host) realhost = host else: host, selector = url urltype, rest = splittype(selector) user_passwd = None if string.lower(urltype) != 'http': realhost = None else: realhost, rest = s...
fcea3a44cb5bc4ca94c174353aba37f481e83a11 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fcea3a44cb5bc4ca94c174353aba37f481e83a11/urllib.py
realhost, rest = splithost(rest) user_passwd, realhost = splituser(realhost) if user_passwd: selector = "%s://%s%s" % (urltype, realhost, rest)
realhost, rest = splithost(rest) user_passwd, realhost = splituser(realhost) if user_passwd: selector = "%s://%s%s" % (urltype, realhost, rest)
def open_http(self, url, data=None): import httplib if type(url) is type(""): host, selector = splithost(url) user_passwd, host = splituser(host) realhost = host else: host, selector = url urltype, rest = splittype(selector) user_passwd = None if string.lower(urltype) != 'http': realhost = None else: realhost, rest = s...
fcea3a44cb5bc4ca94c174353aba37f481e83a11 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fcea3a44cb5bc4ca94c174353aba37f481e83a11/urllib.py
if url[:2] == '//' and url[2:3] != '/': return self.open_ftp(url) else: return self.open_local_file(url)
if url[:2] == '//' and url[2:3] != '/': return self.open_ftp(url) else: return self.open_local_file(url)
def open_file(self, url): if url[:2] == '//' and url[2:3] != '/': return self.open_ftp(url) else: return self.open_local_file(url)
fcea3a44cb5bc4ca94c174353aba37f481e83a11 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fcea3a44cb5bc4ca94c174353aba37f481e83a11/urllib.py
return addinfourl(fp, headers, "http:" + url)
return addinfourl(fp, headers, "http:" + url)
def http_error_default(self, url, fp, errcode, errmsg, headers): return addinfourl(fp, headers, "http:" + url)
fcea3a44cb5bc4ca94c174353aba37f481e83a11 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fcea3a44cb5bc4ca94c174353aba37f481e83a11/urllib.py
scheme, realm = match.groups()
scheme, realm = match.groups()
def http_error_401(self, url, fp, errcode, errmsg, headers): if headers.has_key('www-authenticate'): stuff = headers['www-authenticate'] import re match = re.match( '[ \t]*([^ \t]+)[ \t]+realm="([^"]*)"', stuff) if match: scheme, realm = match.groups() if string.lower(scheme) == 'basic': return self.retry_http_basic_au...
fcea3a44cb5bc4ca94c174353aba37f481e83a11 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fcea3a44cb5bc4ca94c174353aba37f481e83a11/urllib.py
import re _typeprog = re.compile('^([^/:]+):') match = _typeprog.match(url)
import re _typeprog = re.compile('^([^/:]+):') match = _typeprog.match(url)
def splittype(url): global _typeprog if _typeprog is None: import re _typeprog = re.compile('^([^/:]+):') match = _typeprog.match(url) if match: scheme = match.group(1) return scheme, url[len(scheme) + 1:] return None, url
fcea3a44cb5bc4ca94c174353aba37f481e83a11 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fcea3a44cb5bc4ca94c174353aba37f481e83a11/urllib.py
import re _hostprog = re.compile('^//([^/]+)(.*)$')
import re _hostprog = re.compile('^//([^/]+)(.*)$')
def splithost(url): global _hostprog if _hostprog is None: import re _hostprog = re.compile('^//([^/]+)(.*)$') match = _hostprog.match(url) if match: return match.group(1, 2) return None, url
fcea3a44cb5bc4ca94c174353aba37f481e83a11 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fcea3a44cb5bc4ca94c174353aba37f481e83a11/urllib.py
import re _userprog = re.compile('^([^@]*)@(.*)$')
import re _userprog = re.compile('^([^@]*)@(.*)$')
def splituser(host): global _userprog if _userprog is None: import re _userprog = re.compile('^([^@]*)@(.*)$') match = _userprog.match(host) if match: return match.group(1, 2) return None, host
fcea3a44cb5bc4ca94c174353aba37f481e83a11 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fcea3a44cb5bc4ca94c174353aba37f481e83a11/urllib.py
import re _passwdprog = re.compile('^([^:]*):(.*)$')
import re _passwdprog = re.compile('^([^:]*):(.*)$')
def splitpasswd(user): global _passwdprog if _passwdprog is None: import re _passwdprog = re.compile('^([^:]*):(.*)$') match = _passwdprog.match(user) if match: return match.group(1, 2) return user, None
fcea3a44cb5bc4ca94c174353aba37f481e83a11 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fcea3a44cb5bc4ca94c174353aba37f481e83a11/urllib.py
import re _portprog = re.compile('^(.*):([0-9]+)$')
import re _portprog = re.compile('^(.*):([0-9]+)$')
def splitport(host): global _portprog if _portprog is None: import re _portprog = re.compile('^(.*):([0-9]+)$') match = _portprog.match(host) if match: return match.group(1, 2) return host, None
fcea3a44cb5bc4ca94c174353aba37f481e83a11 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fcea3a44cb5bc4ca94c174353aba37f481e83a11/urllib.py
import re _nportprog = re.compile('^(.*):(.*)$')
import re _nportprog = re.compile('^(.*):(.*)$')
def splitnport(host, defport=-1): global _nportprog if _nportprog is None: import re _nportprog = re.compile('^(.*):(.*)$') match = _nportprog.match(host) if match: host, port = match.group(1, 2) try: if not port: raise string.atoi_error, "no digits" nport = string.atoi(port) except string.atoi_error: nport = None ret...
fcea3a44cb5bc4ca94c174353aba37f481e83a11 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fcea3a44cb5bc4ca94c174353aba37f481e83a11/urllib.py
host, port = match.group(1, 2) try: if not port: raise string.atoi_error, "no digits" nport = string.atoi(port) except string.atoi_error: nport = None return host, nport
host, port = match.group(1, 2) try: if not port: raise string.atoi_error, "no digits" nport = string.atoi(port) except string.atoi_error: nport = None return host, nport
def splitnport(host, defport=-1): global _nportprog if _nportprog is None: import re _nportprog = re.compile('^(.*):(.*)$') match = _nportprog.match(host) if match: host, port = match.group(1, 2) try: if not port: raise string.atoi_error, "no digits" nport = string.atoi(port) except string.atoi_error: nport = None ret...
fcea3a44cb5bc4ca94c174353aba37f481e83a11 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fcea3a44cb5bc4ca94c174353aba37f481e83a11/urllib.py
import re _queryprog = re.compile('^(.*)\?([^?]*)$')
import re _queryprog = re.compile('^(.*)\?([^?]*)$')
def splitquery(url): global _queryprog if _queryprog is None: import re _queryprog = re.compile('^(.*)\?([^?]*)$') match = _queryprog.match(url) if match: return match.group(1, 2) return url, None
fcea3a44cb5bc4ca94c174353aba37f481e83a11 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fcea3a44cb5bc4ca94c174353aba37f481e83a11/urllib.py
import re _tagprog = re.compile('^(.*)
import re _tagprog = re.compile('^(.*)
def splittag(url): global _tagprog if _tagprog is None: import re _tagprog = re.compile('^(.*)#([^#]*)$') match = _tagprog.match(url) if match: return match.group(1, 2) return url, None
fcea3a44cb5bc4ca94c174353aba37f481e83a11 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fcea3a44cb5bc4ca94c174353aba37f481e83a11/urllib.py
import re _valueprog = re.compile('^([^=]*)=(.*)$') match = _valueprog.match(attr)
import re _valueprog = re.compile('^([^=]*)=(.*)$') match = _valueprog.match(attr)
def splitvalue(attr): global _valueprog if _valueprog is None: import re _valueprog = re.compile('^([^=]*)=(.*)$') match = _valueprog.match(attr) if match: return match.group(1, 2) return attr, None
fcea3a44cb5bc4ca94c174353aba37f481e83a11 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fcea3a44cb5bc4ca94c174353aba37f481e83a11/urllib.py
import re _quoteprog = re.compile('%[0-9a-fA-F][0-9a-fA-F]')
import re _quoteprog = re.compile('%[0-9a-fA-F][0-9a-fA-F]')
def unquote(s): global _quoteprog if _quoteprog is None: import re _quoteprog = re.compile('%[0-9a-fA-F][0-9a-fA-F]') i = 0 n = len(s) res = [] while 0 <= i < n: match = _quoteprog.search(s, i) if not match: res.append(s[i:]) break j = match.start(0) res.append(s[i:j] + chr(string.atoi(s[j+1:j+3], 16))) i = j+3 return...
fcea3a44cb5bc4ca94c174353aba37f481e83a11 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fcea3a44cb5bc4ca94c174353aba37f481e83a11/urllib.py
if '+' in s: s = string.join(string.split(s, '+'), ' ') return unquote(s)
if '+' in s: s = string.join(string.split(s, '+'), ' ') return unquote(s)
def unquote_plus(s): if '+' in s: # replace '+' with ' ' s = string.join(string.split(s, '+'), ' ') return unquote(s)
fcea3a44cb5bc4ca94c174353aba37f481e83a11 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fcea3a44cb5bc4ca94c174353aba37f481e83a11/urllib.py
if ' ' in s: s = string.join(string.split(s, ' '), '+') return quote(s, safe + '+') else: return quote(s, safe)
if ' ' in s: s = string.join(string.split(s, ' '), '+') return quote(s, safe + '+') else: return quote(s, safe)
def quote_plus(s, safe = '/'): if ' ' in s: # replace ' ' with '+' s = string.join(string.split(s, ' '), '+') return quote(s, safe + '+') else: return quote(s, safe)
fcea3a44cb5bc4ca94c174353aba37f481e83a11 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fcea3a44cb5bc4ca94c174353aba37f481e83a11/urllib.py
table = string.maketrans("", "") data = string.translate(data, table, "\r")
table = string.maketrans("", "") data = string.translate(data, table, "\r")
def test(): import sys args = sys.argv[1:] if not args: args = [ '/etc/passwd', 'file:/etc/passwd', 'file://localhost/etc/passwd', 'ftp://ftp.python.org/etc/passwd', 'gopher://gopher.micro.umn.edu/1/', 'http://www.python.org/index.html', ] try: for url in args: print '-'*10, url, '-'*10 fn, h = urlretrieve(url) print f...
fcea3a44cb5bc4ca94c174353aba37f481e83a11 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fcea3a44cb5bc4ca94c174353aba37f481e83a11/urllib.py
self.mkpath (os.path.dirname (obj))
self.mkpath(os.path.dirname(obj))
def compile (self, sources, output_dir=None, macros=None, include_dirs=None, debug=0, extra_preargs=None, extra_postargs=None):
9785481e9d4764ad00cdf3c5c92c436452d1c1ae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9785481e9d4764ad00cdf3c5c92c436452d1c1ae/bcppcompiler.py
def compile (self, sources, output_dir=None, macros=None, include_dirs=None, debug=0, extra_preargs=None, extra_postargs=None):
9785481e9d4764ad00cdf3c5c92c436452d1c1ae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9785481e9d4764ad00cdf3c5c92c436452d1c1ae/bcppcompiler.py
ldflags = self.ldflags_shared_debug
ld_args = self.ldflags_shared_debug[:]
def link_shared_object (self, objects, output_filename, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=0, extra_preargs=None, extra_postargs=None, build_temp=None):
9785481e9d4764ad00cdf3c5c92c436452d1c1ae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9785481e9d4764ad00cdf3c5c92c436452d1c1ae/bcppcompiler.py
ldflags = self.ldflags_shared
ld_args = self.ldflags_shared[:] objects = map(os.path.normpath, objects)
def link_shared_object (self, objects, output_filename, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=0, extra_preargs=None, extra_postargs=None, build_temp=None):
9785481e9d4764ad00cdf3c5c92c436452d1c1ae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9785481e9d4764ad00cdf3c5c92c436452d1c1ae/bcppcompiler.py
libraries.append ('mypylib')
objects.insert(0, startup_obj)
def link_shared_object (self, objects, output_filename, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=0, extra_preargs=None, extra_postargs=None, build_temp=None):
9785481e9d4764ad00cdf3c5c92c436452d1c1ae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9785481e9d4764ad00cdf3c5c92c436452d1c1ae/bcppcompiler.py
def_file = os.path.join (build_temp, '%s.def' % modname) f = open (def_file, 'w') f.write ('EXPORTS\n')
temp_dir = os.path.dirname(objects[0]) def_file = os.path.join (temp_dir, '%s.def' % modname) contents = ['EXPORTS']
def link_shared_object (self, objects, output_filename, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=0, extra_preargs=None, extra_postargs=None, build_temp=None):
9785481e9d4764ad00cdf3c5c92c436452d1c1ae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9785481e9d4764ad00cdf3c5c92c436452d1c1ae/bcppcompiler.py
f.write (' %s=_%s\n' % (sym, sym)) ld_args = ldflags + [startup_obj] + objects + \ [',%s,,' % output_filename] + \ libraries + [',' + def_file]
contents.append(' %s=_%s' % (sym, sym)) self.execute(write_file, (def_file, contents), "writing %s" % def_file) for l in library_dirs: ld_args.append("/L%s" % os.path.normpath(l)) ld_args.extend(objects) ld_args.extend([',',output_filename]) ld_args.extend([',', ',']) for lib in libraries: libfile = self.fin...
def link_shared_object (self, objects, output_filename, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=0, extra_preargs=None, extra_postargs=None, build_temp=None):
9785481e9d4764ad00cdf3c5c92c436452d1c1ae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9785481e9d4764ad00cdf3c5c92c436452d1c1ae/bcppcompiler.py
ld_args.extend (extra_postargs)
ld_args.extend(extra_postargs)
def link_shared_object (self, objects, output_filename, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=0, extra_preargs=None, extra_postargs=None, build_temp=None):
9785481e9d4764ad00cdf3c5c92c436452d1c1ae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9785481e9d4764ad00cdf3c5c92c436452d1c1ae/bcppcompiler.py
"don't know how to set runtime library search path for MSVC++"
("don't know how to set runtime library search path " "for Borland C++")
def runtime_library_dir_option (self, dir): raise DistutilsPlatformError, \ "don't know how to set runtime library search path for MSVC++"
9785481e9d4764ad00cdf3c5c92c436452d1c1ae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9785481e9d4764ad00cdf3c5c92c436452d1c1ae/bcppcompiler.py
def find_library_file (self, dirs, lib):
def find_library_file (self, dirs, lib, debug=0):
def find_library_file (self, dirs, lib):
9785481e9d4764ad00cdf3c5c92c436452d1c1ae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9785481e9d4764ad00cdf3c5c92c436452d1c1ae/bcppcompiler.py
['extract-all', 'default-domain', 'escape', 'help',
['extract-all', 'default-domain=', 'escape', 'help',
def main(): global default_keywords try: opts, args = getopt.getopt( sys.argv[1:], 'ad:DEhk:Kno:p:S:Vvw:x:', ['extract-all', 'default-domain', 'escape', 'help', 'keyword=', 'no-default-keywords', 'add-location', 'no-location', 'output=', 'output-dir=', 'style=', 'verbose', 'version', 'width=', 'exclude-file=', 'docstri...
9186d1028d9b696d168e631295aa20b1d8204ab0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9186d1028d9b696d168e631295aa20b1d8204ab0/pygettext.py
f = open(filename, 'r')
f = open(filename, 'rb')
def whathdr(filename): """Recognize sound headers""" f = open(filename, 'r') h = f.read(512) for tf in tests: res = tf(h, f) if res: return res return None
09f0346a464d41b643b3e0e707ce9004e347ea8d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/09f0346a464d41b643b3e0e707ce9004e347ea8d/sndhdr.py
def __init__(self, name=""): """Construct a TarInfo object. name is the optional name of the member. """
14cab674653252113190b16078d9d939372d8557 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/14cab674653252113190b16078d9d939372d8557/tarfile.py
self.prefix = ""
def __init__(self, name=""): """Construct a TarInfo object. name is the optional name of the member. """
14cab674653252113190b16078d9d939372d8557 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/14cab674653252113190b16078d9d939372d8557/tarfile.py
tarinfo.prefix = buf[345:500]
prefix = buf[345:500].rstrip(NUL) if prefix and not tarinfo.issparse(): tarinfo.name = prefix + "/" + tarinfo.name
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")
14cab674653252113190b16078d9d939372d8557 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/14cab674653252113190b16078d9d939372d8557/tarfile.py
"""Return a tar header block as a 512 byte string. """
"""Return a tar header as a string of 512 byte blocks. """ buf = "" type = self.type prefix = "" if self.name.endswith("/"): type = DIRTYPE name = normpath(self.name) if type == DIRTYPE: name += "/" linkname = self.linkname if linkname: linkname = normpath(linkname) if posix: if self.size > MAXSIZE_MEMBER: raise...
def tobuf(self, posix=False): """Return a tar header block as a 512 byte string. """ parts = [ stn(self.name, 100), itn(self.mode & 07777, 8, posix), itn(self.uid, 8, posix), itn(self.gid, 8, posix), itn(self.size, 12, posix), itn(self.mtime, 12, posix), " ", # checksum field self.type, stn(self.linkname, 100), ...
14cab674653252113190b16078d9d939372d8557 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/14cab674653252113190b16078d9d939372d8557/tarfile.py
stn(self.name, 100),
stn(name, 100),
def tobuf(self, posix=False): """Return a tar header block as a 512 byte string. """ parts = [ stn(self.name, 100), itn(self.mode & 07777, 8, posix), itn(self.uid, 8, posix), itn(self.gid, 8, posix), itn(self.size, 12, posix), itn(self.mtime, 12, posix), " ", # checksum field self.type, stn(self.linkname, 100), ...
14cab674653252113190b16078d9d939372d8557 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/14cab674653252113190b16078d9d939372d8557/tarfile.py
self.type,
type,
def tobuf(self, posix=False): """Return a tar header block as a 512 byte string. """ parts = [ stn(self.name, 100), itn(self.mode & 07777, 8, posix), itn(self.uid, 8, posix), itn(self.gid, 8, posix), itn(self.size, 12, posix), itn(self.mtime, 12, posix), " ", # checksum field self.type, stn(self.linkname, 100), ...
14cab674653252113190b16078d9d939372d8557 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/14cab674653252113190b16078d9d939372d8557/tarfile.py
stn(self.prefix, 155)
stn(prefix, 155)
def tobuf(self, posix=False): """Return a tar header block as a 512 byte string. """ parts = [ stn(self.name, 100), itn(self.mode & 07777, 8, posix), itn(self.uid, 8, posix), itn(self.gid, 8, posix), itn(self.size, 12, posix), itn(self.mtime, 12, posix), " ", # checksum field self.type, stn(self.linkname, 100), ...
14cab674653252113190b16078d9d939372d8557 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/14cab674653252113190b16078d9d939372d8557/tarfile.py
buf = struct.pack("%ds" % BLOCKSIZE, "".join(parts))
buf += struct.pack("%ds" % BLOCKSIZE, "".join(parts))
def tobuf(self, posix=False): """Return a tar header block as a 512 byte string. """ parts = [ stn(self.name, 100), itn(self.mode & 07777, 8, posix), itn(self.uid, 8, posix), itn(self.gid, 8, posix), itn(self.size, 12, posix), itn(self.mtime, 12, posix), " ", # checksum field self.type, stn(self.linkname, 100), ...
14cab674653252113190b16078d9d939372d8557 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/14cab674653252113190b16078d9d939372d8557/tarfile.py
buf = buf[:148] + "%06o\0" % chksum + buf[155:]
buf = buf[:-364] + "%06o\0" % chksum + buf[-357:]
def tobuf(self, posix=False): """Return a tar header block as a 512 byte string. """ parts = [ stn(self.name, 100), itn(self.mode & 07777, 8, posix), itn(self.uid, 8, posix), itn(self.gid, 8, posix), itn(self.size, 12, posix), itn(self.mtime, 12, posix), " ", # checksum field self.type, stn(self.linkname, 100), ...
14cab674653252113190b16078d9d939372d8557 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/14cab674653252113190b16078d9d939372d8557/tarfile.py
tarinfo.name = normpath(tarinfo.name) if tarinfo.isdir(): tarinfo.name += "/" if tarinfo.linkname: tarinfo.linkname = normpath(tarinfo.linkname) if tarinfo.size > MAXSIZE_MEMBER: if self.posix: raise ValueError("file is too large (>= 8 GB)") else: self._dbg(2, "tarfile: Created GNU tar largefile header") if len(ta...
tarinfo = copy.copy(tarinfo) buf = tarinfo.tobuf(self.posix) self.fileobj.write(buf) self.offset += len(buf)
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...
14cab674653252113190b16078d9d939372d8557 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/14cab674653252113190b16078d9d939372d8557/tarfile.py
tarinfo.name = normpath(os.path.join(tarinfo.prefix.rstrip(NUL), tarinfo.name))
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
14cab674653252113190b16078d9d939372d8557 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/14cab674653252113190b16078d9d939372d8557/tarfile.py
tarinfo.prefix = ""
def proc_sparse(self, tarinfo): """Process a GNU sparse header plus extra headers. """ buf = tarinfo.buf sp = _ringbuffer() pos = 386 lastpos = 0L realpos = 0L # There are 4 possible sparse structs in the # first header. for i in xrange(4): try: offset = nti(buf[pos:pos + 12]) numbytes = nti(buf[pos + 12:pos + 24]) exc...
14cab674653252113190b16078d9d939372d8557 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/14cab674653252113190b16078d9d939372d8557/tarfile.py
def _create_gnulong(self, name, type): """Write a GNU longname/longlink member to the TarFile. It consists of an extended tar header, with the length of the longname as size, followed by data blocks, which contain the longname as a null terminated string. """ name += NUL tarinfo = TarInfo() tarinfo.name = "././@LongL...
def __iter__(self): """Provide an iterator object. """ if self._loaded: return iter(self.members) else: return TarIter(self)
14cab674653252113190b16078d9d939372d8557 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/14cab674653252113190b16078d9d939372d8557/tarfile.py
blocknum = blocknum + 1
read += len(block) blocknum += 1
def retrieve(self, url, filename=None, reporthook=None, data=None): """retrieve(url) returns (filename, headers) for a local object or (tempfilename, headers) for a remote object.""" url = unwrap(toBytes(url)) if self.tempcache and url in self.tempcache: return self.tempcache[url] type, url1 = splittype(url) if filenam...
ff4621ea3c2427b340b9612009e86f4b5a1352a4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ff4621ea3c2427b340b9612009e86f4b5a1352a4/urllib.py
def putrequest(self, method, url):
def putrequest(self, method, url, skip_host=0):
def putrequest(self, method, url): """Send a request to the server.
565dd907942e7aa0a4087a7c6a4488a4566f1b9f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/565dd907942e7aa0a4087a7c6a4488a4566f1b9f/httplib.py
if url.startswith('http:'): nil, netloc, nil, nil, nil = urlsplit(url) self.putheader('Host', netloc) elif self.port == HTTP_PORT: self.putheader('Host', netloc) else: self.putheader('Host', "%s:%s" % (self.host, self.port))
if not skip_host: netloc = '' if url.startswith('http'): nil, netloc, nil, nil, nil = urlsplit(url) if netloc: self.putheader('Host', netloc) elif self.port == HTTP_PORT: self.putheader('Host', self.host) else: self.putheader('Host', "%s:%s" % (self.host, self.port))
def putrequest(self, method, url): """Send a request to the server.
565dd907942e7aa0a4087a7c6a4488a4566f1b9f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/565dd907942e7aa0a4087a7c6a4488a4566f1b9f/httplib.py
self.putrequest(method, url)
if (headers.has_key('Host') or [k for k in headers.iterkeys() if k.lower() == "host"]): self.putrequest(method, url, skip_host=1) else: self.putrequest(method, url)
def _send_request(self, method, url, body, headers): self.putrequest(method, url)
565dd907942e7aa0a4087a7c6a4488a4566f1b9f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/565dd907942e7aa0a4087a7c6a4488a4566f1b9f/httplib.py
self.format_all(map(lambda (mtime, file): file, list))
self.format_all(map(lambda (mtime, file): file, list), headers=0)
def do_recent(self):
f01b9c728270577ad8c2d426c32e9e7be35e1617 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f01b9c728270577ad8c2d426c32e9e7be35e1617/faqwiz.py
while 1:
depth = 0 while depth < 10: depth = depth + 1
def get(self, section, option, raw=0, vars=None): """Get an option value for a given section.
b7d18aba05e94e0dfc876b8d5318a3526b80bcb4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b7d18aba05e94e0dfc876b8d5318a3526b80bcb4/ConfigParser.py
release = '98'
release = 'postMe'
def win32_ver(release='',version='',csd='',ptype=''): """ Get additional version information from the Windows Registry and return a tuple (version,csd,ptype) referring to version number, CSD level and OS type (multi/single processor). As a hint: ptype returns 'Uniprocessor Free' on single processor NT machines and 'M...
ea974cc15e33c987a26d4c43845cc095b2eeb985 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ea974cc15e33c987a26d4c43845cc095b2eeb985/platform.py
release = '2000'
if min == 0: release = '2000' elif min == 1: release = 'XP' elif min == 2: release = '2003Server' else: release = 'post2003'
def win32_ver(release='',version='',csd='',ptype=''): """ Get additional version information from the Windows Registry and return a tuple (version,csd,ptype) referring to version number, CSD level and OS type (multi/single processor). As a hint: ptype returns 'Uniprocessor Free' on single processor NT machines and 'M...
ea974cc15e33c987a26d4c43845cc095b2eeb985 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ea974cc15e33c987a26d4c43845cc095b2eeb985/platform.py
_platform_cache_terse = None _platform_cache_not_terse = None _platform_aliased_cache_terse = None _platform_aliased_cache_not_terse = None
_platform_cache = {}
def python_compiler(): """ Returns a string identifying the compiler used for compiling Python. """ return _sys_version()[3]
ea974cc15e33c987a26d4c43845cc095b2eeb985 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ea974cc15e33c987a26d4c43845cc095b2eeb985/platform.py
global _platform_cache_terse, _platform_cache_not_terse global _platform_aliased_cache_terse, _platform_aliased_cache_not_terse if not aliased and terse and (_platform_cache_terse is not None): return _platform_cache_terse elif not aliased and not terse and (_platform_cache_not_terse is not None): return _platform_cac...
result = _platform_cache.get((aliased, terse), None) if result is not None: return result
def platform(aliased=0, terse=0): """ Returns a single string identifying the underlying platform with as much useful information as possible (but no more :). The output is intended to be human readable rather than machine parseable. It may look different on different platforms and this is intended. If "aliased" is ...
ea974cc15e33c987a26d4c43845cc095b2eeb985 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ea974cc15e33c987a26d4c43845cc095b2eeb985/platform.py
if aliased and terse: _platform_aliased_cache_terse = platform elif aliased and not terse: _platform_aliased_cache_not_terse = platform elif terse: pass else: if terse: _platform_cache_terse = platform else: _platform_cache_not_terse = platform
_platform_cache[(aliased, terse)] = platform
def platform(aliased=0, terse=0): """ Returns a single string identifying the underlying platform with as much useful information as possible (but no more :). The output is intended to be human readable rather than machine parseable. It may look different on different platforms and this is intended. If "aliased" is ...
ea974cc15e33c987a26d4c43845cc095b2eeb985 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ea974cc15e33c987a26d4c43845cc095b2eeb985/platform.py
def makefile(self, mode, bufsize=None): if mode != 'r' and mode != 'rb': raise httplib.UnimplementedFileMode() return StringIO.StringIO(self.text)
d909c02d45f659c228159645ab18245faae03fa7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d909c02d45f659c228159645ab18245faae03fa7/test_httplib.py
body = "HTTP/1.1 200 Ok\r\n\r\nText" sock = FakeSocket(body) resp = httplib.HTTPResponse(sock, 1) resp.begin() print resp.read() resp.close()
import sys
def makefile(self, mode, bufsize=None): if mode != 'r' and mode != 'rb': raise httplib.UnimplementedFileMode() return StringIO.StringIO(self.text)
d909c02d45f659c228159645ab18245faae03fa7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d909c02d45f659c228159645ab18245faae03fa7/test_httplib.py
body = "HTTP/1.1 400.100 Not Ok\r\n\r\nText" sock = FakeSocket(body) resp = httplib.HTTPResponse(sock, 1) try:
def test(): buf = StringIO.StringIO() _stdout = sys.stdout try: sys.stdout = buf _test() finally: sys.stdout = _stdout s = buf.getvalue() for line in s.split("\n"): print line.strip() def _test(): body = "HTTP/1.1 200 Ok\r\n\r\nText" sock = FakeSocket(body) resp = httplib.HTTPResponse(sock, 1)
def makefile(self, mode, bufsize=None): if mode != 'r' and mode != 'rb': raise httplib.UnimplementedFileMode() return StringIO.StringIO(self.text)
d909c02d45f659c228159645ab18245faae03fa7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d909c02d45f659c228159645ab18245faae03fa7/test_httplib.py
except httplib.BadStatusLine: print "BadStatusLine raised as expected" else: print "Expect BadStatusLine"
print resp.read() resp.close()
def makefile(self, mode, bufsize=None): if mode != 'r' and mode != 'rb': raise httplib.UnimplementedFileMode() return StringIO.StringIO(self.text)
d909c02d45f659c228159645ab18245faae03fa7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d909c02d45f659c228159645ab18245faae03fa7/test_httplib.py
body = "HTTP/1.1 400.100 Not Ok\r\n\r\nText" sock = FakeSocket(body) resp = httplib.HTTPResponse(sock, 1) try: resp.begin() except httplib.BadStatusLine: print "BadStatusLine raised as expected" else: print "Expect BadStatusLine"
def makefile(self, mode, bufsize=None): if mode != 'r' and mode != 'rb': raise httplib.UnimplementedFileMode() return StringIO.StringIO(self.text)
d909c02d45f659c228159645ab18245faae03fa7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d909c02d45f659c228159645ab18245faae03fa7/test_httplib.py
for hp in ("www.python.org:abc", "www.python.org:"): try: h = httplib.HTTP(hp) except httplib.InvalidURL: print "InvalidURL raised as expected" else: print "Expect InvalidURL"
def makefile(self, mode, bufsize=None): if mode != 'r' and mode != 'rb': raise httplib.UnimplementedFileMode() return StringIO.StringIO(self.text)
d909c02d45f659c228159645ab18245faae03fa7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d909c02d45f659c228159645ab18245faae03fa7/test_httplib.py
text = ('HTTP/1.1 200 OK\r\n' 'Set-Cookie: Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"\r\n' 'Set-Cookie: Part_Number="Rocket_Launcher_0001"; Version="1";' ' Path="/acme"\r\n' '\r\n' 'No body\r\n') hdr = ('Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"' ', ' 'Part_Number="Rocket_Launcher_0001"; Version="1"...
for hp in ("www.python.org:abc", "www.python.org:"): try: h = httplib.HTTP(hp) except httplib.InvalidURL: print "InvalidURL raised as expected" else: print "Expect InvalidURL" text = ('HTTP/1.1 200 OK\r\n' 'Set-Cookie: Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"\r\n' 'Set-Cookie: Part_Number="Rocket_Launcher_...
def makefile(self, mode, bufsize=None): if mode != 'r' and mode != 'rb': raise httplib.UnimplementedFileMode() return StringIO.StringIO(self.text)
d909c02d45f659c228159645ab18245faae03fa7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d909c02d45f659c228159645ab18245faae03fa7/test_httplib.py
def register(name, klass, instance=None):
def register(name, klass, instance=None, update_tryorder=1):
def register(name, klass, instance=None): """Register a browser connector and, optionally, connection.""" _browsers[name.lower()] = [klass, instance]
336cf8e9a006f0abbd7712771acc892711f93ebd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/336cf8e9a006f0abbd7712771acc892711f93ebd/webbrowser.py
def get(using=None): """Return a browser launcher instance appropriate for the environment.""" if using is not None: alternatives = [using] else: alternatives = _tryorder for browser in alternatives: if '%s' in browser: # User gave us a command line, don't mess with it. return GenericBrowser(browser) else: # User gave ...
336cf8e9a006f0abbd7712771acc892711f93ebd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/336cf8e9a006f0abbd7712771acc892711f93ebd/webbrowser.py
if command[1] is None:
if command[1] is not None: return command[1] elif command[0] is not None:
def get(using=None): """Return a browser launcher instance appropriate for the environment.""" if using is not None: alternatives = [using] else: alternatives = _tryorder for browser in alternatives: if '%s' in browser: # User gave us a command line, don't mess with it. return GenericBrowser(browser) else: # User gave ...
336cf8e9a006f0abbd7712771acc892711f93ebd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/336cf8e9a006f0abbd7712771acc892711f93ebd/webbrowser.py
else: return command[1]
def get(using=None): """Return a browser launcher instance appropriate for the environment.""" if using is not None: alternatives = [using] else: alternatives = _tryorder for browser in alternatives: if '%s' in browser: # User gave us a command line, don't mess with it. return GenericBrowser(browser) else: # User gave ...
336cf8e9a006f0abbd7712771acc892711f93ebd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/336cf8e9a006f0abbd7712771acc892711f93ebd/webbrowser.py
get().open(url, new, autoraise)
for name in _tryorder: browser = get(name) if browser.open(url, new, autoraise): return True return False
def open(url, new=0, autoraise=1): get().open(url, new, autoraise)
336cf8e9a006f0abbd7712771acc892711f93ebd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/336cf8e9a006f0abbd7712771acc892711f93ebd/webbrowser.py
get().open(url, 1) def _synthesize(browser):
return open(url, 1) def open_new_tab(url): return open(url, 2) def _synthesize(browser, update_tryorder=1):
def open_new(url): get().open(url, 1)
336cf8e9a006f0abbd7712771acc892711f93ebd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/336cf8e9a006f0abbd7712771acc892711f93ebd/webbrowser.py
if not os.path.exists(browser):
cmd = browser.split()[0] if not _iscommand(cmd):
def _synthesize(browser): """Attempt to synthesize a controller base on existing controllers. This is useful to create a controller when a user specifies a path to an entry in the BROWSER environment variable -- we can copy a general controller to operate using a specific installation of the desired browser in this wa...
336cf8e9a006f0abbd7712771acc892711f93ebd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/336cf8e9a006f0abbd7712771acc892711f93ebd/webbrowser.py
name = os.path.basename(browser)
name = os.path.basename(cmd)
def _synthesize(browser): """Attempt to synthesize a controller base on existing controllers. This is useful to create a controller when a user specifies a path to an entry in the BROWSER environment variable -- we can copy a general controller to operate using a specific installation of the desired browser in this wa...
336cf8e9a006f0abbd7712771acc892711f93ebd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/336cf8e9a006f0abbd7712771acc892711f93ebd/webbrowser.py
register(browser, None, controller)
register(browser, None, controller, update_tryorder)
def _synthesize(browser): """Attempt to synthesize a controller base on existing controllers. This is useful to create a controller when a user specifies a path to an entry in the BROWSER environment variable -- we can copy a general controller to operate using a specific installation of the desired browser in this wa...
336cf8e9a006f0abbd7712771acc892711f93ebd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/336cf8e9a006f0abbd7712771acc892711f93ebd/webbrowser.py
"""Return True if cmd can be found on the executable search path."""
"""Return True if cmd is executable or can be found on the executable search path.""" if _isexecutable(cmd): return True
def _iscommand(cmd): """Return True if cmd can be found on the executable search path.""" path = os.environ.get("PATH") if not path: return False for d in path.split(os.pathsep): exe = os.path.join(d, cmd) if os.path.isfile(exe): return True return False
336cf8e9a006f0abbd7712771acc892711f93ebd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/336cf8e9a006f0abbd7712771acc892711f93ebd/webbrowser.py
if os.path.isfile(exe):
if _isexecutable(exe):
def _iscommand(cmd): """Return True if cmd can be found on the executable search path.""" path = os.environ.get("PATH") if not path: return False for d in path.split(os.pathsep): exe = os.path.join(d, cmd) if os.path.isfile(exe): return True return False
336cf8e9a006f0abbd7712771acc892711f93ebd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/336cf8e9a006f0abbd7712771acc892711f93ebd/webbrowser.py
PROCESS_CREATION_DELAY = 4 class GenericBrowser:
class BaseBrowser(object): """Parent class for all browsers.""" def __init__(self, name=""): self.name = name def open_new(self, url): return self.open(url, 1) def open_new_tab(self, url): return self.open(url, 2) class GenericBrowser(BaseBrowser): """Class for all browsers started with a command and without rem...
def _iscommand(cmd): """Return True if cmd can be found on the executable search path.""" path = os.environ.get("PATH") if not path: return False for d in path.split(os.pathsep): exe = os.path.join(d, cmd) if os.path.isfile(exe): return True return False
336cf8e9a006f0abbd7712771acc892711f93ebd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/336cf8e9a006f0abbd7712771acc892711f93ebd/webbrowser.py
self.basename = os.path.basename(self.name)
def __init__(self, cmd): self.name, self.args = cmd.split(None, 1) self.basename = os.path.basename(self.name)
336cf8e9a006f0abbd7712771acc892711f93ebd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/336cf8e9a006f0abbd7712771acc892711f93ebd/webbrowser.py
os.system(command % url) def open_new(self, url): self.open(url) class Netscape: "Launcher class for Netscape browsers." def __init__(self, name): self.name = name self.basename = os.path.basename(name) def _remote(self, action, autoraise): raise_opt = ("-noraise", "-raise")[autoraise] cmd = "%s %s -remote '%s' >/d...
rc = os.system(command % url) return not rc class UnixBrowser(BaseBrowser): """Parent class for all Unix browsers with remote functionality.""" raise_opts = None remote_cmd = '' remote_action = None remote_action_newwin = None remote_action_newtab = None remote_background = False def _remote(self, url, action, aut...
def open(self, url, new=0, autoraise=1): assert "'" not in url command = "%s %s" % (self.name, self.args) os.system(command % url)
336cf8e9a006f0abbd7712771acc892711f93ebd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/336cf8e9a006f0abbd7712771acc892711f93ebd/webbrowser.py
import time os.system("%s &" % self.name) time.sleep(PROCESS_CREATION_DELAY) rc = os.system(cmd)
rc = os.system("%s %s" % (self.name, url))
def _remote(self, action, autoraise): raise_opt = ("-noraise", "-raise")[autoraise] cmd = "%s %s -remote '%s' >/dev/null 2>&1" % (self.name, raise_opt, action) rc = os.system(cmd) if rc: import time os.system("%s &" % self.name) time.sleep(PROCESS_CREATION_DELAY) rc = os.system(cmd) return not rc
336cf8e9a006f0abbd7712771acc892711f93ebd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/336cf8e9a006f0abbd7712771acc892711f93ebd/webbrowser.py
if new: self._remote("openURL(%s, new-window)"%url, autoraise)
assert "'" not in url if new == 0: action = self.remote_action elif new == 1: action = self.remote_action_newwin elif new == 2: if self.remote_action_newtab is None: action = self.remote_action_newwin else: action = self.remote_action_newtab
def open(self, url, new=0, autoraise=1): if new: self._remote("openURL(%s, new-window)"%url, autoraise) else: self._remote("openURL(%s)" % url, autoraise)
336cf8e9a006f0abbd7712771acc892711f93ebd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/336cf8e9a006f0abbd7712771acc892711f93ebd/webbrowser.py
self._remote("openURL(%s)" % url, autoraise) def open_new(self, url): self.open(url, 1) class Galeon: """Launcher class for Galeon browsers.""" def __init__(self, name): self.name = name self.basename = os.path.basename(name) def _remote(self, action, autoraise): raise_opt = ("--noraise", "")[autoraise] cmd = "%s %...
raise Error("Bad 'new' parameter to open(); expected 0, 1, or 2, got %s" % new) return self._remote(url, action % url, autoraise) class Mozilla(UnixBrowser): """Launcher class for Mozilla/Netscape browsers.""" raise_opts = ("-noraise", "-raise") remote_cmd = '-remote' remote_action = "openURL(%s)" remote_action_new...
def open(self, url, new=0, autoraise=1): if new: self._remote("openURL(%s, new-window)"%url, autoraise) else: self._remote("openURL(%s)" % url, autoraise)
336cf8e9a006f0abbd7712771acc892711f93ebd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/336cf8e9a006f0abbd7712771acc892711f93ebd/webbrowser.py
def __init__(self): if _iscommand("konqueror"): self.name = self.basename = "konqueror" else: self.name = self.basename = "kfm" def _remote(self, action):
def _remote(self, url, action):
def __init__(self): if _iscommand("konqueror"): self.name = self.basename = "konqueror" else: self.name = self.basename = "kfm"
336cf8e9a006f0abbd7712771acc892711f93ebd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/336cf8e9a006f0abbd7712771acc892711f93ebd/webbrowser.py
import time if self.basename == "konqueror": os.system(self.name + " --silent &") else: os.system(self.name + " -d &") time.sleep(PROCESS_CREATION_DELAY) rc = os.system(cmd)
if _iscommand("konqueror"): rc = os.system(self.name + " --silent '%s' &" % url) elif _iscommand("kfm"): rc = os.system(self.name + " -d '%s'" % url)
def _remote(self, action): cmd = "kfmclient %s >/dev/null 2>&1" % action rc = os.system(cmd) if rc: import time if self.basename == "konqueror": os.system(self.name + " --silent &") else: os.system(self.name + " -d &") time.sleep(PROCESS_CREATION_DELAY) rc = os.system(cmd) return not rc
336cf8e9a006f0abbd7712771acc892711f93ebd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/336cf8e9a006f0abbd7712771acc892711f93ebd/webbrowser.py
def open(self, url, new=1, autoraise=1):
def open(self, url, new=0, autoraise=1):
def open(self, url, new=1, autoraise=1): # XXX Currently I know no way to prevent KFM from # opening a new win. assert "'" not in url self._remote("openURL '%s'" % url)
336cf8e9a006f0abbd7712771acc892711f93ebd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/336cf8e9a006f0abbd7712771acc892711f93ebd/webbrowser.py
self._remote("openURL '%s'" % url) open_new = open class Grail:
if new == 2: action = "newTab '%s'" % url else: action = "openURL '%s'" % url ok = self._remote(url, action) return ok class Opera(UnixBrowser): "Launcher class for Opera browser." raise_opts = ("", "-raise") remote_cmd = '-remote' remote_action = "openURL(%s)" remote_action_newwin = "openURL(%s,new-window)" remote...
def open(self, url, new=1, autoraise=1): # XXX Currently I know no way to prevent KFM from # opening a new win. assert "'" not in url self._remote("openURL '%s'" % url)
336cf8e9a006f0abbd7712771acc892711f93ebd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/336cf8e9a006f0abbd7712771acc892711f93ebd/webbrowser.py
self._remote("LOADNEW " + url)
ok = self._remote("LOADNEW " + url)
def open(self, url, new=0, autoraise=1): if new: self._remote("LOADNEW " + url) else: self._remote("LOAD " + url)
336cf8e9a006f0abbd7712771acc892711f93ebd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/336cf8e9a006f0abbd7712771acc892711f93ebd/webbrowser.py
self._remote("LOAD " + url) def open_new(self, url): self.open(url, 1) class WindowsDefault: def open(self, url, new=0, autoraise=1): os.startfile(url) def open_new(self, url): self.open(url)
ok = self._remote("LOAD " + url) return ok
def open(self, url, new=0, autoraise=1): if new: self._remote("LOADNEW " + url) else: self._remote("LOAD " + url)
336cf8e9a006f0abbd7712771acc892711f93ebd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/336cf8e9a006f0abbd7712771acc892711f93ebd/webbrowser.py
if os.environ.get("TERM") or os.environ.get("DISPLAY"): _tryorder = ["links", "lynx", "w3m"] if os.environ.get("TERM"): if _iscommand("links"): register("links", None, GenericBrowser("links '%s'")) if _iscommand("lynx"): register("lynx", None, GenericBrowser("lynx '%s'")) if _iscommand("w3m"): register("w3m", ...
if os.environ.get("DISPLAY"): for browser in ("mozilla-firefox", "firefox", "mozilla-firebird", "firebird", "mozilla", "netscape"): if _iscommand(browser): register(browser, None, Mozilla(browser)) if _iscommand("gconftool-2"): gc = 'gconftool-2 -g /desktop/gnome/url-handlers/http/command' out = os.popen(gc) c...
def open_new(self, url): self.open(url)
336cf8e9a006f0abbd7712771acc892711f93ebd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/336cf8e9a006f0abbd7712771acc892711f93ebd/webbrowser.py
_tryorder = ["netscape", "windows-default"]
class WindowsDefault(BaseBrowser): def open(self, url, new=0, autoraise=1): os.startfile(url) return True _tryorder = [] _browsers = {} for browser in ("firefox", "firebird", "mozilla", "netscape", "opera"): if _iscommand(browser): register(browser, None, GenericBrowser(browser + ' %s'))
def open_new(self, url): self.open(url)
336cf8e9a006f0abbd7712771acc892711f93ebd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/336cf8e9a006f0abbd7712771acc892711f93ebd/webbrowser.py
_tryorder = ["internet-config"] register("internet-config", InternetConfig)
class InternetConfig(BaseBrowser): def open(self, url, new=0, autoraise=1): ic.launchurl(url) return True register("internet-config", InternetConfig, update_tryorder=-1) if sys.platform == 'darwin': class MacOSX(BaseBrowser): """Launcher class for Aqua browsers on Mac OS X Optionally specify a browser name on insta...
def open_new(self, url): self.open(url)
336cf8e9a006f0abbd7712771acc892711f93ebd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/336cf8e9a006f0abbd7712771acc892711f93ebd/webbrowser.py
if sys.platform[:3] == "os2" and _iscommand("netscape.exe"): _tryorder = ["os2netscape"]
if sys.platform[:3] == "os2" and _iscommand("netscape"): _tryorder = [] _browsers = {}
def open_new(self, url): self.open(url)
336cf8e9a006f0abbd7712771acc892711f93ebd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/336cf8e9a006f0abbd7712771acc892711f93ebd/webbrowser.py
GenericBrowser("start netscape.exe %s"))
GenericBrowser("start netscape %s"), -1)
def open_new(self, url): self.open(url)
336cf8e9a006f0abbd7712771acc892711f93ebd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/336cf8e9a006f0abbd7712771acc892711f93ebd/webbrowser.py
def open_new(self, url): self.open(url)
336cf8e9a006f0abbd7712771acc892711f93ebd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/336cf8e9a006f0abbd7712771acc892711f93ebd/webbrowser.py
_tryorder = os.environ["BROWSER"].split(os.pathsep) for cmd in _tryorder: if not cmd.lower() in _browsers: if _iscommand(cmd.lower()): register(cmd.lower(), None, GenericBrowser( "%s '%%s'" % cmd.lower())) cmd = None del cmd _tryorder = filter(lambda x: x.lower() in _browsers or x.find("%s") > -1, _tryorder)
_userchoices = os.environ["BROWSER"].split(os.pathsep) _userchoices.reverse() for cmdline in _userchoices: if cmdline != '': _synthesize(cmdline, -1) cmdline = None del cmdline del _userchoices
def open_new(self, url): self.open(url)
336cf8e9a006f0abbd7712771acc892711f93ebd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/336cf8e9a006f0abbd7712771acc892711f93ebd/webbrowser.py
s.bind('', self.port)
s.bind(('', self.port))
def __init__(self, port=None, connection_hook=None): self.connections = [] self.port = port or self.default_port self.connection_hook = connection_hook
64627dee239f18823f2f1f561685897452ec9a2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/64627dee239f18823f2f1f561685897452ec9a2d/protocol.py
except BClass, v: raise TestFailed except AClass, v:
except BClass, v:
def __init__(self, ignore):
c4b2bf86f2179cf8ce9518c7c1e3fff7fc58361a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c4b2bf86f2179cf8ce9518c7c1e3fff7fc58361a/test_opcodes.py
else: raise TestFailed
def __init__(self, ignore):
c4b2bf86f2179cf8ce9518c7c1e3fff7fc58361a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c4b2bf86f2179cf8ce9518c7c1e3fff7fc58361a/test_opcodes.py
last = last + 1
last = min(self.maxx, last+1)
def _end_of_line(self, y): "Go to the location of the first blank on the given line." last = self.maxx while 1: if ascii.ascii(self.win.inch(y, last)) != ascii.SP: last = last + 1 break elif last == 0: break last = last - 1 return last
9b298800e161e9504f7a2eb83e264732f35f2c36 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9b298800e161e9504f7a2eb83e264732f35f2c36/textpad.py
parts = ctype.split('/') if len(parts) > 0: return ctype.split('/')[0] return failobj
if ctype.count('/') <> 1: return failobj return ctype.split('/')[0]
def get_main_type(self, failobj=None): """Return the message's main content type if present.""" missing = [] ctype = self.get_type(missing) if ctype is missing: return failobj parts = ctype.split('/') if len(parts) > 0: return ctype.split('/')[0] return failobj
8b6fb51a00b698e73dce077dd98e026502b96e90 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8b6fb51a00b698e73dce077dd98e026502b96e90/Message.py
parts = ctype.split('/') if len(parts) > 1: return ctype.split('/')[1] return failobj
if ctype.count('/') <> 1: return failobj return ctype.split('/')[1] def get_content_type(self): """Returns the message's content type. The returned string is coerced to lowercase and returned as a ingle string of the form `maintype/subtype'. If there was no Content-Type: header in the message, the default type a...
def get_subtype(self, failobj=None): """Return the message's content subtype if present.""" missing = [] ctype = self.get_type(missing) if ctype is missing: return failobj parts = ctype.split('/') if len(parts) > 1: return ctype.split('/')[1] return failobj
8b6fb51a00b698e73dce077dd98e026502b96e90 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8b6fb51a00b698e73dce077dd98e026502b96e90/Message.py
ctype must be either "text/plain" or "message/rfc822". The default content type is not stored in the Content-Type: header. """ if ctype not in ('text/plain', 'message/rfc822'): raise ValueError( 'first arg must be either "text/plain" or "message/rfc822"')
ctype should be either "text/plain" or "message/rfc822", although this is not enforced. The default content type is not stored in the Content-Type: header. """
def set_default_type(self, ctype): """Set the `default' content type.
8b6fb51a00b698e73dce077dd98e026502b96e90 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8b6fb51a00b698e73dce077dd98e026502b96e90/Message.py