bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def __add__(self, other): return hexint(int.__add__(self, other)) | defverify(int(a) == 12345) __add__(self,verify(int(a) == 12345) other):verify(int(a) == 12345) returnverify(int(a) == 12345) hexint(int.__add__(self,verify(int(a) == 12345) other)) | 22,300 |
def __add__(self, other): return self.__class__(super(octlong, self).__add__(other)) | defverify(long(a) == 12345L) __add__(self,verify(long(a) == 12345L) other):verify(long(a) == 12345L) returnverify(long(a) == 12345L) self.__class__(super(octlong,verify(long(a) == 12345L) self).__add__(other)) | 22,301 |
def __repr__(self): return "%.*g" % (self.prec, self) | defverify(float(a) == 12345.0) __repr__(self):verify(float(a) == 12345.0) returnverify(float(a) == 12345.0) "%.*g"verify(float(a) == 12345.0) %verify(float(a) == 12345.0) (self.prec,verify(float(a) == 12345.0) self) | 22,302 |
def rev(self): if self._rev is not None: return self._rev L = list(self) L.reverse() self._rev = self.__class__(L) return self._rev | defverify(tuple(a).__class__ is tuple) rev(self):verify(tuple(a).__class__ is tuple) ifverify(tuple(a).__class__ is tuple) self._revverify(tuple(a).__class__ is tuple) isverify(tuple(a).__class__ is tuple) notverify(tuple(a).__class__ is tuple) None:verify(tuple(a).__class__ is tuple) returnverify(tuple(a).__class__ is... | 22,303 |
def rev(self): if self._rev is not None: return self._rev L = list(self) L.reverse() self._rev = self.__class__("".join(L)) return self._rev | defverify(str(s) == "12345") rev(self):verify(str(s) == "12345") ifverify(str(s) == "12345") self._revverify(str(s) == "12345") isverify(str(s) == "12345") notverify(str(s) == "12345") None:verify(str(s) == "12345") returnverify(str(s) == "12345") self._revverify(str(s) == "12345") Lverify(str(s) == "12345") =verify(st... | 22,304 |
def rev(self): if self._rev is not None: return self._rev L = list(self) L.reverse() self._rev = self.__class__("".join(L)) return self._rev | defverify(str(s) == "\x00" * 5) rev(self):verify(str(s) == "\x00" * 5) ifverify(str(s) == "\x00" * 5) self._revverify(str(s) == "\x00" * 5) isverify(str(s) == "\x00" * 5) notverify(str(s) == "\x00" * 5) None:verify(str(s) == "\x00" * 5) returnverify(str(s) == "\x00" * 5) self._revverify(str(s) == "\x00" * 5) Lverify(st... | 22,305 |
def getargs(co): """Get information about the arguments accepted by a code object. Three things are returned: (args, varargs, varkw), where 'args' is a list of argument names (possibly containing nested lists), and 'varargs' and 'varkw' are the names of the * and ** arguments or None.""" if not iscode(co): raise TypeE... | def getargs(co): """Get information about the arguments accepted by a code object. Three things are returned: (args, varargs, varkw), where 'args' is a list of argument names (possibly containing nested lists), and 'varargs' and 'varkw' are the names of the * and ** arguments or None.""" if not iscode(co): raise Type... | 22,306 |
def getargspec(func): """Get the names and default values of a function's arguments. A tuple of four things is returned: (args, varargs, varkw, defaults). 'args' is a list of the argument names (it may contain nested lists). 'varargs' and 'varkw' are the names of the * and ** arguments or None. 'defaults' is an n-tupl... | def getargspec(func): """Get the names and default values of a function's arguments. A tuple of four things is returned: (args, varargs, varkw, defaults). 'args' is a list of the argument names (it may contain nested lists). 'varargs' and 'varkw' are the names of the * and ** arguments or None. 'defaults' is an n-tupl... | 22,307 |
def smart_backspace_event(self, event): text = self.text first, last = self.editwin.get_selection_indices() if first and last: text.delete(first, last) text.mark_set("insert", first) return "break" # Delete whitespace left, until hitting a real char or closest # preceding virtual tab stop. chars = text.get("insert line... | def smart_backspace_event(self, event): text = self.text first, last = self.editwin.get_selection_indices() if first and last: text.delete(first, last) text.mark_set("insert", first) return "break" # Delete whitespace left, until hitting a real char or closest # preceding virtual tab stop. chars = text.get("insert line... | 22,308 |
def nts(s): """Convert a null-terminated string buffer to a python string. """ return s.split(NUL, 1)[0] | def nts(s): """Convert a null-terminated string buffer to a python string. """ return s.rstrip(NUL) | 22,309 |
def tobuf(self): """Return a tar header block as a 512 byte string. """ name = self.name | def tobuf(self): """Return a tar header block as a 512 byte string. """ name = self.name | 22,310 |
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... | 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... | 22,311 |
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... | 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... | 22,312 |
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 | 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 | 22,313 |
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 | 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 | 22,314 |
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 | 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 | 22,315 |
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 | 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 | 22,316 |
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 | 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.firstmem... | 22,317 |
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 | 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 | 22,318 |
def _test(): teststr = "abc\n" print "testing popen2..." r, w = popen2('cat') w.write(teststr) w.close() assert r.read() == teststr print "testing popen3..." r, w, e = popen3(['cat']) w.write(teststr) w.close() assert r.read() == teststr assert e.read() == "" _cleanup() assert not _active print "All OK" | def _test(): teststr = "abc\n" print "testing popen2..." r, w = popen2('cat') w.write(teststr) w.close() assert r.read() == teststr print "testing popen3..." r, w, e = popen3(['cat']) w.write(teststr) w.close() assert r.read() == teststr assert e.read() == "" for inst in _active[:]: inst.wait() assert not _active print... | 22,319 |
def help_b(self): print """b(reak) ([file:]lineno | function) [, "condition"] | def help_b(self): print """b(reak) ([file:]lineno | function) [, "condition"] | 22,320 |
def help_cl(self): print """cl(ear) [lineno] | def help_cl(self): print """cl(ear) [lineno] | 22,321 |
def help_cl(self): print """cl(ear) [lineno] | def help_cl(self): print """cl(ear) [lineno] | 22,322 |
def parseitem(x, self=self): return x[:1] + tuple(map(getint, x[1:])) | def parseitem(x, self=self): return x[:1] + tuple(map(getint, x[1:])) | 22,323 |
def __and__(self, other): """Return the intersection of two sets as a new set. | def __and__(self, other): """Return the intersection of two sets as a new set. | 22,324 |
def __xor__(self, other): """Return the symmetric difference of two sets as a new set. | def __xor__(self, other): """Return the symmetric difference of two sets as a new set. | 22,325 |
def __sub__(self, other): """Return the difference of two sets as a new Set. | def __sub__(self, other): """Return the difference of two sets as a new Set. | 22,326 |
def __sub__(self, other): """Return the difference of two sets as a new Set. | def __sub__(self, other): """Return the difference of two sets as a new Set. | 22,327 |
def issubset(self, other): """Report whether another set contains this set.""" self._binary_sanity_check(other) if len(self) > len(other): # Fast check for obvious cases return False otherdata = other._data for elt in self: if elt not in otherdata: return False return True | def issubset(self, other): """Report whether another set contains this set.""" self._binary_sanity_check(other) if len(self) > len(other): # Fast check for obvious cases return False for elt in ifilter(other._data.has_key, self, True): return False return True | 22,328 |
def issuperset(self, other): """Report whether this set contains another set.""" self._binary_sanity_check(other) if len(self) < len(other): # Fast check for obvious cases return False selfdata = self._data for elt in other: if elt not in selfdata: return False return True | def issuperset(self, other): """Report whether this set contains another set.""" self._binary_sanity_check(other) if len(self) < len(other): # Fast check for obvious cases return False for elt in ifilter(self._data.has_key, other, True): return False return True | 22,329 |
def findsource(object): """Return the entire source file and starting line number for an object. The argument may be a module, class, method, function, traceback, frame, or code object. The source code is returned as a list of all the lines in the file and the line number indexes a line in that list. An IOError is r... | def findsource(object): """Return the entire source file and starting line number for an object. The argument may be a module, class, method, function, traceback, frame, or code object. The source code is returned as a list of all the lines in the file and the line number indexes a line in that list. An IOError is r... | 22,330 |
def findsource(object): """Return the entire source file and starting line number for an object. The argument may be a module, class, method, function, traceback, frame, or code object. The source code is returned as a list of all the lines in the file and the line number indexes a line in that list. An IOError is r... | def findsource(object): """Return the entire source file and starting line number for an object. The argument may be a module, class, method, function, traceback, frame, or code object. The source code is returned as a list of all the lines in the file and the line number indexes a line in that list. An IOError is r... | 22,331 |
def getframeinfo(frame, context=1): """Get information about a frame or traceback object. A tuple of five things is returned: the filename, the line number of the current line, the function name, a list of lines of context from the source code, and the index of the current line within that list. The optional second ar... | def getframeinfo(frame, context=1): """Get information about a frame or traceback object. A tuple of five things is returned: the filename, the line number of the current line, the function name, a list of lines of context from the source code, and the index of the current line within that list. The optional second ar... | 22,332 |
def get_outputs (self): # This command doesn't have any outputs of its own, so just # get the outputs of all its sub-commands. outputs = [] for cmd_name in self.get_sub_commands(): cmd = self.get_finalized_command(cmd_name) outputs.extend(cmd.get_outputs()) | def get_outputs (self): # This command doesn't have any outputs of its own, so just # get the outputs of all its sub-commands. outputs = [] for cmd_name in self.get_sub_commands(): cmd = self.get_finalized_command(cmd_name) outputs.extend(cmd.get_outputs()) | 22,333 |
def parseargs(): global DEBUGSTREAM try: opts, args = getopt.getopt( sys.argv[1:], 'nVhc:d', ['class=', 'nosetuid', 'version', 'help', 'debug']) except getopt.error, e: usage(1, e) options = Options() for opt, arg in opts: if opt in ('-h', '--help'): usage(0) elif opt in ('-V', '--version'): print >> sys.stderr, __ver... | def parseargs(): global DEBUGSTREAM try: opts, args = getopt.getopt( sys.argv[1:], 'nVhc:d', ['class=', 'nosetuid', 'version', 'help', 'debug']) except getopt.error, e: usage(1, e) options = Options() for opt, arg in opts: if opt in ('-h', '--help'): usage(0) elif opt in ('-V', '--version'): print >> sys.stderr, __ver... | 22,334 |
def get_source_files (self): self.check_extension_list() filenames = [] | def get_source_files (self): self.check_extensions_list(self.extensions) filenames = [] | 22,335 |
def inroots(self, url): | def inroots(self, url): | 22,336 |
def getpage(self, url): | def getpage(self, url): | 22,337 |
def test(fn = 'f:just samples:just.aif'): import aifc af = aifc.open(fn, 'r') print af.getparams() p = Play_Audio_mac() p.setoutrate(af.getframerate()) p.setsampwidth(af.getsampwidth()) p.setnchannels(af.getnchannels()) BUFSIZ = 10000 while 1: data = af.readframes(BUFSIZ) if not data: break p.writeframes(data) p.wait()... | def test(): import aifc af = aifc.open(fn, 'r') print af.getparams() p = Play_Audio_mac() p.setoutrate(af.getframerate()) p.setsampwidth(af.getsampwidth()) p.setnchannels(af.getnchannels()) BUFSIZ = 10000 while 1: data = af.readframes(BUFSIZ) if not data: break p.writeframes(data) p.wait() | 22,338 |
def __format(self, object, stream, indent, allowance, context, level): level = level + 1 if context.has_key(id(object)): object = _Recursion(object) self.__recursive = 1 rep = self.__repr(object, context, level - 1) objid = id(object) context[objid] = 1 typ = type(object) sepLines = len(rep) > (self.__width - 1 - inden... | def __format(self, object, stream, indent, allowance, context, level): level = level + 1 if context.has_key(id(object)): object = _Recursion(object) self.__recursive = 1 rep = self.__repr(object, context, level - 1) objid = id(object) context[objid] = 1 typ = type(object) sepLines = len(rep) > (self.__width - 1 - inden... | 22,339 |
def do_activateEvt(self, event): (what, message, when, where, modifiers) = event wid = WhichWindow(message) if wid and self._windows.has_key(wid): window = self._windows[wid] window.do_activate(modifiers & 1, event) else: MacOS.HandleEvent(event) | def do_activateEvt(self, event): (what, message, when, where, modifiers) = event if type(message) == type(1): wid = WhichWindow(message) else: wid = message if wid and self._windows.has_key(wid): window = self._windows[wid] window.do_activate(modifiers & 1, event) else: MacOS.HandleEvent(event) | 22,340 |
def do_suspendresume(self, event): # Is this a good idea??? (what, message, when, where, modifiers) = event w = FrontWindow() if w: nev = (activateEvt, w, when, where, message&1) self.do_activateEvt(self, nev) | def do_suspendresume(self, event): # Is this a good idea??? (what, message, when, where, modifiers) = event w = FrontWindow() if w: nev = (activateEvt, w, when, where, message&1) self.do_activateEvt(self, nev) | 22,341 |
def dispatch(self, id, item, window, event): if item == 1: Menu.dispatch(self, id, item, window, event) else: name = self.menu.GetItem(item) OpenDeskAcc(name) | def dispatch(self, id, item, window, event): if item == 1: Menu.dispatch(self, id, item, window, event) else: name = self.menu.GetMenuItemText(item) OpenDeskAcc(name) | 22,342 |
def open(self): self.wid = NewWindow((40, 40, 400, 400), self.__class__.__name__, 1, 0, -1, 1, 0) self.do_postopen() | def open(self, bounds=(40, 40, 400, 400), resid=None): if resid <> None: self.wid = GetNewWindow(resid, -1) else: self.wid = NewWindow(bounds, self.__class__.__name__, 1, 0, -1, 1, 0) self.do_postopen() | 22,343 |
def run (self): | def run (self): | 22,344 |
def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = string.rfind(rest, '?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = string.find(rest, '/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.tran... | def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = string.rfind(rest, '?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = string.find(rest, '/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.tran... | 22,345 |
def install(self, namespace=vars(__builtin__)): "Install this ImportManager into the specified namespace." | def install(self, namespace=vars(__builtin__)): "Install this ImportManager into the specified namespace." | 22,346 |
def __init__(self): global _root, _canvas if _root is None: _root = Tkinter.Tk() _root.wm_protocol("WM_DELETE_WINDOW", self._destroy) _root.title(_title) | def __init__(self): global _root, _canvas if _root is None: _root = Tkinter.Tk() _root.wm_protocol("WM_DELETE_WINDOW", self._destroy) _root.title(_title) | 22,347 |
def __init__(self, filename, mode="r", compression=ZIP_STORED): 'Open the ZIP file with mode read "r", write "w" or append "a".' if compression == ZIP_STORED: pass elif compression == ZIP_DEFLATED: if not zlib: raise RuntimeError,\ "Compression requires the (missing) zlib module" else: raise RuntimeError, "That compres... | def __init__(self, filename, mode="r", compression=ZIP_STORED): 'Open the ZIP file with mode read "r", write "w" or append "a".' if compression == ZIP_STORED: pass elif compression == ZIP_DEFLATED: if not zlib: raise RuntimeError,\ "Compression requires the (missing) zlib module" else: raise RuntimeError, "That compres... | 22,348 |
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,... | 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,... | 22,349 |
def read(self, name): "Return file bytes (as a string) for name" if self.mode not in ("r", "a"): raise RuntimeError, 'read() requires mode "r" or "a"' if not self.fp: raise RuntimeError, \ "Attempt to read ZIP archive that was already closed" zinfo = self.getinfo(name) filepos = self.fp.tell() self.fp.seek(zinfo.file_o... | def read(self, name): "Return file bytes (as a string) for name" if self.mode not in ("r", "a"): raise RuntimeError, 'read() requires mode "r" or "a"' if not self.fp: raise RuntimeError, \ "Attempt to read ZIP archive that was already closed" zinfo = self.getinfo(name) filepos = self.fp.tell() self.fp.seek(zinfo.file_o... | 22,350 |
def read(self, name): "Return file bytes (as a string) for name" if self.mode not in ("r", "a"): raise RuntimeError, 'read() requires mode "r" or "a"' if not self.fp: raise RuntimeError, \ "Attempt to read ZIP archive that was already closed" zinfo = self.getinfo(name) filepos = self.fp.tell() self.fp.seek(zinfo.file_o... | def read(self, name): "Return file bytes (as a string) for name" if self.mode not in ("r", "a"): raise RuntimeError, 'read() requires mode "r" or "a"' if not self.fp: raise RuntimeError, \ "Attempt to read ZIP archive that was already closed" zinfo = self.getinfo(name) filepos = self.fp.tell() self.fp.seek(zinfo.file_o... | 22,351 |
def read(self, name): "Return file bytes (as a string) for name" if self.mode not in ("r", "a"): raise RuntimeError, 'read() requires mode "r" or "a"' if not self.fp: raise RuntimeError, \ "Attempt to read ZIP archive that was already closed" zinfo = self.getinfo(name) filepos = self.fp.tell() self.fp.seek(zinfo.file_o... | def read(self, name): "Return file bytes (as a string) for name" if self.mode not in ("r", "a"): raise RuntimeError, 'read() requires mode "r" or "a"' if not self.fp: raise RuntimeError, \ "Attempt to read ZIP archive that was already closed" zinfo = self.getinfo(name) filepos = self.fp.tell() self.fp.seek(zinfo.file_o... | 22,352 |
def _writecheck(self, zinfo): 'Check for errors before writing a file to the archive' if self.NameToInfo.has_key(zinfo.filename): if self.debug: # Warning for duplicate names print "Duplicate name:", zinfo.filename if self.mode not in ("w", "a"): raise RuntimeError, 'write() requires mode "w" or "a"' if not self.fp: ra... | def _writecheck(self, zinfo): 'Check for errors before writing a file to the archive' if self.NameToInfo.has_key(zinfo.filename): if self.debug: # Warning for duplicate names print "Duplicate name:", zinfo.filename if self.mode not in ("w", "a"): raise RuntimeError, 'write() requires mode "w" or "a"' if not self.fp: ra... | 22,353 |
def _writecheck(self, zinfo): 'Check for errors before writing a file to the archive' if self.NameToInfo.has_key(zinfo.filename): if self.debug: # Warning for duplicate names print "Duplicate name:", zinfo.filename if self.mode not in ("w", "a"): raise RuntimeError, 'write() requires mode "w" or "a"' if not self.fp: ra... | def _writecheck(self, zinfo): 'Check for errors before writing a file to the archive' if self.NameToInfo.has_key(zinfo.filename): if self.debug: # Warning for duplicate names print "Duplicate name:", zinfo.filename if self.mode not in ("w", "a"): raise RuntimeError, 'write() requires mode "w" or "a"' if not self.fp: ra... | 22,354 |
def _writecheck(self, zinfo): 'Check for errors before writing a file to the archive' if self.NameToInfo.has_key(zinfo.filename): if self.debug: # Warning for duplicate names print "Duplicate name:", zinfo.filename if self.mode not in ("w", "a"): raise RuntimeError, 'write() requires mode "w" or "a"' if not self.fp: ra... | def _writecheck(self, zinfo): 'Check for errors before writing a file to the archive' if self.NameToInfo.has_key(zinfo.filename): if self.debug: # Warning for duplicate names print "Duplicate name:", zinfo.filename if self.mode not in ("w", "a"): raise RuntimeError, 'write() requires mode "w" or "a"' if not self.fp: ra... | 22,355 |
def writepy(self, pathname, basename = ""): """Add all files from "pathname" to the ZIP archive. | def writepy(self, pathname, basename = ""): """Add all files from "pathname" to the ZIP archive. | 22,356 |
def scan_dragto(self, x, y): """Adjust the view of the canvas to 10 times the difference between X and Y and the coordinates given in scan_mark.""" self.tk.call(self._w, 'scan', 'dragto', x, y) | def scan_dragto(self, x, y, gain=10): """Adjust the view of the canvas to GAIN times the difference between X and Y and the coordinates given in scan_mark.""" self.tk.call(self._w, 'scan', 'dragto', x, y) | 22,357 |
def scan_dragto(self, x, y): """Adjust the view of the canvas to 10 times the difference between X and Y and the coordinates given in scan_mark.""" self.tk.call(self._w, 'scan', 'dragto', x, y) | def scan_dragto(self, x, y): """Adjust the view of the canvas to 10 times the difference between X and Y and the coordinates given in scan_mark.""" self.tk.call(self._w, 'scan', 'dragto', x, y) | 22,358 |
def bpprint(self): if self.temporary: disp = 'del ' else: disp = 'keep ' if self.enabled: disp = disp + 'yes' else: disp = disp + 'no ' print '%-4dbreakpoint %s at %s:%d' % (self.number, disp, self.file, self.line) if self.cond: print '\tstop only if %s' % (self.cond,) if self.ignore: print '\tignore next %d hits' ... | def bpprint(self): if self.temporary: disp = 'del ' else: disp = 'keep ' if self.enabled: disp = disp + 'yes ' else: disp = disp + 'no ' print '%-4dbreakpoint %s at %s:%d' % (self.number, disp, self.file, self.line) if self.cond: print '\tstop only if %s' % (self.cond,) if self.ignore: print '\tignore next %d hit... | 22,359 |
def print_log(self): self._mesg('last %d IMAP4 interactions:' % len(self._cmd_log)) i, n = self._cmd_log_idx, self._cmd_log_len while n: try: apply(self._mesg, self._cmd_log[i]) except: pass i += 1 if i >= self._cmd_log_len: i = 0 n -= 1 | def print_log(self): self._mesg('last %d IMAP4 interactions:' % len(self._cmd_log)) i, n = self._cmd_log_idx, self._cmd_log_len while n: try: apply(self._mesg, self._cmd_log[i]) except: pass i += 1 if i >= self._cmd_log_len: i = 0 n -= 1 | 22,360 |
def readheaders(self): """Read header lines. Read header lines up to the entirely blank line that terminates them. The (normally blank) line that ends the headers is skipped, but not included in the returned list. If a non-header line ends the headers, (which is an error), an attempt is made to backspace over it; it ... | def readheaders(self): """Read header lines. Read header lines up to the entirely blank line that terminates them. The (normally blank) line that ends the headers is skipped, but not included in the returned list. If a non-header line ends the headers, (which is an error), an attempt is made to backspace over it; it ... | 22,361 |
def test_gopher(self): import warnings warnings.filterwarnings("ignore", "the gopherlib module is deprecated", DeprecationWarning, "urllib2$") urls = [ # Thanks to Fred for finding these! 'gopher://gopher.lib.ncsu.edu/11/library/stacks/Alex', 'gopher://gopher.vt.edu:10010/10/33', ] self._test_urls(urls, self._extra_han... | def test_gopher(self): import warnings warnings.filterwarnings("ignore", "the gopherlib module is deprecated", DeprecationWarning, "urllib2$") urls = [ # Thanks to Fred for finding these! 'gopher://gopher.lib.ncsu.edu./11/library/stacks/Alex', 'gopher://gopher.vt.edu.:10010/10/33', ] self._test_urls(urls, self._extra_h... | 22,362 |
def _test_urls(self, urls, handlers): import socket import time import logging debug = logging.getLogger("test_urllib2").debug | def _test_urls(self, urls, handlers): import socket import time import logging debug = logging.getLogger("test_urllib2").debug | 22,363 |
def _extra_handlers(self): handlers = [] | def_extra_handlers(self):handlers=[] | 22,364 |
... def tail(g): | ... def tail(g): | 22,365 |
... def _m235(): | ... def _m235(): | 22,366 |
... def _m235(): | ... def _m235(): | 22,367 |
... def _fib(): | ... def _fib(): | 22,368 |
def open(self, event=None, editFile=None): if self.editwin.flist: if not editFile: filename = self.askopenfile() else: filename=editFile if filename: # if the current window has no filename and hasn't been # modified, we replace it's contents (no loss). Otherwise # we open a new window. if not self.filename and se... | def open(self, event=None, editFile=None): if self.editwin.flist: if not editFile: filename = self.askopenfile() else: filename=editFile if filename: # if the current window has no filename and hasn't been # modified, we replace it's contents (no loss). Otherwise # we open a new window. if not self.filename and se... | 22,369 |
def open(self, event=None, editFile=None): if self.editwin.flist: if not editFile: filename = self.askopenfile() else: filename=editFile if filename: # if the current window has no filename and hasn't been # modified, we replace it's contents (no loss). Otherwise # we open a new window. if not self.filename and se... | defopen(self,event=None,editFile=None):ifself.editwin.flist:ifnoteditFile:filename=self.askopenfile()else:filename=editFileiffilename:#ifthecurrentwindowhasnofilenameandhasn'tbeen#modified,wereplaceit'scontents(noloss).Otherwise#weopenanewwindow.ifnotself.filenameandself.get_saved():self.editwin.flist.open(filename,sel... | 22,370 |
def get_inidata (self): # Return data describing the installation. | def get_inidata (self): # Return data describing the installation. | 22,371 |
def get_exe_bytes (self): import base64 return base64.decodestring (EXEDATA) | def get_exe_bytes (self): import base64 return base64.decodestring (EXEDATA) | 22,372 |
def get_exe_bytes (self): import base64 return base64.decodestring (EXEDATA) | def get_exe_bytes (self): import base64 return base64.decodestring (EXEDATA) | 22,373 |
def get_exe_bytes (self): import base64 return base64.decodestring (EXEDATA) | def get_exe_bytes (self): import base64 return base64.decodestring (EXEDATA) | 22,374 |
def get_exe_bytes (self): import base64 return base64.decodestring (EXEDATA) | def get_exe_bytes (self): import base64 return base64.decodestring (EXEDATA) | 22,375 |
def get_exe_bytes (self): import base64 return base64.decodestring (EXEDATA) | def get_exe_bytes (self): import base64 return base64.decodestring (EXEDATA) | 22,376 |
def set(self, field, value, depth): if field.seq: if field.type.value == "cmpop": # XXX check that this cast is safe, i.e. works independent on whether # sizeof(cmpop_ty) != sizeof(void*) cast = "(PyObject*(*)(void*))" else: cast = "" self.emit("value = ast2obj_list(%s, %sast2obj_%s);" % (value, cast, field.type), dept... | def set(self, field, value, depth): if field.seq: if field.type.value == "cmpop": # XXX check that this cast is safe, i.e. works independent on whether # sizeof(cmpop_ty) != sizeof(void*) cast = "(PyObject*(*)(void*))" else: cast = "" self.emit("value = ast2obj_list(%s, %sast2obj_%s);" % (value, cast, field.type), dept... | 22,377 |
def set(self, field, value, depth): if field.seq: if field.type.value == "cmpop": # XXX check that this cast is safe, i.e. works independent on whether # sizeof(cmpop_ty) != sizeof(void*) cast = "(PyObject*(*)(void*))" else: cast = "" self.emit("value = ast2obj_list(%s, %sast2obj_%s);" % (value, cast, field.type), dept... | def set(self, field, value, depth): if field.seq: if field.type.value == "cmpop": # XXX check that this cast is safe, i.e. works independent on whether # sizeof(cmpop_ty) != sizeof(void*) cast = "(PyObject*(*)(void*))" else: self.emit("value = ast2obj_list(%s, ast2obj_%s);" % (value, field.type), depth) else: ctype = g... | 22,378 |
def __init__(self, fp): self.fp = fp self.stack = [] # Grows down self.level = 0 self.last = 0 self.start = self.fp.tell() self.posstack = [] # Grows down | seekable = 0 def __init__(self, fp, seekable=1): self.fp = fp self.stack = [] # Grows down self.level = 0 self.last = 0 self.start = self.fp.tell() self.posstack = [] # Grows down | 22,379 |
def __init__(self, fp): self.fp = fp self.stack = [] # Grows down self.level = 0 self.last = 0 self.start = self.fp.tell() self.posstack = [] # Grows down | def __init__(self, fp): self.fp = fp self.stack = [] # Grows down self.level = 0 self.last = 0 if seekable: self.seekable = 1 self.start = self.fp.tell() self.posstack = [] # Grows down | 22,380 |
def readline(self): if self.level > 0: return '' line = self.fp.readline() if not line: self.level = len(self.stack) self.last = (self.level > 0) if self.last: err('*** Sudden EOF in MultiFile.readline()\n') return '' if line[:2] <> '--': return line n = len(line) k = n while k > 0 and line[k-1] in string.whitespace: k... | def readline(self): if self.level > 0: return '' line = self.fp.readline() if not line: self.level = len(self.stack) self.last = (self.level > 0) if self.last: err('*** Sudden EOF in MultiFile.readline()\n') return '' if line[:2] <> '--': return line n = len(line) k = n while k > 0 and line[k-1] in string.whitespace: k... | 22,381 |
def next(self): while self.readline(): pass if self.level > 1 or self.last: return 0 self.level = 0 self.last = 0 self.start = self.fp.tell() return 1 | def next(self): while self.readline(): pass if self.level > 1 or self.last: return 0 self.level = 0 self.last = 0 if self.seekable: self.start = self.fp.tell() return 1 | 22,382 |
def push(self, sep): if self.level > 0: raise Error, 'bad MultiFile.push() call' self.stack.insert(0, sep) self.posstack.insert(0, self.start) self.start = self.fp.tell() | def push(self, sep): if self.level > 0: raise Error, 'bad MultiFile.push() call' self.stack.insert(0, sep) self.posstack.insert(0, self.start) self.start = self.fp.tell() | 22,383 |
def strftest(now): if verbose: print "strftime test for", time.ctime(now) nowsecs = str(long(now))[:-1] gmt = time.gmtime(now) now = time.localtime(now) if now[3] < 12: ampm='AM' else: ampm='PM' jan1 = time.localtime(time.mktime((now[0], 1, 1) + (0,)*6)) try: if now[8]: tz = time.tzname[1] else: tz = time.tzname[0] ... | def strftest(now): if verbose: print "strftime test for", time.ctime(now) nowsecs = str(long(now))[:-1] gmt = time.gmtime(now) now = time.localtime(now) if now[3] < 12: ampm='AM' else: ampm='PM' jan1 = time.localtime(time.mktime((now[0], 1, 1) + (0,)*6)) try: if now[8]: tz = time.tzname[1] else: tz = time.tzname[0] ... | 22,384 |
def __init__(self, switchboard, parent=None): # non-gui ivars self.__sb = switchboard self.__hexp = BooleanVar() self.__uwtyping = BooleanVar() # create the gui self.__frame = Frame(parent, relief=GROOVE, borderwidth=2) self.__frame.pack(side=RIGHT) # Red self.__xl = Label(self.__frame, text='Red:') self.__xl.grid(row=... | def __init__(self, switchboard, parent=None): # non-gui ivars self.__sb = switchboard self.__hexp = BooleanVar() self.__uwtyping = BooleanVar() # create the gui self.__frame = Frame(parent, relief=GROOVE, borderwidth=2) self.__frame.pack(side=RIGHT) # Red self.__xl = Label(self.__frame, text='Red:') self.__xl.grid(row=... | 22,385 |
def __normalize(self, event=None): ew = event.widget contents = ew.get() if contents == '': contents = '0' # figure out what the contents value is in the current base try: if self.__hexp.get(): v = string.atoi(contents, 16) else: v = string.atoi(contents) except ValueError: v = None # if value is not legal, delete the ... | def __normalize(self, event=None): ew = event.widget contents = ew.get() if contents == '': contents = '0' # figure out what the contents value is in the current base try: if self.__hexp.get(): v = string.atoi(contents, 16) else: v = string.atoi(contents) except ValueError: v =... | 22,386 |
def __normalize(self, event=None): ew = event.widget contents = ew.get() if contents == '': contents = '0' # figure out what the contents value is in the current base try: if self.__hexp.get(): v = string.atoi(contents, 16) else: v = string.atoi(contents) except ValueError: v = None # if value is not legal, delete the ... | def __normalize(self, event=None): ew = event.widget contents = ew.get() if contents == '': contents = '0' # figure out what the contents value is in the current base try: if self.__hexp.get(): v = string.atoi(contents, 16) else: v = string.atoi(contents) except ValueError: v = None # if value is not legal, delete the ... | 22,387 |
def warn_explicit(message, category, filename, lineno, module=None, registry=None): if module is None: module = filename if module[-3:].lower() == ".py": module = module[:-3] # XXX What about leading pathname? if registry is None: registry = {} key = (message, category, lineno) # Quick test for common case if registry.... | def warn_explicit(message, category, filename, lineno, module=None, registry=None): if module is None: module = filename if module[-3:].lower() == ".py": module = module[:-3] # XXX What about leading pathname? if registry is None: registry = {} if isinstance(message, Warning): text = str(message) category = message.__c... | 22,388 |
def warn_explicit(message, category, filename, lineno, module=None, registry=None): if module is None: module = filename if module[-3:].lower() == ".py": module = module[:-3] # XXX What about leading pathname? if registry is None: registry = {} key = (message, category, lineno) # Quick test for common case if registry.... | def warn_explicit(message, category, filename, lineno, module=None, registry=None): if module is None: module = filename if module[-3:].lower() == ".py": module = module[:-3] # XXX What about leading pathname? if registry is None: registry = {} key = (message, category, lineno) # Quick test for common case if registry.... | 22,389 |
def warn_explicit(message, category, filename, lineno, module=None, registry=None): if module is None: module = filename if module[-3:].lower() == ".py": module = module[:-3] # XXX What about leading pathname? if registry is None: registry = {} key = (message, category, lineno) # Quick test for common case if registry.... | def warn_explicit(message, category, filename, lineno, module=None, registry=None): if module is None: module = filename if module[-3:].lower() == ".py": module = module[:-3] # XXX What about leading pathname? if registry is None: registry = {} key = (message, category, lineno) # Quick test for common case if registry.... | 22,390 |
def warn_explicit(message, category, filename, lineno, module=None, registry=None): if module is None: module = filename if module[-3:].lower() == ".py": module = module[:-3] # XXX What about leading pathname? if registry is None: registry = {} key = (message, category, lineno) # Quick test for common case if registry.... | def warn_explicit(message, category, filename, lineno, module=None, registry=None): if module is None: module = filename if module[-3:].lower() == ".py": module = module[:-3] # XXX What about leading pathname? if registry is None: registry = {} key = (message, category, lineno) # Quick test for common case if registry.... | 22,391 |
def warn_explicit(message, category, filename, lineno, module=None, registry=None): if module is None: module = filename if module[-3:].lower() == ".py": module = module[:-3] # XXX What about leading pathname? if registry is None: registry = {} key = (message, category, lineno) # Quick test for common case if registry.... | def warn_explicit(message, category, filename, lineno, module=None, registry=None): if module is None: module = filename if module[-3:].lower() == ".py": module = module[:-3] # XXX What about leading pathname? if registry is None: registry = {} key = (message, category, lineno) # Quick test for common case if registry.... | 22,392 |
def reportMissing(self): missing = [name for name in self.missingModules if name not in MAYMISS_MODULES] if self.maybeMissingModules: maybe = self.maybeMissingModules else: maybe = [name for name in missing if "." in name] missing = [name for name in missing if "." not in name] missing.sort() maybe.sort() if maybe: sel... | def reportMissing(self): missing = [name for name in self.missingModules if name not in MAYMISS_MODULES] if self.maybeMissingModules: maybe = self.maybeMissingModules else: maybe = [name for name in missing if "." in name] missing = [name for name in missing if "." not in name] missing.sort() maybe.sort() if maybe: sel... | 22,393 |
def msvc_prelink_hack (self, sources, ext, extra_args): | def msvc_prelink_hack (self, sources, ext, extra_args): | 22,394 |
def escape(pattern): "Escape all non-alphanumeric characters in pattern." result = list(pattern) alphanum=string.letters+'_'+string.digits for i in range(len(pattern)): char = pattern[i] if char not in alphanum: if char=='\000': result[i] = '\\000' else: result[i] = '\\'+char return string.join(result, '') | def escape(pattern): """escape(string) -> string Return string with all non-alphanumerics backslashed; this is useful if you want to match an arbitrary literal string that may have regular expression metacharacters in it. """ result = list(pattern) alphanum=string.letters+'_'+string.digits for i in range(len(pattern)... | 22,395 |
def compile(pattern, flags=0): "Compile a regular expression pattern, returning a RegexObject." groupindex={} code=pcre_compile(pattern, flags, groupindex) return RegexObject(pattern, flags, code, groupindex) | def compile(pattern, flags=0): """compile(pattern[, flags]) -> RegexObject Compile a regular expression pattern into a regular expression object, which can be used for matching using its match() and search() methods. """ groupindex={} code=pcre_compile(pattern, flags, groupindex) return RegexObject(pattern, flags, co... | 22,396 |
def search(self, string, pos=0, endpos=None): """Scan through string looking for a match to the pattern, returning a MatchObject instance, or None if no match was found.""" | def search(self, string, pos=0, endpos=None): """Scan through string looking for a match to the pattern, returning a MatchObject instance, or None if no match was found.""" | 22,397 |
def match(self, string, pos=0, endpos=None): """Try to apply the pattern at the start of the string, returning a MatchObject instance, or None if no match was found.""" | def match(self, string, pos=0, endpos=None): """Try to apply the pattern at the start of the string, returning a MatchObject instance, or None if no match was found.""" | 22,398 |
def sub(self, repl, string, count=0): """Return the string obtained by replacing the leftmost non-overlapping occurrences of the pattern in string by the replacement repl""" | def sub(self, repl, string, count=0): """Return the string obtained by replacing the leftmost non-overlapping occurrences of the pattern in string by the replacement repl""" | 22,399 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.