rem stringlengths 1 322k | add stringlengths 0 2.05M | context stringlengths 4 228k | meta stringlengths 156 215 |
|---|---|---|---|
try: | for thisType in [int, long, float, complex]: | def seval(item): """ Strips parens from item prior to calling eval in an attempt to make it safer """ return eval(item.replace('(', '').replace(')', '')) | 5cf26e5184cafd0f87ad4cafc52ed5b635df0d4a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5cf26e5184cafd0f87ad4cafc52ed5b635df0d4a/csv.py |
thisType = type(seval(row[col])) except OverflowError: thisType = type(seval(row[col] + 'L')) thisType = type(0) except: | thisType(row[col]) break except ValueError, OverflowError: pass else: | def seval(item): """ Strips parens from item prior to calling eval in an attempt to make it safer """ return eval(item.replace('(', '').replace(')', '')) | 5cf26e5184cafd0f87ad4cafc52ed5b635df0d4a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5cf26e5184cafd0f87ad4cafc52ed5b635df0d4a/csv.py |
eval("%s(%s)" % (colType.__name__, header[col])) except: | colType(header[col]) except ValueError, TypeError: | def seval(item): """ Strips parens from item prior to calling eval in an attempt to make it safer """ return eval(item.replace('(', '').replace(')', '')) | 5cf26e5184cafd0f87ad4cafc52ed5b635df0d4a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5cf26e5184cafd0f87ad4cafc52ed5b635df0d4a/csv.py |
return s.split(NUL, 1)[0] | return s.rstrip(NUL) | def nts(s): """Convert a null-terminated string buffer to a python string. """ return s.split(NUL, 1)[0] | a74b881a4cd6de08399203b7b9fd0fb368fe774c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a74b881a4cd6de08399203b7b9fd0fb368fe774c/tarfile.py |
parts.append(value + (fieldsize - l) * NUL) | parts.append(value[:fieldsize] + (fieldsize - l) * NUL) | def tobuf(self): """Return a tar header block as a 512 byte string. """ name = self.name | a74b881a4cd6de08399203b7b9fd0fb368fe774c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a74b881a4cd6de08399203b7b9fd0fb368fe774c/tarfile.py |
self.chunks = [0] | 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 readin... | a74b881a4cd6de08399203b7b9fd0fb368fe774c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a74b881a4cd6de08399203b7b9fd0fb368fe774c/tarfile.py | |
self.members.append(tarinfo) self.membernames.append(tarinfo.name) self.chunks.append(self.offset) | self._record_member(tarinfo) | def addfile(self, tarinfo, fileobj=None): """Add the TarInfo object `tarinfo' to the archive. If `fileobj' is given, tarinfo.size bytes are read from it and added to the archive. You can create TarInfo objects using gettarinfo(). On Windows platforms, `fileobj' should always be opened with mode 'rb' to avoid irritation... | a74b881a4cd6de08399203b7b9fd0fb368fe774c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a74b881a4cd6de08399203b7b9fd0fb368fe774c/tarfile.py |
self.fileobj.seek(self.chunks[-1]) | self.fileobj.seek(self.offset) | def next(self): """Return the next member of the archive as a TarInfo object, when TarFile is opened for reading. Return None if there is no more available. """ self._check("ra") if self.firstmember is not None: m = self.firstmember self.firstmember = None return m | a74b881a4cd6de08399203b7b9fd0fb368fe774c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a74b881a4cd6de08399203b7b9fd0fb368fe774c/tarfile.py |
if self.chunks[-1] == 0: | if self.offset == 0: | def next(self): """Return the next member of the archive as a TarInfo object, when TarFile is opened for reading. Return None if there is no more available. """ self._check("ra") if self.firstmember is not None: m = self.firstmember self.firstmember = None return m | a74b881a4cd6de08399203b7b9fd0fb368fe774c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a74b881a4cd6de08399203b7b9fd0fb368fe774c/tarfile.py |
tarinfo = self.TYPE_METH[tarinfo.type](self, tarinfo) else: tarinfo.offset_data = self.offset if tarinfo.isreg() or tarinfo.type not in SUPPORTED_TYPES: self.offset += self._block(tarinfo.size) | return self.TYPE_METH[tarinfo.type](self, tarinfo) tarinfo.offset_data = self.offset if tarinfo.isreg() or tarinfo.type not in SUPPORTED_TYPES: self.offset += self._block(tarinfo.size) | def next(self): """Return the next member of the archive as a TarInfo object, when TarFile is opened for reading. Return None if there is no more available. """ self._check("ra") if self.firstmember is not None: m = self.firstmember self.firstmember = None return m | a74b881a4cd6de08399203b7b9fd0fb368fe774c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a74b881a4cd6de08399203b7b9fd0fb368fe774c/tarfile.py |
self.members.append(tarinfo) self.membernames.append(tarinfo.name) self.chunks.append(self.offset) | self._record_member(tarinfo) | def next(self): """Return the next member of the archive as a TarInfo object, when TarFile is opened for reading. Return None if there is no more available. """ self._check("ra") if self.firstmember is not None: m = self.firstmember self.firstmember = None return m | a74b881a4cd6de08399203b7b9fd0fb368fe774c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a74b881a4cd6de08399203b7b9fd0fb368fe774c/tarfile.py |
def next(self): """Return the next member of the archive as a TarInfo object, when TarFile is opened for reading. Return None if there is no more available. """ self._check("ra") if self.firstmember is not None: m = self.firstmember self.firstmember = None return m | a74b881a4cd6de08399203b7b9fd0fb368fe774c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a74b881a4cd6de08399203b7b9fd0fb368fe774c/tarfile.py | ||
name = nts(buf) if tarinfo.type == GNUTYPE_LONGLINK: linkname = nts(buf) buf = self.fileobj.read(BLOCKSIZE) tarinfo = TarInfo.frombuf(buf) tarinfo.offset = self.offset self.offset += BLOCKSIZE tarinfo.offset_data = self.offset tarinfo.name = name or tarinfo.name tarinfo.linkname = linkname or tarinfo.linkname if tar... | next.name = nts(buf) elif tarinfo.type == GNUTYPE_LONGLINK: next.linkname = nts(buf) return next | def proc_gnulong(self, tarinfo): """Evaluate the blocks that hold a GNU longname or longlink member. """ buf = "" name = None linkname = None count = tarinfo.size while count > 0: block = self.fileobj.read(BLOCKSIZE) buf += block self.offset += BLOCKSIZE count -= BLOCKSIZE | a74b881a4cd6de08399203b7b9fd0fb368fe774c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a74b881a4cd6de08399203b7b9fd0fb368fe774c/tarfile.py |
"""Yield submodule names+loaders recursively, for path or sys.path""" | """Yields (module_loader, name, ispkg) for all modules recursively on path, or, if path is None, all accessible modules. 'path' should be either None or a list of paths to look for modules in. 'prefix' is a string to output on the front of every module name on output. Note that this function must import all *package... | def walk_packages(path=None, prefix='', onerror=None): """Yield submodule names+loaders recursively, for path or sys.path""" def seen(p, m={}): if p in m: return True m[p] = True for importer, name, ispkg in iter_modules(path, prefix): yield importer, name, ispkg if ispkg: try: __import__(name) except ImportError: i... | 0c794a0bf1c69eb314aed94c3d45da6e72559fd7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0c794a0bf1c69eb314aed94c3d45da6e72559fd7/pkgutil.py |
onerror() | onerror(name) | def seen(p, m={}): if p in m: return True m[p] = True | 0c794a0bf1c69eb314aed94c3d45da6e72559fd7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0c794a0bf1c69eb314aed94c3d45da6e72559fd7/pkgutil.py |
for item in walk_packages(path, name+'.'): | for item in walk_packages(path, name+'.', onerror): | def seen(p, m={}): if p in m: return True m[p] = True | 0c794a0bf1c69eb314aed94c3d45da6e72559fd7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0c794a0bf1c69eb314aed94c3d45da6e72559fd7/pkgutil.py |
"""Yield submodule names+loaders for path or sys.path""" | """Yields (module_loader, name, ispkg) for all submodules on path, or, if path is None, all top-level modules on sys.path. 'path' should be either None or a list of paths to look for modules in. 'prefix' is a string to output on the front of every module name on output. """ | def iter_modules(path=None, prefix=''): """Yield submodule names+loaders for path or sys.path""" if path is None: importers = iter_importers() else: importers = map(get_importer, path) yielded = {} for i in importers: for name, ispkg in iter_importer_modules(i, prefix): if name not in yielded: yielded[name] = 1 yield ... | 0c794a0bf1c69eb314aed94c3d45da6e72559fd7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0c794a0bf1c69eb314aed94c3d45da6e72559fd7/pkgutil.py |
return self.fp.tell() - self.start | return self.fp.tell() - len(self.readahead) - self.start | def tell(self): if self.level > 0: return self.lastpos return self.fp.tell() - self.start | ab4ae4454020df9de19a9140e63a4e15d2ca3894 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ab4ae4454020df9de19a9140e63a4e15d2ca3894/multifile.py |
test_support.run_unittest( TrivialTests, OpenerDirectorTests, HandlerTests, MiscTests, ) | tests = (TrivialTests, OpenerDirectorTests, HandlerTests, MiscTests) if test_support.is_resource_enabled('network'): tests += (NetworkTests,) test_support.run_unittest(*tests) | def test_main(verbose=None): from test import test_sets test_support.run_unittest( TrivialTests, OpenerDirectorTests, HandlerTests, MiscTests, ) | 9c67491428947547268c4c7dda4519074204753d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9c67491428947547268c4c7dda4519074204753d/test_urllib2.py |
assert output_dir is not None | if output_dir is None: output_dir = '' | def object_filenames(self, source_filenames, strip_dir=0, output_dir=''): assert output_dir is not None obj_names = [] for src_name in source_filenames: base, ext = os.path.splitext(src_name) if ext not in self.src_extensions: raise UnknownFileError, \ "unknown file type '%s' (from '%s')" % (ext, src_name) if strip_dir... | 3c0ed8d236bba953a3dfeb5469a2a1cf4dc760a6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3c0ed8d236bba953a3dfeb5469a2a1cf4dc760a6/ccompiler.py |
ext_modules=[Extension('struct', ['structmodule.c'])], | ext_modules=[Extension('_struct', ['_struct.c'])], | def main(): # turn off warnings when deprecated modules are imported import warnings warnings.filterwarnings("ignore",category=DeprecationWarning) setup(# PyPI Metadata (PEP 301) name = "Python", version = sys.version.split()[0], url = "http://www.python.org/%s" % sys.version[:3], maintainer = "Guido van Rossum and the... | 90e097f9c40b9d045ade31d21a17bb553a15c9d4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/90e097f9c40b9d045ade31d21a17bb553a15c9d4/setup.py |
regexp=None, nocase=None, count=None): | regexp=None, nocase=None, count=None, elide=None): | def search(self, pattern, index, stopindex=None, forwards=None, backwards=None, exact=None, regexp=None, nocase=None, count=None): """Search PATTERN beginning from INDEX until STOPINDEX. Return the index of the first character of a match or an empty string.""" args = [self._w, 'search'] if forwards: args.append('-forwa... | f2f3cd8b7effa6d4a9a75890d721c02adf808fe0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f2f3cd8b7effa6d4a9a75890d721c02adf808fe0/Tkinter.py |
def checkSetMinor(self): | def test_checkSetMinor(self): | def checkSetMinor(self): au = MIMEAudio(self._audiodata, 'fish') self.assertEqual(im.get_type(), 'audio/fish') | 904c1d02e084eedcc12cee56bfca3579d050abf2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/904c1d02e084eedcc12cee56bfca3579d050abf2/test_email.py |
self.assertEqual(im.get_type(), 'audio/fish') | self.assertEqual(au.get_type(), 'audio/fish') | def checkSetMinor(self): au = MIMEAudio(self._audiodata, 'fish') self.assertEqual(im.get_type(), 'audio/fish') | 904c1d02e084eedcc12cee56bfca3579d050abf2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/904c1d02e084eedcc12cee56bfca3579d050abf2/test_email.py |
def checkSetMinor(self): | def test_checkSetMinor(self): | def checkSetMinor(self): im = MIMEImage(self._imgdata, 'fish') self.assertEqual(im.get_type(), 'image/fish') | 904c1d02e084eedcc12cee56bfca3579d050abf2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/904c1d02e084eedcc12cee56bfca3579d050abf2/test_email.py |
def redirect_request(self, req, fp, code, msg, headers): """Return a Request or None in response to a redirect. | ac6817c3c65ca5ef8a6c7c75fe2b53cf5f35344a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ac6817c3c65ca5ef8a6c7c75fe2b53cf5f35344a/urllib2.py | ||
if (code in (301, 302, 303, 307) and req.method() in ("GET", "HEAD") or code in (302, 303) and req.method() == "POST"): | if "location" in headers: newurl = headers["location"] elif "uri" in headers: newurl = headers["uri"] else: return newurl = urlparse.urljoin(req.get_full_url(), newurl) m = req.get_method() if (code in (301, 302, 303, 307) and m in ("GET", "HEAD") or code in (302, 303) and m == "POST"): | def redirect_request(self, req, fp, code, msg, headers): """Return a Request or None in response to a redirect. | ac6817c3c65ca5ef8a6c7c75fe2b53cf5f35344a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ac6817c3c65ca5ef8a6c7c75fe2b53cf5f35344a/urllib2.py |
try: h = http_class(host) if req.has_data(): data = req.get_data() h.putrequest('POST', req.get_selector()) if not 'Content-type' in req.headers: h.putheader('Content-type', 'application/x-www-form-urlencoded') if not 'Content-length' in req.headers: h.putheader('Content-length', '%d' % len(data)) else: h.putrequest('G... | h = http_class(host) if req.has_data(): data = req.get_data() h.putrequest('POST', req.get_selector()) if not 'Content-type' in req.headers: h.putheader('Content-type', 'application/x-www-form-urlencoded') if not 'Content-length' in req.headers: h.putheader('Content-length', '%d' % len(data)) else: h.putrequest('GET', ... | def do_open(self, http_class, req): host = req.get_host() if not host: raise URLError('no host given') | ac6817c3c65ca5ef8a6c7c75fe2b53cf5f35344a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ac6817c3c65ca5ef8a6c7c75fe2b53cf5f35344a/urllib2.py |
h.endheaders() | try: h.endheaders() except socket.error, err: raise URLError(err) | def do_open(self, http_class, req): host = req.get_host() if not host: raise URLError('no host given') | ac6817c3c65ca5ef8a6c7c75fe2b53cf5f35344a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ac6817c3c65ca5ef8a6c7c75fe2b53cf5f35344a/urllib2.py |
timestamp = 1000000000 utc = FixedOffset(0, "utc", 0) expected = datetime(2001, 9, 9, 1, 46, 40) got = datetime.utcfromtimestamp(timestamp) self.failUnless(abs(got - expected) < timedelta(minutes=1)) est = FixedOffset(-5*60, "est", 0) expected -= timedelta(hours=5) got = datetime.fromtimestamp(timestamp, est).replac... | timestamp = 1000000000 utcdatetime = datetime.utcfromtimestamp(timestamp) utcoffset = timedelta(hours=-15, minutes=39) tz = FixedOffset(utcoffset, "tz", 0) expected = utcdatetime + utcoffset got = datetime.fromtimestamp(timestamp, tz) self.assertEqual(expected, got.replace(tzinfo=None)) | def test_tzinfo_fromtimestamp(self): import time meth = self.theclass.fromtimestamp ts = time.time() # Ensure it doesn't require tzinfo (i.e., that this doesn't blow up). base = meth(ts) # Try with and without naming the keyword. off42 = FixedOffset(42, "42") another = meth(ts, off42) again = meth(ts, tz=off42) self.fa... | 36153d9d6e39233f15bf54c9d8c14f3c7c82df93 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/36153d9d6e39233f15bf54c9d8c14f3c7c82df93/test_datetime.py |
self._arrow = _canvas.create_line(x-dx,y+dy,x,y, | self._arrow = self._canvas.create_line(x-dx,y+dy,x,y, | def _draw_turtle(self,position=[]): if not self._tracing: return if position == []: position = self._position x,y = position distance = 8 dx = distance * cos(self._angle*self._invradian) dy = distance * sin(self._angle*self._invradian) self._delete_turtle() self._arrow = _canvas.create_line(x-dx,y+dy,x,y, width=self._w... | 7efadd55c31efe5a169943d66cef80ba98056ea0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7efadd55c31efe5a169943d66cef80ba98056ea0/turtle.py |
print 'DBG interaction' | def edit_applet(name): pref_handle = openpreffile(READ) app_handle = openapplet(name) notfound = '' l, sr = getprefpath(OVERRIDE_PATH_STRINGS_ID) if l == None: notfound = 'path' l, dummy = getprefpath(PATH_STRINGS_ID) if l == None: message('Cannot find any sys.path resource! (Old python?)') sys.exit(0) fss, dr, fss_... | de76f6cb606861769dfd55c64c6113e1068f193f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/de76f6cb606861769dfd55c64c6113e1068f193f/EditPythonPrefs.py | |
def _read(self, size=1024): if self.fileobj is None: raise EOFError, "Reached EOF" | db6b7a680bb447f5c6ea14edab0696d340732c70 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/db6b7a680bb447f5c6ea14edab0696d340732c70/gzip.py | ||
def readline(self): | def readline(self, size=-1): if size < 0: size = sys.maxint | def readline(self): bufs = [] readsize = 100 while 1: c = self.read(readsize) i = string.find(c, '\n') if i >= 0 or c == '': bufs.append(c[:i+1]) self._unread(c[i+1:]) return string.join(bufs, '') bufs.append(c) readsize = readsize * 2 | db6b7a680bb447f5c6ea14edab0696d340732c70 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/db6b7a680bb447f5c6ea14edab0696d340732c70/gzip.py |
readsize = 100 | orig_size = size readsize = min(100, size) | def readline(self): bufs = [] readsize = 100 while 1: c = self.read(readsize) i = string.find(c, '\n') if i >= 0 or c == '': bufs.append(c[:i+1]) self._unread(c[i+1:]) return string.join(bufs, '') bufs.append(c) readsize = readsize * 2 | db6b7a680bb447f5c6ea14edab0696d340732c70 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/db6b7a680bb447f5c6ea14edab0696d340732c70/gzip.py |
bufs.append(c[:i+1]) self._unread(c[i+1:]) return string.join(bufs, '') | bufs.append(c[:i+1]) self._unread(c[i+1:]) return string.join(bufs, '') | def readline(self): bufs = [] readsize = 100 while 1: c = self.read(readsize) i = string.find(c, '\n') if i >= 0 or c == '': bufs.append(c[:i+1]) self._unread(c[i+1:]) return string.join(bufs, '') bufs.append(c) readsize = readsize * 2 | db6b7a680bb447f5c6ea14edab0696d340732c70 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/db6b7a680bb447f5c6ea14edab0696d340732c70/gzip.py |
readsize = readsize * 2 def readlines(self, ignored=None): buf = self.read() lines = string.split(buf, '\n') for i in range(len(lines)-1): lines[i] = lines[i] + '\n' if lines and not lines[-1]: del lines[-1] return lines | size = size - len(c) readsize = min(size, readsize * 2) def readlines(self, sizehint=0): if sizehint <= 0: sizehint = sys.maxint L = [] while sizehint > 0: line = self.readline() if line == "": break L.append( line ) sizehint = sizehint - len(line) return L | def readline(self): bufs = [] readsize = 100 while 1: c = self.read(readsize) i = string.find(c, '\n') if i >= 0 or c == '': bufs.append(c[:i+1]) self._unread(c[i+1:]) return string.join(bufs, '') bufs.append(c) readsize = readsize * 2 | db6b7a680bb447f5c6ea14edab0696d340732c70 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/db6b7a680bb447f5c6ea14edab0696d340732c70/gzip.py |
retval = os.spawnl(os.P_WAIT, sys.executable, sys.executable, tester, v, fd) | if sys.platform in ('win32'): decorated = '"%s"' % sys.executable tester = '"%s"' % tester else: decorated = sys.executable retval = os.spawnl(os.P_WAIT, sys.executable, decorated, tester, v, fd) | def test_noinherit(self): # _mkstemp_inner file handles are not inherited by child processes if not has_spawnl: return # ugh, can't use TestSkipped. | 94f4b784a42fe9ac9ba58081ab733886848c976b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/94f4b784a42fe9ac9ba58081ab733886848c976b/test_tempfile.py |
def createMessage(self, dir): | def createMessage(self, dir, mbox=False): | def createMessage(self, dir): t = int(time.time() % 1000000) pid = self._counter self._counter += 1 filename = os.extsep.join((str(t), str(pid), "myhostname", "mydomain")) tmpname = os.path.join(self._dir, "tmp", filename) newname = os.path.join(self._dir, dir, filename) fp = open(tmpname, "w") self._msgfiles.append(tm... | 0137f49977b7885b2612af7b535b2dc7e15dc946 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0137f49977b7885b2612af7b535b2dc7e15dc946/test_mailbox.py |
t>>11, (t>>5)&0x3F, t&0x1F * 2 ) | t>>11, (t>>5)&0x3F, (t&0x1F) * 2 ) | def _GetContents(self): "Read in the table of contents for the zip file" fp = self.fp fp.seek(-22, 2) # Start of end-of-archive record filesize = fp.tell() + 22 # Get file size endrec = fp.read(22) # Archive must not end with a comment! if endrec[0:4] != stringEndArchive or endrec[-2:] != "\000\000": raise BadZipfile,... | 816c8922523c43fcc2e056ae33d4839ab177d09c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/816c8922523c43fcc2e056ae33d4839ab177d09c/zipfile.py |
def AS_TYPE_64BIT(as_): return \ | def AS_TYPE_64BIT(as): return \ | def AS_TYPE_64BIT(as_): return \ | d46994584fb6a7ccebbab184c589cf5476b30a44 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d46994584fb6a7ccebbab184c589cf5476b30a44/STROPTS.py |
if request.command in ('post', 'put'): | if request.command.lower() in ('post', 'put'): | def handle_request (self, request): [path, params, query, fragment] = request.split_uri() | 2f0b99704ba9383906c1e977e097c4be684f3eed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2f0b99704ba9383906c1e977e097c4be684f3eed/xmlrpc_handler.py |
def wait(self, timeout=None): self.__cond.acquire() if not self.__flag: self.__cond.wait(timeout) self.__cond.release() | 9aa768fae6f87cd7b6c65bbd6548ea779ce8732d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9aa768fae6f87cd7b6c65bbd6548ea779ce8732d/threading.py | ||
res[i] = '%%%02x' % ord(c) | res[i] = '%%%02X' % ord(c) | def _fast_quote(s): global _fast_safe if _fast_safe is None: _fast_safe = {} for c in _fast_safe_test: _fast_safe[c] = c res = list(s) for i in range(len(res)): c = res[i] if not _fast_safe.has_key(c): res[i] = '%%%02x' % ord(c) return ''.join(res) | b0446de497a682b7c63979906f548c3861022e95 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b0446de497a682b7c63979906f548c3861022e95/urllib.py |
res[i] = '%%%02x' % ord(c) | res[i] = '%%%02X' % ord(c) | def quote(s, safe = '/'): """quote('abc def') -> 'abc%20def' Each part of a URL, e.g. the path info, the query, etc., has a different set of reserved characters that must be quoted. RFC 2396 Uniform Resource Identifiers (URI): Generic Syntax lists the following reserved characters. reserved = ";" | "/" | "?" | ":... | b0446de497a682b7c63979906f548c3861022e95 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b0446de497a682b7c63979906f548c3861022e95/urllib.py |
else: p = "%s-ast.h" % mod.name f = open(p, "wb") print >> f, auto_gen_msg print >> f, ' c = ChainOfVisitors(TypeDefVisitor(f), StructVisitor(f), PrototypeVisitor(f), ) c.visit(mod) print >>f, "PyObject* PyAST_mod2obj(mod_ty t);" f.close() | f = open(p, "wb") print >> f, auto_gen_msg print >> f, ' c = ChainOfVisitors(TypeDefVisitor(f), StructVisitor(f), PrototypeVisitor(f), ) c.visit(mod) print >>f, "PyObject* PyAST_mod2obj(mod_ty t);" f.close() | def main(srcfile): argv0 = sys.argv[0] components = argv0.split(os.sep) argv0 = os.sep.join(components[-2:]) auto_gen_msg = '/* File automatically generated by %s */\n' % argv0 mod = asdl.parse(srcfile) if not asdl.check(mod): sys.exit(1) if INC_DIR: p = "%s/%s-ast.h" % (INC_DIR, mod.name) else: p = "%s-ast.h" % mod.na... | 107d08463a26492fd36ed134f09409a1547b0540 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/107d08463a26492fd36ed134f09409a1547b0540/asdl_c.py |
else: p = "%s-ast.c" % mod.name f = open(p, "wb") print >> f, auto_gen_msg print >> f, ' print >> f, ' print >> f print >>f, "static PyTypeObject* AST_type;" v = ChainOfVisitors( PyTypesDeclareVisitor(f), PyTypesVisitor(f), FunctionVisitor(f), ObjVisitor(f), ASTModuleVisitor(f), PartingShots(f), ) v.visit(mod) f.close(... | f = open(p, "wb") print >> f, auto_gen_msg print >> f, ' print >> f, ' print >> f print >>f, "static PyTypeObject* AST_type;" v = ChainOfVisitors( PyTypesDeclareVisitor(f), PyTypesVisitor(f), FunctionVisitor(f), ObjVisitor(f), ASTModuleVisitor(f), PartingShots(f), ) v.visit(mod) f.close() | def main(srcfile): argv0 = sys.argv[0] components = argv0.split(os.sep) argv0 = os.sep.join(components[-2:]) auto_gen_msg = '/* File automatically generated by %s */\n' % argv0 mod = asdl.parse(srcfile) if not asdl.check(mod): sys.exit(1) if INC_DIR: p = "%s/%s-ast.h" % (INC_DIR, mod.name) else: p = "%s-ast.h" % mod.na... | 107d08463a26492fd36ed134f09409a1547b0540 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/107d08463a26492fd36ed134f09409a1547b0540/asdl_c.py |
exts.append( Extension('ossaudiodev', ['ossaudiodev.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') | 497a84bc876f4170963c7b9a867b15f5b56338c3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/497a84bc876f4170963c7b9a867b15f5b56338c3/setup.py | |
if len(a) < len(b): a, b = b, a res = a[:] for i in range(len(b)): res[i] = res[i] - b[i] return normalize(res) | neg_b = map(lambda x: -x, b[:]) return plus(a, neg_b) | def minus(a, b): if len(a) < len(b): a, b = b, a # make sure a is the longest res = a[:] # make a copy for i in range(len(b)): res[i] = res[i] - b[i] return normalize(res) | ec0831f744ad5a2eb816d0d17e37c46c9c71c71a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ec0831f744ad5a2eb816d0d17e37c46c9c71c71a/poly.py |
if type (package) is StringType: path = string.split (package, '.') elif type (package) in (TupleType, ListType): path = list (package) else: raise TypeError, "'package' must be a string, list, or tuple" | path = string.split (package, '.') | def get_package_dir (self, package): """Return the directory, relative to the top of the source distribution, where package 'package' should be found (at least according to the 'package_dir' option, if any).""" | 3d9bb778ccc0824f7d97c06b70a7acdb7f51e70b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3d9bb778ccc0824f7d97c06b70a7acdb7f51e70b/build_py.py |
package = tuple (path[0:-1]) | package = string.join(path[0:-1], '.') | def find_modules (self): """Finds individually-specified Python modules, ie. those listed by module name in 'self.py_modules'. Returns a list of tuples (package, module_base, filename): 'package' is a tuple of the path through package-space to the module; 'module_base' is the bare (no packages, no dots) module name, a... | 3d9bb778ccc0824f7d97c06b70a7acdb7f51e70b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3d9bb778ccc0824f7d97c06b70a7acdb7f51e70b/build_py.py |
newurl = basejoin("http:" + url, newurl) | newurl = basejoin(self.type + ":" + url, newurl) | def redirect_internal(self, url, fp, errcode, errmsg, headers, data): if headers.has_key('location'): newurl = headers['location'] elif headers.has_key('uri'): newurl = headers['uri'] else: return void = fp.read() fp.close() # In case the server sent a relative URL, join with original: newurl = basejoin("http:" + url, ... | 729bdef1d05d468ff158ca3741762a42e6fb26b3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/729bdef1d05d468ff158ca3741762a42e6fb26b3/urllib.py |
if sys.argv[-1] == "Release": | if sys.argv[1] == "Release": | def main(): build_all = "-a" in sys.argv if sys.argv[-1] == "Release": arch = "x86" debug = False configure = "VC-WIN32" makefile = "32.mak" elif sys.argv[-1] == "Debug": arch = "x86" debug = True configure = "VC-WIN32" makefile="d32.mak" elif sys.argv[-1] == "ReleaseItanium": arch = "ia64" debug = False configure = "V... | 40128621657218c77c0b1ab6c79261f4d757a774 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/40128621657218c77c0b1ab6c79261f4d757a774/build_ssl.py |
elif sys.argv[-1] == "Debug": | elif sys.argv[1] == "Debug": | def main(): build_all = "-a" in sys.argv if sys.argv[-1] == "Release": arch = "x86" debug = False configure = "VC-WIN32" makefile = "32.mak" elif sys.argv[-1] == "Debug": arch = "x86" debug = True configure = "VC-WIN32" makefile="d32.mak" elif sys.argv[-1] == "ReleaseItanium": arch = "ia64" debug = False configure = "V... | 40128621657218c77c0b1ab6c79261f4d757a774 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/40128621657218c77c0b1ab6c79261f4d757a774/build_ssl.py |
elif sys.argv[-1] == "ReleaseItanium": | elif sys.argv[1] == "ReleaseItanium": | def main(): build_all = "-a" in sys.argv if sys.argv[-1] == "Release": arch = "x86" debug = False configure = "VC-WIN32" makefile = "32.mak" elif sys.argv[-1] == "Debug": arch = "x86" debug = True configure = "VC-WIN32" makefile="d32.mak" elif sys.argv[-1] == "ReleaseItanium": arch = "ia64" debug = False configure = "V... | 40128621657218c77c0b1ab6c79261f4d757a774 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/40128621657218c77c0b1ab6c79261f4d757a774/build_ssl.py |
elif sys.argv[-1] == "ReleaseAMD64": | elif sys.argv[1] == "ReleaseAMD64": | def main(): build_all = "-a" in sys.argv if sys.argv[-1] == "Release": arch = "x86" debug = False configure = "VC-WIN32" makefile = "32.mak" elif sys.argv[-1] == "Debug": arch = "x86" debug = True configure = "VC-WIN32" makefile="d32.mak" elif sys.argv[-1] == "ReleaseItanium": arch = "ia64" debug = False configure = "V... | 40128621657218c77c0b1ab6c79261f4d757a774 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/40128621657218c77c0b1ab6c79261f4d757a774/build_ssl.py |
self.plist.CFBundleExecutable = self.name | def setup(self): if self.mainprogram is None and self.executable is None: raise TypeError, ("must specify either or both of " "'executable' and 'mainprogram'") | 9ad693d92fd6efd9d232473808eabc0df23e0b8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9ad693d92fd6efd9d232473808eabc0df23e0b8c/bundlebuilder.py | |
try: fp = open(file) except: return None | fp = open(file) | def __init__(self, file=None): if not file: file = os.path.join(os.environ['HOME'], ".netrc") try: fp = open(file) except: return None self.hosts = {} self.macros = {} lexer = shlex.shlex(fp) | 94386c09a599b72a60117b78821688716b60139b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/94386c09a599b72a60117b78821688716b60139b/netrc.py |
emit(LOGHEADER, self.ui, os.environ, date=date, _file=tfn) | emit(LOGHEADER, self.ui, os.environ, date=date, _file=tf) | def commit(self, entry): file = entry.file # Normalize line endings in body if '\r' in self.ui.body: self.ui.body = re.sub('\r\n?', '\n', self.ui.body) # Normalize whitespace in title self.ui.title = ' '.join(self.ui.title.split()) # Check that there were any changes if self.ui.body == entry.body and self.ui.title == e... | 9ffc1d6c116ea48a64d97c9b25c1d352ee0b0094 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9ffc1d6c116ea48a64d97c9b25c1d352ee0b0094/faqwiz.py |
os.unlink(tfn) | os.unlink(tf.name) | def commit(self, entry): file = entry.file # Normalize line endings in body if '\r' in self.ui.body: self.ui.body = re.sub('\r\n?', '\n', self.ui.body) # Normalize whitespace in title self.ui.title = ' '.join(self.ui.title.split()) # Check that there were any changes if self.ui.body == entry.body and self.ui.title == e... | 9ffc1d6c116ea48a64d97c9b25c1d352ee0b0094 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9ffc1d6c116ea48a64d97c9b25c1d352ee0b0094/faqwiz.py |
traceback.print_exc() | traceback.print_exc(file=sys.stdout) | def runtest(hier, code): root = tempfile.mktemp() mkhier(root, hier) savepath = sys.path[:] codefile = tempfile.mktemp() f = open(codefile, "w") f.write(code) f.close() try: sys.path.insert(0, root) if verbose: print "sys.path =", sys.path try: execfile(codefile, globals(), {}) except: traceback.print_exc() finally: sy... | d259d86dd9f563d3b98ea8b4cbe9dc4ac70f51e3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d259d86dd9f563d3b98ea8b4cbe9dc4ac70f51e3/test_pkg.py |
("t1", [("t1", None)], "import ni"), | ("t1", [("t1", None)], "import t1"), | def runtest(hier, code): root = tempfile.mktemp() mkhier(root, hier) savepath = sys.path[:] codefile = tempfile.mktemp() f = open(codefile, "w") f.write(code) f.close() try: sys.path.insert(0, root) if verbose: print "sys.path =", sys.path try: execfile(codefile, globals(), {}) except: traceback.print_exc() finally: sy... | d259d86dd9f563d3b98ea8b4cbe9dc4ac70f51e3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d259d86dd9f563d3b98ea8b4cbe9dc4ac70f51e3/test_pkg.py |
test('replace', 'one!two!three!', 'one!two!three!', '!', '@', 0) | test('replace', 'one!two!three!', 'one@two@three@', '!', '@', 0) | def __getitem__(self, i): return self.seq[i] | 8c071f192bcaf45cb7f621baab2e5bc2d1b4f1e0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8c071f192bcaf45cb7f621baab2e5bc2d1b4f1e0/test_strop.py |
osname = string.lower(osname) | osname = string.lower(osname) osname = string.replace(osname, '/', '') | def get_platform (): """Return a string that identifies the current platform. This is used mainly to distinguish platform-specific build directories and platform-specific built distributions. Typically includes the OS name and version and the architecture (as supplied by 'os.uname()'), although the exact information ... | 1454626dff145ef9f655be82194558bb34327409 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1454626dff145ef9f655be82194558bb34327409/util.py |
if isinstance(fullurl, (types.StringType, types.UnicodeType)): | if isinstance(fullurl, types.StringTypes): | def open(self, fullurl, data=None): # accept a URL or a Request object if isinstance(fullurl, (types.StringType, types.UnicodeType)): req = Request(fullurl, data) else: req = fullurl if data is not None: req.add_data(data) assert isinstance(req, Request) # really only care about interface | 7cc432f73152ac06245ea869392b44fb88d4c2f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7cc432f73152ac06245ea869392b44fb88d4c2f8/urllib2.py |
if isinstance(uri, (types.StringType, types.UnicodeType)): | if isinstance(uri, types.StringTypes): | def add_password(self, realm, uri, user, passwd): # uri could be a single URI or a sequence if isinstance(uri, (types.StringType, types.UnicodeType)): uri = [uri] uri = tuple(map(self.reduce_uri, uri)) if not self.passwd.has_key(realm): self.passwd[realm] = {} self.passwd[realm][uri] = (user, passwd) | 7cc432f73152ac06245ea869392b44fb88d4c2f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7cc432f73152ac06245ea869392b44fb88d4c2f8/urllib2.py |
debian_tcl_include = ( '/usr/include/tcl' + version ) debian_tk_include = ( '/usr/include/tk' + version ) tcl_includes = find_file('tcl.h', inc_dirs, [debian_tcl_include] ) tk_includes = find_file('tk.h', inc_dirs, [debian_tk_include] ) | debian_tcl_include = [ '/usr/include/tcl' + version ] debian_tk_include = [ '/usr/include/tk' + version ] + debian_tcl_include tcl_includes = find_file('tcl.h', inc_dirs, debian_tcl_include) tk_includes = find_file('tk.h', inc_dirs, debian_tk_include) | def detect_tkinter(self, inc_dirs, lib_dirs): # The _tkinter module. # # The command for _tkinter is long and site specific. Please # uncomment and/or edit those parts as indicated. If you don't have a # specific extension (e.g. Tix or BLT), leave the corresponding line # commented out. (Leave the trailing backslash... | 0ddea030f955e4ee9c7f9a2e86065ab127e41833 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0ddea030f955e4ee9c7f9a2e86065ab127e41833/setup.py |
lexer.whitepace = ' \t' | lexer.whitespace = ' \t' | # Look for a machine, default, or macdef top-level keyword | dc3bebe91f60391266d4c5651032cfadf1964725 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/dc3bebe91f60391266d4c5651032cfadf1964725/netrc.py |
if not line or line == '\012' and tt == '\012': lexer.whitepace = ' \t\r\n' | if not line or line == '\012': lexer.whitespace = ' \t\r\n' | # Look for a machine, default, or macdef top-level keyword | dc3bebe91f60391266d4c5651032cfadf1964725 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/dc3bebe91f60391266d4c5651032cfadf1964725/netrc.py |
tt = line | # Look for a machine, default, or macdef top-level keyword | dc3bebe91f60391266d4c5651032cfadf1964725 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/dc3bebe91f60391266d4c5651032cfadf1964725/netrc.py | |
if toplevel == 'machine': login = account = password = None self.hosts[entryname] = {} | login = account = password = None self.hosts[entryname] = {} | # Look for a machine, default, or macdef top-level keyword | dc3bebe91f60391266d4c5651032cfadf1964725 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/dc3bebe91f60391266d4c5651032cfadf1964725/netrc.py |
if tt=='' or tt == 'machine' or tt == 'default' or tt == 'macdef': if toplevel == 'macdef': break elif login and password: | if (tt=='' or tt == 'machine' or tt == 'default' or tt =='macdef'): if login and password: | # Look for a machine, default, or macdef top-level keyword | dc3bebe91f60391266d4c5651032cfadf1964725 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/dc3bebe91f60391266d4c5651032cfadf1964725/netrc.py |
Assume y1 <= y2 and no funny (non-leap century) years.""" return (y2+3)/4 - (y1+3)/4 | Assume y1 <= y2.""" y1 -= 1 y2 -= 1 return (y2/4 - y1/4) - (y2/100 - y1/100) + (y2/400 - y1/400) | def leapdays(y1, y2): """Return number of leap years in range [y1, y2). Assume y1 <= y2 and no funny (non-leap century) years.""" return (y2+3)/4 - (y1+3)/4 | 48b8aa7e6b152d8b75c853dd164c3322a85afa63 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/48b8aa7e6b152d8b75c853dd164c3322a85afa63/calendar.py |
def test_basic_pty(): try: debug("Calling master_open()") master_fd, slave_name = pty.master_open() debug("Got master_fd '%d', slave_name '%s'"%(master_fd, slave_name)) debug("Calling slave_open(%r)"%(slave_name,)) slave_fd = pty.slave_open(slave_name) debug("Got slave_fd '%d'"%slave_fd) except OSError: # " An optional... | 70c47f9f59fde40322448090d8d59323175b7d85 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/70c47f9f59fde40322448090d8d59323175b7d85/test_pty.py | ||
sys.stdout.write(s1.replace("\r\n", "\n")) | sys.stdout.write(normalize_output(s1)) | def test_basic_pty(): try: debug("Calling master_open()") master_fd, slave_name = pty.master_open() debug("Got master_fd '%d', slave_name '%s'"%(master_fd, slave_name)) debug("Calling slave_open(%r)"%(slave_name,)) slave_fd = pty.slave_open(slave_name) debug("Got slave_fd '%d'"%slave_fd) except OSError: # " An optional... | 70c47f9f59fde40322448090d8d59323175b7d85 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/70c47f9f59fde40322448090d8d59323175b7d85/test_pty.py |
sys.stdout.write(s2.replace("\r\n", "\n")) | sys.stdout.write(normalize_output(s2)) | def test_basic_pty(): try: debug("Calling master_open()") master_fd, slave_name = pty.master_open() debug("Got master_fd '%d', slave_name '%s'"%(master_fd, slave_name)) debug("Calling slave_open(%r)"%(slave_name,)) slave_fd = pty.slave_open(slave_name) debug("Got slave_fd '%d'"%slave_fd) except OSError: # " An optional... | 70c47f9f59fde40322448090d8d59323175b7d85 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/70c47f9f59fde40322448090d8d59323175b7d85/test_pty.py |
compiler = self.compiler | def build_libraries (self, libraries): | 32ce1142bd0be81f26415db6d5f9205e8acac57d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/32ce1142bd0be81f26415db6d5f9205e8acac57d/build_clib.py | |
self.info = list(self.interesting_lines(1)) | self.info = [(0, -1, "", False)] | def __init__(self, editwin): self.editwin = editwin self.text = editwin.text self.textfont = self.text["font"] self.label = None # Dummy line, which starts the "block" of the whole document: self.info = list(self.interesting_lines(1)) self.lastfirstline = 1 visible = idleConf.GetOption("extensions", "CodeContext", "vis... | 98f9ff7223406f0c344f530e77fc866a67894c35 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/98f9ff7223406f0c344f530e77fc866a67894c35/CodeContext.py |
There is a dummy block start, with indentation -1 and text "". Return the indent level, text (including leading whitespace), and the block opening keyword. | def get_line_info(self, linenum): """Get the line indent value, text, and any block start keyword | 98f9ff7223406f0c344f530e77fc866a67894c35 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/98f9ff7223406f0c344f530e77fc866a67894c35/CodeContext.py | |
if linenum == 0: return -1, "", True | def get_line_info(self, linenum): """Get the line indent value, text, and any block start keyword | 98f9ff7223406f0c344f530e77fc866a67894c35 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/98f9ff7223406f0c344f530e77fc866a67894c35/CodeContext.py | |
def interesting_lines(self, firstline): """Generator which yields context lines, starting at firstline.""" | def interesting_lines(self, firstline, stopline=1, stopindent=0): """ Find the context lines, starting at firstline. Will not return lines whose index is smaller than stopline or whose indentation is smaller than stopindent. stopline should always be >= 1, so the dummy block start will never be returned (This function ... | def interesting_lines(self, firstline): """Generator which yields context lines, starting at firstline.""" # The indentation level we are currently in: lastindent = INFINITY # For a line to be interesting, it must begin with a block opening # keyword, and have less indentation than lastindent. for line_index in xrange(... | 98f9ff7223406f0c344f530e77fc866a67894c35 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/98f9ff7223406f0c344f530e77fc866a67894c35/CodeContext.py |
for line_index in xrange(firstline, -1, -1): | for line_index in xrange(firstline, stopline-1, -1): | def interesting_lines(self, firstline): """Generator which yields context lines, starting at firstline.""" # The indentation level we are currently in: lastindent = INFINITY # For a line to be interesting, it must begin with a block opening # keyword, and have less indentation than lastindent. for line_index in xrange(... | 98f9ff7223406f0c344f530e77fc866a67894c35 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/98f9ff7223406f0c344f530e77fc866a67894c35/CodeContext.py |
if opener and line_index < firstline: yield line_index, text | if opener and line_index < firstline and indent >= stopindent: lines.append((line_index, indent, text, opener)) if lastindent <= stopindent: break lines.reverse() return lines, lastindent | def interesting_lines(self, firstline): """Generator which yields context lines, starting at firstline.""" # The indentation level we are currently in: lastindent = INFINITY # For a line to be interesting, it must begin with a block opening # keyword, and have less indentation than lastindent. for line_index in xrange(... | 98f9ff7223406f0c344f530e77fc866a67894c35 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/98f9ff7223406f0c344f530e77fc866a67894c35/CodeContext.py |
tmpstack = [] for line_index, text in self.interesting_lines(firstline): while self.info[-1][0] > line_index: del self.info[-1] if self.info[-1][0] == line_index: break tmpstack.append((line_index, text)) while tmpstack: self.info.append(tmpstack.pop()) | def update_label(self): firstline = int(self.text.index("@0,0").split('.')[0]) if self.lastfirstline == firstline: return self.lastfirstline = firstline tmpstack = [] for line_index, text in self.interesting_lines(firstline): # Remove irrelevant self.info items, and when we reach a relevant # item (which must happen be... | 98f9ff7223406f0c344f530e77fc866a67894c35 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/98f9ff7223406f0c344f530e77fc866a67894c35/CodeContext.py | |
[x[1] for x in self.info[-self.numlines:]] | [x[2] for x in self.info[-self.numlines:]] | def update_label(self): firstline = int(self.text.index("@0,0").split('.')[0]) if self.lastfirstline == firstline: return self.lastfirstline = firstline tmpstack = [] for line_index, text in self.interesting_lines(firstline): # Remove irrelevant self.info items, and when we reach a relevant # item (which must happen be... | 98f9ff7223406f0c344f530e77fc866a67894c35 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/98f9ff7223406f0c344f530e77fc866a67894c35/CodeContext.py |
self.assertEqual(sys.stdout.getvalue().splitlines(), ['0', '0.5', '0']) | if 1/2 == 0: expected = ['0', '0.5', '0'] else: expected = ['0.5', '0.5', '0.5'] self.assertEqual(sys.stdout.getvalue().splitlines(), expected) | def test_input_and_raw_input(self): self.write_testfile() fp = open(TESTFN, 'r') savestdin = sys.stdin savestdout = sys.stdout # Eats the echo try: sys.stdin = fp sys.stdout = BitBucket() self.assertEqual(input(), 2) self.assertEqual(input('testing\n'), 2) self.assertEqual(raw_input(), 'The quick brown fox jumps over t... | 0511c932b9e77c4f163f9d3504aad92394d648c3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0511c932b9e77c4f163f9d3504aad92394d648c3/test_builtin.py |
def message_from_string(s, _class=_Message): return _Parser(_class).parsestr(s) | def message_from_string(s, _class=_Message, strict=1): return _Parser(_class, strict=strict).parsestr(s) | def message_from_string(s, _class=_Message): return _Parser(_class).parsestr(s) | e638faba21d423d2f75faa859194d87fb80befad /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e638faba21d423d2f75faa859194d87fb80befad/__init__.py |
attrname = string.lower(attrname) | def parse_starttag(self, i): | 49eb8822fe10574e9e4e4392194d57c8292d0a8f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/49eb8822fe10574e9e4e4392194d57c8292d0a8f/xmllib.py | |
def test(args = None): import sys if not args: args = sys.argv[1:] if args and args[0] == '-s': args = args[1:] klass = XMLParser else: klass = TestXMLParser if args: file = args[0] else: file = 'test.xml' if file == '-': f = sys.stdin else: try: f = open(file, 'r') except IOError, msg: print file, ":", msg sys.exi... | 49eb8822fe10574e9e4e4392194d57c8292d0a8f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/49eb8822fe10574e9e4e4392194d57c8292d0a8f/xmllib.py | ||
def askopenfilenames(**options): """Ask for multiple filenames to open Returns a list of filenames or empty list if cancel button selected """ options["multiple"]=1 files=Open(**options).show() return files.split() | def asksaveasfilename(**options): "Ask for a filename to save as" return SaveAs(**options).show() | e6f33f710a772d32e6ba44f223aa3fa01cca4cc3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e6f33f710a772d32e6ba44f223aa3fa01cca4cc3/tkFileDialog.py | |
n_lines += 1 | def write_results_file(self, path, lines, lnotab, lines_hit): """Return a coverage results file in path.""" | eae3b77ba7e028343b1ce13411320c4f2ac4dd6f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/eae3b77ba7e028343b1ce13411320c4f2ac4dd6f/trace.py | |
params, method = xmlrpclib.loads(data) | def _marshaled_dispatch(self, data, dispatch_method = None): """Dispatches an XML-RPC method from marshalled (XML) data. | d5d8a78cd81f8fed88448d7b2e9e6e10fe5496b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d5d8a78cd81f8fed88448d7b2e9e6e10fe5496b9/SimpleXMLRPCServer.py | |
print self.debug | def sendsms(self):#{{{ baseURLSSL='https://www.orange.pl' baseURL='http://www.orange.pl' length = 634 - len(self.message) cj = cookielib.CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) # orange index#{{{ request = urllib2.Request(baseURLSSL) request.add_header('User-Agent', 'Opera/8.00 (Wind... | d27f4c53e24bf8591d5093449ed8c32346f61ad6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2325/d27f4c53e24bf8591d5093449ed8c32346f61ad6/orange.py | |
print postdata | def sendsms(self):#{{{ baseURLSSL='https://www.orange.pl' baseURL='http://www.orange.pl' length = 634 - len(self.message) cj = cookielib.CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) # orange index#{{{ request = urllib2.Request(baseURLSSL) request.add_header('User-Agent', 'Opera/9.00 (Windo... | d738da0586f43d406e7b3cd584e863708de73b21 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2325/d738da0586f43d406e7b3cd584e863708de73b21/orange.py | |
print postdata | def sendsms(self):#{{{ baseURL='http://www.eraomnix.pl' cj = cookielib.CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj), moj_redirect_handler) request = urllib2.Request(baseURL + '/msg/api/do/tinker/sponsored') parametry = { 'failure' : baseURL, 'success' : baseURL, 'message' : self.message, 'l... | b06d8d784cec632efda7fdf326a22c337b2c048d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2325/b06d8d784cec632efda7fdf326a22c337b2c048d/eraomnix.py | |
print blad | def sendsms(self):#{{{ baseURL='http://www.eraomnix.pl' cj = cookielib.CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj), moj_redirect_handler) request = urllib2.Request(baseURL + '/msg/api/do/tinker/sponsored') parametry = { 'failure' : baseURL, 'success' : baseURL, 'message' : self.message, 'l... | b06d8d784cec632efda7fdf326a22c337b2c048d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2325/b06d8d784cec632efda7fdf326a22c337b2c048d/eraomnix.py | |
print "change desc: ``%s''" % changedesc | def parse_change_desc(changedesc, result_dict): summary = "" description = "" files = [] changedesc_keys = { 'QA Notes': "", 'Testing Done': "", 'Documentation Notes': "", 'Bug Number': "", 'Reviewed by': "", 'Approved by': "", 'Breaks vmcore compatibility': "", 'Breaks vmkernel compatibility': "", 'Breaks vmkdrivers ... | 945dddff971630c6744b0d920a4e4b0e4d8061ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/1600/945dddff971630c6744b0d920a4e4b0e4d8061ab/views.py | |
print ">> `%s'" % line | def parse_change_desc(changedesc, result_dict): summary = "" description = "" files = [] changedesc_keys = { 'QA Notes': "", 'Testing Done': "", 'Documentation Notes': "", 'Bug Number': "", 'Reviewed by': "", 'Approved by': "", 'Breaks vmcore compatibility': "", 'Breaks vmkernel compatibility': "", 'Breaks vmkdrivers ... | 945dddff971630c6744b0d920a4e4b0e4d8061ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/1600/945dddff971630c6744b0d920a4e4b0e4d8061ab/views.py | |
result_dict['bugs_closed'] = changedesc_keys['Bug Number'] | result_dict['bugs_closed'] = \ ", ".join(re.split(r"[, ]+", changedesc_keys['Bug Number'])) | def parse_change_desc(changedesc, result_dict): summary = "" description = "" files = [] changedesc_keys = { 'QA Notes': "", 'Testing Done': "", 'Documentation Notes': "", 'Bug Number': "", 'Reviewed by': "", 'Approved by': "", 'Breaks vmcore compatibility': "", 'Breaks vmkernel compatibility': "", 'Breaks vmkdrivers ... | 945dddff971630c6744b0d920a4e4b0e4d8061ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/1600/945dddff971630c6744b0d920a4e4b0e4d8061ab/views.py |
Bug Number: 456123\n\ | Bug Number: 456123, 12873 1298371\n\ | def new_review_request(request, template_name='reviews/new.html', changenum_path='changenum'): changedesc = "\ | 945dddff971630c6744b0d920a4e4b0e4d8061ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/1600/945dddff971630c6744b0d920a4e4b0e4d8061ab/views.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.