rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
if len(data) < ds: raise EOFError
if len(data) < ds: self.eofseen = 1 raise EOFError
def getnextframedata(self, ds, cs): if self.atframeheader: raise CallError if ds: data = self.fp.read(ds) if len(data) < ds: raise EOFError else: data = '' if cs: cdata = self.fp.read(cs) if len(cdata) < cs: raise EOFerror else: cdata = '' self.atframeheader = 1 self.framecount = self.framecount + 1 return (data, cdata)
4526f379bca5695b2144f1142f6a524d77bb7fe4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4526f379bca5695b2144f1142f6a524d77bb7fe4/VFile.py
if len(cdata) < cs: raise EOFerror
if len(cdata) < cs: self.eofseen = 1 raise EOFError
def getnextframedata(self, ds, cs): if self.atframeheader: raise CallError if ds: data = self.fp.read(ds) if len(data) < ds: raise EOFError else: data = '' if cs: cdata = self.fp.read(cs) if len(cdata) < cs: raise EOFerror else: cdata = '' self.atframeheader = 1 self.framecount = self.framecount + 1 return (data, cdata)
4526f379bca5695b2144f1142f6a524d77bb7fe4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4526f379bca5695b2144f1142f6a524d77bb7fe4/VFile.py
self.version = 3.0
self.version = 3.0
def initfp(self, fp, filename): self = VideoParams.init(self) self.fp = fp self.filename = filename self.version = 3.0 # In case anyone inquires self.headerwritten = 0 return self
4526f379bca5695b2144f1142f6a524d77bb7fe4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4526f379bca5695b2144f1142f6a524d77bb7fe4/VFile.py
self.fp.write(`(t, ds, cs)` + '\n')
data = `(t, ds, cs)` n = len(data) if n < 63: data = data + ' '*(63-n) self.fp.write(data + '\n')
def writeframeheader(self, t, ds, cs): if not self.headerwritten: self.writeheader() if not self.atheader: raise CallError self.fp.write(`(t, ds, cs)` + '\n') self.atheader = 0
4526f379bca5695b2144f1142f6a524d77bb7fe4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4526f379bca5695b2144f1142f6a524d77bb7fe4/VFile.py
class VinFile(BasicVinFile, Displayer):
class VinFile(RandomVinFile, Displayer):
def writeframedata(self, data, cdata): if not self.headerwritten or self.atheader: raise CallError if data: self.fp.write(data) if cdata: self.fp.write(cdata) self.atheader = 1 self.framecount = self.framecount + 1
4526f379bca5695b2144f1142f6a524d77bb7fe4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4526f379bca5695b2144f1142f6a524d77bb7fe4/VFile.py
return BasicVinFile.initfp(self, fp, filename)
return RandomVinFile.initfp(self, fp, filename)
def initfp(self, fp, filename): self = Displayer.init(self) return BasicVinFile.initfp(self, fp, filename)
4526f379bca5695b2144f1142f6a524d77bb7fe4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4526f379bca5695b2144f1142f6a524d77bb7fe4/VFile.py
self.__frame.grid(row=3, column=0, ipadx=5)
self.__frame.grid(row=3, column=0, ipadx=5, sticky='NSEW')
def __init__(self, switchboard, master=None): self.__sb = switchboard self.__frame = Frame(master, relief=RAISED, borderwidth=1) self.__frame.grid(row=3, column=0, ipadx=5) # create the chip that will display the currently selected color # exactly self.__sframe = Frame(self.__frame) self.__sframe.grid(row=0, column=0) self.__selected = ChipWidget(self.__sframe, text='Selected') # create the chip that will display the nearest real X11 color # database color name self.__nframe = Frame(self.__frame) self.__nframe.grid(row=0, column=1) self.__nearest = ChipWidget(self.__nframe, text='Nearest', presscmd = self.__buttonpress, releasecmd = self.__buttonrelease)
615a66a5ef4f127e4851344b7f67f1dfde6d2155 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/615a66a5ef4f127e4851344b7f67f1dfde6d2155/ChipViewer.py
try: import sys orig = sys.getrefcount(__name__) socket.getnameinfo(__name__,0) except SystemError: if sys.getrefcount(__name__) <> orig: raise TestFailed,"socket.getnameinfo loses a reference"
import sys if not sys.platform.startswith('java'): try: orig = sys.getrefcount(__name__) socket.getnameinfo(__name__,0) except SystemError: if sys.getrefcount(__name__) <> orig: raise TestFailed,"socket.getnameinfo loses a reference"
def missing_ok(str): try: getattr(socket, str) except AttributeError: pass
ada1983950395e640020535513eb086b6314f0f2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ada1983950395e640020535513eb086b6314f0f2/test_socket.py
authorization = self.headers.getheader("authorization") if authorization: authorization = authorization.split() if len(authorization) == 2: import base64, binascii env['AUTH_TYPE'] = authorization[0] if authorization[0].lower() == "basic": try: authorization = base64.decodestring(authorization[1]) except binascii.Error: pass else: authorization = authorization.split(':') if len(authorization) == 2: env['REMOTE_USER'] = authorization[0]
def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = rest.rfind('?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = rest.find('/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scriptname) if not os.path.exists(scriptfile): self.send_error(404, "No such CGI script (%r)" % scriptname) return if not os.path.isfile(scriptfile): self.send_error(403, "CGI script is not a plain file (%r)" % scriptname) return ispy = self.is_python(scriptname) if not ispy: if not (self.have_fork or self.have_popen2 or self.have_popen3): self.send_error(403, "CGI script is not a Python script (%r)" % scriptname) return if not self.is_executable(scriptfile): self.send_error(403, "CGI script is not executable (%r)" % scriptname) return
a28b3e6dfb399a6107b717d78bc81ef6be80f123 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a28b3e6dfb399a6107b717d78bc81ef6be80f123/CGIHTTPServer.py
self._dist_path(rpms[0])
self._dist_path(rpms[0]))
def run (self):
700f36c7520bffef73d86088fa80b7a1c62c416a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/700f36c7520bffef73d86088fa80b7a1c62c416a/bdist_rpm.py
self._dist_path(debuginfo[0])
self._dist_path(debuginfo[0]))
def run (self):
700f36c7520bffef73d86088fa80b7a1c62c416a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/700f36c7520bffef73d86088fa80b7a1c62c416a/bdist_rpm.py
self._list.LCellSize((width, cellheight))
self._list.LCellSize((width/self._cols, cellheight))
def adjust(self, oldbounds): self.SetPort() # Appearance frames are drawn outside the specified bounds, # so we always need to outset the invalidated area. self.GetWindow().InvalWindowRect(Qd.InsetRect(oldbounds, -3, -3)) self.GetWindow().InvalWindowRect(Qd.InsetRect(self._bounds, -3, -3))
726b238860d6ec09a9ad1ca227390dddfdc01047 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/726b238860d6ec09a9ad1ca227390dddfdc01047/Wlists.py
Qd.MoveTo(left + 4, top + ascent)
Qd.MoveTo(int(left + 4), int(top + ascent))
def listDefDraw(self, selected, cellRect, theCell, dataOffset, dataLen, theList): savedPort = Qd.GetPort() Qd.SetPort(theList.GetListPort()) savedClip = Qd.NewRgn() Qd.GetClip(savedClip) Qd.ClipRect(cellRect) savedPenState = Qd.GetPenState() Qd.PenNormal() Qd.EraseRect(cellRect) #draw the cell if it contains data ascent, descent, leading, size, hm = Fm.FontMetrics() linefeed = ascent + descent + leading if dataLen: left, top, right, bottom = cellRect data = theList.LGetCell(dataLen, theCell) lines = data.split("\r") line1 = lines[0] if len(lines) > 1: line2 = lines[1] else: line2 = "" Qd.MoveTo(left + 4, top + ascent) Qd.DrawText(line1, 0, len(line1)) if line2: Qd.MoveTo(left + 4, top + ascent + linefeed) Qd.DrawText(line2, 0, len(line2)) Qd.PenPat("\x11\x11\x11\x11\x11\x11\x11\x11") bottom = top + theList.cellSize[1] Qd.MoveTo(left, bottom - 1) Qd.LineTo(right, bottom - 1) if selected: self.listDefHighlight(selected, cellRect, theCell, dataOffset, dataLen, theList) #restore graphics environment Qd.SetPort(savedPort) Qd.SetClip(savedClip) Qd.DisposeRgn(savedClip) Qd.SetPenState(savedPenState)
726b238860d6ec09a9ad1ca227390dddfdc01047 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/726b238860d6ec09a9ad1ca227390dddfdc01047/Wlists.py
Qd.MoveTo(left + 4, top + ascent + linefeed)
Qd.MoveTo(int(left + 4), int(top + ascent + linefeed))
def listDefDraw(self, selected, cellRect, theCell, dataOffset, dataLen, theList): savedPort = Qd.GetPort() Qd.SetPort(theList.GetListPort()) savedClip = Qd.NewRgn() Qd.GetClip(savedClip) Qd.ClipRect(cellRect) savedPenState = Qd.GetPenState() Qd.PenNormal() Qd.EraseRect(cellRect) #draw the cell if it contains data ascent, descent, leading, size, hm = Fm.FontMetrics() linefeed = ascent + descent + leading if dataLen: left, top, right, bottom = cellRect data = theList.LGetCell(dataLen, theCell) lines = data.split("\r") line1 = lines[0] if len(lines) > 1: line2 = lines[1] else: line2 = "" Qd.MoveTo(left + 4, top + ascent) Qd.DrawText(line1, 0, len(line1)) if line2: Qd.MoveTo(left + 4, top + ascent + linefeed) Qd.DrawText(line2, 0, len(line2)) Qd.PenPat("\x11\x11\x11\x11\x11\x11\x11\x11") bottom = top + theList.cellSize[1] Qd.MoveTo(left, bottom - 1) Qd.LineTo(right, bottom - 1) if selected: self.listDefHighlight(selected, cellRect, theCell, dataOffset, dataLen, theList) #restore graphics environment Qd.SetPort(savedPort) Qd.SetClip(savedClip) Qd.DisposeRgn(savedClip) Qd.SetPenState(savedPenState)
726b238860d6ec09a9ad1ca227390dddfdc01047 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/726b238860d6ec09a9ad1ca227390dddfdc01047/Wlists.py
def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts."
3bd8d0fb9c153552cd2593ecdeb80023b7776930 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3bd8d0fb9c153552cd2593ecdeb80023b7776930/buildpkg.py
for pat in ("*upgrade", "*install"):
for pat in ("*upgrade", "*install", "*flight"):
def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts."
3bd8d0fb9c153552cd2593ecdeb80023b7776930 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3bd8d0fb9c153552cd2593ecdeb80023b7776930/buildpkg.py
elif f in ["pre-upgrade", "pre-install", "post-upgrade", "post-install"]: files.append((f, self.packageInfo["Title"]+"."+f)) elif f[-8:] == "-upgrade":
elif basename(f) in ["pre_upgrade", "pre_install", "post_upgrade", "post_install"]: files.append((f, packageName+"."+basename(f))) elif basename(f) in ["preflight", "postflight"]: files.append((f, f)) elif f[-8:] == "_upgrade":
def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts."
3bd8d0fb9c153552cd2593ecdeb80023b7776930 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3bd8d0fb9c153552cd2593ecdeb80023b7776930/buildpkg.py
elif f[-8:] == "-install":
elif f[-8:] == "_install":
def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts."
3bd8d0fb9c153552cd2593ecdeb80023b7776930 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3bd8d0fb9c153552cd2593ecdeb80023b7776930/buildpkg.py
class _Verbose:
class _Verbose(object):
def _note(self, format, *args): if self.__verbose: format = format % args format = "%s: %s\n" % ( currentThread().getName(), format) _sys.stderr.write(format)
59aba128a5266a944d9773f7223f25b164372146 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/59aba128a5266a944d9773f7223f25b164372146/threading.py
if nodelist[2] != ':':
if len(nodelist) == 1 or nodelist[1] != ':':
def com_dictsetmaker(self, nodelist): # dictsetmaker: (test ':' test (',' test ':' value)* [',']) | (test (',' test)* [',']) items = [] if nodelist[2] != ':': # it's a set for i in range(1, len(nodelist), 2): items.append(self.com_node(nodelist[i])) return Set(items, lineno=items[0].lineno) else: # it's a dict for i in range(1, len(nodelist), 4): items.append((self.com_node(nodelist[i]), self.com_node(nodelist[i+2]))) return Dict(items, lineno=items[0][0].lineno)
b3fa66fe30c66adbbd54588f390c4d332285880d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b3fa66fe30c66adbbd54588f390c4d332285880d/transformer.py
dirs_in_sys_path = {}
_dirs_in_sys_path = {}
def makepath(*paths): dir = os.path.abspath(os.path.join(*paths)) return dir, os.path.normcase(dir)
7f5296e7c06f5a6010960f34ae7db89d8902cddb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7f5296e7c06f5a6010960f34ae7db89d8902cddb/site.py
if not dirs_in_sys_path.has_key(dircase):
if not _dirs_in_sys_path.has_key(dircase):
def makepath(*paths): dir = os.path.abspath(os.path.join(*paths)) return dir, os.path.normcase(dir)
7f5296e7c06f5a6010960f34ae7db89d8902cddb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7f5296e7c06f5a6010960f34ae7db89d8902cddb/site.py
dirs_in_sys_path[dircase] = 1
_dirs_in_sys_path[dircase] = 1
def makepath(*paths): dir = os.path.abspath(os.path.join(*paths)) return dir, os.path.normcase(dir)
7f5296e7c06f5a6010960f34ae7db89d8902cddb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7f5296e7c06f5a6010960f34ae7db89d8902cddb/site.py
if not dirs_in_sys_path.has_key(sitedircase):
if not _dirs_in_sys_path.has_key(sitedircase):
def addsitedir(sitedir): sitedir, sitedircase = makepath(sitedir) if not dirs_in_sys_path.has_key(sitedircase): sys.path.append(sitedir) # Add path component try: names = os.listdir(sitedir) except os.error: return names.sort() for name in names: if name[-4:] == endsep + "pth": addpackage(sitedir, name)
7f5296e7c06f5a6010960f34ae7db89d8902cddb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7f5296e7c06f5a6010960f34ae7db89d8902cddb/site.py
if not dirs_in_sys_path.has_key(dircase) and os.path.exists(dir):
if not _dirs_in_sys_path.has_key(dircase) and os.path.exists(dir):
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
7f5296e7c06f5a6010960f34ae7db89d8902cddb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7f5296e7c06f5a6010960f34ae7db89d8902cddb/site.py
dirs_in_sys_path[dircase] = 1
_dirs_in_sys_path[dircase] = 1 if reset: _dirs_in_sys_path = None
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
7f5296e7c06f5a6010960f34ae7db89d8902cddb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7f5296e7c06f5a6010960f34ae7db89d8902cddb/site.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
f90d5292298cbaa114c4a1d000e7d8e946ca65b3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f90d5292298cbaa114c4a1d000e7d8e946ca65b3/IOBinding.py
f.write('z') f.seek(0) f.seek(size) f.write('a') f.flush() if test_support.verbose: print 'check file size with os.fstat' expect(os.fstat(f.fileno())[stat.ST_SIZE], size+1) f.close()
try: f.write('z') f.seek(0) f.seek(size) f.write('a') f.flush() if test_support.verbose: print 'check file size with os.fstat' expect(os.fstat(f.fileno())[stat.ST_SIZE], size+1) finally: f.close()
def expect(got_this, expect_this): if test_support.verbose: print '%r =?= %r ...' % (got_this, expect_this), if got_this != expect_this: if test_support.verbose: print 'no' raise test_support.TestFailed, 'got %r, but expected %r' %\ (got_this, expect_this) else: if test_support.verbose: print 'yes'
063606a0d5302d8a5530297a70494a9cad334e83 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/063606a0d5302d8a5530297a70494a9cad334e83/test_largefile.py
expect(f.tell(), 0) expect(f.read(1), 'z') expect(f.tell(), 1) f.seek(0) expect(f.tell(), 0) f.seek(0, 0) expect(f.tell(), 0) f.seek(42) expect(f.tell(), 42) f.seek(42, 0) expect(f.tell(), 42) f.seek(42, 1) expect(f.tell(), 84) f.seek(0, 1) expect(f.tell(), 84) f.seek(0, 2) expect(f.tell(), size + 1 + 0) f.seek(-10, 2) expect(f.tell(), size + 1 - 10) f.seek(-size-1, 2) expect(f.tell(), 0) f.seek(size) expect(f.tell(), size) expect(f.read(1), 'a') f.seek(-size-1, 1) expect(f.read(1), 'z') expect(f.tell(), 1) f.close()
try: expect(f.tell(), 0) expect(f.read(1), 'z') expect(f.tell(), 1) f.seek(0) expect(f.tell(), 0) f.seek(0, 0) expect(f.tell(), 0) f.seek(42) expect(f.tell(), 42) f.seek(42, 0) expect(f.tell(), 42) f.seek(42, 1) expect(f.tell(), 84) f.seek(0, 1) expect(f.tell(), 84) f.seek(0, 2) expect(f.tell(), size + 1 + 0) f.seek(-10, 2) expect(f.tell(), size + 1 - 10) f.seek(-size-1, 2) expect(f.tell(), 0) f.seek(size) expect(f.tell(), size) expect(f.read(1), 'a') f.seek(-size-1, 1) expect(f.read(1), 'z') expect(f.tell(), 1) finally: f.close()
def expect(got_this, expect_this): if test_support.verbose: print '%r =?= %r ...' % (got_this, expect_this), if got_this != expect_this: if test_support.verbose: print 'no' raise test_support.TestFailed, 'got %r, but expected %r' %\ (got_this, expect_this) else: if test_support.verbose: print 'yes'
063606a0d5302d8a5530297a70494a9cad334e83 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/063606a0d5302d8a5530297a70494a9cad334e83/test_largefile.py
expect(os.lseek(f.fileno(), 0, 0), 0) expect(os.lseek(f.fileno(), 42, 0), 42) expect(os.lseek(f.fileno(), 42, 1), 84) expect(os.lseek(f.fileno(), 0, 1), 84) expect(os.lseek(f.fileno(), 0, 2), size+1+0) expect(os.lseek(f.fileno(), -10, 2), size+1-10) expect(os.lseek(f.fileno(), -size-1, 2), 0) expect(os.lseek(f.fileno(), size, 0), size) expect(f.read(1), 'a') f.close()
try: expect(os.lseek(f.fileno(), 0, 0), 0) expect(os.lseek(f.fileno(), 42, 0), 42) expect(os.lseek(f.fileno(), 42, 1), 84) expect(os.lseek(f.fileno(), 0, 1), 84) expect(os.lseek(f.fileno(), 0, 2), size+1+0) expect(os.lseek(f.fileno(), -10, 2), size+1-10) expect(os.lseek(f.fileno(), -size-1, 2), 0) expect(os.lseek(f.fileno(), size, 0), size) expect(f.read(1), 'a') finally: f.close()
def expect(got_this, expect_this): if test_support.verbose: print '%r =?= %r ...' % (got_this, expect_this), if got_this != expect_this: if test_support.verbose: print 'no' raise test_support.TestFailed, 'got %r, but expected %r' %\ (got_this, expect_this) else: if test_support.verbose: print 'yes'
063606a0d5302d8a5530297a70494a9cad334e83 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/063606a0d5302d8a5530297a70494a9cad334e83/test_largefile.py
f.seek(0, 2) expect(f.tell(), size+1) newsize = size - 10 f.seek(newsize) f.truncate() expect(f.tell(), newsize) f.seek(0, 2) expect(f.tell(), newsize) newsize -= 1 f.seek(42) f.truncate(newsize) expect(f.tell(), 42) f.seek(0, 2) expect(f.tell(), newsize)
try: f.seek(0, 2) expect(f.tell(), size+1) newsize = size - 10 f.seek(newsize) f.truncate() expect(f.tell(), newsize) f.seek(0, 2) expect(f.tell(), newsize) newsize -= 1 f.seek(42) f.truncate(newsize) expect(f.tell(), 42) f.seek(0, 2) expect(f.tell(), newsize)
def expect(got_this, expect_this): if test_support.verbose: print '%r =?= %r ...' % (got_this, expect_this), if got_this != expect_this: if test_support.verbose: print 'no' raise test_support.TestFailed, 'got %r, but expected %r' %\ (got_this, expect_this) else: if test_support.verbose: print 'yes'
063606a0d5302d8a5530297a70494a9cad334e83 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/063606a0d5302d8a5530297a70494a9cad334e83/test_largefile.py
def expect(got_this, expect_this): if test_support.verbose: print '%r =?= %r ...' % (got_this, expect_this), if got_this != expect_this: if test_support.verbose: print 'no' raise test_support.TestFailed, 'got %r, but expected %r' %\ (got_this, expect_this) else: if test_support.verbose: print 'yes'
063606a0d5302d8a5530297a70494a9cad334e83 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/063606a0d5302d8a5530297a70494a9cad334e83/test_largefile.py
f.seek(0) f.truncate(1) expect(f.tell(), 0) expect(len(f.read()), 1)
f.seek(0) f.truncate(1) expect(f.tell(), 0) expect(len(f.read()), 1)
def expect(got_this, expect_this): if test_support.verbose: print '%r =?= %r ...' % (got_this, expect_this), if got_this != expect_this: if test_support.verbose: print 'no' raise test_support.TestFailed, 'got %r, but expected %r' %\ (got_this, expect_this) else: if test_support.verbose: print 'yes'
063606a0d5302d8a5530297a70494a9cad334e83 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/063606a0d5302d8a5530297a70494a9cad334e83/test_largefile.py
f.close()
finally: f.close()
def expect(got_this, expect_this): if test_support.verbose: print '%r =?= %r ...' % (got_this, expect_this), if got_this != expect_this: if test_support.verbose: print 'no' raise test_support.TestFailed, 'got %r, but expected %r' %\ (got_this, expect_this) else: if test_support.verbose: print 'yes'
063606a0d5302d8a5530297a70494a9cad334e83 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/063606a0d5302d8a5530297a70494a9cad334e83/test_largefile.py
def addpackers(self): self.packer = MountPacker().init() self.unpacker = MountUnpacker().init('')
63ae96e3d7a1bf545bdf2c4484aa1cb065e920ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/63ae96e3d7a1bf545bdf2c4484aa1cb065e920ea/mountclient.py
if proc not in (1, 3, 4):
if proc not in (1, 3, 4):
def mkcred(self, proc): if proc not in (1, 3, 4): # not Mnt/Unmnt/Unmntall return rpc.AUTH_NULL, '' if self.cred == None: self.cred = rpc.AUTH_UNIX, rpc.make_auth_unix_default() return self.cred
63ae96e3d7a1bf545bdf2c4484aa1cb065e920ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/63ae96e3d7a1bf545bdf2c4484aa1cb065e920ea/mountclient.py
def bind(self, sequence=None, command=None): return self.canvas.tag_bind(self.id, sequence, command) def unbind(self, sequence): self.canvas.tag_bind(self.id, sequence, '')
def bind(self, sequence=None, command=None, add=None): return self.canvas.tag_bind(self.id, sequence, command, add) def unbind(self, sequence, funcid=None): self.canvas.tag_unbind(self.id, sequence, funcid)
def bind(self, sequence=None, command=None): return self.canvas.tag_bind(self.id, sequence, command)
00236f38dabd16ffe5da4d75664f051c37833aa5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/00236f38dabd16ffe5da4d75664f051c37833aa5/Canvas.py
self.canvas.lower(self.id, belowthis)
self.canvas.tag_lower(self.id, belowthis)
def lower(self, belowthis=None): self.canvas.lower(self.id, belowthis)
00236f38dabd16ffe5da4d75664f051c37833aa5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/00236f38dabd16ffe5da4d75664f051c37833aa5/Canvas.py
self.canvas.tkraise(self.id, abovethis)
self.canvas.tag_raise(self.id, abovethis)
def tkraise(self, abovethis=None): self.canvas.tkraise(self.id, abovethis)
00236f38dabd16ffe5da4d75664f051c37833aa5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/00236f38dabd16ffe5da4d75664f051c37833aa5/Canvas.py
def bind(self, sequence=None, command=None): return self.canvas.tag_bind(self.id, sequence, command) def unbind(self, sequence): self.canvas.tag_bind(self.id, sequence, '')
def bind(self, sequence=None, command=None, add=None): return self.canvas.tag_bind(self.id, sequence, command, add) def unbind(self, sequence, funcid=None): self.canvas.tag_unbind(self.id, sequence, funcid)
def bind(self, sequence=None, command=None): return self.canvas.tag_bind(self.id, sequence, command)
00236f38dabd16ffe5da4d75664f051c37833aa5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/00236f38dabd16ffe5da4d75664f051c37833aa5/Canvas.py
self._do('lower', belowThis)
self._do('tag_lower', belowThis)
def lower(self, belowThis=None): self._do('lower', belowThis)
00236f38dabd16ffe5da4d75664f051c37833aa5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/00236f38dabd16ffe5da4d75664f051c37833aa5/Canvas.py
self._do('raise', aboveThis)
self._do('tag_raise', aboveThis)
def tkraise(self, aboveThis=None): self._do('raise', aboveThis)
00236f38dabd16ffe5da4d75664f051c37833aa5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/00236f38dabd16ffe5da4d75664f051c37833aa5/Canvas.py
"Handle a recoverable error."
"Handle a recoverable error."
def error(self, exception):
a2dccfbc094df7e017520720a103342c90766491 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a2dccfbc094df7e017520720a103342c90766491/handler.py
"Handle a non-recoverable error."
"Handle a non-recoverable error."
def fatalError(self, exception):
a2dccfbc094df7e017520720a103342c90766491 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a2dccfbc094df7e017520720a103342c90766491/handler.py
"Handle a warning."
"Handle a warning."
def warning(self, exception):
a2dccfbc094df7e017520720a103342c90766491 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a2dccfbc094df7e017520720a103342c90766491/handler.py
str = '<?xml version="1.0" ?>\n<a b="c"/>'
str = '<?xml version="1.0" ?><a b="c"/>'
def testWriteXML(): str = '<?xml version="1.0" ?>\n<a b="c"/>' dom = parseString(str) domstr = dom.toxml() dom.unlink() confirm(str == domstr)
905a01aba41988cb0c3d9fe15de38c3c94cc09dc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/905a01aba41988cb0c3d9fe15de38c3c94cc09dc/test_minidom.py
confirm(doc.toxml() == u'<?xml version="1.0" ?>\n<foo>\u20ac</foo>' and doc.toxml('utf-8') == '<?xml version="1.0" encoding="utf-8"?>\n<foo>\xe2\x82\xac</foo>' and doc.toxml('iso-8859-15') == '<?xml version="1.0" encoding="iso-8859-15"?>\n<foo>\xa4</foo>',
confirm(doc.toxml() == u'<?xml version="1.0" ?><foo>\u20ac</foo>' and doc.toxml('utf-8') == '<?xml version="1.0" encoding="utf-8"?><foo>\xe2\x82\xac</foo>' and doc.toxml('iso-8859-15') == '<?xml version="1.0" encoding="iso-8859-15"?><foo>\xa4</foo>',
def testEncodings(): doc = parseString('<foo>&#x20ac;</foo>') confirm(doc.toxml() == u'<?xml version="1.0" ?>\n<foo>\u20ac</foo>' and doc.toxml('utf-8') == '<?xml version="1.0" encoding="utf-8"?>\n<foo>\xe2\x82\xac</foo>' and doc.toxml('iso-8859-15') == '<?xml version="1.0" encoding="iso-8859-15"?>\n<foo>\xa4</foo>', "testEncodings - encoding EURO SIGN") doc.unlink()
905a01aba41988cb0c3d9fe15de38c3c94cc09dc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/905a01aba41988cb0c3d9fe15de38c3c94cc09dc/test_minidom.py
def NodeList(): return []
95700f7cde5c0efa1ae7bc956f4ba54ec8508b51 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/95700f7cde5c0efa1ae7bc956f4ba54ec8508b51/minidom.py
return _getElementsByTagNameHelper(self, name, [])
return _getElementsByTagNameHelper(self, name, NodeList())
def getElementsByTagName(self, name): return _getElementsByTagNameHelper(self, name, [])
95700f7cde5c0efa1ae7bc956f4ba54ec8508b51 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/95700f7cde5c0efa1ae7bc956f4ba54ec8508b51/minidom.py
return _getElementsByTagNameNSHelper(self, namespaceURI, localName, [])
return _getElementsByTagNameNSHelper(self, namespaceURI, localName, NodeList())
def getElementsByTagNameNS(self, namespaceURI, localName): return _getElementsByTagNameNSHelper(self, namespaceURI, localName, [])
95700f7cde5c0efa1ae7bc956f4ba54ec8508b51 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/95700f7cde5c0efa1ae7bc956f4ba54ec8508b51/minidom.py
return _getElementsByTagNameHelper(self, name, [])
return _getElementsByTagNameHelper(self, name, NodeList())
def getElementsByTagName(self, name): return _getElementsByTagNameHelper(self, name, [])
95700f7cde5c0efa1ae7bc956f4ba54ec8508b51 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/95700f7cde5c0efa1ae7bc956f4ba54ec8508b51/minidom.py
return _getElementsByTagNameNSHelper(self, namespaceURI, localName, [])
return _getElementsByTagNameNSHelper(self, namespaceURI, localName, NodeList())
def getElementsByTagNameNS(self, namespaceURI, localName): return _getElementsByTagNameNSHelper(self, namespaceURI, localName, [])
95700f7cde5c0efa1ae7bc956f4ba54ec8508b51 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/95700f7cde5c0efa1ae7bc956f4ba54ec8508b51/minidom.py
"timeout (%g) is %g seconds more than expected (%g)"
"timeout (%g) is more than %g seconds more than expected (%g)"
def testConnectTimeout(self): # Test connect() timeout _timeout = 0.001 self.sock.settimeout(_timeout)
01e80b45d6f2d2b2eac5e81731c3af80f09214c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/01e80b45d6f2d2b2eac5e81731c3af80f09214c2/test_timeout.py
continuation_ws=' '):
continuation_ws=' ', errors='strict'):
def __init__(self, s=None, charset=None, maxlinelen=None, header_name=None, continuation_ws=' '): """Create a MIME-compliant header that can contain many character sets.
f4fdff715af7a9d595444065c523f8de5303895d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f4fdff715af7a9d595444065c523f8de5303895d/Header.py
self.append(s, charset)
self.append(s, charset, errors)
def __init__(self, s=None, charset=None, maxlinelen=None, header_name=None, continuation_ws=' '): """Create a MIME-compliant header that can contain many character sets.
f4fdff715af7a9d595444065c523f8de5303895d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f4fdff715af7a9d595444065c523f8de5303895d/Header.py
def append(self, s, charset=None):
def append(self, s, charset=None, errors='strict'):
def append(self, s, charset=None): """Append a string to the MIME header.
f4fdff715af7a9d595444065c523f8de5303895d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f4fdff715af7a9d595444065c523f8de5303895d/Header.py
ustr = unicode(s, incodec)
ustr = unicode(s, incodec, errors)
def append(self, s, charset=None): """Append a string to the MIME header.
f4fdff715af7a9d595444065c523f8de5303895d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f4fdff715af7a9d595444065c523f8de5303895d/Header.py
ustr.encode(outcodec)
ustr.encode(outcodec, errors)
def append(self, s, charset=None): """Append a string to the MIME header.
f4fdff715af7a9d595444065c523f8de5303895d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f4fdff715af7a9d595444065c523f8de5303895d/Header.py
s = s.encode(outcodec)
s = s.encode(outcodec, errors)
def append(self, s, charset=None): """Append a string to the MIME header.
f4fdff715af7a9d595444065c523f8de5303895d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f4fdff715af7a9d595444065c523f8de5303895d/Header.py
libraries=[dblib]))
libraries=dblibs))
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')
d1b2045958306349b04da931a1a400d7e9a49fb9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d1b2045958306349b04da931a1a400d7e9a49fb9/setup.py
libraries=[dblib]))
libraries=dblibs))
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')
d1b2045958306349b04da931a1a400d7e9a49fb9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d1b2045958306349b04da931a1a400d7e9a49fb9/setup.py
if platform not in ['cygwin', 'mac']: if (self.compiler.find_library_file(lib_dirs, 'ndbm')):
if platform not in ['cygwin']: if (self.compiler.find_library_file(lib_dirs, 'ndbm') and find_file("ndbm.h", inc_dirs, []) is not None):
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')
d1b2045958306349b04da931a1a400d7e9a49fb9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d1b2045958306349b04da931a1a400d7e9a49fb9/setup.py
elif self.compiler.find_library_file(lib_dirs, 'gdbm'):
elif (platform in ['darwin'] and find_file("ndbm.h", inc_dirs, []) is not None):
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')
d1b2045958306349b04da931a1a400d7e9a49fb9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d1b2045958306349b04da931a1a400d7e9a49fb9/setup.py
library_dirs=dblib_dir,
library_dirs=[dblib_dir],
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')
d1b2045958306349b04da931a1a400d7e9a49fb9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d1b2045958306349b04da931a1a400d7e9a49fb9/setup.py
else: exts.append( Extension('dbm', ['dbmmodule.c']) )
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')
d1b2045958306349b04da931a1a400d7e9a49fb9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d1b2045958306349b04da931a1a400d7e9a49fb9/setup.py
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')
d1b2045958306349b04da931a1a400d7e9a49fb9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d1b2045958306349b04da931a1a400d7e9a49fb9/setup.py
frameworkdir = sysconfig.get_config_var('PYTHONFRAMEWORKDIR') exts.append( Extension('gestalt', ['gestaltmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('MacOS', ['macosmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('icglue', ['icgluemodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('macfs', ['macfsmodule.c', '../Python/getapplbycreator.c'], extra_link_args=['-framework', 'Carbon']) )
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')
d1b2045958306349b04da931a1a400d7e9a49fb9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d1b2045958306349b04da931a1a400d7e9a49fb9/setup.py
exts.append( Extension('_Res', ['res/_Resmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Snd', ['snd/_Sndmodule.c'], extra_link_args=['-framework', 'Carbon']) ) if frameworkdir:
framework = sysconfig.get_config_var('PYTHONFRAMEWORK') if framework: exts.append( Extension('gestalt', ['gestaltmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('MacOS', ['macosmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('icglue', ['icgluemodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('macfs', ['macfsmodule.c', '../Python/getapplbycreator.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Res', ['res/_Resmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Snd', ['snd/_Sndmodule.c'], extra_link_args=['-framework', 'Carbon']) )
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')
d1b2045958306349b04da931a1a400d7e9a49fb9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d1b2045958306349b04da931a1a400d7e9a49fb9/setup.py
["../"*n + "waste/Static Libraries" for n in (0,1,2,3,4)])
[ "../"*n + "waste/Static Libraries" for n in (0,1,2,3,4)])
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')
d1b2045958306349b04da931a1a400d7e9a49fb9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d1b2045958306349b04da931a1a400d7e9a49fb9/setup.py
if cache.has_key(path): return cache[path] cache[path] = ret = os.stat(path)
ret = cache.get(path, None) if ret is None: cache[path] = ret = _os.stat(path)
def stat(path): """Stat a file, possibly out of the cache.""" if cache.has_key(path): return cache[path] cache[path] = ret = os.stat(path) return ret
0149e84af280523f74bc2bccb6505eb12cf5bf9c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0149e84af280523f74bc2bccb6505eb12cf5bf9c/statcache.py
def reset(): """Reset the cache completely.""" global cache cache = {}
def reset(): """Reset the cache completely.""" global cache cache = {}
0149e84af280523f74bc2bccb6505eb12cf5bf9c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0149e84af280523f74bc2bccb6505eb12cf5bf9c/statcache.py
if cache.has_key(path):
try:
def forget(path): """Remove a given item from the cache, if it exists.""" if cache.has_key(path): del cache[path]
0149e84af280523f74bc2bccb6505eb12cf5bf9c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0149e84af280523f74bc2bccb6505eb12cf5bf9c/statcache.py
except KeyError: pass
def forget(path): """Remove a given item from the cache, if it exists.""" if cache.has_key(path): del cache[path]
0149e84af280523f74bc2bccb6505eb12cf5bf9c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0149e84af280523f74bc2bccb6505eb12cf5bf9c/statcache.py
n = len(prefix)
def forget_prefix(prefix): """Remove all pathnames with a given prefix.""" n = len(prefix) for path in cache.keys(): if path[:n] == prefix: del cache[path]
0149e84af280523f74bc2bccb6505eb12cf5bf9c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0149e84af280523f74bc2bccb6505eb12cf5bf9c/statcache.py
if path[:n] == prefix: del cache[path]
if path.startswith(prefix): forget(path)
def forget_prefix(prefix): """Remove all pathnames with a given prefix.""" n = len(prefix) for path in cache.keys(): if path[:n] == prefix: del cache[path]
0149e84af280523f74bc2bccb6505eb12cf5bf9c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0149e84af280523f74bc2bccb6505eb12cf5bf9c/statcache.py
"""Forget about a directory and all entries in it, but not about entries in subdirectories.""" if prefix[-1:] == '/' and prefix != '/': prefix = prefix[:-1]
"""Forget a directory and all entries except for entries in subdirs.""" from os.path import split, join prefix = split(join(prefix, "xxx"))[0]
def forget_dir(prefix): """Forget about a directory and all entries in it, but not about entries in subdirectories.""" if prefix[-1:] == '/' and prefix != '/': prefix = prefix[:-1] forget(prefix) if prefix[-1:] != '/': prefix = prefix + '/' n = len(prefix) for path in cache.keys(): if path[:n] == prefix: rest = path[n:] if rest[-1:] == '/': rest = rest[:-1] if '/' not in rest: del cache[path]
0149e84af280523f74bc2bccb6505eb12cf5bf9c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0149e84af280523f74bc2bccb6505eb12cf5bf9c/statcache.py
if prefix[-1:] != '/': prefix = prefix + '/' n = len(prefix)
def forget_dir(prefix): """Forget about a directory and all entries in it, but not about entries in subdirectories.""" if prefix[-1:] == '/' and prefix != '/': prefix = prefix[:-1] forget(prefix) if prefix[-1:] != '/': prefix = prefix + '/' n = len(prefix) for path in cache.keys(): if path[:n] == prefix: rest = path[n:] if rest[-1:] == '/': rest = rest[:-1] if '/' not in rest: del cache[path]
0149e84af280523f74bc2bccb6505eb12cf5bf9c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0149e84af280523f74bc2bccb6505eb12cf5bf9c/statcache.py
if path[:n] == prefix: rest = path[n:] if rest[-1:] == '/': rest = rest[:-1] if '/' not in rest: del cache[path]
if path.startswith(prefix) and split(path)[0] == prefix: forget(path)
def forget_dir(prefix): """Forget about a directory and all entries in it, but not about entries in subdirectories.""" if prefix[-1:] == '/' and prefix != '/': prefix = prefix[:-1] forget(prefix) if prefix[-1:] != '/': prefix = prefix + '/' n = len(prefix) for path in cache.keys(): if path[:n] == prefix: rest = path[n:] if rest[-1:] == '/': rest = rest[:-1] if '/' not in rest: del cache[path]
0149e84af280523f74bc2bccb6505eb12cf5bf9c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0149e84af280523f74bc2bccb6505eb12cf5bf9c/statcache.py
Normally used with prefix = '/' after a chdir().""" n = len(prefix)
Normally used with prefix = '/' after a chdir(). """
def forget_except_prefix(prefix): """Remove all pathnames except with a given prefix. Normally used with prefix = '/' after a chdir().""" n = len(prefix) for path in cache.keys(): if path[:n] != prefix: del cache[path]
0149e84af280523f74bc2bccb6505eb12cf5bf9c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0149e84af280523f74bc2bccb6505eb12cf5bf9c/statcache.py
if path[:n] != prefix: del cache[path]
if not path.startswith(prefix): forget(path)
def forget_except_prefix(prefix): """Remove all pathnames except with a given prefix. Normally used with prefix = '/' after a chdir().""" n = len(prefix) for path in cache.keys(): if path[:n] != prefix: del cache[path]
0149e84af280523f74bc2bccb6505eb12cf5bf9c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0149e84af280523f74bc2bccb6505eb12cf5bf9c/statcache.py
self.send_error(501, "Unsupported method (%s)" % `mname`)
self.send_error(501, "Unsupported method (%s)" % `command`)
def handle(self): """Handle a single HTTP request.
60e7330fee3e34732ab55cd6bb1212e138c11f7f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/60e7330fee3e34732ab55cd6bb1212e138c11f7f/BaseHTTPServer.py
"contact_email", "licence")
"contact_email", "licence", "classifiers")
def is_pure (self): return (self.has_pure_modules() and not self.has_ext_modules() and not self.has_c_libraries())
282e2c36ba630aeeedb16a97aa6e881ca27b1a4d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/282e2c36ba630aeeedb16a97aa6e881ca27b1a4d/dist.py
fn = os.path.join(fn, os.pardir, os.pardir, "Doc", "index.html")
fn = os.path.join(fn, os.pardir, os.pardir, "pythlp.chm")
def help_dialog(self, event=None): fn=os.path.join(os.path.abspath(os.path.dirname(__file__)),'help.txt') textView.TextViewer(self.top,'Help',fn)
931625dc77cfd527b059e579615d517d8d994110 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/931625dc77cfd527b059e579615d517d8d994110/EditorWindow.py
def python_docs(self, event=None): self.display_docs(self.help_url)
def python_docs(self, event=None): os.startfile(self.help_url) else: def python_docs(self, event=None): self.display_docs(self.help_url)
def help_dialog(self, event=None): fn=os.path.join(os.path.abspath(os.path.dirname(__file__)),'help.txt') textView.TextViewer(self.top,'Help',fn)
931625dc77cfd527b059e579615d517d8d994110 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/931625dc77cfd527b059e579615d517d8d994110/EditorWindow.py
"can't pickle %s objects" % `t.__name__`
"can't pickle %s object: %s" % (`t.__name__`, `object`)
def save(self, object, pers_save = 0): memo = self.memo
08a92cb56874537b88a224e9fcd6a3d89a5a703b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/08a92cb56874537b88a224e9fcd6a3d89a5a703b/pickle.py
apply(self.cb, self.cb_arg)
apply(self.cb, (self.cb_arg,))
def poll(self): if not self.async: raise error, 'Can only call poll() in async mode' if not self.busy_cmd: return if self.testready(): if self.cb: apply(self.cb, self.cb_arg)
26c86abb4b1d031770d8f8eb01850893bf0594aa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/26c86abb4b1d031770d8f8eb01850893bf0594aa/VCR.py
width=80,
width=79,
def __init__ (self, indent_increment=2, max_help_position=24, width=80, short_first=1): HelpFormatter.__init__( self, indent_increment, max_help_position, width, short_first)
4e9e7a61404ea168ffa30f5ef5203d3e0cb3d172 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4e9e7a61404ea168ffa30f5ef5203d3e0cb3d172/optparse.py
width=80,
width=79,
def __init__ (self, indent_increment=0, max_help_position=24, width=80, short_first=0): HelpFormatter.__init__ ( self, indent_increment, max_help_position, width, short_first)
4e9e7a61404ea168ffa30f5ef5203d3e0cb3d172 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4e9e7a61404ea168ffa30f5ef5203d3e0cb3d172/optparse.py
Note: this functions only works if Mark Hammond's win32
Note: this function only works if Mark Hammond's win32
def win32_ver(release='',version='',csd='',ptype=''): """ Get additional version information from the Windows Registry and return a tuple (version,csd,ptype) referring to version number, CSD level and OS type (multi/single processor). As a hint: ptype returns 'Uniprocessor Free' on single processor NT machines and 'Multiprocessor Free' on multi processor machines. The 'Free' refers to the OS version being free of debugging code. It could also state 'Checked' which means the OS version uses debugging code, i.e. code that checks arguments, ranges, etc. (Thomas Heller). Note: this functions only works if Mark Hammond's win32 package is installed and obviously only runs on Win32 compatible platforms. """ # XXX Is there any way to find out the processor type on WinXX ? # XXX Is win32 available on Windows CE ? # Adapted from code posted by Karl Putland to comp.lang.python. # Import the needed APIs try: import win32api except ImportError: return release,version,csd,ptype from win32api import RegQueryValueEx,RegOpenKeyEx,RegCloseKey,GetVersionEx from win32con import HKEY_LOCAL_MACHINE,VER_PLATFORM_WIN32_NT,\ VER_PLATFORM_WIN32_WINDOWS # Find out the registry key and some general version infos maj,min,buildno,plat,csd = GetVersionEx() version = '%i.%i.%i' % (maj,min,buildno & 0xFFFF) if csd[:13] == 'Service Pack ': csd = 'SP' + csd[13:] if plat == VER_PLATFORM_WIN32_WINDOWS: regkey = 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion' # Try to guess the release name if maj == 4: if min == 0: release = '95' else: release = '98' elif maj == 5: release = '2000' elif plat == VER_PLATFORM_WIN32_NT: regkey = 'SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion' if maj <= 4: release = 'NT' elif maj == 5: release = '2000' else: if not release: # E.g. Win3.1 with win32s release = '%i.%i' % (maj,min) return release,version,csd,ptype # Open the registry key try: keyCurVer = RegOpenKeyEx(HKEY_LOCAL_MACHINE,regkey) # Get a value to make sure the key exists... RegQueryValueEx(keyCurVer,'SystemRoot') except: return release,version,csd,ptype # Parse values #subversion = _win32_getvalue(keyCurVer, # 'SubVersionNumber', # ('',1))[0] #if subversion: # release = release + subversion # 95a, 95b, etc. build = _win32_getvalue(keyCurVer, 'CurrentBuildNumber', ('',1))[0] ptype = _win32_getvalue(keyCurVer, 'CurrentType', (ptype,1))[0] # Normalize version version = _norm_version(version,build) # Close key RegCloseKey(keyCurVer) return release,version,csd,ptype
47c2ab6b5446b22daa592c70cb9fc29d27e1c503 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/47c2ab6b5446b22daa592c70cb9fc29d27e1c503/platform.py
d = new.code(3, 3, 3, 3, codestr, (), (), (), "<string>", "<name>", 1, "", (), ())
def f(a): pass c = f.func_code argcount = c.co_argcount nlocals = c.co_nlocals stacksize = c.co_stacksize flags = c.co_flags codestring = c.co_code constants = c.co_consts names = c.co_names varnames = c.co_varnames filename = c.co_filename name = c.co_name firstlineno = c.co_firstlineno lnotab = c.co_lnotab freevars = c.co_freevars cellvars = c.co_cellvars d = new.code(argcount, nlocals, stacksize, flags, codestring, constants, names, varnames, filename, name, firstlineno, lnotab, freevars, cellvars)
def test_closure(func, closure, exc): try: new.function(func.func_code, {}, "", None, closure) except exc: pass else: print "corrupt closure accepted"
609346273903cd848d055b046ec46d9cc831b750 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/609346273903cd848d055b046ec46d9cc831b750/test_new.py
d = new.code(3, 3, 3, 3, codestr, (), (), (), "<string>", "<name>", 1, "")
d = new.code(argcount, nlocals, stacksize, flags, codestring, constants, names, varnames, filename, name, firstlineno, lnotab) try: d = new.code(-argcount, nlocals, stacksize, flags, codestring, constants, names, varnames, filename, name, firstlineno, lnotab) except ValueError: pass else: raise TestFailed, "negative co_argcount didn't trigger an exception" try: d = new.code(argcount, -nlocals, stacksize, flags, codestring, constants, names, varnames, filename, name, firstlineno, lnotab) except ValueError: pass else: raise TestFailed, "negative co_nlocals didn't trigger an exception" try: d = new.code(argcount, nlocals, stacksize, flags, codestring, constants, (5,), varnames, filename, name, firstlineno, lnotab) except TypeError: pass else: raise TestFailed, "non-string co_name didn't trigger an exception" class S(str): pass t = (S("ab"),) d = new.code(argcount, nlocals, stacksize, flags, codestring, constants, t, varnames, filename, name, firstlineno, lnotab) verify(type(t[0]) is S, "eek, tuple changed under us!")
def test_closure(func, closure, exc): try: new.function(func.func_code, {}, "", None, closure) except exc: pass else: print "corrupt closure accepted"
609346273903cd848d055b046ec46d9cc831b750 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/609346273903cd848d055b046ec46d9cc831b750/test_new.py
if self.__at_start:
data = rawdata[i:j] if self.__at_start and space.match(data) is None:
def goahead(self, end): rawdata = self.rawdata i = 0 n = len(rawdata) while i < n: if i > 0: self.__at_start = 0 if self.nomoretags: data = rawdata[i:n] self.handle_data(data) self.lineno = self.lineno + string.count(data, '\n') i = n break res = interesting.search(rawdata, i) if res: j = res.start(0) else: j = n if i < j: if self.__at_start: self.syntax_error('illegal data at start of file') self.__at_start = 0 data = rawdata[i:j] if not self.stack and space.match(data) is None: self.syntax_error('data not in content') if illegal.search(data): self.syntax_error('illegal character in content') self.handle_data(data) self.lineno = self.lineno + string.count(data, '\n') i = j if i == n: break if rawdata[i] == '<': if starttagopen.match(rawdata, i): if self.literal: data = rawdata[i] self.handle_data(data) self.lineno = self.lineno + string.count(data, '\n') i = i+1 continue k = self.parse_starttag(i) if k < 0: break self.__seen_starttag = 1 self.lineno = self.lineno + string.count(rawdata[i:k], '\n') i = k continue if endtagopen.match(rawdata, i): k = self.parse_endtag(i) if k < 0: break self.lineno = self.lineno + string.count(rawdata[i:k], '\n') i = k continue if commentopen.match(rawdata, i): if self.literal: data = rawdata[i] self.handle_data(data) self.lineno = self.lineno + string.count(data, '\n') i = i+1 continue k = self.parse_comment(i) if k < 0: break self.lineno = self.lineno + string.count(rawdata[i:k], '\n') i = k continue if cdataopen.match(rawdata, i): k = self.parse_cdata(i) if k < 0: break self.lineno = self.lineno + string.count(rawdata[i:i], '\n') i = k continue res = xmldecl.match(rawdata, i) if res: if not self.__at_start: self.syntax_error("<?xml?> declaration not at start of document") version, encoding, standalone = res.group('version', 'encoding', 'standalone') if version[1:-1] != '1.0': raise RuntimeError, 'only XML version 1.0 supported' if encoding: encoding = encoding[1:-1] if standalone: standalone = standalone[1:-1] self.handle_xml(encoding, standalone) i = res.end(0) continue res = procopen.match(rawdata, i) if res: k = self.parse_proc(i) if k < 0: break self.lineno = self.lineno + string.count(rawdata[i:k], '\n') i = k continue res = doctype.match(rawdata, i) if res: if self.literal: data = rawdata[i] self.handle_data(data) self.lineno = self.lineno + string.count(data, '\n') i = i+1 continue if self.__seen_doctype: self.syntax_error('multiple DOCTYPE elements') if self.__seen_starttag: self.syntax_error('DOCTYPE not at beginning of document') k = self.parse_doctype(res) if k < 0: break self.__seen_doctype = res.group('name') self.lineno = self.lineno + string.count(rawdata[i:k], '\n') i = k continue elif rawdata[i] == '&': if self.literal: data = rawdata[i] self.handle_data(data) i = i+1 continue res = charref.match(rawdata, i) if res is not None: i = res.end(0) if rawdata[i-1] != ';': self.syntax_error("`;' missing in charref") i = i-1 if not self.stack: self.syntax_error('data not in content') self.handle_charref(res.group('char')[:-1]) self.lineno = self.lineno + string.count(res.group(0), '\n') continue res = entityref.match(rawdata, i) if res is not None: i = res.end(0) if rawdata[i-1] != ';': self.syntax_error("`;' missing in entityref") i = i-1 name = res.group('name') if self.entitydefs.has_key(name): self.rawdata = rawdata = rawdata[:res.start(0)] + self.entitydefs[name] + rawdata[i:] n = len(rawdata) i = res.start(0) else: self.syntax_error('reference to unknown entity') self.unknown_entityref(name) self.lineno = self.lineno + string.count(res.group(0), '\n') continue elif rawdata[i] == ']': if self.literal: data = rawdata[i] self.handle_data(data) i = i+1 continue if n-i < 3: break if cdataclose.match(rawdata, i): self.syntax_error("bogus `]]>'") self.handle_data(rawdata[i]) i = i+1 continue else: raise RuntimeError, 'neither < nor & ??' # We get here only if incomplete matches but # nothing else break # end while if i > 0: self.__at_start = 0 if end and i < n: data = rawdata[i] self.syntax_error("bogus `%s'" % data) if illegal.search(data): self.syntax_error('illegal character in content') self.handle_data(data) self.lineno = self.lineno + string.count(data, '\n') self.rawdata = rawdata[i+1:] return self.goahead(end) self.rawdata = rawdata[i:] if end: if not self.__seen_starttag: self.syntax_error('no elements in file') if self.stack: self.syntax_error('missing end tags') while self.stack: self.finish_endtag(self.stack[-1][0])
91c8f5901b806331105be9193411b28278d6517d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/91c8f5901b806331105be9193411b28278d6517d/xmllib.py
data = rawdata[i:j]
def goahead(self, end): rawdata = self.rawdata i = 0 n = len(rawdata) while i < n: if i > 0: self.__at_start = 0 if self.nomoretags: data = rawdata[i:n] self.handle_data(data) self.lineno = self.lineno + string.count(data, '\n') i = n break res = interesting.search(rawdata, i) if res: j = res.start(0) else: j = n if i < j: if self.__at_start: self.syntax_error('illegal data at start of file') self.__at_start = 0 data = rawdata[i:j] if not self.stack and space.match(data) is None: self.syntax_error('data not in content') if illegal.search(data): self.syntax_error('illegal character in content') self.handle_data(data) self.lineno = self.lineno + string.count(data, '\n') i = j if i == n: break if rawdata[i] == '<': if starttagopen.match(rawdata, i): if self.literal: data = rawdata[i] self.handle_data(data) self.lineno = self.lineno + string.count(data, '\n') i = i+1 continue k = self.parse_starttag(i) if k < 0: break self.__seen_starttag = 1 self.lineno = self.lineno + string.count(rawdata[i:k], '\n') i = k continue if endtagopen.match(rawdata, i): k = self.parse_endtag(i) if k < 0: break self.lineno = self.lineno + string.count(rawdata[i:k], '\n') i = k continue if commentopen.match(rawdata, i): if self.literal: data = rawdata[i] self.handle_data(data) self.lineno = self.lineno + string.count(data, '\n') i = i+1 continue k = self.parse_comment(i) if k < 0: break self.lineno = self.lineno + string.count(rawdata[i:k], '\n') i = k continue if cdataopen.match(rawdata, i): k = self.parse_cdata(i) if k < 0: break self.lineno = self.lineno + string.count(rawdata[i:i], '\n') i = k continue res = xmldecl.match(rawdata, i) if res: if not self.__at_start: self.syntax_error("<?xml?> declaration not at start of document") version, encoding, standalone = res.group('version', 'encoding', 'standalone') if version[1:-1] != '1.0': raise RuntimeError, 'only XML version 1.0 supported' if encoding: encoding = encoding[1:-1] if standalone: standalone = standalone[1:-1] self.handle_xml(encoding, standalone) i = res.end(0) continue res = procopen.match(rawdata, i) if res: k = self.parse_proc(i) if k < 0: break self.lineno = self.lineno + string.count(rawdata[i:k], '\n') i = k continue res = doctype.match(rawdata, i) if res: if self.literal: data = rawdata[i] self.handle_data(data) self.lineno = self.lineno + string.count(data, '\n') i = i+1 continue if self.__seen_doctype: self.syntax_error('multiple DOCTYPE elements') if self.__seen_starttag: self.syntax_error('DOCTYPE not at beginning of document') k = self.parse_doctype(res) if k < 0: break self.__seen_doctype = res.group('name') self.lineno = self.lineno + string.count(rawdata[i:k], '\n') i = k continue elif rawdata[i] == '&': if self.literal: data = rawdata[i] self.handle_data(data) i = i+1 continue res = charref.match(rawdata, i) if res is not None: i = res.end(0) if rawdata[i-1] != ';': self.syntax_error("`;' missing in charref") i = i-1 if not self.stack: self.syntax_error('data not in content') self.handle_charref(res.group('char')[:-1]) self.lineno = self.lineno + string.count(res.group(0), '\n') continue res = entityref.match(rawdata, i) if res is not None: i = res.end(0) if rawdata[i-1] != ';': self.syntax_error("`;' missing in entityref") i = i-1 name = res.group('name') if self.entitydefs.has_key(name): self.rawdata = rawdata = rawdata[:res.start(0)] + self.entitydefs[name] + rawdata[i:] n = len(rawdata) i = res.start(0) else: self.syntax_error('reference to unknown entity') self.unknown_entityref(name) self.lineno = self.lineno + string.count(res.group(0), '\n') continue elif rawdata[i] == ']': if self.literal: data = rawdata[i] self.handle_data(data) i = i+1 continue if n-i < 3: break if cdataclose.match(rawdata, i): self.syntax_error("bogus `]]>'") self.handle_data(rawdata[i]) i = i+1 continue else: raise RuntimeError, 'neither < nor & ??' # We get here only if incomplete matches but # nothing else break # end while if i > 0: self.__at_start = 0 if end and i < n: data = rawdata[i] self.syntax_error("bogus `%s'" % data) if illegal.search(data): self.syntax_error('illegal character in content') self.handle_data(data) self.lineno = self.lineno + string.count(data, '\n') self.rawdata = rawdata[i+1:] return self.goahead(end) self.rawdata = rawdata[i:] if end: if not self.__seen_starttag: self.syntax_error('no elements in file') if self.stack: self.syntax_error('missing end tags') while self.stack: self.finish_endtag(self.stack[-1][0])
91c8f5901b806331105be9193411b28278d6517d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/91c8f5901b806331105be9193411b28278d6517d/xmllib.py
res = qname.match(tagname)
if self.__use_namespaces: res = qname.match(tagname) else: res = None
def parse_starttag(self, i): rawdata = self.rawdata # i points to start of tag end = endbracketfind.match(rawdata, i+1) if end is None: return -1 tag = starttagmatch.match(rawdata, i) if tag is None or tag.end(0) != end.end(0): self.syntax_error('garbage in starttag') return end.end(0) nstag = tagname = tag.group('tagname') if not self.__seen_starttag and self.__seen_doctype and \ tagname != self.__seen_doctype: self.syntax_error('starttag does not match DOCTYPE') if self.__seen_starttag and not self.stack: self.syntax_error('multiple elements on top level') k, j = tag.span('attrs') attrdict, nsdict, k = self.parse_attributes(tagname, k, j) self.stack.append((tagname, nsdict, nstag)) res = qname.match(tagname) if res is not None: prefix, nstag = res.group('prefix', 'local') if prefix is None: prefix = '' ns = None for t, d, nst in self.stack: if d.has_key(prefix): ns = d[prefix] if ns is None and prefix != '': ns = self.__namespaces.get(prefix) if ns is not None: nstag = ns + ' ' + nstag elif prefix != '': nstag = prefix + ':' + nstag # undo split self.stack[-1] = tagname, nsdict, nstag # translate namespace of attributes nattrdict = {} for key, val in attrdict.items(): res = qname.match(key) if res is not None: aprefix, key = res.group('prefix', 'local') if aprefix is None: aprefix = '' ans = None for t, d, nst in self.stack: if d.has_key(aprefix): ans = d[aprefix] if ans is None and aprefix != '': ans = self.__namespaces.get(aprefix) if ans is not None: key = ans + ' ' + key elif aprefix != '': key = aprefix + ':' + key elif ns is not None: key = ns + ' ' + key nattrdict[key] = val attrdict = nattrdict attributes = self.attributes.get(nstag) if attributes is not None: for key in attrdict.keys(): if not attributes.has_key(key): self.syntax_error("unknown attribute `%s' in tag `%s'" % (key, tagname)) for key, val in attributes.items(): if val is not None and not attrdict.has_key(key): attrdict[key] = val method = self.elements.get(nstag, (None, None))[0] self.finish_starttag(nstag, attrdict, method) if tag.group('slash') == '/': self.finish_endtag(tagname) return tag.end(0)
91c8f5901b806331105be9193411b28278d6517d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/91c8f5901b806331105be9193411b28278d6517d/xmllib.py
nattrdict = {} for key, val in attrdict.items(): res = qname.match(key) if res is not None: aprefix, key = res.group('prefix', 'local') if aprefix is None: aprefix = '' ans = None for t, d, nst in self.stack: if d.has_key(aprefix): ans = d[aprefix] if ans is None and aprefix != '': ans = self.__namespaces.get(aprefix) if ans is not None: key = ans + ' ' + key elif aprefix != '': key = aprefix + ':' + key elif ns is not None: key = ns + ' ' + key nattrdict[key] = val attrdict = nattrdict
if self.__use_namespaces: nattrdict = {} for key, val in attrdict.items(): res = qname.match(key) if res is not None: aprefix, key = res.group('prefix', 'local') if aprefix is None: aprefix = '' ans = None for t, d, nst in self.stack: if d.has_key(aprefix): ans = d[aprefix] if ans is None and aprefix != '': ans = self.__namespaces.get(aprefix) if ans is not None: key = ans + ' ' + key elif aprefix != '': key = aprefix + ':' + key elif ns is not None: key = ns + ' ' + key nattrdict[key] = val attrdict = nattrdict
def parse_starttag(self, i): rawdata = self.rawdata # i points to start of tag end = endbracketfind.match(rawdata, i+1) if end is None: return -1 tag = starttagmatch.match(rawdata, i) if tag is None or tag.end(0) != end.end(0): self.syntax_error('garbage in starttag') return end.end(0) nstag = tagname = tag.group('tagname') if not self.__seen_starttag and self.__seen_doctype and \ tagname != self.__seen_doctype: self.syntax_error('starttag does not match DOCTYPE') if self.__seen_starttag and not self.stack: self.syntax_error('multiple elements on top level') k, j = tag.span('attrs') attrdict, nsdict, k = self.parse_attributes(tagname, k, j) self.stack.append((tagname, nsdict, nstag)) res = qname.match(tagname) if res is not None: prefix, nstag = res.group('prefix', 'local') if prefix is None: prefix = '' ns = None for t, d, nst in self.stack: if d.has_key(prefix): ns = d[prefix] if ns is None and prefix != '': ns = self.__namespaces.get(prefix) if ns is not None: nstag = ns + ' ' + nstag elif prefix != '': nstag = prefix + ':' + nstag # undo split self.stack[-1] = tagname, nsdict, nstag # translate namespace of attributes nattrdict = {} for key, val in attrdict.items(): res = qname.match(key) if res is not None: aprefix, key = res.group('prefix', 'local') if aprefix is None: aprefix = '' ans = None for t, d, nst in self.stack: if d.has_key(aprefix): ans = d[aprefix] if ans is None and aprefix != '': ans = self.__namespaces.get(aprefix) if ans is not None: key = ans + ' ' + key elif aprefix != '': key = aprefix + ':' + key elif ns is not None: key = ns + ' ' + key nattrdict[key] = val attrdict = nattrdict attributes = self.attributes.get(nstag) if attributes is not None: for key in attrdict.keys(): if not attributes.has_key(key): self.syntax_error("unknown attribute `%s' in tag `%s'" % (key, tagname)) for key, val in attributes.items(): if val is not None and not attrdict.has_key(key): attrdict[key] = val method = self.elements.get(nstag, (None, None))[0] self.finish_starttag(nstag, attrdict, method) if tag.group('slash') == '/': self.finish_endtag(tagname) return tag.end(0)
91c8f5901b806331105be9193411b28278d6517d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/91c8f5901b806331105be9193411b28278d6517d/xmllib.py
if high_bits == 0 or high_bits == -1:
if high_bits == 0 or high_bits == -1:
def save_int(self, object, pack=struct.pack): if self.bin: # If the int is small enough to fit in a signed 4-byte 2's-comp # format, we can store it more efficiently than the general # case. # First one- and two-byte unsigned ints: if object >= 0: if object <= 0xff: self.write(BININT1 + chr(object)) return if object <= 0xffff: self.write(BININT2 + chr(object&0xff) + chr(object>>8)) return # Next check for 4-byte signed ints: high_bits = object >> 31 # note that Python shift sign-extends if high_bits == 0 or high_bits == -1: # All high bits are copies of bit 2**31, so the value # fits in a 4-byte signed int. self.write(BININT + pack("<i", object)) return # Text pickle, or int too big to fit in signed 4-byte format. self.write(INT + `object` + '\n')
d95c2df3a92dcabc5ffad48e15962fe9ff93a4d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d95c2df3a92dcabc5ffad48e15962fe9ff93a4d0/pickle.py
self.__buf = ''
self.__buf = _StringIO()
def reset(self): self.__buf = ''
c47016ee74fdd765bdad0f890c810518501de22a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c47016ee74fdd765bdad0f890c810518501de22a/xdrlib.py
return self.__buf
return self.__buf.getvalue()
def get_buffer(self): return self.__buf
c47016ee74fdd765bdad0f890c810518501de22a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c47016ee74fdd765bdad0f890c810518501de22a/xdrlib.py
self.__buf = self.__buf + struct.pack('>L', x)
self.__buf.write(struct.pack('>L', x))
def pack_uint(self, x): self.__buf = self.__buf + struct.pack('>L', x)
c47016ee74fdd765bdad0f890c810518501de22a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c47016ee74fdd765bdad0f890c810518501de22a/xdrlib.py
if x: self.__buf = self.__buf + '\0\0\0\1' else: self.__buf = self.__buf + '\0\0\0\0'
if x: self.__buf.write('\0\0\0\1') else: self.__buf.write('\0\0\0\0')
def pack_bool(self, x): if x: self.__buf = self.__buf + '\0\0\0\1' else: self.__buf = self.__buf + '\0\0\0\0'
c47016ee74fdd765bdad0f890c810518501de22a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c47016ee74fdd765bdad0f890c810518501de22a/xdrlib.py