rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
if DEBUG: print 'DBG CRC %x %x'%(self.crc, filecrc)
|
def _checkcrc(self):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
|
def _readheader(self):
|
def _readheader(self):
|
def _readheader(self):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
if DEBUG: print 'DATA, RLEN', self.dlen, self.rlen
|
def _readheader(self):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
|
def read(self, *n):
|
def read(self, *n):
|
def read(self, *n):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
def close_data(self): if self.state != _DID_HEADER: raise Error, 'close_data at wrong time' if self.dlen:
|
def close_data(self): if self.state != _DID_HEADER: raise Error, 'close_data at wrong time' if self.dlen:
|
def close_data(self): if self.state != _DID_HEADER: raise Error, 'close_data at wrong time' if self.dlen:
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
self._checkcrc() self.state = _DID_DATA def read_rsrc(self, *n): if self.state == _DID_HEADER: self.close_data() if self.state != _DID_DATA: raise Error, 'Read resource data at wrong time' if n: n = n[0] n = min(n, self.rlen) else: n = self.rlen self.rlen = self.rlen - n return self._read(n) def close(self): if self.rlen: dummy = self.read_rsrc(self.rlen) self._checkcrc() self.state = _DID_RSRC self.ifp.close()
|
self._checkcrc() self.state = _DID_DATA def read_rsrc(self, *n): if self.state == _DID_HEADER: self.close_data() if self.state != _DID_DATA: raise Error, 'Read resource data at wrong time' if n: n = n[0] n = min(n, self.rlen) else: n = self.rlen self.rlen = self.rlen - n return self._read(n) def close(self): if self.rlen: dummy = self.read_rsrc(self.rlen) self._checkcrc() self.state = _DID_RSRC self.ifp.close()
|
def close_data(self): if self.state != _DID_HEADER: raise Error, 'close_data at wrong time' if self.dlen:
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
d = ifp.read() ofp.write(d)
|
while 1: d = ifp.read(128000) if not d: break ofp.write(d)
|
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 d = ifp.read() ofp.write(d) ofp.close() ifp.close_data() d = ifp.read_rsrc() if d: ofp = openrsrc(out, 'wb') ofp.write(d) ofp.close() if os.name == 'mac': nfinfo = ofss.GetFInfo() nfinfo.Creator = finfo.Creator nfinfo.Type = finfo.Type nfinfo.Flags = finfo.Flags ofss.SetFInfo(nfinfo) ifp.close()
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
d = ifp.read_rsrc()
|
d = ifp.read_rsrc(128000)
|
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 d = ifp.read() ofp.write(d) ofp.close() ifp.close_data() d = ifp.read_rsrc() if d: ofp = openrsrc(out, 'wb') ofp.write(d) ofp.close() if os.name == 'mac': nfinfo = ofss.GetFInfo() nfinfo.Creator = finfo.Creator nfinfo.Type = finfo.Type nfinfo.Flags = finfo.Flags ofss.SetFInfo(nfinfo) ifp.close()
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
def _test(): if os.name == 'mac': fss, ok = macfs.PromptGetFile('File to convert:') if not ok: sys.exit(0) fname = fss.as_pathname() else: fname = sys.argv[1] #binhex(fname, fname+'.hqx') #hexbin(fname+'.hqx', fname+'.viahqx') hexbin(fname, fname+'.unpacked') sys.exit(1)
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
||
<type 'None'>
|
<type 'NoneType'>
|
... def g():
|
297abadc6b871c61388c3df2e5e7b3e531a9a813 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/297abadc6b871c61388c3df2e5e7b3e531a9a813/test_generators.py
|
<type 'None'>
|
<type 'NoneType'>
|
... def f(self):
|
297abadc6b871c61388c3df2e5e7b3e531a9a813 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/297abadc6b871c61388c3df2e5e7b3e531a9a813/test_generators.py
|
child = TreeNode(self.canvas, self, item)
|
child = self.__class__(self.canvas, self, item)
|
def draw(self, x, y): # XXX This hard-codes too many geometry constants! self.x, self.y = x, y self.drawicon() self.drawtext() if self.state != 'expanded': return y+17 # draw children if not self.children: sublist = self.item._GetSubList() if not sublist: # _IsExpandable() was mistaken; that's allowed return y+17 for item in sublist: child = TreeNode(self.canvas, self, item) self.children.append(child) cx = x+20 cy = y+17 cylast = 0 for child in self.children: cylast = cy self.canvas.create_line(x+9, cy+7, cx, cy+7, fill="gray50") cy = child.draw(cx, cy) if child.item._IsExpandable(): if child.state == 'expanded': iconname = "minusnode" callback = child.collapse else: iconname = "plusnode" callback = child.expand image = self.geticonimage(iconname) id = self.canvas.create_image(x+9, cylast+7, image=image) # XXX This leaks bindings until canvas is deleted: self.canvas.tag_bind(id, "<1>", callback) self.canvas.tag_bind(id, "<Double-1>", lambda x: None) id = self.canvas.create_line(x+9, y+10, x+9, cylast+7, ##stipple="gray50", # XXX Seems broken in Tk 8.0.x fill="gray50") self.canvas.tag_lower(id) # XXX .lower(id) before Python 1.5.2 return cy
|
72de9c7a9c06bfe498c04ef134f510c51a5aef98 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/72de9c7a9c06bfe498c04ef134f510c51a5aef98/TreeWidget.py
|
self.failUnlessEqual(3, getargs_b(3.14))
|
self.assertRaises(TypeError, getargs_b, 3.14)
|
def test_b(self): from _testcapi import getargs_b # b returns 'unsigned char', and does range checking (0 ... UCHAR_MAX) self.failUnlessEqual(3, getargs_b(3.14)) self.failUnlessEqual(99, getargs_b(Long())) self.failUnlessEqual(99, getargs_b(Int()))
|
c947123350b31d3fab7e4893eb87cb361125f549 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c947123350b31d3fab7e4893eb87cb361125f549/test_getargs2.py
|
self.failUnlessEqual(3, getargs_B(3.14))
|
self.assertRaises(TypeError, getargs_B, 3.14)
|
def test_B(self): from _testcapi import getargs_B # B returns 'unsigned char', no range checking self.failUnlessEqual(3, getargs_B(3.14)) self.failUnlessEqual(99, getargs_B(Long())) self.failUnlessEqual(99, getargs_B(Int()))
|
c947123350b31d3fab7e4893eb87cb361125f549 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c947123350b31d3fab7e4893eb87cb361125f549/test_getargs2.py
|
self.failUnlessEqual(3, getargs_H(3.14))
|
self.assertRaises(TypeError, getargs_H, 3.14)
|
def test_H(self): from _testcapi import getargs_H # H returns 'unsigned short', no range checking self.failUnlessEqual(3, getargs_H(3.14)) self.failUnlessEqual(99, getargs_H(Long())) self.failUnlessEqual(99, getargs_H(Int()))
|
c947123350b31d3fab7e4893eb87cb361125f549 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c947123350b31d3fab7e4893eb87cb361125f549/test_getargs2.py
|
self.failUnlessEqual(3, getargs_I(3.14))
|
self.assertRaises(TypeError, getargs_I, 3.14)
|
def test_I(self): from _testcapi import getargs_I # I returns 'unsigned int', no range checking self.failUnlessEqual(3, getargs_I(3.14)) self.failUnlessEqual(99, getargs_I(Long())) self.failUnlessEqual(99, getargs_I(Int()))
|
c947123350b31d3fab7e4893eb87cb361125f549 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c947123350b31d3fab7e4893eb87cb361125f549/test_getargs2.py
|
self.failUnlessEqual(3, getargs_i(3.14))
|
self.assertRaises(TypeError, getargs_i, 3.14)
|
def test_i(self): from _testcapi import getargs_i # i returns 'int', and does range checking (INT_MIN ... INT_MAX) self.failUnlessEqual(3, getargs_i(3.14)) self.failUnlessEqual(99, getargs_i(Long())) self.failUnlessEqual(99, getargs_i(Int()))
|
c947123350b31d3fab7e4893eb87cb361125f549 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c947123350b31d3fab7e4893eb87cb361125f549/test_getargs2.py
|
self.failUnlessEqual(3, getargs_l(3.14))
|
self.assertRaises(TypeError, getargs_l, 3.14)
|
def test_l(self): from _testcapi import getargs_l # l returns 'long', and does range checking (LONG_MIN ... LONG_MAX) self.failUnlessEqual(3, getargs_l(3.14)) self.failUnlessEqual(99, getargs_l(Long())) self.failUnlessEqual(99, getargs_l(Int()))
|
c947123350b31d3fab7e4893eb87cb361125f549 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c947123350b31d3fab7e4893eb87cb361125f549/test_getargs2.py
|
if self.fp and not self._filePassed: self.fp.close() self.fp = None
|
self.close()
|
def __del__(self): """Call the "close()" method in case the user forgot.""" if self.fp and not self._filePassed: self.fp.close() self.fp = None
|
d15f8bbe320811d8edaf869c91308679d246693f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d15f8bbe320811d8edaf869c91308679d246693f/zipfile.py
|
check_syntax("def f(): global time; import ")
|
check_syntax("def f(): global time; import ")
|
483638c9a865d504b1131c098f010590103415dd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/483638c9a865d504b1131c098f010590103415dd/test_grammar.py
|
|
next = self.index(mark + " lineend +1c")
|
next = self.index(mark + "+%d lines linestart" % lines_to_get) lines_to_get = min(lines_to_get * 2, 100)
|
def recolorize_main(self): next = "1.0" was_ok = is_ok = 0 while 1: item = self.tag_nextrange("TODO", next) if not item: break head, tail = item self.tag_remove("SYNC", head, tail) item = self.tag_prevrange("SYNC", head) if item: head = item[1] else: head = "1.0"
|
e62e76c38322ebb88bcf54a933a07291d9e7c5ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e62e76c38322ebb88bcf54a933a07291d9e7c5ba/ColorDelegator.py
|
(objects, output_dir) = \ self._fix_link_args (objects, output_dir, takes_libs=0)
|
(objects, output_dir) = self._fix_object_args (objects, output_dir)
|
def create_static_lib (self, objects, output_libname, output_dir=None, debug=0, extra_preargs=None, extra_postargs=None):
|
2f557a2ec46afe5cc699f47baae6aaba52ba7553 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2f557a2ec46afe5cc699f47baae6aaba52ba7553/msvccompiler.py
|
(objects, output_dir, libraries, library_dirs) = \ self._fix_link_args (objects, output_dir, takes_libs=1, libraries=libraries, library_dirs=library_dirs)
|
(objects, output_dir) = self._fix_object_args (objects, output_dir) (libraries, library_dirs, runtime_library_dirs) = \ self._fix_lib_args (libraries, library_dirs, runtime_library_dirs) if self.runtime_library_dirs: self.warn ("I don't know what to do with 'runtime_library_dirs': " + str (runtime_library_dirs))
|
def link_shared_object (self, objects, output_filename, output_dir=None, libraries=None, library_dirs=None, debug=0, extra_preargs=None, extra_postargs=None):
|
2f557a2ec46afe5cc699f47baae6aaba52ba7553 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2f557a2ec46afe5cc699f47baae6aaba52ba7553/msvccompiler.py
|
library_dirs, self.runtime_library_dirs,
|
library_dirs, runtime_library_dirs,
|
def link_shared_object (self, objects, output_filename, output_dir=None, libraries=None, library_dirs=None, debug=0, extra_preargs=None, extra_postargs=None):
|
2f557a2ec46afe5cc699f47baae6aaba52ba7553 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2f557a2ec46afe5cc699f47baae6aaba52ba7553/msvccompiler.py
|
initialcolor = (128, 128, 128)
|
initialcolor = 'grey50'
|
def main(): global app initialcolor = (128, 128, 128) try: opts, args = getopt.getopt(sys.argv[1:], 'hc:', ['color=', 'help']) except getopt.error, msg: usage(1, msg) if args: usage(1) for opt, arg in opts: if opt in ('-h', '--help'): usage(0) elif opt in ('-c', '--color'): initialcolor = arg # create the windows and go for f in RGB_TXT: try: colordb = ColorDB.get_colordb(f) break except IOError: pass else: raise IOError('No color database file found') app = Pmw.initialise(fontScheme='pmw1') app.title('Pynche %s' % __version__) app.tk.createtimerhandler(KEEPALIVE_TIMER, keepalive) # get triplet for initial color try: red, green, blue = colordb.find_byname(initialcolor) except ColorDB.BadColor: # must be a #rrggbb style color try: red, green, blue = ColorDB.rrggbb_to_triplet(initialcolor) except ColorDB.BadColor: usage(1, 'Bad initial color: %s' % initialcolor) p = PyncheWidget(colordb, app, color=(red, green, blue)) try: keepalive() app.mainloop() except KeyboardInterrupt: pass
|
f7e4793660289bd2b1d9877cc936a7e934f910c5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f7e4793660289bd2b1d9877cc936a7e934f910c5/Main.py
|
if self.optmize > 0:
|
if self.optimize > 0:
|
def _bytecode_filenames (self, py_filenames): bytecode_files = [] for py_file in py_filenames: if self.compile: bytecode_files.append(py_file + "c") if self.optmize > 0: bytecode_files.append(py_file + "o")
|
0295181fa6089d53268b87d6756363796cd7c27d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0295181fa6089d53268b87d6756363796cd7c27d/install_lib.py
|
if wid:
|
if KILLUNKNOWNWINDOWS and wid:
|
def do_updateEvt(self, event): (what, message, when, where, modifiers) = event wid = Win.WhichWindow(message) if wid and self._windows.has_key(wid): window = self._windows[wid] window.do_rawupdate(wid, event) else: if wid: wid.HideWindow() import sys sys.stderr.write("XXX killed unknown (crashed?) Python window.\n") else: MacOS.HandleEvent(event)
|
dc4d925be9f95bdf77e6d9ddd94f3042f061f550 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dc4d925be9f95bdf77e6d9ddd94f3042f061f550/Wapplication.py
|
objects = self.object_filenames(sources, 0, outdir)
|
objects = self.object_filenames(sources, strip_dir=python_build, output_dir=outdir)
|
def _setup_compile(self, outdir, macros, incdirs, sources, depends, extra): """Process arguments and decide which source files to compile.
|
8c6e0ec16a39bb4ae139ec0104f6615173244664 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8c6e0ec16a39bb4ae139ec0104f6615173244664/ccompiler.py
|
objects = self.object_filenames(sources, strip_dir=0,
|
objects = self.object_filenames(sources, strip_dir=python_build,
|
def _prep_compile(self, sources, output_dir, depends=None): """Decide which souce files must be recompiled.
|
8c6e0ec16a39bb4ae139ec0104f6615173244664 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8c6e0ec16a39bb4ae139ec0104f6615173244664/ccompiler.py
|
def open(self, url, new=0):
|
def open(self, url, new=0, autoraise=1):
|
def open(self, url, new=0): os.system(self.command % url)
|
cfa4096618650f6317c8872b8cbe7daaf90ccb03 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cfa4096618650f6317c8872b8cbe7daaf90ccb03/webbrowser.py
|
def open(self, url, new=1):
|
def open(self, url, new=1, autoraise=1):
|
def open(self, url, new=1): # XXX Currently I know no way to prevent KFM from opening a new win. self._remote("openURL %s" % url)
|
cfa4096618650f6317c8872b8cbe7daaf90ccb03 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cfa4096618650f6317c8872b8cbe7daaf90ccb03/webbrowser.py
|
def open(self, url, new=0):
|
def open(self, url, new=0, autoraise=1):
|
def open(self, url, new=0): if new: self._remote("LOADNEW " + url) else: self._remote("LOAD " + url)
|
cfa4096618650f6317c8872b8cbe7daaf90ccb03 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cfa4096618650f6317c8872b8cbe7daaf90ccb03/webbrowser.py
|
def open(self, url, new=0):
|
def open(self, url, new=0, autoraise=1):
|
def open(self, url, new=0): os.startfile(url)
|
cfa4096618650f6317c8872b8cbe7daaf90ccb03 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cfa4096618650f6317c8872b8cbe7daaf90ccb03/webbrowser.py
|
def open(self, url, new=0):
|
def open(self, url, new=0, autoraise=1):
|
def open(self, url, new=0): ic.launchurl(url)
|
cfa4096618650f6317c8872b8cbe7daaf90ccb03 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cfa4096618650f6317c8872b8cbe7daaf90ccb03/webbrowser.py
|
return self.version or "???"
|
return self.version or "0.0.0"
|
def get_version(self): return self.version or "???"
|
bcd8975740da47e7d1c8a5d2839ad4bf214fe34b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/bcd8975740da47e7d1c8a5d2839ad4bf214fe34b/dist.py
|
from distutils.util import get_platform s = "build/lib.%s-%.3s" % (get_platform(), sys.version)
|
s = "build/lib.%s-%.3s" % ("linux-i686", sys.version)
|
def makepath(*paths): dir = os.path.abspath(os.path.join(*paths)) return dir, os.path.normcase(dir)
|
bdf3b509ed9f131d3c868d6097f8e02c8a9d554e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/bdf3b509ed9f131d3c868d6097f8e02c8a9d554e/site.py
|
del get_platform, s
|
def makepath(*paths): dir = os.path.abspath(os.path.join(*paths)) return dir, os.path.normcase(dir)
|
bdf3b509ed9f131d3c868d6097f8e02c8a9d554e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/bdf3b509ed9f131d3c868d6097f8e02c8a9d554e/site.py
|
|
print 'new.code()'
|
def break_yolks(self): self.yolks = self.yolks - 2
|
d08011a0e1ec2f3eeaa089ba69eb9ba68941277f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d08011a0e1ec2f3eeaa089ba69eb9ba68941277f/test_new.py
|
|
def upload_file(self, command, pyversion, filename): # Sign if requested if self.sign: spawn(("gpg", "--detach-sign", "-a", filename), dry_run=self.dry_run)
|
6d0c85a71c0d12fd45693ca37b66959a33e9b941 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6d0c85a71c0d12fd45693ca37b66959a33e9b941/upload.py
|
||
':action':'file_upload', 'protcol_version':'1', 'name':self.distribution.get_name(), 'version':self.distribution.get_version(), 'content':(os.path.basename(filename),content), 'filetype':command, 'pyversion':pyversion, 'md5_digest':md5(content).hexdigest(),
|
':action': 'file_upload', 'protcol_version': '1', 'name': meta.get_name(), 'version': meta.get_version(), 'content': (os.path.basename(filename),content), 'filetype': command, 'pyversion': pyversion, 'md5_digest': md5(content).hexdigest(), 'metadata_version' : '1.0', 'summary': meta.get_description(), 'home_page': meta.get_url(), 'author': meta.get_contact(), 'author_email': meta.get_contact_email(), 'license': meta.get_licence(), 'description': meta.get_long_description(), 'keywords': meta.get_keywords(), 'platform': meta.get_platforms(), 'classifiers': meta.get_classifiers(), 'download_url': meta.get_download_url(), 'provides': meta.get_provides(), 'requires': meta.get_requires(), 'obsoletes': meta.get_obsoletes(),
|
def upload_file(self, command, pyversion, filename): # Sign if requested if self.sign: spawn(("gpg", "--detach-sign", "-a", filename), dry_run=self.dry_run)
|
6d0c85a71c0d12fd45693ca37b66959a33e9b941 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6d0c85a71c0d12fd45693ca37b66959a33e9b941/upload.py
|
elif sys.platform.startswith("netbsd"):
|
elif sys.platform.startswith("netbsd") or sys.platform.startswith("openbsd"):
|
def test_load(self): if os.name == "nt": name = "msvcrt" elif os.name == "ce": name = "coredll" elif sys.platform == "darwin": name = "libc.dylib" elif sys.platform.startswith("freebsd"): name = "libc.so" elif sys.platform == "sunos5": name = "libc.so" elif sys.platform.startswith("netbsd"): name = "libc.so" else: name = "libc.so.6"
|
0d93a234790d86a67c592c226070f8a6bf6ba300 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0d93a234790d86a67c592c226070f8a6bf6ba300/test_loading.py
|
lib_dirs = self.compiler.library_dirs + ['/lib', '/usr/lib']
|
lib_dirs = self.compiler.library_dirs + ['/lib', '/usr/lib', '/usr/lib/lib64']
|
def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
|
642c8a11fd3b1c6b2fed366e5344885ca0188b37 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/642c8a11fd3b1c6b2fed366e5344885ca0188b37/setup.py
|
self.assertRaises(OverflowError, xrange, 1e100, 1e101, 1e101)
|
self.assertRaises(TypeError, xrange, 0.0, 2, 1) self.assertRaises(TypeError, xrange, 1, 2.0, 1) self.assertRaises(TypeError, xrange, 1, 2, 1.0) self.assertRaises(TypeError, xrange, 1e100, 1e101, 1e101)
|
def test_xrange(self): self.assertEqual(list(xrange(3)), [0, 1, 2]) self.assertEqual(list(xrange(1, 5)), [1, 2, 3, 4]) self.assertEqual(list(xrange(0)), []) self.assertEqual(list(xrange(-3)), []) self.assertEqual(list(xrange(1, 10, 3)), [1, 4, 7]) self.assertEqual(list(xrange(5, -5, -3)), [5, 2, -1, -4])
|
07519f8712241397bcb98efa19e2e7ec9257c18c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/07519f8712241397bcb98efa19e2e7ec9257c18c/test_xrange.py
|
def _get_fqdn_hostname(name):
|
def make_fqdn(name = ''): """Get fully qualified domain name from name. An empty argument is interpreted as meaning the local host. First the hostname returned by socket.gethostbyaddr() is checked, then possibly existing aliases. In case no FQDN is available, hostname is returned. """
|
def _get_fqdn_hostname(name): name = string.strip(name) if len(name) == 0: name = socket.gethostname() try: hostname, aliases, ipaddrs = socket.gethostbyaddr(name) except socket.error: pass else: aliases.insert(0, hostname) for name in aliases: if '.' in name: break else: name = hostname return name
|
caa658d04739875133f388d9dc470843e3870f87 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/caa658d04739875133f388d9dc470843e3870f87/smtplib.py
|
try: hostname, aliases, ipaddrs = socket.gethostbyaddr(name) except socket.error: pass
|
try: hostname, aliases, ipaddrs = socket.gethostbyaddr(name) except socket.error: pass else: aliases.insert(0, hostname) for name in aliases: if '.' in name: break
|
def _get_fqdn_hostname(name): name = string.strip(name) if len(name) == 0: name = socket.gethostname() try: hostname, aliases, ipaddrs = socket.gethostbyaddr(name) except socket.error: pass else: aliases.insert(0, hostname) for name in aliases: if '.' in name: break else: name = hostname return name
|
caa658d04739875133f388d9dc470843e3870f87 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/caa658d04739875133f388d9dc470843e3870f87/smtplib.py
|
aliases.insert(0, hostname) for name in aliases: if '.' in name: break else: name = hostname
|
name = hostname
|
def _get_fqdn_hostname(name): name = string.strip(name) if len(name) == 0: name = socket.gethostname() try: hostname, aliases, ipaddrs = socket.gethostbyaddr(name) except socket.error: pass else: aliases.insert(0, hostname) for name in aliases: if '.' in name: break else: name = hostname return name
|
caa658d04739875133f388d9dc470843e3870f87 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/caa658d04739875133f388d9dc470843e3870f87/smtplib.py
|
self.putcmd("helo", _get_fqdn_hostname(name))
|
if name: self.putcmd("helo", name) else: self.putcmd("helo", make_fqdn())
|
def helo(self, name=''): """SMTP 'helo' command. Hostname to send for this command defaults to the FQDN of the local host. """ self.putcmd("helo", _get_fqdn_hostname(name)) (code,msg)=self.getreply() self.helo_resp=msg return (code,msg)
|
caa658d04739875133f388d9dc470843e3870f87 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/caa658d04739875133f388d9dc470843e3870f87/smtplib.py
|
self.putcmd("ehlo", _get_fqdn_hostname(name))
|
if name: self.putcmd("ehlo", name) else: self.putcmd("ehlo", make_fqdn())
|
def ehlo(self, name=''): """ SMTP 'ehlo' command. Hostname to send for this command defaults to the FQDN of the local host. """ self.putcmd("ehlo", _get_fqdn_hostname(name)) (code,msg)=self.getreply() # According to RFC1869 some (badly written) # MTA's will disconnect on an ehlo. Toss an exception if # that happens -ddm if code == -1 and len(msg) == 0: raise SMTPServerDisconnected("Server not connected") self.ehlo_resp=msg if code<>250: return (code,msg) self.does_esmtp=1 #parse the ehlo response -ddm resp=string.split(self.ehlo_resp,'\n') del resp[0] for each in resp: m=re.match(r'(?P<feature>[A-Za-z0-9][A-Za-z0-9\-]*)',each) if m: feature=string.lower(m.group("feature")) params=string.strip(m.string[m.end("feature"):]) self.esmtp_features[feature]=params return (code,msg)
|
caa658d04739875133f388d9dc470843e3870f87 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/caa658d04739875133f388d9dc470843e3870f87/smtplib.py
|
tagName = self._current_context[uri] + ":" + localname
|
prefix = self._current_context[uri] if prefix: tagName = prefix + ":" + localname else: tagName = localname
|
def startElementNS(self, name, tagName , attrs): uri, localname = name if uri: # When using namespaces, the reader may or may not # provide us with the original name. If not, create # *a* valid tagName from the current context. if tagName is None: tagName = self._current_context[uri] + ":" + localname node = self.document.createElementNS(uri, tagName) else: # When the tagname is not prefixed, it just appears as # localname node = self.document.createElement(localname)
|
795ad56b319daa610766327b99a74e5ba1ae41b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/795ad56b319daa610766327b99a74e5ba1ae41b2/pulldom.py
|
qname = self._current_context[a_uri] + ":" + a_localname
|
prefix = self._current_context[a_uri] if prefix: qname = prefix + ":" + a_localname else: qname = a_localname
|
def startElementNS(self, name, tagName , attrs): uri, localname = name if uri: # When using namespaces, the reader may or may not # provide us with the original name. If not, create # *a* valid tagName from the current context. if tagName is None: tagName = self._current_context[uri] + ":" + localname node = self.document.createElementNS(uri, tagName) else: # When the tagname is not prefixed, it just appears as # localname node = self.document.createElement(localname)
|
795ad56b319daa610766327b99a74e5ba1ae41b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/795ad56b319daa610766327b99a74e5ba1ae41b2/pulldom.py
|
except pwd.error:
|
except KeyError:
|
def nobody_uid(): """Internal routine to get nobody's uid""" global nobody if nobody: return nobody import pwd try: nobody = pwd.getpwnam('nobody')[2] except pwd.error: nobody = 1 + max(map(lambda x: x[2], pwd.getpwall())) return nobody
|
630b811676c24bd3c15df9484c3e73c500fbf746 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/630b811676c24bd3c15df9484c3e73c500fbf746/CGIHTTPServer.py
|
if verbose: print "starting pause() loop..."
|
print "starting pause() loop..."
|
def force_test_exit(): # Sigh, both imports seem necessary to avoid errors. import os fork_pid = os.fork() if fork_pid: # In parent. return fork_pid # In child. import os, time try: # Wait 5 seconds longer than the expected alarm to give enough # time for the normal sequence of events to occur. This is # just a stop-gap to try to prevent the test from hanging. time.sleep(MAX_DURATION + 5) print >> sys.__stdout__, ' child should not have to kill parent' for signame in "SIGHUP", "SIGUSR1", "SIGUSR2", "SIGALRM": os.kill(pid, getattr(signal, signame)) print >> sys.__stdout__, " child sent", signame, "to", pid time.sleep(1) finally: os._exit(0)
|
953c1897d2c1683e37899998d4e2bc1a9d85b6c0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/953c1897d2c1683e37899998d4e2bc1a9d85b6c0/test_signal.py
|
Output("static int %s_init(PyObject *self, PyObject *args, PyObject *kwds)", self.prefix)
|
Output("static int %s_tp_init(PyObject *self, PyObject *args, PyObject *kwds)", self.prefix)
|
def output_tp_init(self): if self.output_tp_initBody: Output("static int %s_init(PyObject *self, PyObject *args, PyObject *kwds)", self.prefix) OutLbrace() self.output_tp_initBody() OutRbrace() else: Output("#define %s_tp_init 0", self.prefix) Output()
|
dd888a6cff1aaac4663bdbfc777d0472a22985d7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dd888a6cff1aaac4663bdbfc777d0472a22985d7/bgenObjectDefinition.py
|
addbase.close(self)
|
def close(self): if self.closehook: apply(self.closehook, self.hookargs) self.closehook = None self.hookargs = None addbase.close(self)
|
c580dae6da60aa76e9b885ddbf7a9833aa61c147 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c580dae6da60aa76e9b885ddbf7a9833aa61c147/urllib.py
|
|
self.assertEqual(len(Set(map(id, list(self.seq)))), len(self.seq))
|
self.assertEqual(len(Set(map(id, list(enumerate(self.seq))))), len(self.seq))
|
def test_tuple_reuse(self): # Tests an implementation detail where tuple is reused # whenever nothing else holds a reference to it self.assertEqual(len(Set(map(id, list(self.seq)))), len(self.seq)) self.assertEqual(len(Set(map(id, enumerate(self.seq)))), min(1,len(self.seq)))
|
b25a52aac09b725dac76013dfafa60093fb2b576 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b25a52aac09b725dac76013dfafa60093fb2b576/test_enumerate.py
|
if os.name == 'mac': def getproxies():
|
if sys.platform == 'darwin': def getproxies_internetconfig():
|
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, value in os.environ.items(): name = name.lower() if value and name[-6:] == '_proxy': proxies[name[:-6]] = value return proxies
|
11d9b0628396749eaf9bc7f8a0e37f0cd46d75bf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/11d9b0628396749eaf9bc7f8a0e37f0cd46d75bf/urllib.py
|
if type(name) is not StringType:
|
if not isinstance(name, StringTypes):
|
def mkpath (name, mode=0777, verbose=0, dry_run=0): """Create a directory and any missing ancestor directories. If the directory already exists (or if 'name' is the empty string, which means the current directory, which of course exists), then do nothing. Raise DistutilsFileError if unable to create some directory along the way (eg. some sub-path exists, but is a file rather than a directory). If 'verbose' is true, print a one-line summary of each mkdir to stdout. Return the list of directories actually created.""" global _path_created # Detect a common bug -- name is None if type(name) is not StringType: raise DistutilsInternalError, \ "mkpath: 'name' must be a string (got %r)" % (name,) # XXX what's the better way to handle verbosity? print as we create # each directory in the path (the current behaviour), or only announce # the creation of the whole path? (quite easy to do the latter since # we're not using a recursive algorithm) name = os.path.normpath(name) created_dirs = [] if os.path.isdir(name) or name == '': return created_dirs if _path_created.get(os.path.abspath(name)): return created_dirs (head, tail) = os.path.split(name) tails = [tail] # stack of lone dirs to create while head and tail and not os.path.isdir(head): #print "splitting '%s': " % head, (head, tail) = os.path.split(head) #print "to ('%s','%s')" % (head, tail) tails.insert(0, tail) # push next higher dir onto stack #print "stack of tails:", tails # now 'head' contains the deepest directory that already exists # (that is, the child of 'head' in 'name' is the highest directory # that does *not* exist) for d in tails: #print "head = %s, d = %s: " % (head, d), head = os.path.join(head, d) abs_head = os.path.abspath(head) if _path_created.get(abs_head): continue log.info("creating %s", head) if not dry_run: try: os.mkdir(head) created_dirs.append(head) except OSError, exc: raise DistutilsFileError, \ "could not create '%s': %s" % (head, exc[-1]) _path_created[abs_head] = 1 return created_dirs
|
0a5d4a20e7b2b758c974766cc3ac02af5a342483 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0a5d4a20e7b2b758c974766cc3ac02af5a342483/dir_util.py
|
auth = base64.encodestring(auth)
|
auth = base64.encodestring(urllib.unquote(auth))
|
def get_host_info(self, host):
|
768c98bb0b974cd3b5421252f8263e6d4afb8f79 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/768c98bb0b974cd3b5421252f8263e6d4afb8f79/xmlrpclib.py
|
'__module__', '__name__']: return 0
|
'__module__', '__name__', '__slots__']: return 0
|
def visiblename(name, all=None): """Decide whether to show documentation on a variable.""" # Certain special names are redundant. if name in ['__builtins__', '__doc__', '__file__', '__path__', '__module__', '__name__']: return 0 # Private names are hidden, but special names are displayed. if name.startswith('__') and name.endswith('__'): return 1 if all is not None: # only document that which the programmer exported in __all__ return name in all else: return not name.startswith('_')
|
9ddb3005986dae244935c670cdd58cc08b09f752 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ddb3005986dae244935c670cdd58cc08b09f752/pydoc.py
|
def spillproperties(msg, attrs, predicate):
|
def spilldescriptors(msg, attrs, predicate):
|
def spillproperties(msg, attrs, predicate): ok, attrs = _split_list(attrs, predicate) if ok: hr.maybe() push(msg) for name, kind, homecls, value in ok: push(self._docproperty(name, value, mod)) return attrs
|
9ddb3005986dae244935c670cdd58cc08b09f752 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ddb3005986dae244935c670cdd58cc08b09f752/pydoc.py
|
push(self._docproperty(name, value, mod))
|
push(self._docdescriptor(name, value, mod))
|
def spillproperties(msg, attrs, predicate): ok, attrs = _split_list(attrs, predicate) if ok: hr.maybe() push(msg) for name, kind, homecls, value in ok: push(self._docproperty(name, value, mod)) return attrs
|
9ddb3005986dae244935c670cdd58cc08b09f752 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ddb3005986dae244935c670cdd58cc08b09f752/pydoc.py
|
inspect.classify_class_attrs(object))
|
classify_class_attrs(object))
|
def spilldata(msg, attrs, predicate): ok, attrs = _split_list(attrs, predicate) if ok: hr.maybe() push(msg) for name, kind, homecls, value in ok: base = self.docother(getattr(object, name), name, mod) if callable(value) or inspect.isdatadescriptor(value): doc = getattr(value, "__doc__", None) else: doc = None if doc is None: push('<dl><dt>%s</dl>\n' % base) else: doc = self.markup(getdoc(value), self.preformat, funcs, classes, mdict) doc = '<dd><tt>%s</tt>' % doc push('<dl><dt>%s%s</dl>\n' % (base, doc)) push('\n') return attrs
|
9ddb3005986dae244935c670cdd58cc08b09f752 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ddb3005986dae244935c670cdd58cc08b09f752/pydoc.py
|
attrs = spillproperties('Properties %s' % tag, attrs, lambda t: t[1] == 'property')
|
attrs = spilldescriptors('Data descriptors %s' % tag, attrs, lambda t: t[1] == 'data descriptor')
|
def spilldata(msg, attrs, predicate): ok, attrs = _split_list(attrs, predicate) if ok: hr.maybe() push(msg) for name, kind, homecls, value in ok: base = self.docother(getattr(object, name), name, mod) if callable(value) or inspect.isdatadescriptor(value): doc = getattr(value, "__doc__", None) else: doc = None if doc is None: push('<dl><dt>%s</dl>\n' % base) else: doc = self.markup(getdoc(value), self.preformat, funcs, classes, mdict) doc = '<dd><tt>%s</tt>' % doc push('<dl><dt>%s%s</dl>\n' % (base, doc)) push('\n') return attrs
|
9ddb3005986dae244935c670cdd58cc08b09f752 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ddb3005986dae244935c670cdd58cc08b09f752/pydoc.py
|
def _docproperty(self, name, value, mod):
|
def _docdescriptor(self, name, value, mod):
|
def _docproperty(self, name, value, mod): results = [] push = results.append
|
9ddb3005986dae244935c670cdd58cc08b09f752 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ddb3005986dae244935c670cdd58cc08b09f752/pydoc.py
|
for attr, tag in [('fget', '<em>get</em>'), ('fset', '<em>set</em>'), ('fdel', '<em>delete</em>')]: func = getattr(value, attr) if func is not None: base = self.document(func, tag, mod) push('<dd>%s</dd>\n' % base)
|
def _docproperty(self, name, value, mod): results = [] push = results.append
|
9ddb3005986dae244935c670cdd58cc08b09f752 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ddb3005986dae244935c670cdd58cc08b09f752/pydoc.py
|
|
return self._docproperty(name, object, mod)
|
return self._docdescriptor(name, object, mod)
|
def docproperty(self, object, name=None, mod=None, cl=None): """Produce html documentation for a property.""" return self._docproperty(name, object, mod)
|
9ddb3005986dae244935c670cdd58cc08b09f752 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ddb3005986dae244935c670cdd58cc08b09f752/pydoc.py
|
def spillproperties(msg, attrs, predicate):
|
def spilldescriptors(msg, attrs, predicate):
|
def spillproperties(msg, attrs, predicate): ok, attrs = _split_list(attrs, predicate) if ok: hr.maybe() push(msg) for name, kind, homecls, value in ok: push(self._docproperty(name, value, mod)) return attrs
|
9ddb3005986dae244935c670cdd58cc08b09f752 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ddb3005986dae244935c670cdd58cc08b09f752/pydoc.py
|
push(self._docproperty(name, value, mod))
|
push(self._docdescriptor(name, value, mod))
|
def spillproperties(msg, attrs, predicate): ok, attrs = _split_list(attrs, predicate) if ok: hr.maybe() push(msg) for name, kind, homecls, value in ok: push(self._docproperty(name, value, mod)) return attrs
|
9ddb3005986dae244935c670cdd58cc08b09f752 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ddb3005986dae244935c670cdd58cc08b09f752/pydoc.py
|
inspect.classify_class_attrs(object))
|
classify_class_attrs(object))
|
def spilldata(msg, attrs, predicate): ok, attrs = _split_list(attrs, predicate) if ok: hr.maybe() push(msg) for name, kind, homecls, value in ok: if callable(value) or inspect.isdatadescriptor(value): doc = getattr(value, "__doc__", None) else: doc = None push(self.docother(getattr(object, name), name, mod, 70, doc) + '\n') return attrs
|
9ddb3005986dae244935c670cdd58cc08b09f752 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ddb3005986dae244935c670cdd58cc08b09f752/pydoc.py
|
attrs = spillproperties("Properties %s:\n" % tag, attrs, lambda t: t[1] == 'property')
|
attrs = spilldescriptors("Data descriptors %s:\n" % tag, attrs, lambda t: t[1] == 'data descriptor')
|
def spilldata(msg, attrs, predicate): ok, attrs = _split_list(attrs, predicate) if ok: hr.maybe() push(msg) for name, kind, homecls, value in ok: if callable(value) or inspect.isdatadescriptor(value): doc = getattr(value, "__doc__", None) else: doc = None push(self.docother(getattr(object, name), name, mod, 70, doc) + '\n') return attrs
|
9ddb3005986dae244935c670cdd58cc08b09f752 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ddb3005986dae244935c670cdd58cc08b09f752/pydoc.py
|
def _docproperty(self, name, value, mod):
|
def _docdescriptor(self, name, value, mod):
|
def _docproperty(self, name, value, mod): results = [] push = results.append
|
9ddb3005986dae244935c670cdd58cc08b09f752 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ddb3005986dae244935c670cdd58cc08b09f752/pydoc.py
|
push(name) need_blank_after_doc = 0
|
push(self.bold(name)) push('\n')
|
def _docproperty(self, name, value, mod): results = [] push = results.append
|
9ddb3005986dae244935c670cdd58cc08b09f752 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ddb3005986dae244935c670cdd58cc08b09f752/pydoc.py
|
need_blank_after_doc = 1 for attr, tag in [('fget', '<get>'), ('fset', '<set>'), ('fdel', '<delete>')]: func = getattr(value, attr) if func is not None: if need_blank_after_doc: push('') need_blank_after_doc = 0 base = self.document(func, tag, mod) push(self.indent(base)) return '\n'.join(results)
|
push('\n') return ''.join(results)
|
def _docproperty(self, name, value, mod): results = [] push = results.append
|
9ddb3005986dae244935c670cdd58cc08b09f752 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ddb3005986dae244935c670cdd58cc08b09f752/pydoc.py
|
return self._docproperty(name, object, mod)
|
return self._docdescriptor(name, object, mod)
|
def docproperty(self, object, name=None, mod=None, cl=None): """Produce text documentation for a property.""" return self._docproperty(name, object, mod)
|
9ddb3005986dae244935c670cdd58cc08b09f752 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ddb3005986dae244935c670cdd58cc08b09f752/pydoc.py
|
os.fsync(f.fileno())
|
if hasattr(os, 'fsync'): os.fsync(f.fileno())
|
def _sync_flush(f): """Ensure changes to file f are physically on disk.""" f.flush() os.fsync(f.fileno())
|
a75d31619c75854e45ad20918e4300efe7507767 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a75d31619c75854e45ad20918e4300efe7507767/mailbox.py
|
return id(self)
|
return hash(id(self))
|
def __hash__(self, *args): print "__hash__:", args return id(self)
|
d68d0a6f5a0a4af255d6a73e236166d42f8b76b6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d68d0a6f5a0a4af255d6a73e236166d42f8b76b6/test_class.py
|
(e[0], e[2], str(error))
|
(e[0], e[2], str(result))
|
def strftest(now): if verbose: print "strftime test for", time.ctime(now) nowsecs = int(now) gmt = time.gmtime(now) now = time.localtime(now) if now[3] < 12: ampm='AM' else: ampm='PM' jan1 = time.localtime(time.mktime((now[0], 1, 1) + (0,)*6)) if now[8]: tz = time.tzname[1] else: tz = time.tzname[0] if now[3] > 12: clock12 = now[3] - 12 elif now[3] > 0: clock12 = now[3] else: clock12 = 12 expectations = ( ('%A', calendar.day_name[now[6]], 'full weekday name'), ('%a', calendar.day_abbr[now[6]], 'abbreviated weekday name'), ('%B', calendar.month_name[now[1]], 'full month name'), ('%b', calendar.month_abbr[now[1]], 'abbreviated month name'), ('%h', calendar.month_abbr[now[1]], 'abbreviated month name'), ('%c', fixasctime(time.asctime(now)), 'near-asctime() format'), ('%D', '%02d/%02d/%02d' % (now[1], now[2], (now[0]%100)), 'mm/dd/yy'), ('%d', '%02d' % now[2], 'day of month as number (00-31)'), ('%e', '%2d' % now[2], 'day of month as number, blank padded ( 0-31)'), ('%H', '%02d' % now[3], 'hour (00-23)'), ('%I', '%02d' % clock12, 'hour (01-12)'), ('%j', '%03d' % now[7], 'julian day (001-366)'), ('%M', '%02d' % now[4], 'minute, (00-59)'), ('%m', '%02d' % now[1], 'month as number (01-12)'), ('%p', ampm, 'AM or PM as appropriate'), ('%R', '%02d:%02d' % (now[3], now[4]), '%H:%M'), ('%r', '%02d:%02d:%02d %s' % (clock12, now[4], now[5], ampm), '%I:%M:%S %p'), ('%S', '%02d' % now[5], 'seconds of current time (00-60)'), ('%T', '%02d:%02d:%02d' % (now[3], now[4], now[5]), '%H:%M:%S'), ('%X', '%02d:%02d:%02d' % (now[3], now[4], now[5]), '%H:%M:%S'), ('%U', '%02d' % ((now[7] + jan1[6])/7), 'week number of the year (Sun 1st)'), ('%W', '%02d' % ((now[7] + (jan1[6] - 1)%7)/7), 'week number of the year (Mon 1st)'), ('%w', '%d' % ((1+now[6]) % 7), 'weekday as a number (Sun 1st)'), ('%x', '%02d/%02d/%02d' % (now[1], now[2], (now[0]%100)), '%m/%d/%y %H:%M:%S'), ('%Y', '%d' % now[0], 'year with century'), ('%y', '%02d' % (now[0]%100), 'year without century'), ('%Z', tz, 'time zone name'), ('%%', '%', 'single percent sign'), ) nonstandard_expectations = ( ('%C', '%02d' % (now[0]/100), 'century'), # This is for IRIX; on Solaris, %C yields date(1) format. # Tough. ('%k', '%2d' % now[3], 'hour, blank padded ( 0-23)'), ('%s', '%d' % nowsecs, 'seconds since the Epoch in UCT'), ('%3y', '%03d' % (now[0]%100), 'year without century rendered using fieldwidth'), ('%n', '\n', 'newline character'), ('%t', '\t', 'tab character'), ) if verbose: print "Strftime test, platform: %s, Python version: %s" % \ (sys.platform, string.split(sys.version)[0]) for e in expectations: try: result = time.strftime(e[0], now) except ValueError, error: print "Standard '%s' format gave error:" % e[0], error continue if result == e[1]: continue if result[0] == '%': print "Does not support standard '%s' format (%s)" % (e[0], e[2]) else: print "Conflict for %s (%s):" % (e[0], e[2]) print " Expected %s, but got %s" % (e[1], result) for e in nonstandard_expectations: try: result = time.strftime(e[0], now) except ValueError, result: if verbose: print "Error for nonstandard '%s' format (%s): %s" % \ (e[0], e[2], str(error)) continue if result == e[1]: if verbose: print "Supports nonstandard '%s' format (%s)" % (e[0], e[2]) elif result[0] == '%': if verbose: print "Does not appear to support '%s' format (%s)" % (e[0], e[2]) else: if verbose: print "Conflict for nonstandard '%s' format (%s):" % (e[0], e[2]) print " Expected %s, but got %s" % (e[1], result)
|
4dfd458611b706055deccb024f8bf9f27a9e97d6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4dfd458611b706055deccb024f8bf9f27a9e97d6/test_strftime.py
|
self.unixsocket = 1
|
def __init__(self, address=('localhost', SYSLOG_UDP_PORT), facility=LOG_USER): """ Initialize a handler.
|
5492e1722af1ce85b8248e30cf35e957429d161d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5492e1722af1ce85b8248e30cf35e957429d161d/handlers.py
|
|
self.unixsocket = 0
|
def __init__(self, address=('localhost', SYSLOG_UDP_PORT), facility=LOG_USER): """ Initialize a handler.
|
5492e1722af1ce85b8248e30cf35e957429d161d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5492e1722af1ce85b8248e30cf35e957429d161d/handlers.py
|
|
outf.write(" (os.path.normpath(sys.executable), post_interp))
|
if not sysconfig.python_build: outf.write(" (os.path.normpath(sys.executable), post_interp)) else: outf.write(" (os.path.join( sysconfig.get_config_var("BINDIR"), "python" + sysconfig.get_config_var("EXE")), post_interp))
|
def copy_scripts (self): """Copy each script listed in 'self.scripts'; if it's marked as a Python script in the Unix way (first line matches 'first_line_re', ie. starts with "\#!" and contains "python"), then adjust the first line to refer to the current Python interpreter as we copy. """ self.mkpath(self.build_dir) for script in self.scripts: adjust = 0 script = convert_path(script) outfile = os.path.join(self.build_dir, os.path.basename(script))
|
fb173cd471e842dc37f01e767dd1fe0a9a5f7d4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/fb173cd471e842dc37f01e767dd1fe0a9a5f7d4e/build_scripts.py
|
print 'h=',h
|
def getentry(self, which): self._check() if which == 'in': cmd = IN_ENTRY_SENSE elif which == 'out': cmd = OUT_ENTRY_SENSE self.replycmd(cmd) h = self._getnumber(2) print 'h=',h m = self._getnumber(2) print 'm=',m s = self._getnumber(2) print 's=',s f = self._getnumber(2) print 'f=',f return (h, m, s, f)
|
bab2ca3eb100f02eb3d5b6e9e164b7b0ce936a1d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/bab2ca3eb100f02eb3d5b6e9e164b7b0ce936a1d/VCR.py
|
|
print 'm=',m
|
def getentry(self, which): self._check() if which == 'in': cmd = IN_ENTRY_SENSE elif which == 'out': cmd = OUT_ENTRY_SENSE self.replycmd(cmd) h = self._getnumber(2) print 'h=',h m = self._getnumber(2) print 'm=',m s = self._getnumber(2) print 's=',s f = self._getnumber(2) print 'f=',f return (h, m, s, f)
|
bab2ca3eb100f02eb3d5b6e9e164b7b0ce936a1d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/bab2ca3eb100f02eb3d5b6e9e164b7b0ce936a1d/VCR.py
|
|
print 's=',s
|
def getentry(self, which): self._check() if which == 'in': cmd = IN_ENTRY_SENSE elif which == 'out': cmd = OUT_ENTRY_SENSE self.replycmd(cmd) h = self._getnumber(2) print 'h=',h m = self._getnumber(2) print 'm=',m s = self._getnumber(2) print 's=',s f = self._getnumber(2) print 'f=',f return (h, m, s, f)
|
bab2ca3eb100f02eb3d5b6e9e164b7b0ce936a1d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/bab2ca3eb100f02eb3d5b6e9e164b7b0ce936a1d/VCR.py
|
|
print 'f=',f
|
def getentry(self, which): self._check() if which == 'in': cmd = IN_ENTRY_SENSE elif which == 'out': cmd = OUT_ENTRY_SENSE self.replycmd(cmd) h = self._getnumber(2) print 'h=',h m = self._getnumber(2) print 'm=',m s = self._getnumber(2) print 's=',s f = self._getnumber(2) print 'f=',f return (h, m, s, f)
|
bab2ca3eb100f02eb3d5b6e9e164b7b0ce936a1d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/bab2ca3eb100f02eb3d5b6e9e164b7b0ce936a1d/VCR.py
|
|
self.filename = file
|
self.filename = filename
|
def __init__(self, msg, filename=None, lineno=None): self.filename = file self.lineno = lineno self.msg = msg Exception.__init__(self, msg)
|
815bee4cf455983e0b9d6c7ebef442141f792050 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/815bee4cf455983e0b9d6c7ebef442141f792050/netrc.py
|
print repr(p)
|
def test_pickling(self): p = pickle.dumps(self.set) print repr(p) copy = pickle.loads(p) repr(copy) self.assertEqual(self.set, copy, "%s != %s" % (self.set, copy))
|
0e1183ddffd1363ffce6b4792f5b82a8d3a9e5a8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0e1183ddffd1363ffce6b4792f5b82a8d3a9e5a8/test_sets.py
|
|
repr(copy)
|
def test_pickling(self): p = pickle.dumps(self.set) print repr(p) copy = pickle.loads(p) repr(copy) self.assertEqual(self.set, copy, "%s != %s" % (self.set, copy))
|
0e1183ddffd1363ffce6b4792f5b82a8d3a9e5a8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0e1183ddffd1363ffce6b4792f5b82a8d3a9e5a8/test_sets.py
|
|
import httplib tries = 0 while tries<5: connection = httplib.HTTP(self.host) connection.putrequest("GET", self.path) connection.putheader("Host", self.host) connection.endheaders() status, text, mime = connection.getreply() if status in [301,302] and mime: tries = tries + 1 newurl = mime.get("Location", mime.get("Uri", "")) newurl = urlparse.urljoin(self.url, newurl) self.set_url(newurl) else: break if status==401 or status==403:
|
opener = URLopener() f = opener.open(self.url) lines = f.readlines() self.errcode = opener.errcode if self.errcode == 401 or self.errcode == 403:
|
def read(self): import httplib tries = 0 while tries<5: connection = httplib.HTTP(self.host) connection.putrequest("GET", self.path) connection.putheader("Host", self.host) connection.endheaders() status, text, mime = connection.getreply() if status in [301,302] and mime: tries = tries + 1 newurl = mime.get("Location", mime.get("Uri", "")) newurl = urlparse.urljoin(self.url, newurl) self.set_url(newurl) else: break if status==401 or status==403: self.disallow_all = 1 elif status>=400: self.allow_all = 1 else: # status < 400 self.parse(connection.getfile().readlines())
|
5bba231d1e78b60c9886405476df92992fb4e349 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5bba231d1e78b60c9886405476df92992fb4e349/robotparser.py
|
elif status>=400:
|
_debug("disallow all") elif self.errcode >= 400:
|
def read(self): import httplib tries = 0 while tries<5: connection = httplib.HTTP(self.host) connection.putrequest("GET", self.path) connection.putheader("Host", self.host) connection.endheaders() status, text, mime = connection.getreply() if status in [301,302] and mime: tries = tries + 1 newurl = mime.get("Location", mime.get("Uri", "")) newurl = urlparse.urljoin(self.url, newurl) self.set_url(newurl) else: break if status==401 or status==403: self.disallow_all = 1 elif status>=400: self.allow_all = 1 else: # status < 400 self.parse(connection.getfile().readlines())
|
5bba231d1e78b60c9886405476df92992fb4e349 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5bba231d1e78b60c9886405476df92992fb4e349/robotparser.py
|
else: self.parse(connection.getfile().readlines())
|
_debug("allow all") elif self.errcode == 200 and lines: _debug("parse lines") self.parse(lines)
|
def read(self): import httplib tries = 0 while tries<5: connection = httplib.HTTP(self.host) connection.putrequest("GET", self.path) connection.putheader("Host", self.host) connection.endheaders() status, text, mime = connection.getreply() if status in [301,302] and mime: tries = tries + 1 newurl = mime.get("Location", mime.get("Uri", "")) newurl = urlparse.urljoin(self.url, newurl) self.set_url(newurl) else: break if status==401 or status==403: self.disallow_all = 1 elif status>=400: self.allow_all = 1 else: # status < 400 self.parse(connection.getfile().readlines())
|
5bba231d1e78b60c9886405476df92992fb4e349 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5bba231d1e78b60c9886405476df92992fb4e349/robotparser.py
|
_debug("Checking robot.txt allowance for\n%s\n%s" % (useragent, url))
|
_debug("Checking robot.txt allowance for:\n user agent: %s\n url: %s" % (useragent, url))
|
def can_fetch(self, useragent, url): """using the parsed robots.txt decide if useragent can fetch url""" _debug("Checking robot.txt allowance for\n%s\n%s" % (useragent, url)) if self.disallow_all: return 0 if self.allow_all: return 1 # search for given user agent matches # the first match counts useragent = useragent.lower() url = urllib.quote(urlparse.urlparse(url)[2]) for entry in self.entries: if entry.applies_to(useragent): return entry.allowance(url) # agent not found ==> access granted return 1
|
5bba231d1e78b60c9886405476df92992fb4e349 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5bba231d1e78b60c9886405476df92992fb4e349/robotparser.py
|
useragent = useragent.lower() url = urllib.quote(urlparse.urlparse(url)[2])
|
url = urllib.quote(urlparse.urlparse(url)[2]) or "/"
|
def can_fetch(self, useragent, url): """using the parsed robots.txt decide if useragent can fetch url""" _debug("Checking robot.txt allowance for\n%s\n%s" % (useragent, url)) if self.disallow_all: return 0 if self.allow_all: return 1 # search for given user agent matches # the first match counts useragent = useragent.lower() url = urllib.quote(urlparse.urlparse(url)[2]) for entry in self.entries: if entry.applies_to(useragent): return entry.allowance(url) # agent not found ==> access granted return 1
|
5bba231d1e78b60c9886405476df92992fb4e349 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5bba231d1e78b60c9886405476df92992fb4e349/robotparser.py
|
"check if this entry applies to the specified agent"
|
"""check if this entry applies to the specified agent""" useragent = useragent.split("/")[0].lower()
|
def applies_to(self, useragent): "check if this entry applies to the specified agent" for agent in self.useragents: if agent=="*": return 1 if re.match(agent, useragent): return 1 return 0
|
5bba231d1e78b60c9886405476df92992fb4e349 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5bba231d1e78b60c9886405476df92992fb4e349/robotparser.py
|
if agent=="*":
|
if agent=='*':
|
def applies_to(self, useragent): "check if this entry applies to the specified agent" for agent in self.useragents: if agent=="*": return 1 if re.match(agent, useragent): return 1 return 0
|
5bba231d1e78b60c9886405476df92992fb4e349 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5bba231d1e78b60c9886405476df92992fb4e349/robotparser.py
|
if re.match(agent, useragent):
|
agent = agent.lower() if re.search(re.escape(useragent), agent):
|
def applies_to(self, useragent): "check if this entry applies to the specified agent" for agent in self.useragents: if agent=="*": return 1 if re.match(agent, useragent): return 1 return 0
|
5bba231d1e78b60c9886405476df92992fb4e349 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5bba231d1e78b60c9886405476df92992fb4e349/robotparser.py
|
if len(sys.argv) <= 1: rp.set_url('http://www.musi-cal.com/robots.txt') rp.read() else: rp.parse(open(sys.argv[1]).readlines()) print rp.can_fetch('*', 'http://www.musi-cal.com/') print rp.can_fetch('Musi-Cal-Robot/1.0',
|
rp.set_url('http://www.musi-cal.com/robots.txt') rp.read() _check(rp.can_fetch('*', 'http://www.musi-cal.com/'), 1) _check(rp.can_fetch('', 'http://www.musi-cal.com/'), 0) _check(rp.can_fetch('CherryPickerSE',
|
def _test(): global debug import sys rp = RobotFileParser() debug = 1 if len(sys.argv) <= 1: rp.set_url('http://www.musi-cal.com/robots.txt') rp.read() else: rp.parse(open(sys.argv[1]).readlines()) print rp.can_fetch('*', 'http://www.musi-cal.com/') print rp.can_fetch('Musi-Cal-Robot/1.0', 'http://www.musi-cal.com/cgi-bin/event-search' '?city=San+Francisco')
|
5bba231d1e78b60c9886405476df92992fb4e349 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5bba231d1e78b60c9886405476df92992fb4e349/robotparser.py
|
'?city=San+Francisco')
|
'?city=San+Francisco'), 0) _check(rp.can_fetch('CherryPickerSE/1.0', 'http://www.musi-cal.com/cgi-bin/event-search' '?city=San+Francisco'), 0) _check(rp.can_fetch('CherryPickerSE/1.5', 'http://www.musi-cal.com/cgi-bin/event-search' '?city=San+Francisco'), 0) _check(rp.can_fetch('ExtractorPro', 'http://www.musi-cal.com/blubba'), 0) _check(rp.can_fetch('extractorpro', 'http://www.musi-cal.com/blubba'), 0) _check(rp.can_fetch('toolpak/1.1', 'http://www.musi-cal.com/blubba'), 0) _check(rp.can_fetch('spam', 'http://www.musi-cal.com/search'), 0) _check(rp.can_fetch('spam', 'http://www.musi-cal.com/Musician/me'), 1) _check(rp.can_fetch('spam', 'http://www.musi-cal.com/'), 1) _check(rp.can_fetch('spam', 'http://www.musi-cal.com/'), 1) rp.set_url('http://www.lycos.com/robots.txt') rp.read() _check(rp.can_fetch('Mozilla', 'http://www.lycos.com/search'), 1)
|
def _test(): global debug import sys rp = RobotFileParser() debug = 1 if len(sys.argv) <= 1: rp.set_url('http://www.musi-cal.com/robots.txt') rp.read() else: rp.parse(open(sys.argv[1]).readlines()) print rp.can_fetch('*', 'http://www.musi-cal.com/') print rp.can_fetch('Musi-Cal-Robot/1.0', 'http://www.musi-cal.com/cgi-bin/event-search' '?city=San+Francisco')
|
5bba231d1e78b60c9886405476df92992fb4e349 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5bba231d1e78b60c9886405476df92992fb4e349/robotparser.py
|
elif os.sep == ':': sitedirs = [os.path.join(prefix, "lib", "site-packages")]
|
def addpackage(sitedir, name): fullname = os.path.join(sitedir, name) try: f = open(fullname) except IOError: return while 1: dir = f.readline() if not dir: break if dir[0] == '#': continue if dir.startswith("import"): exec dir continue if dir[-1] == '\n': dir = dir[:-1] dir, dircase = makepath(sitedir, dir) if not dirs_in_sys_path.has_key(dircase) and os.path.exists(dir): sys.path.append(dir) dirs_in_sys_path[dircase] = 1
|
6a479f548850f5ccf941eb74f855d6b2dc91368f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6a479f548850f5ccf941eb74f855d6b2dc91368f/site.py
|
|
sitedirs = [prefix]
|
sitedirs = [prefix, os.path.join(prefix, "lib", "site-packages")]
|
def addpackage(sitedir, name): fullname = os.path.join(sitedir, name) try: f = open(fullname) except IOError: return while 1: dir = f.readline() if not dir: break if dir[0] == '#': continue if dir.startswith("import"): exec dir continue if dir[-1] == '\n': dir = dir[:-1] dir, dircase = makepath(sitedir, dir) if not dirs_in_sys_path.has_key(dircase) and os.path.exists(dir): sys.path.append(dir) dirs_in_sys_path[dircase] = 1
|
6a479f548850f5ccf941eb74f855d6b2dc91368f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6a479f548850f5ccf941eb74f855d6b2dc91368f/site.py
|
try: printable = value is None or not str(value) except: printable = False if printable:
|
valuestr = _some_str(value) if value is None or not valuestr:
|
def _format_final_exc_line(etype, value): """Return a list of a single line -- normal case for format_exception_only""" try: printable = value is None or not str(value) except: printable = False if printable: line = "%s\n" % etype else: line = "%s: %s\n" % (etype, _some_str(value)) return line
|
16183631ede0656a5cfd58626419cc081d281fff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/16183631ede0656a5cfd58626419cc081d281fff/traceback.py
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.