rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
sys.stdout.flush() os.system("/depot/gnu/plat/bin/rlog %s </dev/null 2>&1" % self.name)
p = os.popen("/depot/gnu/plat/bin/rlog %s </dev/null 2>&1" % self.name) output = p.read() p.close() print cgi.escape(output)
def do_rlog(self):
6245eb2d27f293881257f927c77ba0f68974b7b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6245eb2d27f293881257f927c77ba0f68974b7b1/faqmain.py
print "domain=%s;" % os.environ['HTTP_HOST'],
print "domain=%s;" % hostname,
def set_cookie(self, author, email):
6245eb2d27f293881257f927c77ba0f68974b7b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6245eb2d27f293881257f927c77ba0f68974b7b1/faqmain.py
<TEXTAREA COLS=80 ROWS=20 NAME=text>""" % title
<TEXTAREA COLS=80 ROWS=20 NAME=text>""" % self.escape(title)
def showedit(self, name, title, text):
6245eb2d27f293881257f927c77ba0f68974b7b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6245eb2d27f293881257f927c77ba0f68974b7b1/faqmain.py
""" % (author, email, self.log)
""" % (self.escape(author), self.escape(email), self.escape(self.log)) def escape(self, s): import regsub if '&' in s: s = regsub.gsub("&", "&amp;", s) if '<' in s: s = regsub.gsub("<", "&lt;", s) if '>' in s: s = regsub.gsub(">", "&gt;", s) if '"' in s: s = regsub.gsub('"', "&quot;", s) return s
def showedit(self, name, title, text):
6245eb2d27f293881257f927c77ba0f68974b7b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6245eb2d27f293881257f927c77ba0f68974b7b1/faqmain.py
while url[-1] in ");:,.?":
while url[-1] in ");:,.?'\"":
def translate(self, text):
6245eb2d27f293881257f927c77ba0f68974b7b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6245eb2d27f293881257f927c77ba0f68974b7b1/faqmain.py
url = cgi.escape(url)
url = self.escape(url)
def translate(self, text):
6245eb2d27f293881257f927c77ba0f68974b7b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6245eb2d27f293881257f927c77ba0f68974b7b1/faqmain.py
pos = f.tell()
pos = int(f.tell())
def _addval(self, val): f = _open(self._datfile, 'rb+') f.seek(0, 2) pos = f.tell()
761e1bcd1e2318acc4f5f38f9b82080ebf6d6fdf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/761e1bcd1e2318acc4f5f38f9b82080ebf6d6fdf/dumbdbm.py
fp.write("\t\tif _arguments.has_key('errn'):\n")
fp.write("\t\tif _arguments.get('errn', 0):\n")
fp.write("\tdef %s(self, "%funcname)
2f213a4ad2253ccde858876e2995855eac9515bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2f213a4ad2253ccde858876e2995855eac9515bb/gensuitemodule.py
def splitdrive(p): """Split a pathname into drive and path. On Posix, drive is always empty.""" return '', p
a4a52e262ecd3c0ead9282b6b4508995d1aa8700 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a4a52e262ecd3c0ead9282b6b4508995d1aa8700/posixpath.py
return split(p)[1]
i = p.rfind('/') + 1 return p[i:]
def basename(p): """Returns the final component of a pathname""" return split(p)[1]
a4a52e262ecd3c0ead9282b6b4508995d1aa8700 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a4a52e262ecd3c0ead9282b6b4508995d1aa8700/posixpath.py
return split(p)[0]
i = p.rfind('/') + 1 head = p[:i] if head and head != '/'*len(head): head = head.rstrip('/') return head
def dirname(p): """Returns the directory component of a pathname""" return split(p)[0]
a4a52e262ecd3c0ead9282b6b4508995d1aa8700 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a4a52e262ecd3c0ead9282b6b4508995d1aa8700/posixpath.py
testclasses = (WichmannHill_TestBasicOps,
testclasses = [WichmannHill_TestBasicOps,
def test_main(verbose=None): testclasses = (WichmannHill_TestBasicOps, MersenneTwister_TestBasicOps, HardwareRandom_TestBasicOps, TestDistributions, TestModule) test_support.run_unittest(*testclasses) # verify reference counting import sys if verbose and hasattr(sys, "gettotalrefcount"): counts = [None] * 5 for i i...
bde953ef3c345fda8256ad048449ebc6eeeafc61 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bde953ef3c345fda8256ad048449ebc6eeeafc61/test_random.py
HardwareRandom_TestBasicOps,
def test_main(verbose=None): testclasses = (WichmannHill_TestBasicOps, MersenneTwister_TestBasicOps, HardwareRandom_TestBasicOps, TestDistributions, TestModule) test_support.run_unittest(*testclasses) # verify reference counting import sys if verbose and hasattr(sys, "gettotalrefcount"): counts = [None] * 5 for i i...
bde953ef3c345fda8256ad048449ebc6eeeafc61 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bde953ef3c345fda8256ad048449ebc6eeeafc61/test_random.py
TestModule)
TestModule] if random._urandom is not None: testclasses.append(HardwareRandom_TestBasicOps)
def test_main(verbose=None): testclasses = (WichmannHill_TestBasicOps, MersenneTwister_TestBasicOps, HardwareRandom_TestBasicOps, TestDistributions, TestModule) test_support.run_unittest(*testclasses) # verify reference counting import sys if verbose and hasattr(sys, "gettotalrefcount"): counts = [None] * 5 for i i...
bde953ef3c345fda8256ad048449ebc6eeeafc61 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bde953ef3c345fda8256ad048449ebc6eeeafc61/test_random.py
"""comment: get or set the Finder-comment of the item, displayed in the Get Info window."""
"""comment: get or set the Finder-comment of the item, displayed in the 'Get Info' window."""
def comment(object, comment=None): """comment: get or set the Finder-comment of the item, displayed in the Get Info window.""" object = macfs.FSSpec(object) fss = macfs.FSSpec(object) object_alias = fss.NewAlias() if comment == None: return _getcomment(object_alias) else: return _setcomment(object_alias, comment)
d3e6006733c5c6736e844d64a329526720edd389 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d3e6006733c5c6736e844d64a329526720edd389/findertools.py
print '\nmorefindertools version %s\nTests coming up' %__version__
print '\nmorefindertools version %s\nTests coming up...' %__version__
def _test2(): print '\nmorefindertools version %s\nTests coming up' %__version__ import os import random # miscellaneous print '\tfilesharing on?', filesharing() # is file sharing on, off, starting up? print '\tOS version', OSversion() # the version of the system software # set the soundvolume in a simple way pri...
d3e6006733c5c6736e844d64a329526720edd389 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d3e6006733c5c6736e844d64a329526720edd389/findertools.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. ...
494d0666bbd1c51595495abf757828b8dafb2dd7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/494d0666bbd1c51595495abf757828b8dafb2dd7/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)
494d0666bbd1c51595495abf757828b8dafb2dd7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/494d0666bbd1c51595495abf757828b8dafb2dd7/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)
494d0666bbd1c51595495abf757828b8dafb2dd7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/494d0666bbd1c51595495abf757828b8dafb2dd7/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...
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)
494d0666bbd1c51595495abf757828b8dafb2dd7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/494d0666bbd1c51595495abf757828b8dafb2dd7/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_...
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)
494d0666bbd1c51595495abf757828b8dafb2dd7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/494d0666bbd1c51595495abf757828b8dafb2dd7/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)
494d0666bbd1c51595495abf757828b8dafb2dd7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/494d0666bbd1c51595495abf757828b8dafb2dd7/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)
494d0666bbd1c51595495abf757828b8dafb2dd7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/494d0666bbd1c51595495abf757828b8dafb2dd7/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_M...
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)
494d0666bbd1c51595495abf757828b8dafb2dd7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/494d0666bbd1c51595495abf757828b8dafb2dd7/locale.py
self.close()
try: self.close() except: pass
def __del__(self): self.close()
364ca9055bd376bf495364881aa15971a8907d2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/364ca9055bd376bf495364881aa15971a8907d2c/socket.py
chars = self.text.get("1.0", "end-1c")
def writefile(self, filename): self.fixlastline() try: f = open(filename, "w") chars = self.text.get("1.0", "end-1c") f.write(chars) f.close() ## print "saved to", `filename` return True except IOError, msg: tkMessageBox.showerror("I/O Error", str(msg), master=self.text) return False
47619f78c5041fb533e7483b577b06671b9b3673 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/47619f78c5041fb533e7483b577b06671b9b3673/IOBinding.py
finfo = macfs.FSSpec(name).GetFInfo()
finfo = FSSpec(name).FSpGetFInfo()
def getfileinfo(name): finfo = macfs.FSSpec(name).GetFInfo() dir, file = os.path.split(name) # XXXX Get resource/data sizes fp = open(name, 'rb') fp.seek(0, 2) dlen = fp.tell() fp = openrf(name, '*rb') fp.seek(0, 2) rlen = fp.tell() return file, finfo, dlen, rlen
3cc48ceed9d84dd8ea049cba45c2d8356ee7f2e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3cc48ceed9d84dd8ea049cba45c2d8356ee7f2e5/binhex.py
def getfileinfo(name): finfo = macfs.FSSpec(name).GetFInfo() dir, file = os.path.split(name) # XXXX Get resource/data sizes fp = open(name, 'rb') fp.seek(0, 2) dlen = fp.tell() fp = openrf(name, '*rb') fp.seek(0, 2) rlen = fp.tell() return file, finfo, dlen, rlen
3cc48ceed9d84dd8ea049cba45c2d8356ee7f2e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3cc48ceed9d84dd8ea049cba45c2d8356ee7f2e5/binhex.py
else:
except ImportError:
def openrsrc(name, *mode): if not mode: mode = '*rb' else: mode = '*' + mode[0] return openrf(name, mode)
3cc48ceed9d84dd8ea049cba45c2d8356ee7f2e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3cc48ceed9d84dd8ea049cba45c2d8356ee7f2e5/binhex.py
fss = macfs.FSSpec(ofname)
fss = FSSpec(ofname)
def __init__(self, (name, finfo, dlen, rlen), ofp): if type(ofp) == type(''): ofname = ofp ofp = open(ofname, 'w') if os.name == 'mac': fss = macfs.FSSpec(ofname) fss.SetCreatorType('BnHq', 'TEXT') ofp.write('(This file must be converted with BinHex 4.0)\n\n:') hqxer = _Hqxcoderengine(ofp) self.ofp = _Rlecoderengine(hq...
3cc48ceed9d84dd8ea049cba45c2d8356ee7f2e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3cc48ceed9d84dd8ea049cba45c2d8356ee7f2e5/binhex.py
ofss = macfs.FSSpec(out)
ofss = FSSpec(out)
def hexbin(inp, out): """(infilename, outfilename) - Decode binhexed file""" ifp = HexBin(inp) finfo = ifp.FInfo if not out: out = ifp.FName if os.name == 'mac': ofss = macfs.FSSpec(out) out = ofss.as_pathname() ofp = open(out, 'wb') # XXXX Do translation on non-mac systems while 1: d = ifp.read(128000) if not d: brea...
3cc48ceed9d84dd8ea049cba45c2d8356ee7f2e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3cc48ceed9d84dd8ea049cba45c2d8356ee7f2e5/binhex.py
self.hashcode = random.randrange(1000000000) def __hash__(self): return self.hashcode
def __hash__(self): return 42
def __init__(self, i): # Comparison outcomes are determined by the value of i. self.i = i
8fcf47618ace955ae72fd0b95729305c047ed09d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8fcf47618ace955ae72fd0b95729305c047ed09d/test_mutants.py
XXX
def test_one(n): global mutate, dict1, dict2, dict1keys, dict2keys # Fill the dicts without mutating them. mutate = 0 dict1keys = fill_dict(dict1, range(n), n) dict2keys = fill_dict(dict2, range(n), n) # Enable mutation, then compare the dicts so long as they have the # same size. mutate = 1 if verbose: print "trying...
8fcf47618ace955ae72fd0b95729305c047ed09d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8fcf47618ace955ae72fd0b95729305c047ed09d/test_mutants.py
referenced = C() a = C()
referenced = A() a = A()
def callback(*args): pass
8783910bd0d5e4a1e3ca50fed685d85496febcf0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8783910bd0d5e4a1e3ca50fed685d85496febcf0/test_weakref.py
a = C() a.wrc = weakref.ref(referenced, callback)
a = A() weakref.ref(referenced, callback)
def callback(*args): pass
8783910bd0d5e4a1e3ca50fed685d85496febcf0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8783910bd0d5e4a1e3ca50fed685d85496febcf0/test_weakref.py
def writestr(self, zinfo, bytes):
def writestr(self, zinfo_or_arcname, bytes):
def writestr(self, zinfo, bytes): """Write a file into the archive. The contents is the string 'bytes'.""" self._writecheck(zinfo) zinfo.file_size = len(bytes) # Uncompressed size zinfo.CRC = binascii.crc32(bytes) # CRC-32 checksum if zinfo.compress_type == ZIP_DEFLATED: co = zlib.compressobj(zlib.Z_D...
33331e271a17ff37ca21224255394ebde60c9b05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/33331e271a17ff37ca21224255394ebde60c9b05/zipfile.py
'bytes'."""
'bytes'. 'zinfo_or_arcname' is either a ZipInfo instance or the name of the file in the archive.""" if not isinstance(zinfo_or_arcname, ZipInfo): zinfo = ZipInfo(filename=zinfo_or_arcname, date_time=time.localtime(time.time())) zinfo.compress_type = self.compression else: zinfo = zinfo_or_arcname
def writestr(self, zinfo, bytes): """Write a file into the archive. The contents is the string 'bytes'.""" self._writecheck(zinfo) zinfo.file_size = len(bytes) # Uncompressed size zinfo.CRC = binascii.crc32(bytes) # CRC-32 checksum if zinfo.compress_type == ZIP_DEFLATED: co = zlib.compressobj(zlib.Z_D...
33331e271a17ff37ca21224255394ebde60c9b05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/33331e271a17ff37ca21224255394ebde60c9b05/zipfile.py
urllib.urlopen, "http://www.sadflkjsasadf.com/")
urllib.urlopen, "http://www.python.invalid/")
def test_bad_address(self): # Make sure proper exception is raised when connecting to a bogus # address. self.assertRaises(IOError, urllib.urlopen, "http://www.sadflkjsasadf.com/")
977f198431b25a6d80071ab8f0a35c0d2e4f0efd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/977f198431b25a6d80071ab8f0a35c0d2e4f0efd/test_urllibnet.py
for (func, cmd) in self.sub_commands:
for (func, cmd_name) in self.sub_commands:
def run (self):
c92e3b3b6b4e86b00e5476831c1d34d048a5ac9e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c92e3b3b6b4e86b00e5476831c1d34d048a5ac9e/install.py
self.run_peer (cmd)
self.run_peer (cmd_name)
def run (self):
c92e3b3b6b4e86b00e5476831c1d34d048a5ac9e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c92e3b3b6b4e86b00e5476831c1d34d048a5ac9e/install.py
for (func, cmd) in self.sub_commands:
for (func, cmd_name) in self.sub_commands:
def get_outputs (self): # This command doesn't have any outputs of its own, so just # get the outputs of all its sub-commands. outputs = [] for (func, cmd) in self.sub_commands: if func is None or func(): outputs.extend (self.run_peer (cmd))
c92e3b3b6b4e86b00e5476831c1d34d048a5ac9e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c92e3b3b6b4e86b00e5476831c1d34d048a5ac9e/install.py
outputs.extend (self.run_peer (cmd))
cmd = self.find_peer (cmd_name) outputs.extend (cmd.get_outputs())
def get_outputs (self): # This command doesn't have any outputs of its own, so just # get the outputs of all its sub-commands. outputs = [] for (func, cmd) in self.sub_commands: if func is None or func(): outputs.extend (self.run_peer (cmd))
c92e3b3b6b4e86b00e5476831c1d34d048a5ac9e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c92e3b3b6b4e86b00e5476831c1d34d048a5ac9e/install.py
self.write("Unsupported characters in input")
self.write("Unsupported characters in input\n")
def runsource(self, source): "Extend base class method: Stuff the source in the line cache first" filename = self.stuffsource(source) self.more = 0 self.save_warnings_filters = warnings.filters[:] warnings.filterwarnings(action="error", category=SyntaxWarning) if isinstance(source, types.UnicodeType): import IOBinding ...
ec1ca90708a80acdccd1a5e9ebc3dae17214c449 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ec1ca90708a80acdccd1a5e9ebc3dae17214c449/PyShell.py
s = s.strip() lines = s.split('\n') prefix = self.text.get("insert linestart","insert").rstrip() if prefix and prefix[-1]==':':
prefix = self.text.get("insert linestart", "insert") if prefix.rstrip().endswith(':'):
def recall(self, s, event): self.text.undo_block_start() try: self.text.tag_remove("sel", "1.0", "end") self.text.mark_set("insert", "end-1c") s = s.strip() lines = s.split('\n') prefix = self.text.get("insert linestart","insert").rstrip() if prefix and prefix[-1]==':': self.newline_and_indent_event(event) self.text.in...
ec1ca90708a80acdccd1a5e9ebc3dae17214c449 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ec1ca90708a80acdccd1a5e9ebc3dae17214c449/PyShell.py
self.text.insert("insert",lines[0].strip())
prefix = self.text.get("insert linestart", "insert") self.text.insert("insert", lines[0].strip())
def recall(self, s, event): self.text.undo_block_start() try: self.text.tag_remove("sel", "1.0", "end") self.text.mark_set("insert", "end-1c") s = s.strip() lines = s.split('\n') prefix = self.text.get("insert linestart","insert").rstrip() if prefix and prefix[-1]==':': self.newline_and_indent_event(event) self.text.in...
ec1ca90708a80acdccd1a5e9ebc3dae17214c449 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ec1ca90708a80acdccd1a5e9ebc3dae17214c449/PyShell.py
self.newline_and_indent_event(event)
orig_base_indent = re.search(r'^([ \t]*)', lines[0]).group(0) new_base_indent = re.search(r'^([ \t]*)', prefix).group(0)
def recall(self, s, event): self.text.undo_block_start() try: self.text.tag_remove("sel", "1.0", "end") self.text.mark_set("insert", "end-1c") s = s.strip() lines = s.split('\n') prefix = self.text.get("insert linestart","insert").rstrip() if prefix and prefix[-1]==':': self.newline_and_indent_event(event) self.text.in...
ec1ca90708a80acdccd1a5e9ebc3dae17214c449 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ec1ca90708a80acdccd1a5e9ebc3dae17214c449/PyShell.py
self.text.insert("insert", line.strip()) self.newline_and_indent_event(event)
if line.startswith(orig_base_indent): line = new_base_indent + line[len(orig_base_indent):] self.text.insert('insert', '\n'+line.rstrip())
def recall(self, s, event): self.text.undo_block_start() try: self.text.tag_remove("sel", "1.0", "end") self.text.mark_set("insert", "end-1c") s = s.strip() lines = s.split('\n') prefix = self.text.get("insert linestart","insert").rstrip() if prefix and prefix[-1]==':': self.newline_and_indent_event(event) self.text.in...
ec1ca90708a80acdccd1a5e9ebc3dae17214c449 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ec1ca90708a80acdccd1a5e9ebc3dae17214c449/PyShell.py
import pdb ; pdb.set_trace()
def extractarg(self, part): mode = "InMode" if self.asplit.match(part) < 0: self.error("Indecipherable argument: %s", `part`) import pdb ; pdb.set_trace() return ("unknown", part, mode) type, name, array = self.asplit.group('type', 'name', 'array') if array: # array matches an optional [] after the argument name type =...
dda40f44bbaa80f22681b8fa1508e91a6dda129a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/dda40f44bbaa80f22681b8fa1508e91a6dda129a/scantools.py
t = test()
t = Test()
def str(self): return str(self)
88bc8c0a29ccb765f1f7f4874d5ca58de18430da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/88bc8c0a29ccb765f1f7f4874d5ca58de18430da/test_scope.py
return beta * self.stdgamma(alpha) def stdgamma(self, alpha, *args):
if alpha <= 0.0 or beta <= 0.0: raise ValueError, 'gammavariate: alpha and beta must be > 0.0'
def gammavariate(self, alpha, beta): # beta times standard gamma return beta * self.stdgamma(alpha)
2acd882394b5e00e725784cf9ac8bb0b69b7237e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2acd882394b5e00e725784cf9ac8bb0b69b7237e/random.py
if alpha <= 0.0: raise ValueError, 'stdgamma: alpha must be > 0.0'
def stdgamma(self, alpha, *args): # *args for Py2.2 compatiblity random = self.random if alpha <= 0.0: raise ValueError, 'stdgamma: alpha must be > 0.0'
2acd882394b5e00e725784cf9ac8bb0b69b7237e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2acd882394b5e00e725784cf9ac8bb0b69b7237e/random.py
return x
return x * beta
def stdgamma(self, alpha, *args): # *args for Py2.2 compatiblity random = self.random if alpha <= 0.0: raise ValueError, 'stdgamma: alpha must be > 0.0'
2acd882394b5e00e725784cf9ac8bb0b69b7237e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2acd882394b5e00e725784cf9ac8bb0b69b7237e/random.py
return -_log(u)
return -_log(u) * beta
def stdgamma(self, alpha, *args): # *args for Py2.2 compatiblity random = self.random if alpha <= 0.0: raise ValueError, 'stdgamma: alpha must be > 0.0'
2acd882394b5e00e725784cf9ac8bb0b69b7237e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2acd882394b5e00e725784cf9ac8bb0b69b7237e/random.py
return x
return x * beta def stdgamma(self, alpha, ainv, bbb, ccc): import warnings warnings.warn("The stdgamma function is deprecated; " "use gammavariate() instead", DeprecationWarning) return self.gammavariate(alpha, 1.0)
def stdgamma(self, alpha, *args): # *args for Py2.2 compatiblity random = self.random if alpha <= 0.0: raise ValueError, 'stdgamma: alpha must be > 0.0'
2acd882394b5e00e725784cf9ac8bb0b69b7237e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2acd882394b5e00e725784cf9ac8bb0b69b7237e/random.py
def _test(N=200):
def _test(N=20000):
def _test(N=200): print 'TWOPI =', TWOPI print 'LOG4 =', LOG4 print 'NV_MAGICCONST =', NV_MAGICCONST print 'SG_MAGICCONST =', SG_MAGICCONST _test_generator(N, 'random()') _test_generator(N, 'normalvariate(0.0, 1.0)') _test_generator(N, 'lognormvariate(0.0, 1.0)') _test_generator(N, 'cunifvariate(0.0, 1...
2acd882394b5e00e725784cf9ac8bb0b69b7237e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2acd882394b5e00e725784cf9ac8bb0b69b7237e/random.py
re-inserted are alwyas appended to the header list.
re-inserted are always appended to the header list.
def values(self): """Return a list of all the message's header values.
231abbfb35c4502e85be774f9db94a5cd2eb6a3f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/231abbfb35c4502e85be774f9db94a5cd2eb6a3f/Message.py
re-inserted are alwyas appended to the header list.
re-inserted are always appended to the header list.
def items(self): """Get all the message's header fields and values.
231abbfb35c4502e85be774f9db94a5cd2eb6a3f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/231abbfb35c4502e85be774f9db94a5cd2eb6a3f/Message.py
compile(file)
compileFile(file)
def wrap_aug(node): return wrapper[node.__class__](node)
cafa8358d630358894c72bc8e10fd34fe64f0527 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/cafa8358d630358894c72bc8e10fd34fe64f0527/pycodegen.py
port = int(host[i+1:])
try: port = int(host[i+1:]) except ValueError, msg: raise socket.error, str(msg)
def _set_hostport(self, host, port): if port is None: i = host.find(':') if i >= 0: port = int(host[i+1:]) host = host[:i] else: port = self.default_port self.host = host self.port = port
a982c9f11e2f47304c90c363a90406111416fa90 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a982c9f11e2f47304c90c363a90406111416fa90/httplib.py
print time.strftime("expires=%a, %d-%b-%x %X GMT", gmt)
print time.strftime("expires=%a, %d-%b-%y %X GMT", gmt)
def send_my_cookie(ui): name = COOKIE_NAME value = "%s/%s/%s" % (ui.author, ui.email, ui.password) import urllib value = urllib.quote(value) then = now + COOKIE_LIFETIME gmt = time.gmtime(then) print "Set-Cookie: %s=%s; path=/cgi-bin/;" % (name, value), print time.strftime("expires=%a, %d-%b-%x %X GMT", gmt)
4bd8d0bd6c599d6cf8e959af1d4f850066e4de33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4bd8d0bd6c599d6cf8e959af1d4f850066e4de33/faqwiz.py
s = pickle.dumps(d) e = pickle.loads(s) self.assertNotEqual(id(d), id(e)) self.assertEqual(list(d), list(e))
for i in (0, 1, 2): s = pickle.dumps(d, i) e = pickle.loads(s) self.assertNotEqual(id(d), id(e)) self.assertEqual(list(d), list(e)) def test_pickle_recursive(self): d = deque('abc') d.append(d) for i in (0, 1, 2): e = pickle.loads(pickle.dumps(d, i)) self.assertNotEqual(id(d), id(e)) self.assertEqual(id(e), id(e[-1]))...
def test_pickle(self): d = deque(xrange(200)) s = pickle.dumps(d) e = pickle.loads(s) self.assertNotEqual(id(d), id(e)) self.assertEqual(list(d), list(e))
03a37fefae866e9942339894844d98f6cccffa7d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/03a37fefae866e9942339894844d98f6cccffa7d/test_deque.py
test_mesg = 'From: %s@localhost\nSubject: IMAP4 test\n\ndata...\n' % USER
test_mesg = 'From: %(user)s@localhost%(lf)sSubject: IMAP4 test%(lf)s%(lf)sdata...%(lf)s' % {'user':USER, 'lf':CRLF}
def print_log(): _mesg('last %d IMAP4 interactions:' % len(_cmd_log)) for secs,line in _cmd_log: _mesg(line, secs)
ad10859269e0634c4c562ddc654dcf974d3f3c0a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ad10859269e0634c4c562ddc654dcf974d3f3c0a/imaplib.py
if auth: h.putheader('Authorization: Basic %s' % auth)
if auth: h.putheader('Authorization', 'Basic %s' % auth)
def open_https(self, url, data=None): """Use HTTPS protocol.""" import httplib user_passwd = None if isinstance(url, str): host, selector = splithost(url) if host: user_passwd, host = splituser(host) host = unquote(host) realhost = host else: host, selector = url urltype, rest = splittype(selector) url = rest user_pass...
59f8d1a0459e575e9d246f927745756449d1e42f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/59f8d1a0459e575e9d246f927745756449d1e42f/urllib.py
sys.stdout.writelines(restored)
for line in restored: print line,
def restore(which): restored = difflib.restore(sys.stdin.readlines(), which) sys.stdout.writelines(restored)
38d1938cce02548740ea9ce01f20941881148ba6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/38d1938cce02548740ea9ce01f20941881148ba6/ndiff.py
name = string.join(string.split(name, '-'), '_')
name = '_'.join(name.split('-'))
def open(self, fullurl, data=None): """Use URLopener().open(file) instead of open(file, 'r').""" fullurl = unwrap(toBytes(fullurl)) if self.tempcache and self.tempcache.has_key(fullurl): filename, headers = self.tempcache[fullurl] fp = open(filename, 'rb') return addinfourl(fp, headers, fullurl) urltype, url = splittyp...
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
if string.lower(urltype) != 'http':
if urltype.lower() != 'http':
def open_http(self, url, data=None): """Use HTTP protocol.""" import httplib user_passwd = None if type(url) is types.StringType: host, selector = splithost(url) if host: user_passwd, host = splituser(host) host = unquote(host) realhost = host else: host, selector = url urltype, rest = splittype(selector) url = rest us...
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
auth = string.strip(base64.encodestring(user_passwd))
auth = base64.encodestring(user_passwd).strip()
def open_http(self, url, data=None): """Use HTTP protocol.""" import httplib user_passwd = None if type(url) is types.StringType: host, selector = splithost(url) if host: user_passwd, host = splituser(host) host = unquote(host) realhost = host else: host, selector = url urltype, rest = splittype(selector) url = rest us...
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
if string.lower(urltype) != 'https':
if urltype.lower() != 'https':
def open_https(self, url, data=None): """Use HTTPS protocol.""" import httplib user_passwd = None if type(url) in types.StringTypes: host, selector = splithost(url) if host: user_passwd, host = splituser(host) host = unquote(host) realhost = host else: host, selector = url urltype, rest = splittype(selector) url = rest...
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
auth = string.strip(base64.encodestring(user_passwd))
auth = base64.encodestring(user_passwd).strip()
def open_https(self, url, data=None): """Use HTTPS protocol.""" import httplib user_passwd = None if type(url) in types.StringTypes: host, selector = splithost(url) if host: user_passwd, host = splituser(host) host = unquote(host) realhost = host else: host, selector = url urltype, rest = splittype(selector) url = rest...
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
return self.http_error(url, fp, errcode, errmsg, headers, data)
return self.http_error(url, fp, errcode, errmsg, headers, data)
def open_https(self, url, data=None): """Use HTTPS protocol.""" import httplib user_passwd = None if type(url) in types.StringTypes: host, selector = splithost(url) if host: user_passwd, host = splituser(host) host = unquote(host) realhost = host else: host, selector = url urltype, rest = splittype(selector) url = rest...
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
dirs = string.splitfields(path, '/')
dirs = path.split('/')
def open_ftp(self, url): """Use FTP protocol.""" host, path = splithost(url) if not host: raise IOError, ('ftp error', 'no host given') host, port = splitport(host) user, host = splituser(host) if user: user, passwd = splitpasswd(user) else: passwd = None host = unquote(host) user = unquote(user or '') passwd = unquote...
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
key = user, host, port, string.join(dirs, '/')
key = user, host, port, '/'.join(dirs)
def open_ftp(self, url): """Use FTP protocol.""" host, path = splithost(url) if not host: raise IOError, ('ftp error', 'no host given') host, port = splitport(host) user, host = splituser(host) if user: user, passwd = splitpasswd(user) else: passwd = None host = unquote(host) user = unquote(user or '') passwd = unquote...
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
if string.lower(attr) == 'type' and \
if attr.lower() == 'type' and \
def open_ftp(self, url): """Use FTP protocol.""" host, path = splithost(url) if not host: raise IOError, ('ftp error', 'no host given') host, port = splitport(host) user, host = splituser(host) if user: user, passwd = splitpasswd(user) else: passwd = None host = unquote(host) user = unquote(user or '') passwd = unquote...
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
type = string.upper(value)
type = value.upper()
def open_ftp(self, url): """Use FTP protocol.""" host, path = splithost(url) if not host: raise IOError, ('ftp error', 'no host given') host, port = splitport(host) user, host = splituser(host) if user: user, passwd = splitpasswd(user) else: passwd = None host = unquote(host) user = unquote(user or '') passwd = unquote...
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
[type, data] = string.split(url, ',', 1)
[type, data] = url.split(',', 1)
def open_data(self, url, data=None): """Use "data" URL.""" # ignore POSTed data # # syntax of data URLs: # dataurl := "data:" [ mediatype ] [ ";base64" ] "," data # mediatype := [ type "/" subtype ] *( ";" parameter ) # data := *urlchar # parameter := attribute "=" value import StringIO, mimetools, time try: [ty...
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
semi = string.rfind(type, ';')
semi = type.rfind(';')
def open_data(self, url, data=None): """Use "data" URL.""" # ignore POSTed data # # syntax of data URLs: # dataurl := "data:" [ mediatype ] [ ";base64" ] "," data # mediatype := [ type "/" subtype ] *( ";" parameter ) # data := *urlchar # parameter := attribute "=" value import StringIO, mimetools, time try: [ty...
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
msg = string.join(msg, '\n')
msg = '\n'.join(msg)
def open_data(self, url, data=None): """Use "data" URL.""" # ignore POSTed data # # syntax of data URLs: # dataurl := "data:" [ mediatype ] [ ";base64" ] "," data # mediatype := [ type "/" subtype ] *( ";" parameter ) # data := *urlchar # parameter := attribute "=" value import StringIO, mimetools, time try: [ty...
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
if string.lower(scheme) == 'basic':
if scheme.lower() == 'basic':
def http_error_401(self, url, fp, errcode, errmsg, headers, data=None): """Error 401 -- authentication required. See this URL for a description of the basic authentication scheme: http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-v10-spec-00.txt""" if headers.has_key('www-authenticate'): stuff = headers['www-authent...
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
i = string.find(host, '@') + 1
i = host.find('@') + 1
def retry_http_basic_auth(self, url, realm, data=None): host, selector = splithost(url) i = string.find(host, '@') + 1 host = host[i:] user, passwd = self.get_user_passwd(host, realm, i) if not (user or passwd): return None host = user + ':' + passwd + '@' + host newurl = 'http://' + host + selector if data is None: re...
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
i = string.find(host, '@') + 1
i = host.find('@') + 1
def retry_https_basic_auth(self, url, realm, data=None): host, selector = splithost(url) i = string.find(host, '@') + 1 host = host[i:] user, passwd = self.get_user_passwd(host, realm, i) if not (user or passwd): return None host = user + ':' + passwd + '@' + host newurl = '//' + host + selector return self.open_https(...
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
key = realm + '@' + string.lower(host)
key = realm + '@' + host.lower()
def get_user_passwd(self, host, realm, clear_cache = 0): key = realm + '@' + string.lower(host) if self.auth_cache.has_key(key): if clear_cache: del self.auth_cache[key] else: return self.auth_cache[key] user, passwd = self.prompt_user_passwd(host, realm) if user or passwd: self.auth_cache[key] = (user, passwd) return ...
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
if reason[:3] != '550':
if str(reason)[:3] != '550':
def retrfile(self, file, type): import ftplib self.endtransfer() if type in ('d', 'D'): cmd = 'TYPE A'; isdir = 1 else: cmd = 'TYPE ' + type; isdir = 0 try: self.ftp.voidcmd(cmd) except ftplib.all_errors: self.init() self.ftp.voidcmd(cmd) conn = None if file and not isdir: # Use nlst to see if the file exists at all tr...
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
i = string.rfind(basepath, '/')
i = basepath.rfind('/')
def basejoin(base, url): """Utility to combine a URL with a base URL to form a new URL.""" type, path = splittype(url) if type: # if url is complete (i.e., it contains a type), return it return url host, path = splithost(path) type, basepath = splittype(base) # inherit type from base if host: # if url contains host, ju...
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
i = string.rfind(basepath[:-1], '/')
i = basepath[:-1].rfind('/')
def basejoin(base, url): """Utility to combine a URL with a base URL to form a new URL.""" type, path = splittype(url) if type: # if url is complete (i.e., it contains a type), return it return url host, path = splithost(path) type, basepath = splittype(base) # inherit type from base if host: # if url contains host, ju...
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
raise UnicodeError("URL "+repr(url)+" contains non-ASCII characters")
raise UnicodeError("URL " + repr(url) + " contains non-ASCII characters")
def toBytes(url): """toBytes(u"URL") --> 'URL'.""" # Most URL schemes require ASCII. If that changes, the conversion # can be relaxed if type(url) is types.UnicodeType: try: url = url.encode("ASCII") except UnicodeError: raise UnicodeError("URL "+repr(url)+" contains non-ASCII characters") return url
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
url = string.strip(url)
url = url.strip()
def unwrap(url): """unwrap('<URL:type://host/path>') --> 'type://host/path'.""" url = string.strip(url) if url[:1] == '<' and url[-1:] == '>': url = string.strip(url[1:-1]) if url[:4] == 'URL:': url = string.strip(url[4:]) return url
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
url = string.strip(url[1:-1]) if url[:4] == 'URL:': url = string.strip(url[4:])
url = url[1:-1].strip() if url[:4] == 'URL:': url = url[4:].strip()
def unwrap(url): """unwrap('<URL:type://host/path>') --> 'type://host/path'.""" url = string.strip(url) if url[:1] == '<' and url[-1:] == '>': url = string.strip(url[1:-1]) if url[:4] == 'URL:': url = string.strip(url[4:]) return url
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
if not port: raise string.atoi_error, "no digits" nport = string.atoi(port) except string.atoi_error:
if not port: raise ValueError, "no digits" nport = int(port) except ValueError:
def splitnport(host, defport=-1): """Split host and port, returning numeric port. Return given default port if no ':' found; defaults to -1. Return numerical port if a valid number are found after ':'. Return None if ':' but not a valid number.""" global _nportprog if _nportprog is None: import re _nportprog = re.compi...
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
words = string.splitfields(url, ';')
words = url.split(';')
def splitattr(url): """splitattr('/path;attr1=value1;attr2=value2;...') -> '/path', ['attr1=value1', 'attr2=value2', ...].""" words = string.splitfields(url, ';') return words[0], words[1:]
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
myatoi = string.atoi list = string.split(s, '%')
myatoi = int list = s.split('%')
def unquote(s): """unquote('abc%20def') -> 'abc def'.""" mychr = chr myatoi = string.atoi list = string.split(s, '%') res = [list[0]] myappend = res.append del list[0] for item in list: if item[1:2]: try: myappend(mychr(myatoi(item[:2], 16)) + item[2:]) except: myappend('%' + item) else: myappend('%' + item) return str...
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
return string.join(res, "")
return "".join(res)
def unquote(s): """unquote('abc%20def') -> 'abc def'.""" mychr = chr myatoi = string.atoi list = string.split(s, '%') res = [list[0]] myappend = res.append del list[0] for item in list: if item[1:2]: try: myappend(mychr(myatoi(item[:2], 16)) + item[2:]) except: myappend('%' + item) else: myappend('%' + item) return str...
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
s = string.join(string.split(s, '+'), ' ')
s = ' '.join(s.split('+'))
def unquote_plus(s): """unquote('%7e/abc+def') -> '~/abc def'""" if '+' in s: # replace '+' with ' ' s = string.join(string.split(s, '+'), ' ') return unquote(s)
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
return string.join(res, '')
return ''.join(res)
def _fast_quote(s): global _fast_safe if _fast_safe is None: _fast_safe = {} for c in _fast_safe_test: _fast_safe[c] = c res = list(s) for i in range(len(res)): c = res[i] if not _fast_safe.has_key(c): res[i] = '%%%02x' % ord(c) return string.join(res, '')
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
return string.join(res, '')
return ''.join(res)
def quote(s, safe = '/'): """quote('abc def') -> 'abc%20def' Each part of a URL, e.g. the path info, the query, etc., has a different set of reserved characters that must be quoted. RFC 2396 Uniform Resource Identifiers (URI): Generic Syntax lists the following reserved characters. reserved = ";" | "/" | "?" | ":...
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
l = string.split(s, ' ')
l = s.split(' ')
def quote_plus(s, safe = ''): """Quote the query fragment of a URL; replacing ' ' with '+'""" if ' ' in s: l = string.split(s, ' ') for i in range(len(l)): l[i] = quote(l[i], safe) return string.join(l, '+') else: return quote(s, safe)
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
return string.join(l, '+')
return '+'.join(l)
def quote_plus(s, safe = ''): """Quote the query fragment of a URL; replacing ' ' with '+'""" if ' ' in s: l = string.split(s, ' ') for i in range(len(l)): l[i] = quote(l[i], safe) return string.join(l, '+') else: return quote(s, safe)
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
return string.join(l, '&')
return '&'.join(l)
def urlencode(dict): """Encode a dictionary of form entries into a URL query string.""" l = [] for k, v in dict.items(): k = quote_plus(str(k)) v = quote_plus(str(v)) l.append(k + '=' + v) return string.join(l, '&')
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
name = string.lower(name)
name = name.lower()
def getproxies_environment(): """Return a dictionary of scheme -> proxy server URL mappings. Scan the environment for variables named <scheme>_proxy; this seems to be the standard convention. If you need a different way, you can pass a proxies dictionary to the [Fancy]URLopener constructor. """ proxies = {} for name...
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
print "Block number: %d, Block size: %d, Total size: %d" % (blocknum, blocksize, totalsize)
print "Block number: %d, Block size: %d, Total size: %d" % ( blocknum, blocksize, totalsize)
def reporthook(blocknum, blocksize, totalsize): # Report during remote transfers print "Block number: %d, Block size: %d, Total size: %d" % (blocknum, blocksize, totalsize)
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py
print fn, h
print fn
def test(args=[]): if not args: args = [ '/etc/passwd', 'file:/etc/passwd', 'file://localhost/etc/passwd', 'ftp://ftp.python.org/etc/passwd',
2a3596c7d04c9635576a712f85db07ce4de4bff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2a3596c7d04c9635576a712f85db07ce4de4bff2/urllib.py