rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
return self.__class__(fp, self._mangle_from_, self.__maxheaderlen) | return self.__class__(fp, self._mangle_from_, self._maxheaderlen) | def clone(self, fp): """Clone this generator with the exact same options.""" return self.__class__(fp, self._mangle_from_, self.__maxheaderlen) | 06f820621b37df5c977e2d2239c494cb51a805fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/06f820621b37df5c977e2d2239c494cb51a805fb/Generator.py |
if self.__maxheaderlen == 0: | if self._maxheaderlen == 0: | def _write_headers(self, msg): for h, v in msg.items(): print >> self._fp, '%s:' % h, if self.__maxheaderlen == 0: # Explicit no-wrapping print >> self._fp, v elif isinstance(v, Header): # Header instances know what to do print >> self._fp, v.encode() elif _is8bitstring(v): # If we have raw 8bit data in a byte string, we have no idea # what the encoding is. There is no safe way to split this # string. If it's ascii-subset, then we could do a normal # ascii split, but if it's multibyte then we could break the # string. There's no way to know so the least harm seems to # be to not split the string and risk it being too long. print >> self._fp, v else: # Header's got lots of smarts, so use it. print >> self._fp, Header( v, maxlinelen=self.__maxheaderlen, header_name=h, continuation_ws='\t').encode() # A blank line always separates headers from body print >> self._fp | 06f820621b37df5c977e2d2239c494cb51a805fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/06f820621b37df5c977e2d2239c494cb51a805fb/Generator.py |
v, maxlinelen=self.__maxheaderlen, | v, maxlinelen=self._maxheaderlen, | def _write_headers(self, msg): for h, v in msg.items(): print >> self._fp, '%s:' % h, if self.__maxheaderlen == 0: # Explicit no-wrapping print >> self._fp, v elif isinstance(v, Header): # Header instances know what to do print >> self._fp, v.encode() elif _is8bitstring(v): # If we have raw 8bit data in a byte string, we have no idea # what the encoding is. There is no safe way to split this # string. If it's ascii-subset, then we could do a normal # ascii split, but if it's multibyte then we could break the # string. There's no way to know so the least harm seems to # be to not split the string and risk it being too long. print >> self._fp, v else: # Header's got lots of smarts, so use it. print >> self._fp, Header( v, maxlinelen=self.__maxheaderlen, header_name=h, continuation_ws='\t').encode() # A blank line always separates headers from body print >> self._fp | 06f820621b37df5c977e2d2239c494cb51a805fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/06f820621b37df5c977e2d2239c494cb51a805fb/Generator.py |
if not _isstring(payload): | if not isinstance(payload, basestring): | def _handle_text(self, msg): payload = msg.get_payload() if payload is None: return cset = msg.get_charset() if cset is not None: payload = cset.body_encode(payload) if not _isstring(payload): raise TypeError, 'string payload expected: %s' % type(payload) if self._mangle_from_: payload = fcre.sub('>From ', payload) self._fp.write(payload) | 06f820621b37df5c977e2d2239c494cb51a805fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/06f820621b37df5c977e2d2239c494cb51a805fb/Generator.py |
boundary = msg.get_boundary(failobj=_make_boundary()) print >> self._fp, '--' + boundary print >> self._fp, '\n' print >> self._fp, '--' + boundary + '--' return elif _isstring(subparts): | subparts = [] elif isinstance(subparts, basestring): | def _handle_multipart(self, msg): # The trick here is to write out each part separately, merge them all # together, and then make sure that the boundary we've chosen isn't # present in the payload. msgtexts = [] subparts = msg.get_payload() if subparts is None: # Nothing has ever been attached boundary = msg.get_boundary(failobj=_make_boundary()) print >> self._fp, '--' + boundary print >> self._fp, '\n' print >> self._fp, '--' + boundary + '--' return elif _isstring(subparts): # e.g. a non-strict parse of a message with no starting boundary. self._fp.write(subparts) return elif not isinstance(subparts, ListType): # Scalar payload subparts = [subparts] for part in subparts: s = StringIO() g = self.clone(s) g.flatten(part, unixfrom=False) msgtexts.append(s.getvalue()) # Now make sure the boundary we've selected doesn't appear in any of # the message texts. alltext = NL.join(msgtexts) # BAW: What about boundaries that are wrapped in double-quotes? boundary = msg.get_boundary(failobj=_make_boundary(alltext)) # If we had to calculate a new boundary because the body text # contained that string, set the new boundary. We don't do it # unconditionally because, while set_boundary() preserves order, it # doesn't preserve newlines/continuations in headers. This is no big # deal in practice, but turns out to be inconvenient for the unittest # suite. if msg.get_boundary() <> boundary: msg.set_boundary(boundary) # Write out any preamble if msg.preamble is not None: self._fp.write(msg.preamble) # If preamble is the empty string, the length of the split will be # 1, but the last element will be the empty string. If it's # anything else but does not end in a line separator, the length # will be > 1 and not end in an empty string. We need to # guarantee a newline after the preamble, but don't add too many. plines = NLCRE.split(msg.preamble) if plines <> [''] and plines[-1] <> '': self._fp.write('\n') # First boundary is a bit different; it doesn't have a leading extra # newline. print >> self._fp, '--' + boundary # Join and write the individual parts joiner = '\n--' + boundary + '\n' self._fp.write(joiner.join(msgtexts)) print >> self._fp, '\n--' + boundary + '--', # Write out any epilogue if msg.epilogue is not None: if not msg.epilogue.startswith('\n'): print >> self._fp self._fp.write(msg.epilogue) | 06f820621b37df5c977e2d2239c494cb51a805fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/06f820621b37df5c977e2d2239c494cb51a805fb/Generator.py |
elif not isinstance(subparts, ListType): | elif not isinstance(subparts, list): | def _handle_multipart(self, msg): # The trick here is to write out each part separately, merge them all # together, and then make sure that the boundary we've chosen isn't # present in the payload. msgtexts = [] subparts = msg.get_payload() if subparts is None: # Nothing has ever been attached boundary = msg.get_boundary(failobj=_make_boundary()) print >> self._fp, '--' + boundary print >> self._fp, '\n' print >> self._fp, '--' + boundary + '--' return elif _isstring(subparts): # e.g. a non-strict parse of a message with no starting boundary. self._fp.write(subparts) return elif not isinstance(subparts, ListType): # Scalar payload subparts = [subparts] for part in subparts: s = StringIO() g = self.clone(s) g.flatten(part, unixfrom=False) msgtexts.append(s.getvalue()) # Now make sure the boundary we've selected doesn't appear in any of # the message texts. alltext = NL.join(msgtexts) # BAW: What about boundaries that are wrapped in double-quotes? boundary = msg.get_boundary(failobj=_make_boundary(alltext)) # If we had to calculate a new boundary because the body text # contained that string, set the new boundary. We don't do it # unconditionally because, while set_boundary() preserves order, it # doesn't preserve newlines/continuations in headers. This is no big # deal in practice, but turns out to be inconvenient for the unittest # suite. if msg.get_boundary() <> boundary: msg.set_boundary(boundary) # Write out any preamble if msg.preamble is not None: self._fp.write(msg.preamble) # If preamble is the empty string, the length of the split will be # 1, but the last element will be the empty string. If it's # anything else but does not end in a line separator, the length # will be > 1 and not end in an empty string. We need to # guarantee a newline after the preamble, but don't add too many. plines = NLCRE.split(msg.preamble) if plines <> [''] and plines[-1] <> '': self._fp.write('\n') # First boundary is a bit different; it doesn't have a leading extra # newline. print >> self._fp, '--' + boundary # Join and write the individual parts joiner = '\n--' + boundary + '\n' self._fp.write(joiner.join(msgtexts)) print >> self._fp, '\n--' + boundary + '--', # Write out any epilogue if msg.epilogue is not None: if not msg.epilogue.startswith('\n'): print >> self._fp self._fp.write(msg.epilogue) | 06f820621b37df5c977e2d2239c494cb51a805fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/06f820621b37df5c977e2d2239c494cb51a805fb/Generator.py |
def _handle_multipart(self, msg): # The trick here is to write out each part separately, merge them all # together, and then make sure that the boundary we've chosen isn't # present in the payload. msgtexts = [] subparts = msg.get_payload() if subparts is None: # Nothing has ever been attached boundary = msg.get_boundary(failobj=_make_boundary()) print >> self._fp, '--' + boundary print >> self._fp, '\n' print >> self._fp, '--' + boundary + '--' return elif _isstring(subparts): # e.g. a non-strict parse of a message with no starting boundary. self._fp.write(subparts) return elif not isinstance(subparts, ListType): # Scalar payload subparts = [subparts] for part in subparts: s = StringIO() g = self.clone(s) g.flatten(part, unixfrom=False) msgtexts.append(s.getvalue()) # Now make sure the boundary we've selected doesn't appear in any of # the message texts. alltext = NL.join(msgtexts) # BAW: What about boundaries that are wrapped in double-quotes? boundary = msg.get_boundary(failobj=_make_boundary(alltext)) # If we had to calculate a new boundary because the body text # contained that string, set the new boundary. We don't do it # unconditionally because, while set_boundary() preserves order, it # doesn't preserve newlines/continuations in headers. This is no big # deal in practice, but turns out to be inconvenient for the unittest # suite. if msg.get_boundary() <> boundary: msg.set_boundary(boundary) # Write out any preamble if msg.preamble is not None: self._fp.write(msg.preamble) # If preamble is the empty string, the length of the split will be # 1, but the last element will be the empty string. If it's # anything else but does not end in a line separator, the length # will be > 1 and not end in an empty string. We need to # guarantee a newline after the preamble, but don't add too many. plines = NLCRE.split(msg.preamble) if plines <> [''] and plines[-1] <> '': self._fp.write('\n') # First boundary is a bit different; it doesn't have a leading extra # newline. print >> self._fp, '--' + boundary # Join and write the individual parts joiner = '\n--' + boundary + '\n' self._fp.write(joiner.join(msgtexts)) print >> self._fp, '\n--' + boundary + '--', # Write out any epilogue if msg.epilogue is not None: if not msg.epilogue.startswith('\n'): print >> self._fp self._fp.write(msg.epilogue) | 06f820621b37df5c977e2d2239c494cb51a805fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/06f820621b37df5c977e2d2239c494cb51a805fb/Generator.py |
||
self._fp.write(msg.preamble) plines = NLCRE.split(msg.preamble) if plines <> [''] and plines[-1] <> '': self._fp.write('\n') | print >> self._fp, msg.preamble | def _handle_multipart(self, msg): # The trick here is to write out each part separately, merge them all # together, and then make sure that the boundary we've chosen isn't # present in the payload. msgtexts = [] subparts = msg.get_payload() if subparts is None: # Nothing has ever been attached boundary = msg.get_boundary(failobj=_make_boundary()) print >> self._fp, '--' + boundary print >> self._fp, '\n' print >> self._fp, '--' + boundary + '--' return elif _isstring(subparts): # e.g. a non-strict parse of a message with no starting boundary. self._fp.write(subparts) return elif not isinstance(subparts, ListType): # Scalar payload subparts = [subparts] for part in subparts: s = StringIO() g = self.clone(s) g.flatten(part, unixfrom=False) msgtexts.append(s.getvalue()) # Now make sure the boundary we've selected doesn't appear in any of # the message texts. alltext = NL.join(msgtexts) # BAW: What about boundaries that are wrapped in double-quotes? boundary = msg.get_boundary(failobj=_make_boundary(alltext)) # If we had to calculate a new boundary because the body text # contained that string, set the new boundary. We don't do it # unconditionally because, while set_boundary() preserves order, it # doesn't preserve newlines/continuations in headers. This is no big # deal in practice, but turns out to be inconvenient for the unittest # suite. if msg.get_boundary() <> boundary: msg.set_boundary(boundary) # Write out any preamble if msg.preamble is not None: self._fp.write(msg.preamble) # If preamble is the empty string, the length of the split will be # 1, but the last element will be the empty string. If it's # anything else but does not end in a line separator, the length # will be > 1 and not end in an empty string. We need to # guarantee a newline after the preamble, but don't add too many. plines = NLCRE.split(msg.preamble) if plines <> [''] and plines[-1] <> '': self._fp.write('\n') # First boundary is a bit different; it doesn't have a leading extra # newline. print >> self._fp, '--' + boundary # Join and write the individual parts joiner = '\n--' + boundary + '\n' self._fp.write(joiner.join(msgtexts)) print >> self._fp, '\n--' + boundary + '--', # Write out any epilogue if msg.epilogue is not None: if not msg.epilogue.startswith('\n'): print >> self._fp self._fp.write(msg.epilogue) | 06f820621b37df5c977e2d2239c494cb51a805fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/06f820621b37df5c977e2d2239c494cb51a805fb/Generator.py |
joiner = '\n--' + boundary + '\n' self._fp.write(joiner.join(msgtexts)) print >> self._fp, '\n--' + boundary + '--', | if msgtexts: self._fp.write(msgtexts.pop(0)) for body_part in msgtexts: print >> self._fp, '\n--' + boundary self._fp.write(body_part) self._fp.write('\n--' + boundary + '--') | def _handle_multipart(self, msg): # The trick here is to write out each part separately, merge them all # together, and then make sure that the boundary we've chosen isn't # present in the payload. msgtexts = [] subparts = msg.get_payload() if subparts is None: # Nothing has ever been attached boundary = msg.get_boundary(failobj=_make_boundary()) print >> self._fp, '--' + boundary print >> self._fp, '\n' print >> self._fp, '--' + boundary + '--' return elif _isstring(subparts): # e.g. a non-strict parse of a message with no starting boundary. self._fp.write(subparts) return elif not isinstance(subparts, ListType): # Scalar payload subparts = [subparts] for part in subparts: s = StringIO() g = self.clone(s) g.flatten(part, unixfrom=False) msgtexts.append(s.getvalue()) # Now make sure the boundary we've selected doesn't appear in any of # the message texts. alltext = NL.join(msgtexts) # BAW: What about boundaries that are wrapped in double-quotes? boundary = msg.get_boundary(failobj=_make_boundary(alltext)) # If we had to calculate a new boundary because the body text # contained that string, set the new boundary. We don't do it # unconditionally because, while set_boundary() preserves order, it # doesn't preserve newlines/continuations in headers. This is no big # deal in practice, but turns out to be inconvenient for the unittest # suite. if msg.get_boundary() <> boundary: msg.set_boundary(boundary) # Write out any preamble if msg.preamble is not None: self._fp.write(msg.preamble) # If preamble is the empty string, the length of the split will be # 1, but the last element will be the empty string. If it's # anything else but does not end in a line separator, the length # will be > 1 and not end in an empty string. We need to # guarantee a newline after the preamble, but don't add too many. plines = NLCRE.split(msg.preamble) if plines <> [''] and plines[-1] <> '': self._fp.write('\n') # First boundary is a bit different; it doesn't have a leading extra # newline. print >> self._fp, '--' + boundary # Join and write the individual parts joiner = '\n--' + boundary + '\n' self._fp.write(joiner.join(msgtexts)) print >> self._fp, '\n--' + boundary + '--', # Write out any epilogue if msg.epilogue is not None: if not msg.epilogue.startswith('\n'): print >> self._fp self._fp.write(msg.epilogue) | 06f820621b37df5c977e2d2239c494cb51a805fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/06f820621b37df5c977e2d2239c494cb51a805fb/Generator.py |
if not msg.epilogue.startswith('\n'): print >> self._fp | print >> self._fp | def _handle_multipart(self, msg): # The trick here is to write out each part separately, merge them all # together, and then make sure that the boundary we've chosen isn't # present in the payload. msgtexts = [] subparts = msg.get_payload() if subparts is None: # Nothing has ever been attached boundary = msg.get_boundary(failobj=_make_boundary()) print >> self._fp, '--' + boundary print >> self._fp, '\n' print >> self._fp, '--' + boundary + '--' return elif _isstring(subparts): # e.g. a non-strict parse of a message with no starting boundary. self._fp.write(subparts) return elif not isinstance(subparts, ListType): # Scalar payload subparts = [subparts] for part in subparts: s = StringIO() g = self.clone(s) g.flatten(part, unixfrom=False) msgtexts.append(s.getvalue()) # Now make sure the boundary we've selected doesn't appear in any of # the message texts. alltext = NL.join(msgtexts) # BAW: What about boundaries that are wrapped in double-quotes? boundary = msg.get_boundary(failobj=_make_boundary(alltext)) # If we had to calculate a new boundary because the body text # contained that string, set the new boundary. We don't do it # unconditionally because, while set_boundary() preserves order, it # doesn't preserve newlines/continuations in headers. This is no big # deal in practice, but turns out to be inconvenient for the unittest # suite. if msg.get_boundary() <> boundary: msg.set_boundary(boundary) # Write out any preamble if msg.preamble is not None: self._fp.write(msg.preamble) # If preamble is the empty string, the length of the split will be # 1, but the last element will be the empty string. If it's # anything else but does not end in a line separator, the length # will be > 1 and not end in an empty string. We need to # guarantee a newline after the preamble, but don't add too many. plines = NLCRE.split(msg.preamble) if plines <> [''] and plines[-1] <> '': self._fp.write('\n') # First boundary is a bit different; it doesn't have a leading extra # newline. print >> self._fp, '--' + boundary # Join and write the individual parts joiner = '\n--' + boundary + '\n' self._fp.write(joiner.join(msgtexts)) print >> self._fp, '\n--' + boundary + '--', # Write out any epilogue if msg.epilogue is not None: if not msg.epilogue.startswith('\n'): print >> self._fp self._fp.write(msg.epilogue) | 06f820621b37df5c977e2d2239c494cb51a805fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/06f820621b37df5c977e2d2239c494cb51a805fb/Generator.py |
SyntaxError: assignment to generator expression not possible (<doctest test.test_genexps.__test__.doctests[38]>, line 1) | SyntaxError: assignment to generator expression not possible (<doctest test.test_genexps.__test__.doctests[40]>, line 1) | >>> def f(n): | 64aa3f6b7ac9f6feb8f5c61628f4c28d2ec1db55 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/64aa3f6b7ac9f6feb8f5c61628f4c28d2ec1db55/test_genexps.py |
SyntaxError: augmented assignment to generator expression not possible (<doctest test.test_genexps.__test__.doctests[39]>, line 1) | SyntaxError: augmented assignment to generator expression not possible (<doctest test.test_genexps.__test__.doctests[41]>, line 1) | >>> def f(n): | 64aa3f6b7ac9f6feb8f5c61628f4c28d2ec1db55 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/64aa3f6b7ac9f6feb8f5c61628f4c28d2ec1db55/test_genexps.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)) | 4c050690ad8a3836d6dce7d2537baf642aaf4a33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4c050690ad8a3836d6dce7d2537baf642aaf4a33/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) | 4c050690ad8a3836d6dce7d2537baf642aaf4a33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4c050690ad8a3836d6dce7d2537baf642aaf4a33/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) | 4c050690ad8a3836d6dce7d2537baf642aaf4a33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4c050690ad8a3836d6dce7d2537baf642aaf4a33/Wlists.py |
if hasattr(os, 'utime'): past = time.time() - 3 os.utime(testfile, (past, past)) else: time.sleep(3) | def test(): raise ValueError""" # if this test runs fast, test_bug737473.py will have same mtime # even if it's rewrited and it'll not reloaded. so adjust mtime # of original to past. if hasattr(os, 'utime'): past = time.time() - 3 os.utime(testfile, (past, past)) else: time.sleep(3) if 'test_bug737473' in sys.modules: del sys.modules['test_bug737473'] import test_bug737473 try: test_bug737473.test() except ValueError: # this loads source code to linecache traceback.extract_tb(sys.exc_traceback) print >> open(testfile, 'w'), """\ | f5a6514fe91d5f4f48407b59076e14507d602efd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f5a6514fe91d5f4f48407b59076e14507d602efd/test_traceback.py |
|
def select_scheme (self, name): | c26ed4f8cb365c67d01418d1db22c3a2b0695c26 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c26ed4f8cb365c67d01418d1db22c3a2b0695c26/install.py |
||
vars = { 'base': self.install_base, 'platbase': self.install_platbase, 'py_version_short': sys.version[0:3], } | def select_scheme (self, name): | c26ed4f8cb365c67d01418d1db22c3a2b0695c26 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c26ed4f8cb365c67d01418d1db22c3a2b0695c26/install.py |
|
val = subst_vars (scheme[key], vars) setattr (self, 'install_' + key, val) | setattr (self, 'install_' + key, scheme[key]) def _expand_attrs (self, attrs): for attr in attrs: val = getattr (self, attr) if val is not None: if os.name == 'posix': val = os.path.expanduser (val) val = subst_vars (val, self.config_vars) setattr (self, attr, val) def expand_basedirs (self): self._expand_attrs (['install_base', 'install_platbase']) | def select_scheme (self, name): | c26ed4f8cb365c67d01418d1db22c3a2b0695c26 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c26ed4f8cb365c67d01418d1db22c3a2b0695c26/install.py |
for att in ('base', 'platbase', 'purelib', 'platlib', 'lib', 'scripts', 'data'): fullname = "install_" + att val = getattr (self, fullname) if val is not None: setattr (self, fullname, os.path.expandvars (os.path.expanduser (val))) | self._expand_attrs (['install_purelib', 'install_platlib', 'install_lib', 'install_scripts', 'install_data',]) | def expand_dirs (self): | c26ed4f8cb365c67d01418d1db22c3a2b0695c26 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c26ed4f8cb365c67d01418d1db22c3a2b0695c26/install.py |
return HEAD % self.variables | s = HEAD % self.variables if self.uplink: if self.uptitle: link = ('<link rel="up" href="%s" title="%s">' % (self.uplink, self.uptitle)) else: link = '<link rel="up" href="%s">' % self.uplink repl = " %s\n</head>" % link s = s.replace("</head>", repl, 1) return s | def get_header(self): return HEAD % self.variables | 854571920ca6b3cd231b01e414c42a8c04cdd6b0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/854571920ca6b3cd231b01e414c42a8c04cdd6b0/support.py |
df.Creator, df.Type, df.Flags = sf.Creator, sf.Type, sf.Flags | df.Creator, df.Type = sf.Creator, sf.Type df.Flags = (sf.Flags & (kIsStationary|kNameLocked|kHasBundle|kIsInvisible|kIsAlias)) | def copy(src, dst, createpath=0): """Copy a file, including finder info, resource fork, etc""" if createpath: mkdirs(os.path.split(dst)[0]) srcfss = macfs.FSSpec(src) dstfss = macfs.FSSpec(dst) ifp = open(srcfss.as_pathname(), 'rb') ofp = open(dstfss.as_pathname(), 'wb') d = ifp.read(BUFSIZ) while d: ofp.write(d) d = ifp.read(BUFSIZ) ifp.close() ofp.close() ifp = open(srcfss.as_pathname(), '*rb') ofp = open(dstfss.as_pathname(), '*wb') d = ifp.read(BUFSIZ) while d: ofp.write(d) d = ifp.read(BUFSIZ) ifp.close() ofp.close() sf = srcfss.GetFInfo() df = dstfss.GetFInfo() df.Creator, df.Type, df.Flags = sf.Creator, sf.Type, sf.Flags dstfss.SetFInfo(df) | 2c2508a565cc00d416e77ab23b23a182bdbd5408 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2c2508a565cc00d416e77ab23b23a182bdbd5408/macostools.py |
return PyShellEditorWindow.close(self) | return OutputWindow.close(self) | def close(self): # Extend base class method if self.executing: # XXX Need to ask a question here if not tkMessageBox.askokcancel( "Kill?", "The program is still running; do you want to kill it?", default="ok", master=self.text): return "cancel" self.canceled = 1 if self.reading: self.top.quit() return "cancel" return PyShellEditorWindow.close(self) | 969035ff7419582fe7ddefff1f15d6d4dd196eaa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/969035ff7419582fe7ddefff1f15d6d4dd196eaa/PyShell.py |
def detect_modules(self): # Ensure that /usr/local is always used if '/usr/local/lib' not in self.compiler.library_dirs: self.compiler.library_dirs.append('/usr/local/lib') if '/usr/local/include' not in self.compiler.include_dirs: self.compiler.include_dirs.append( '/usr/local/include' ) | e68beaba58ff38af3754217b7259dab97f54b11e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e68beaba58ff38af3754217b7259dab97f54b11e/setup.py |
||
def detect_modules(self): # Ensure that /usr/local is always used if '/usr/local/lib' not in self.compiler.library_dirs: self.compiler.library_dirs.append('/usr/local/lib') if '/usr/local/include' not in self.compiler.include_dirs: self.compiler.include_dirs.append( '/usr/local/include' ) | e68beaba58ff38af3754217b7259dab97f54b11e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e68beaba58ff38af3754217b7259dab97f54b11e/setup.py |
||
self.do_disassembly_test(bug1333982, dis_bug1333982) | if __debug__: self.do_disassembly_test(bug1333982, dis_bug1333982) | def test_bug_1333982(self): self.do_disassembly_test(bug1333982, dis_bug1333982) | 8c4e307e3aaf8f3052ccc12c9f2e4e40da48ba5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8c4e307e3aaf8f3052ccc12c9f2e4e40da48ba5d/test_dis.py |
def set_get_returns_none(self, *args, **kwargs): return apply(self._cobj.set_get_returns_none, args, kwargs) | def set_get_returns_none(self, *args, **kwargs): return apply(self._cobj.set_get_returns_none, args, kwargs) | 49988654714b0c143ea8943c963cea00d0b5935e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/49988654714b0c143ea8943c963cea00d0b5935e/dbobj.py |
|
except ImportError: | termios.tcgetattr, termios.tcsetattr except (ImportError, AttributeError): | def getuser(): """Get the username from the environment or password database. First try various environment variables, then the password database. This works on Windows as long as USERNAME is set. """ import os for name in ('LOGNAME', 'USER', 'LNAME', 'USERNAME'): user = os.environ.get(name) if user: return user # If this fails, the exception will "explain" why import pwd return pwd.getpwuid(os.getuid())[0] | 5b4308fd7d9ada404cf094ede3c5ba738481b3fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5b4308fd7d9ada404cf094ede3c5ba738481b3fc/getpass.py |
self.top.wm_deiconify() self.top.tkraise() | def close(self): self.top.wm_deiconify() self.top.tkraise() reply = self.maybesave() if reply != "cancel": self._close() return reply | 9c6592a7befa142e14ee1e9d5ffb6cca84087b71 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9c6592a7befa142e14ee1e9d5ffb6cca84087b71/EditorWindow.py |
|
if self.will_close: | if self.length is None: | def read(self, amt=None): if self.fp is None: return '' | 1aeda7dab5fd87b6a19e60d70c7e99c2acf1b53f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1aeda7dab5fd87b6a19e60d70c7e99c2acf1b53f/httplib.py |
self.length -= amt | def read(self, amt=None): if self.fp is None: return '' | 1aeda7dab5fd87b6a19e60d70c7e99c2acf1b53f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1aeda7dab5fd87b6a19e60d70c7e99c2acf1b53f/httplib.py |
|
def get(self, key, default): | def get(self, key, default=None): | def get(self, key, default): try: ref = self.data[key] except KeyError: return default else: o = ref() if o is None: # This should only happen return default else: return o | 25dc69d4b911fb7ef0928a9447fbe878404e7af4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/25dc69d4b911fb7ef0928a9447fbe878404e7af4/weakref.py |
L.append(key, ref(o, remove)) | L.append((key, ref(o, remove))) | def remove(o, data=d, key=key): del data[key] | 25dc69d4b911fb7ef0928a9447fbe878404e7af4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/25dc69d4b911fb7ef0928a9447fbe878404e7af4/weakref.py |
def get(self, key, default): | def get(self, key, default=None): | def get(self, key, default): return self.data.get(ref(key),default) | 25dc69d4b911fb7ef0928a9447fbe878404e7af4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/25dc69d4b911fb7ef0928a9447fbe878404e7af4/weakref.py |
L.append(ref(key, self._remove), value) | L.append((ref(key, self._remove), value)) | def update(self, dict): d = self.data L = [] for key, value in dict.items(): L.append(ref(key, self._remove), value) for key, r in L: d[key] = r | 25dc69d4b911fb7ef0928a9447fbe878404e7af4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/25dc69d4b911fb7ef0928a9447fbe878404e7af4/weakref.py |
def getfileinfo(name): | def getfileinfo(name): | def FInfo(): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
fp = open(name, '*rb') | fp = openrf(name, '*rb') | def getfileinfo(name): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
def openrsrc(name, *mode): if mode: mode = mode[0] | def openrsrc(name, *mode): if not mode: mode = '*rb' | def getfileinfo(name): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
mode = 'rb' mode = '*' + mode return open(name, mode) | mode = '*' + mode[0] return openrf(name, mode) | def openrsrc(name, *mode): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
import regsub class FInfo: | import regsub class FInfo: | def openrsrc(name, *mode): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
self.Type = '????' self.Creator = '????' self.Flags = 0 def getfileinfo(name): | self.Type = '????' self.Creator = '????' self.Flags = 0 def getfileinfo(name): | def __init__(self): self.Type = '????' self.Creator = '????' self.Flags = 0 | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
if not c in string.whitespace and (c<' ' or ord(c) > 0177): break | if not c in string.whitespace and (c<' ' or ord(c) > 0177): break | def getfileinfo(name): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
finfo.Type = 'TEXT' | finfo.Type = 'TEXT' | def getfileinfo(name): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
class openrsrc: | class openrsrc: | def getfileinfo(name): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
pass | pass | def __init__(self, *args): pass | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
return '' | return '' | def read(self, *args): return '' | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
pass | pass | def close(self): pass | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
"""Write data to the coder in 3-byte chunks""" def __init__(self, ofp): | """Write data to the coder in 3-byte chunks""" def __init__(self, ofp): | def close(self): pass | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
def write(self, data): | self.hqxdata = '' self.linelen = LINELEN-1 def write(self, data): | def __init__(self, ofp): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
while len(self.data) > LINELEN: hqxdata = binascii.b2a_hqx(self.data[:LINELEN]) self.ofp.write(hqxdata+'\n') self.data = self.data[LINELEN:] def close(self): | datalen = len(self.data) todo = (datalen/3)*3 data = self.data[:todo] self.data = self.data[todo:] self.hqxdata = self.hqxdata + binascii.b2a_hqx(data) while len(self.hqxdata) > self.linelen: self.ofp.write(self.hqxdata[:self.linelen]+'\n') self.hqxdata = self.hqxdata[self.linelen:] self.linelen = LINELEN def close(self): | def write(self, data): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
self.ofp.write(binascii.b2a_hqx(self.data)) | self.hqxdata = self.hqxdata + binascii.b2a_hqx(self.data) while self.hqxdata: self.ofp.write(self.hqxdata[:self.linelen]) self.hqxdata = self.hqxdata[self.linelen:] self.linelen = LINELEN | def close(self): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
"""Write data to the RLE-coder in suitably large chunks""" def __init__(self, ofp): | """Write data to the RLE-coder in suitably large chunks""" def __init__(self, ofp): | def close(self): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
def write(self, data): if DEBUG: testf.write(data) | def write(self, data): | def write(self, data): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
return | return | def write(self, data): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
def close(self): | def close(self): | def close(self): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
rledata = binascii.rlecode_hqx(self.data) self.ofp.write(rledata) | rledata = binascii.rlecode_hqx(self.data) self.ofp.write(rledata) | def close(self): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
def __init__(self, (name, finfo, dlen, rlen), ofp): if type(ofp) == type(''): ofname = ofp ofp = open(ofname, 'w') if os.name == 'mac': fss = macfs.FSSpec(ofname) fss.SetCreatorType('BnHq', 'TEXT') ofp.write('(This file may be decompressed with BinHex 4.0)\n\n:') | def __init__(self, (name, finfo, dlen, rlen), ofp): if type(ofp) == type(''): ofname = ofp ofp = open(ofname, 'w') if os.name == 'mac': fss = macfs.FSSpec(ofname) fss.SetCreatorType('BnHq', 'TEXT') ofp.write('(This file must be converted with BinHex 4.0)\n\n:') | def __init__(self, (name, finfo, dlen, rlen), ofp): if type(ofp) == type(''): ofname = ofp ofp = open(ofname, 'w') if os.name == 'mac': fss = macfs.FSSpec(ofname) fss.SetCreatorType('BnHq', 'TEXT') | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
finfo = FInfo() | finfo = FInfo() | def __init__(self, (name, finfo, dlen, rlen), ofp): if type(ofp) == type(''): ofname = ofp ofp = open(ofname, 'w') if os.name == 'mac': fss = macfs.FSSpec(ofname) fss.SetCreatorType('BnHq', 'TEXT') | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
def _writeinfo(self, name, finfo): if DEBUG: print 'binhex info:', name, finfo.Type, finfo.Creator, self.dlen, self.rlen | def _writeinfo(self, name, finfo): | def _writeinfo(self, name, finfo): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
raise Error, 'Filename too long' | raise Error, 'Filename too long' | def _writeinfo(self, name, finfo): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
def _write(self, data): | def _write(self, data): | def _write(self, data): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
def _writecrc(self): | def _writecrc(self): | def _writecrc(self): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
def write(self, data): | def write(self, data): | def write(self, data): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
raise Error, 'Writing data at the wrong time' | raise Error, 'Writing data at the wrong time' | def write(self, data): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
def close_data(self): | def close_data(self): | def close_data(self): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
raise Error, 'Incorrect data size, diff='+`self.rlen` | raise Error, 'Incorrect data size, diff='+`self.rlen` | def close_data(self): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
def write_rsrc(self, data): | def write_rsrc(self, data): | def write_rsrc(self, data): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
self.close_data() | self.close_data() | def write_rsrc(self, data): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
raise Error, 'Writing resource data at the wrong time' | raise Error, 'Writing resource data at the wrong time' | def write_rsrc(self, data): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
def close(self): | def close(self): | def close(self): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
self.close_data() | self.close_data() | def close(self): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
raise Error, 'Close at the wrong time' | raise Error, 'Close at the wrong time' | def close(self): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
raise Error, "Incorrect resource-datasize, diff="+`self.rlen` | raise Error, "Incorrect resource-datasize, diff="+`self.rlen` | def close(self): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
d = ifp.read() ofp.write(d) | while 1: d = ifp.read(128000) if not d: break ofp.write(d) | def binhex(inp, out): """(infilename, outfilename) - Create binhex-encoded copy of a file""" finfo = getfileinfo(inp) ofp = BinHex(finfo, out) ifp = open(inp, 'rb') # XXXX Do textfile translation on non-mac systems d = ifp.read() ofp.write(d) ofp.close_data() ifp.close() ifp = openrsrc(inp, 'rb') d = ifp.read() ofp.write_rsrc(d) ofp.close() ifp.close() | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
d = ifp.read() ofp.write_rsrc(d) | while 1: d = ifp.read(128000) if not d: break ofp.write_rsrc(d) | def binhex(inp, out): """(infilename, outfilename) - Create binhex-encoded copy of a file""" finfo = getfileinfo(inp) ofp = BinHex(finfo, out) ifp = open(inp, 'rb') # XXXX Do textfile translation on non-mac systems d = ifp.read() ofp.write(d) ofp.close_data() ifp.close() ifp = openrsrc(inp, 'rb') d = ifp.read() ofp.write_rsrc(d) ofp.close() ifp.close() | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
ifp.close() | ifp.close() | def binhex(inp, out): """(infilename, outfilename) - Create binhex-encoded copy of a file""" finfo = getfileinfo(inp) ofp = BinHex(finfo, out) ifp = open(inp, 'rb') # XXXX Do textfile translation on non-mac systems d = ifp.read() ofp.write(d) ofp.close_data() ifp.close() ifp = openrsrc(inp, 'rb') d = ifp.read() ofp.write_rsrc(d) ofp.close() ifp.close() | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
"""Read data via the decoder in 4-byte chunks""" def __init__(self, ifp): | """Read data via the decoder in 4-byte chunks""" def __init__(self, ifp): | def binhex(inp, out): """(infilename, outfilename) - Create binhex-encoded copy of a file""" finfo = getfileinfo(inp) ofp = BinHex(finfo, out) ifp = open(inp, 'rb') # XXXX Do textfile translation on non-mac systems d = ifp.read() ofp.write(d) ofp.close_data() ifp.close() ifp = openrsrc(inp, 'rb') d = ifp.read() ofp.write_rsrc(d) ofp.close() ifp.close() | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
def read(self, totalwtd): | def read(self, totalwtd): | def read(self, totalwtd): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
def close(self): | def close(self): | def close(self): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
"""Read data via the RLE-coder""" def __init__(self, ifp): | """Read data via the RLE-coder""" def __init__(self, ifp): | def close(self): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
def read(self, wtd): | def read(self, wtd): | def read(self, wtd): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
self._fill(wtd-len(self.post_buffer)) | self._fill(wtd-len(self.post_buffer)) | def read(self, wtd): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
print 'WTD', wtd, 'GOT', len(rv) | def read(self, wtd): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
|
def _fill(self, wtd): | def _fill(self, wtd): | def _fill(self, wtd): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
def close(self): | def close(self): | def close(self): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
def __init__(self, ifp): | def __init__(self, ifp): | def __init__(self, ifp): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
ifp = open(ifp) | ifp = open(ifp) | def __init__(self, ifp): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
if DEBUG: print 'SKIP:', ch+dummy | def __init__(self, ifp): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
|
def _read(self, len): | def _read(self, len): | def _read(self, len): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
def _checkcrc(self): | def _checkcrc(self): | def _checkcrc(self): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
if DEBUG: print 'DBG CRC %x %x'%(self.crc, filecrc) | def _checkcrc(self): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
|
def _readheader(self): | def _readheader(self): | def _readheader(self): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
if DEBUG: print 'DATA, RLEN', self.dlen, self.rlen | def _readheader(self): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
|
def read(self, *n): | def read(self, *n): | def read(self, *n): | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/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: | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/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: | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/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() | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/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() | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/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) | d9300e7ae7f704ad263013ec13346104b4bba7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9300e7ae7f704ad263013ec13346104b4bba7ba/binhex.py |
||
self.name = name | self.name = os.path.abspath(name) | def __init__(self, name=None, mode="r", fileobj=None): """Open an (uncompressed) tar archive `name'. `mode' is either 'r' to read from an existing archive, 'a' to append data to an existing file or 'w' to create a new file overwriting an existing one. `mode' defaults to 'r'. If `fileobj' is given, it is used for reading or writing data. If it can be determined, `mode' is overridden by `fileobj's mode. `fileobj' is not closed, when TarFile is closed. """ self.name = name | 70a24c339655d7f552a52c9eea55ff6f9c3fd5d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/70a24c339655d7f552a52c9eea55ff6f9c3fd5d5/tarfile.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.