bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def testunicode(): try: array.array('b', u'foo') except TypeError: pass else: raise TestFailed("creating a non-unicode array from " "a Unicode string should fail") x = array.array('u', u'\xa0\xc2\u1234') x.fromunicode(u' ') x.fromunicode(u'') x.fromunicode(u'') x.fromunicode(u'\x11abc\xff\u1234') s = x.tounicode() if ... | def testunicode(): try: array.array('b', u'foo') except TypeError: pass else: raise TestFailed("creating a non-unicode array from " "a Unicode string should fail") x = array.array('u', u'\xa0\xc2\u1234') x.fromunicode(u' ') x.fromunicode(u'') x.fromunicode(u'') x.fromunicode(u'\x11abc\xff\u1234') s = x.tounicode() if ... | 8,900 |
def testunicode(): try: array.array('b', u'foo') except TypeError: pass else: raise TestFailed("creating a non-unicode array from " "a Unicode string should fail") x = array.array('u', u'\xa0\xc2\u1234') x.fromunicode(u' ') x.fromunicode(u'') x.fromunicode(u'') x.fromunicode(u'\x11abc\xff\u1234') s = x.tounicode() if ... | def testunicode(): try: array.array('b', u'foo') except TypeError: pass else: raise TestFailed("creating a non-unicode array from " "a Unicode string should fail") x = array.array('u', u'\xa0\xc2\u1234') x.fromunicode(u' ') x.fromunicode(u'') x.fromunicode(u'') x.fromunicode(u'\x11abc\xff\u1234') s = x.tounicode() if ... | 8,901 |
def test(): root = Tk() def doit(root=root): d = SimpleDialog(root, text="This is a test dialog. " "Would this have been an actual dialog, " "the buttons below would have been glowing " "in soft pink light.\n" "Do you believe this?", buttons=["Yes", "No", "Cancel"], default=0, cancel=2, title="Test Dialog") print d.go... | if __name__ == '__main__': def test(): root = Tk() def doit(root=root): d = SimpleDialog(root, text="This is a test dialog. " "Would this have been an actual dialog, " "the buttons below would have been glowing " "in soft pink light.\n" "Do you believe this?", buttons=["Yes", "No", "Cancel"], default=0, cancel=2, tit... | 8,902 |
def doit(root=root): d = SimpleDialog(root, text="This is a test dialog. " "Would this have been an actual dialog, " "the buttons below would have been glowing " "in soft pink light.\n" "Do you believe this?", buttons=["Yes", "No", "Cancel"], default=0, cancel=2, title="Test Dialog") print d.go() | def doit(root=root): d = SimpleDialog(root, text="This is a test dialog. " "Would this have been an actual dialog, " "the buttons below would have been glowing " "in soft pink light.\n" "Do you believe this?", buttons=["Yes", "No", "Cancel"], default=0, cancel=2, title="Test Dialog") print d.go() | 8,903 |
def doit(root=root): d = SimpleDialog(root, text="This is a test dialog. " "Would this have been an actual dialog, " "the buttons below would have been glowing " "in soft pink light.\n" "Do you believe this?", buttons=["Yes", "No", "Cancel"], default=0, cancel=2, title="Test Dialog") print d.go() | def doit(root=root): d = SimpleDialog(root, text="This is a test dialog. " "Would this have been an actual dialog, " "the buttons below would have been glowing " "in soft pink light.\n" "Do you believe this?", buttons=["Yes", "No", "Cancel"], default=0, cancel=2, title="Test Dialog") print d.go() | 8,904 |
def __init__(self, group=None, target=None, name=None, args=(), kwargs={}, verbose=None): assert group is None, "group argument must be None for now" _Verbose.__init__(self, verbose) self.__target = target self.__name = str(name or _newname()) self.__args = args self.__kwargs = kwargs self.__daemonic = self._set_daemon... | def __init__(self, group=None, target=None, name=None, args=(), kwargs=None, verbose=None): assert group is None, "group argument must be None for now" _Verbose.__init__(self, verbose) self.__target = target self.__name = str(name or _newname()) self.__args = args self.__kwargs = kwargs self.__daemonic = self._set_daem... | 8,905 |
def maybe_mutate(): global mutate if not mutate: return if random.random() < 0.5: return if random.random() < 0.5: target, keys = dict1, dict1keys else: target, keys = dict2, dict2keys if random.random() < 0.2: # Insert a new key. mutate = 0 # disable mutation until key inserted while 1: newkey = Horrid(random.rand... | def maybe_mutate(): global mutate if not mutate: return if random.random() < 0.5: return if random.random() < 0.5: target, keys = dict1, dict1keys else: target, keys = dict2, dict2keys if random.random() < 0.2: # Insert a new key. mutate = 0 # disable mutation until key inserted while 1: newkey = Horrid(random.rand... | 8,906 |
def genpluginproject(architecture, module, project=None, projectdir=None, sources=[], sourcedirs=[], libraries=[], extradirs=[], extraexportsymbols=[], outputdir=":::Lib:lib-dynload", libraryflags=None, stdlibraryflags=None, prefixname=None): if architecture == "all": # For the time being we generate two project files.... | def genpluginproject(architecture, module, project=None, projectdir=None, sources=[], sourcedirs=[], libraries=[], extradirs=[], extraexportsymbols=[], outputdir=":::Lib:lib-dynload", libraryflags=None, stdlibraryflags=None, prefixname=None): if architecture == "all": # For the time being we generate two project files.... | 8,907 |
def genpluginproject(architecture, module, project=None, projectdir=None, sources=[], sourcedirs=[], libraries=[], extradirs=[], extraexportsymbols=[], outputdir=":::Lib:lib-dynload", libraryflags=None, stdlibraryflags=None, prefixname=None): if architecture == "all": # For the time being we generate two project files.... | def genpluginproject(architecture, module, project=None, projectdir=None, sources=[], sourcedirs=[], libraries=[], extradirs=[], extraexportsymbols=[], outputdir=":::Lib:lib-dynload", libraryflags=None, stdlibraryflags=None, prefixname=None): if architecture == "all": # For the time being we generate two project files.... | 8,908 |
def genpluginproject(architecture, module, project=None, projectdir=None, sources=[], sourcedirs=[], libraries=[], extradirs=[], extraexportsymbols=[], outputdir=":::Lib:lib-dynload", libraryflags=None, stdlibraryflags=None, prefixname=None): if architecture == "all": # For the time being we generate two project files.... | def genpluginproject(architecture, module, project=None, projectdir=None, sources=[], sourcedirs=[], libraries=[], extradirs=[], extraexportsymbols=[], outputdir=":::Lib:lib-dynload", libraryflags=None, stdlibraryflags=None, prefixname=None): if architecture == "all": # For the time being we generate two project files.... | 8,909 |
def http_error_302(self, req, fp, code, msg, headers): if headers.has_key('location'): newurl = headers['location'] elif headers.has_key('uri'): newurl = headers['uri'] else: return nil = fp.read() fp.close() | def http_error_302(self, req, fp, code, msg, headers): if headers.has_key('location'): newurl = headers['location'] elif headers.has_key('uri'): newurl = headers['uri'] else: return nil = fp.read() fp.close() | 8,910 |
def http_error_302(self, req, fp, code, msg, headers): if headers.has_key('location'): newurl = headers['location'] elif headers.has_key('uri'): newurl = headers['uri'] else: return nil = fp.read() fp.close() | def http_error_302(self, req, fp, code, msg, headers): if headers.has_key('location'): newurl = headers['location'] elif headers.has_key('uri'): newurl = headers['uri'] else: return nil = fp.read() fp.close() | 8,911 |
def do_proxy(self, p, req): p return self.parent.open(req) | def do_proxy(self, p, req): return self.parent.open(req) | 8,912 |
def __init__(self, passwd=None): if passwd is None: passwd = HTTPPassowrdMgr() self.passwd = passwd self.add_password = self.passwd.add_password self.__current_realm = None | def __init__(self, passwd=None): if passwd is None: passwd = HTTPPasswordMgr() self.passwd = passwd self.add_password = self.passwd.add_password self.__current_realm = None | 8,913 |
def build_opener(self): opener = OpenerDirectory() for ph in self.proxy_handlers: if type(ph) == types.ClassType: ph = ph() opener.add_handler(ph) | def build_opener(self): opener = OpenerDirector() for ph in self.proxy_handlers: if type(ph) == types.ClassType: ph = ph() opener.add_handler(ph) | 8,914 |
def _calculate_ratio(matches, length): if length: return 2.0 * matches / length return 1.0 | def _calculate_ratio(matches, length): if length: return 2.0 * matches / length return 1.0 | 8,915 |
def _calculate_ratio(matches, length): if length: return 2.0 * matches / length return 1.0 | def _calculate_ratio(matches, length): if length: return 2.0 * matches / length return 1.0 | 8,916 |
def get_matching_blocks(self): """Return list of triples describing matching subsequences. | def get_matching_blocks(self): """Return list of triples describing matching subsequences. | 8,917 |
def get_matching_blocks(self): """Return list of triples describing matching subsequences. | def get_matching_blocks(self): """Return list of triples describing matching subsequences. | 8,918 |
def get_matching_blocks(self): """Return list of triples describing matching subsequences. | def get_matching_blocks(self): """Return list of triples describing matching subsequences. | 8,919 |
def process_rawq(self): """Transfer from raw queue to cooked queue. | def process_rawq(self): """Transfer from raw queue to cooked queue. | 8,920 |
def process_rawq(self): """Transfer from raw queue to cooked queue. | def process_rawq(self): """Transfer from raw queue to cooked queue. | 8,921 |
def process_rawq(self): """Transfer from raw queue to cooked queue. | def process_rawq(self): """Transfer from raw queue to cooked queue. | 8,922 |
def generate_help (self, header=None): """Generate help text (a list of strings, one per suggested line of output) from the option table for this FancyGetopt object.""" | def generate_help (self, header=None): """Generate help text (a list of strings, one per suggested line of output) from the option table for this FancyGetopt object.""" | 8,923 |
def putrequest(self, method, url, skip_host=0): """Send a request to the server. | def putrequest(self, method, url, skip_host=0, skip_accept_encoding=0): """Send a request to the server. | 8,924 |
def putrequest(self, method, url, skip_host=0): """Send a request to the server. | def putrequest(self, method, url, skip_host=0): """Send a request to the server. | 8,925 |
def putrequest(self, method, url, skip_host=0): """Send a request to the server. | def putrequest(self, method, url, skip_host=0): """Send a request to the server. | 8,926 |
def __repr__(self): return "%.*g" % (self.prec, self) | defverify(float(a).__class__ is float) __repr__(self):verify(float(a).__class__ is float) returnverify(float(a).__class__ is float) "%.*g"verify(float(a).__class__ is float) %verify(float(a).__class__ is float) (self.prec,verify(float(a).__class__ is float) self) | 8,927 |
def upload_file(self, command, pyversion, filename): # Sign if requested if self.sign: gpg_args = ["gpg", "--detach-sign", "-a", filename] if self.identity: gpg_args[2:2] = ["--local-user", self.identity] spawn(gpg_args, dry_run=self.dry_run) | def upload_file(self, command, pyversion, filename): # Sign if requested if self.sign: gpg_args = ["gpg", "--detach-sign", "-a", filename] if self.identity: gpg_args[2:2] = ["--local-user", self.identity] spawn(gpg_args, dry_run=self.dry_run) | 8,928 |
def main(self): | def main(self): | 8,929 |
def main(self): | def main(self): | 8,930 |
def join(self, timeout=None): assert self.__initialized, "Thread.__init__() not called" assert self.__started, "cannot join thread before it is started" assert self is not currentThread(), "cannot join current thread" if __debug__: if not self.__stopped: self._note("%s.join(): waiting until thread stops", self) self.__... | def join(self, timeout=None): assert self.__initialized, "Thread.__init__() not called" assert self.__started, "cannot join thread before it is started" assert self is not currentThread(), "cannot join current thread" if __debug__: if not self.__stopped: self._note("%s.join(): waiting until thread stops", self) self.__... | 8,931 |
def join(self, timeout=None): assert self.__initialized, "Thread.__init__() not called" assert self.__started, "cannot join thread before it is started" assert self is not currentThread(), "cannot join current thread" if __debug__: if not self.__stopped: self._note("%s.join(): waiting until thread stops", self) self.__... | def join(self, timeout=None): assert self.__initialized, "Thread.__init__() not called" assert self.__started, "cannot join thread before it is started" assert self is not currentThread(), "cannot join current thread" if __debug__: if not self.__stopped: self._note("%s.join(): waiting until thread stops", self) self.__... | 8,932 |
def putmessage(self, message): self.debug("putmessage:%d:" % message[0]) try: s = pickle.dumps(message) except pickle.UnpicklingError: print >>sys.__stderr__, "Cannot pickle:", `message` raise s = struct.pack("<i", len(s)) + s while len(s) > 0: try: n = self.sock.send(s) except (AttributeError, socket.error): # socket ... | def putmessage(self, message): self.debug("putmessage:%d:" % message[0]) try: s = pickle.dumps(message) except pickle.PicklingError: print >>sys.__stderr__, "Cannot pickle:", `message` raise s = struct.pack("<i", len(s)) + s while len(s) > 0: try: n = self.sock.send(s) except (AttributeError, socket.error): # socket wa... | 8,933 |
def putmessage(self, message): self.debug("putmessage:%d:" % message[0]) try: s = pickle.dumps(message) except pickle.UnpicklingError: print >>sys.__stderr__, "Cannot pickle:", `message` raise s = struct.pack("<i", len(s)) + s while len(s) > 0: try: n = self.sock.send(s) except (AttributeError, socket.error): # socket ... | def putmessage(self, message): self.debug("putmessage:%d:" % message[0]) try: s = pickle.dumps(message) except pickle.UnpicklingError: print >>sys.__stderr__, "Cannot pickle:", `message` raise s = struct.pack("<i", len(s)) + s while len(s) > 0: try: r, w, x = select.select([], [self.sock], []) n = self.sock.send(s[:BUF... | 8,934 |
def ioready(self, wait): r, w, x = select.select([self.sock.fileno()], [], [], wait) return len(r) | def ioready(self, wait): r, w, x = select.select([self.sock.fileno()], [], [], wait) return len(r) | 8,935 |
def pollpacket(self, wait): self._stage0() if len(self.buffer) < self.bufneed: if not self.ioready(wait): return None try: s = self.sock.recv(BUFSIZE) except socket.error: raise EOFError if len(s) == 0: raise EOFError self.buffer += s self._stage0() return self._stage1() | def pollpacket(self, wait): self._stage0() if len(self.buffer) < self.bufneed: r, w, x = select.select([self.sock.fileno()], [], [], wait) if len(r) == 0: return None try: s = self.sock.recv(BUFSIZE) except socket.error: raise EOFError if len(s) == 0: raise EOFError self.buffer += s self._stage0() return self._stage1() | 8,936 |
def pollmessage(self, wait): packet = self.pollpacket(wait) if packet is None: return None try: message = pickle.loads(packet) except: print >>sys.__stderr__, "-----------------------" print >>sys.__stderr__, "cannot unpickle packet:", `packet` traceback.print_stack(file=sys.__stderr__) print >>sys.__stderr__, "-------... | def pollmessage(self, wait): packet = self.pollpacket(wait) if packet is None: return None try: message = pickle.loads(packet) except pickle.UnpicklingError: print >>sys.__stderr__, "-----------------------" print >>sys.__stderr__, "cannot unpickle packet:", `packet` traceback.print_stack(file=sys.__stderr__) print >>s... | 8,937 |
def run (self): self.mkpath(self.install_dir) for f in self.data_files: if type(f) == StringType: # it's a simple file, so copy it f = convert_path(f) if self.warn_dir: self.warn("setup script did not provide a directory for " "'%s' -- installing right in '%s'" % (f, self.install_dir)) (out, _) = self.copy_file(f, self... | def run (self): self.mkpath(self.install_dir) for f in self.data_files: if type(f) == StringType: # it's a simple file, so copy it f = convert_path(f) if self.warn_dir: self.warn("setup script did not provide a directory for " "'%s' -- installing right in '%s'" % (f, self.install_dir)) (out, _) = self.copy_file(f, self... | 8,938 |
def close(self): if self.editgroup.editor.changed: import EasyDialogs from Carbon import Qd Qd.InitCursor() save = EasyDialogs.AskYesNoCancel('Save window "%s" before closing?' % self.title, default=1, no="Don\xd5t save") if save > 0: if self.domenu_save(): return 1 elif save < 0: return 1 self.globals = None W.Window.... | def close(self): if self.editgroup.editor.changed: import EasyDialogs Qd.InitCursor() save = EasyDialogs.AskYesNoCancel('Save window "%s" before closing?' % self.title, default=1, no="Don\xd5t save") if save > 0: if self.domenu_save(): return 1 elif save < 0: return 1 self.globals = None W.Window.close(self) | 8,939 |
def _run(self): if self.run_with_interpreter: if self.editgroup.editor.changed: import EasyDialogs import Qd; Qd.InitCursor() save = EasyDialogs.AskYesNoCancel('Save "%s" before running?' % self.title, 1) if save > 0: if self.domenu_save(): return elif save < 0: return if not self.path: raise W.AlertError, "Can't run u... | def _run(self): if self.run_with_interpreter: if self.editgroup.editor.changed: import EasyDialogs Qd.InitCursor() save = EasyDialogs.AskYesNoCancel('Save "%s" before running?' % self.title, 1) if save > 0: if self.domenu_save(): return elif save < 0: return if not self.path: raise W.AlertError, "Can't run unsaved file... | 8,940 |
def _run(self): if self.run_with_interpreter: if self.editgroup.editor.changed: import EasyDialogs import Qd; Qd.InitCursor() save = EasyDialogs.AskYesNoCancel('Save "%s" before running?' % self.title, 1) if save > 0: if self.domenu_save(): return elif save < 0: return if not self.path: raise W.AlertError, "Can't run u... | def _run(self): if self.run_with_interpreter: if self.editgroup.editor.changed: import EasyDialogs import Qd; Qd.InitCursor() save = EasyDialogs.AskYesNoCancel('Save "%s" before running?' % self.title, 1) if save > 0: if self.domenu_save(): return elif save < 0: return if not self.path: raise W.AlertError, "Can't run u... | 8,941 |
def _run(self): if self.run_with_interpreter: if self.editgroup.editor.changed: import EasyDialogs import Qd; Qd.InitCursor() save = EasyDialogs.AskYesNoCancel('Save "%s" before running?' % self.title, 1) if save > 0: if self.domenu_save(): return elif save < 0: return if not self.path: raise W.AlertError, "Can't run u... | def _run(self): if self.run_with_interpreter: if self.editgroup.editor.changed: import EasyDialogs Qd.InitCursor() save = EasyDialogs.AskYesNoCancel('Save "%s" before running?' % self.title, 1) if save > 0: if self.domenu_save(): return elif save < 0: return if not self.path: raise W.AlertError, "Can't run unsaved file... | 8,942 |
def post_to_server(self, data, auth=None): ''' Post a query to the server, and return a string response. ''' | def post_to_server(self, data, auth=None): ''' Post a query to the server, and return a string response. ''' | 8,943 |
def __init__(self, fp, factory=rfc822.Message): self.fp = fp self.seekp = 0 self.factory = factory | def __init__(self, fp, factory=rfc822.Message): self.fp = fp self.seekp = 0 self.factory = factory | 8,944 |
def __init__(self, buf = ''): # Force self.buf to be a string or unicode if not isinstance(buf, basestring): buf = str(buf) self.buf = buf self.len = len(buf) self.buflist = [] self.pos = 0 self.closed = 0 self.softspace = 0 | def __init__(self, buf = ''): # Force self.buf to be a string or unicode if not isinstance(buf, basestring): buf = str(buf) self.buf = buf self.len = len(buf) self.buflist = [] self.pos = 0 self.closed = False self.softspace = 0 | 8,945 |
def close(self): """Free the memory buffer. """ if not self.closed: self.closed = 1 del self.buf, self.pos | def close(self): """Free the memory buffer. """ if not self.closed: self.closed = True del self.buf, self.pos | 8,946 |
def isatty(self): if self.closed: raise ValueError, "I/O operation on closed file" return False | def isatty(self): _complain_ifclosed(self.closed) return False | 8,947 |
def seek(self, pos, mode = 0): if self.closed: raise ValueError, "I/O operation on closed file" if self.buflist: self.buf += ''.join(self.buflist) self.buflist = [] if mode == 1: pos += self.pos elif mode == 2: pos += self.len self.pos = max(0, pos) | def seek(self, pos, mode = 0): _complain_ifclosed(self.closed) if self.buflist: self.buf += ''.join(self.buflist) self.buflist = [] if mode == 1: pos += self.pos elif mode == 2: pos += self.len self.pos = max(0, pos) | 8,948 |
def tell(self): if self.closed: raise ValueError, "I/O operation on closed file" return self.pos | def tell(self): _complain_ifclosed(self.closed) return self.pos | 8,949 |
def read(self, n = -1): if self.closed: raise ValueError, "I/O operation on closed file" if self.buflist: self.buf += ''.join(self.buflist) self.buflist = [] if n < 0: newpos = self.len else: newpos = min(self.pos+n, self.len) r = self.buf[self.pos:newpos] self.pos = newpos return r | def read(self, n = -1): _complain_ifclosed(self.closed) if self.buflist: self.buf += ''.join(self.buflist) self.buflist = [] if n < 0: newpos = self.len else: newpos = min(self.pos+n, self.len) r = self.buf[self.pos:newpos] self.pos = newpos return r | 8,950 |
def readline(self, length=None): if self.closed: raise ValueError, "I/O operation on closed file" if self.buflist: self.buf += ''.join(self.buflist) self.buflist = [] i = self.buf.find('\n', self.pos) if i < 0: newpos = self.len else: newpos = i+1 if length is not None: if self.pos + length < newpos: newpos = self.pos ... | def readline(self, length=None): _complain_ifclosed(self.closed) if self.buflist: self.buf += ''.join(self.buflist) self.buflist = [] i = self.buf.find('\n', self.pos) if i < 0: newpos = self.len else: newpos = i+1 if length is not None: if self.pos + length < newpos: newpos = self.pos + length r = self.buf[self.pos:ne... | 8,951 |
def truncate(self, size=None): if self.closed: raise ValueError, "I/O operation on closed file" if size is None: size = self.pos elif size < 0: raise IOError(EINVAL, "Negative size not allowed") elif size < self.pos: self.pos = size self.buf = self.getvalue()[:size] | def truncate(self, size=None): _complain_ifclosed(self.closed) if size is None: size = self.pos elif size < 0: raise IOError(EINVAL, "Negative size not allowed") elif size < self.pos: self.pos = size self.buf = self.getvalue()[:size] | 8,952 |
def write(self, s): if self.closed: raise ValueError, "I/O operation on closed file" if not s: return # Force s to be a string or unicode if not isinstance(s, basestring): s = str(s) if self.pos == self.len: self.buflist.append(s) self.len = self.pos = self.pos + len(s) return if self.pos > self.len: self.buflist.appen... | def write(self, s): _complain_ifclosed(self.closed) if not s: return # Force s to be a string or unicode if not isinstance(s, basestring): s = str(s) if self.pos == self.len: self.buflist.append(s) self.len = self.pos = self.pos + len(s) return if self.pos > self.len: self.buflist.append('\0'*(self.pos - self.len)) sel... | 8,953 |
def flush(self): if self.closed: raise ValueError, "I/O operation on closed file" | def flush(self): if self.closed: raise ValueError, "I/O operation on closed file" | 8,954 |
def softspace(file, newvalue): oldvalue = 0 try: oldvalue = file.softspace except AttributeError: pass try: file.softspace = newvalue except TypeError: # "attribute-less object" or "read-only attributes" pass return oldvalue | def softspace(file, newvalue): oldvalue = 0 try: oldvalue = file.softspace except AttributeError: pass try: file.softspace = newvalue except (AttributeError, TypeError): # "attribute-less object" or "read-only attributes" pass return oldvalue | 8,955 |
def strptime(data_string, format="%a %b %d %H:%M:%S %Y"): """Return a time struct based on the input data and the format string.""" global _locale_cache global _regex_cache locale_time = _locale_cache.locale_time # If the language changes, caches are invalidated, so clear them if locale_time.lang != _getlang(): _locale... | def strptime(data_string, format="%a %b %d %H:%M:%S %Y"): """Return a time struct based on the input data and the format string.""" global _locale_cache global _regex_cache locale_time = _locale_cache.locale_time # If the language changes, caches are invalidated, so clear them if locale_time.lang != _getlang(): _locale... | 8,956 |
def reload(self, module, path=None): if path is None and hasattr(module, '__filename__'): head, tail = os.path.split(module.__filename__) path = [os.path.join(head, '')] return ihooks.ModuleImporter.reload(self, module, path) | def reload(self, module, path=None): if path is None and hasattr(module, '__filename__'): head, tail = os.path.split(module.__filename__) path = [os.path.join(head, '')] return ihooks.ModuleImporter.reload(self, module, path) | 8,957 |
def open_local_file(self, url): """Use local file.""" import mimetypes, mimetools, StringIO mtype = mimetypes.guess_type(url)[0] headers = mimetools.Message(StringIO.StringIO( 'Content-Type: %s\n' % (mtype or 'text/plain'))) host, file = splithost(url) if not host: urlfile = file if file[:1] == '/': urlfile = 'file://'... | def open_local_file(self, url): """Use local file.""" import mimetypes, mimetools, StringIO mtype = mimetypes.guess_type(url)[0] headers = mimetools.Message(StringIO.StringIO( 'Content-Type: %s\nContent-Length: %d\nLast-modified: %s\n' % (mtype or 'text/plain', size, modified))) if not host: urlfile = file if file[:1] ... | 8,958 |
def open_local_file(self, url): """Use local file.""" import mimetypes, mimetools, StringIO mtype = mimetypes.guess_type(url)[0] headers = mimetools.Message(StringIO.StringIO( 'Content-Type: %s\n' % (mtype or 'text/plain'))) host, file = splithost(url) if not host: urlfile = file if file[:1] == '/': urlfile = 'file://'... | def open_local_file(self, url): """Use local file.""" import mimetypes, mimetools, StringIO mtype = mimetypes.guess_type(url)[0] headers = mimetools.Message(StringIO.StringIO( 'Content-Type: %s\n' % (mtype or 'text/plain'))) host, file = splithost(url) if not host: urlfile = file if file[:1] == '/': urlfile = 'file://'... | 8,959 |
def open_local_file(self, url): """Use local file.""" import mimetypes, mimetools, StringIO mtype = mimetypes.guess_type(url)[0] headers = mimetools.Message(StringIO.StringIO( 'Content-Type: %s\n' % (mtype or 'text/plain'))) host, file = splithost(url) if not host: urlfile = file if file[:1] == '/': urlfile = 'file://'... | def open_local_file(self, url): """Use local file.""" import mimetypes, mimetools, StringIO mtype = mimetypes.guess_type(url)[0] headers = mimetools.Message(StringIO.StringIO( 'Content-Type: %s\n' % (mtype or 'text/plain'))) host, file = splithost(url) if not host: urlfile = file if file[:1] == '/': urlfile = 'file://'... | 8,960 |
def main(builder=None): if builder is None: builder = AppBuilder(verbosity=1) shortopts = "b:n:r:e:m:c:p:lx:i:hvq" longopts = ("builddir=", "name=", "resource=", "executable=", "mainprogram=", "creator=", "nib=", "plist=", "link", "link-exec", "help", "verbose", "quiet", "standalone", "exclude=", "include=", "package=... | def main(builder=None): if builder is None: builder = AppBuilder(verbosity=1) shortopts = "b:n:r:e:m:c:p:lx:i:hvq" longopts = ("builddir=", "name=", "resource=", "executable=", "mainprogram=", "creator=", "nib=", "plist=", "link", "link-exec", "help", "verbose", "quiet", "standalone", "exclude=", "include=", "package=... | 8,961 |
def test_bogus_boundary(self): fp = openfile(findfile('msg_15.txt')) try: data = fp.read() finally: fp.close() p = Parser() # Note, under a future non-strict parsing mode, this would parse the # message into the intended message tree. self.assertRaises(Errors.BoundaryError, p.parsestr, data) | def test_bogus_boundary(self): fp = openfile(findfile('msg_15.txt')) try: data = fp.read() finally: fp.close() p = Parser(strict=1) # Note, under a future non-strict parsing mode, this would parse the # message into the intended message tree. self.assertRaises(Errors.BoundaryError, p.parsestr, data) | 8,962 |
def outputCheckNewArg(self): Output("""if (itself == NULL) { Py_INCREF(Py_None); return Py_None; }""") | def outputCheckNewArg(self): Output("""if (itself == NULL) { Py_INCREF(Py_None); return Py_None; }""") | 8,963 |
def isabs(s): s = splitdrive(s)[1] return s != '' and s[:1] in '/\\' | def isabs(s): s = splitdrive(s)[1] return s != '' and s[:1] in '/\\' | 8,964 |
def get(self, section, option, raw=0, vars=None): """Get an option value for a given section. | def get(self, section, option, raw=0, vars=None): """Get an option value for a given section. | 8,965 |
def getboolean(self, section, option): v = self.get(section, option) val = string.atoi(v) if val not in (0, 1): raise ValueError, 'Not a boolean: %s' % v return val | def getboolean(self, section, option): v = self.get(section, option) val = string.atoi(v) if val not in (0, 1): raise ValueError, 'Not a boolean: %s' % v return val | 8,966 |
def getboolean(self, section, option): v = self.get(section, option) val = string.atoi(v) if val not in (0, 1): raise ValueError, 'Not a boolean: %s' % v return val | def getboolean(self, section, option): v = self.get(section, option) val = string.atoi(v) if val not in (0, 1): raise ValueError, 'Not a boolean: %s' % v return val | 8,967 |
def __read(self, fp): """Parse a sectioned setup file. | def __read(self, fp): """Parse a sectioned setup file. | 8,968 |
def __read(self, fp): """Parse a sectioned setup file. | def __read(self, fp): """Parse a sectioned setup file. | 8,969 |
def main(): # overridable context prefix = PREFIX # settable with -p option extensions = [] path = sys.path # output files frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' # normally derived from script name makefile = 'Makefile' # parse command line try: opts, args = getopt.getopt(sys.argv[1:], 'e:p:'... | def main(): # overridable context prefix = PREFIX # settable with -p option extensions = [] path = sys.path # output files frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' # normally derived from script name makefile = 'Makefile' # parse command line try: opts, args = getopt.getopt(sys.argv[1:], 'e:p:P... | 8,970 |
def main(): # overridable context prefix = PREFIX # settable with -p option extensions = [] path = sys.path # output files frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' # normally derived from script name makefile = 'Makefile' # parse command line try: opts, args = getopt.getopt(sys.argv[1:], 'e:p:'... | def main(): # overridable context prefix = PREFIX # settable with -p option extensions = [] path = sys.path # output files frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' # normally derived from script name makefile = 'Makefile' # parse command line try: opts, args = getopt.getopt(sys.argv[1:], 'e:p:'... | 8,971 |
def main(): # overridable context prefix = PREFIX # settable with -p option extensions = [] path = sys.path # output files frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' # normally derived from script name makefile = 'Makefile' # parse command line try: opts, args = getopt.getopt(sys.argv[1:], 'e:p:'... | def main(): # overridable context prefix = PREFIX # settable with -p option extensions = [] path = sys.path # output files frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' # normally derived from script name makefile = 'Makefile' # parse command line try: opts, args = getopt.getopt(sys.argv[1:], 'e:p:'... | 8,972 |
def main(): # overridable context prefix = PREFIX # settable with -p option extensions = [] path = sys.path # output files frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' # normally derived from script name makefile = 'Makefile' # parse command line try: opts, args = getopt.getopt(sys.argv[1:], 'e:p:'... | def main(): # overridable context prefix = PREFIX # settable with -p option extensions = [] path = sys.path # output files frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' # normally derived from script name makefile = 'Makefile' # parse command line try: opts, args = getopt.getopt(sys.argv[1:], 'e:p:'... | 8,973 |
def main(): # overridable context prefix = PREFIX # settable with -p option extensions = [] path = sys.path # output files frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' # normally derived from script name makefile = 'Makefile' # parse command line try: opts, args = getopt.getopt(sys.argv[1:], 'e:p:'... | def main(): # overridable context prefix = PREFIX # settable with -p option extensions = [] path = sys.path # output files frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' # normally derived from script name makefile = 'Makefile' # parse command line try: opts, args = getopt.getopt(sys.argv[1:], 'e:p:'... | 8,974 |
def main(): # overridable context prefix = PREFIX # settable with -p option extensions = [] path = sys.path # output files frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' # normally derived from script name makefile = 'Makefile' # parse command line try: opts, args = getopt.getopt(sys.argv[1:], 'e:p:'... | def main(): # overridable context prefix = PREFIX # settable with -p option extensions = [] path = sys.path # output files frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' # normally derived from script name makefile = 'Makefile' # parse command line try: opts, args = getopt.getopt(sys.argv[1:], 'e:p:'... | 8,975 |
def stopped(): print 'pydoc server stopped' | def stopped(): print 'pydoc server stopped' | 8,976 |
def stopped(): print 'pydoc server stopped' | def stopped(): print 'pydoc server stopped' | 8,977 |
def trace_dispatch(self, frame, event, arg): timer = self.timer t = timer() t = t[0] + t[1] - self.t - self.bias | def trace_dispatch(self, frame, event, arg): timer = self.timer t = timer() t = t[0] + t[1] - self.t - self.bias | 8,978 |
def trace_dispatch_i(self, frame, event, arg): timer = self.timer t = timer() - self.t - self.bias | def trace_dispatch_i(self, frame, event, arg): timer = self.timer t = timer() - self.t - self.bias | 8,979 |
def trace_dispatch_mac(self, frame, event, arg): timer = self.timer t = timer()/60.0 - self.t - self.bias | def trace_dispatch_mac(self, frame, event, arg): timer = self.timer t = timer()/60.0 - self.t - self.bias | 8,980 |
def trace_dispatch_l(self, frame, event, arg): get_time = self.get_time t = get_time() - self.t - self.bias | def trace_dispatch_l(self, frame, event, arg): get_time = self.get_time t = get_time() - self.t - self.bias | 8,981 |
def _make_spec_file(self): """Generate the text of an RPM spec file and return it as a list of strings (one per line). """ # definitions and headers spec_file = [ '%define name ' + self.distribution.get_name(), '%define version ' + self.distribution.get_version(), '%define release ' + self.release, '', 'Summary: ' + se... | def _make_spec_file(self): """Generate the text of an RPM spec file and return it as a list of strings (one per line). """ # definitions and headers spec_file = [ '%define name ' + self.distribution.get_name(), '%define version ' + self.distribution.get_version(), '%define release ' + self.release, '', 'Summary: ' + se... | 8,982 |
def compile (self, sources, output_dir=None, macros=None, include_dirs=None, extra_preargs=None, extra_postargs=None): """Compile one or more C/C++ source files. 'sources' must be a list of strings, each one the name of a C/C++ source file. Return a list of the object filenames generated (one for each source filename... | def compile (self, sources, output_dir=None, macros=None, include_dirs=None, extra_preargs=None, extra_postargs=None): """Compile one or more C/C++ source files. 'sources' must be a list of strings, each one the name of a C/C++ source file. Return a list of the object filenames generated (one for each source filename... | 8,983 |
def link_static_lib (self, objects, output_libname, output_dir=None): """Link a bunch of stuff together to create a static library file. The "bunch of stuff" consists of the list of object files supplied as 'objects', the extra object files supplied to 'add_link_object()' and/or 'set_link_objects()', the libraries sup... | def link_static_lib (self, objects, output_libname, output_dir=None, debug=0): """Link a bunch of stuff together to create a static library file. The "bunch of stuff" consists of the list of object files supplied as 'objects', the extra object files supplied to 'add_link_object()' and/or 'set_link_objects()', the libr... | 8,984 |
def link_static_lib (self, objects, output_libname, output_dir=None): """Link a bunch of stuff together to create a static library file. The "bunch of stuff" consists of the list of object files supplied as 'objects', the extra object files supplied to 'add_link_object()' and/or 'set_link_objects()', the libraries sup... | def link_static_lib (self, objects, output_libname, output_dir=None): """Link a bunch of stuff together to create a static library file. The "bunch of stuff" consists of the list of object files supplied as 'objects', the extra object files supplied to 'add_link_object()' and/or 'set_link_objects()', the libraries sup... | 8,985 |
def link_static_lib (self, objects, output_libname, output_dir=None): """Link a bunch of stuff together to create a static library file. The "bunch of stuff" consists of the list of object files supplied as 'objects', the extra object files supplied to 'add_link_object()' and/or 'set_link_objects()', the libraries sup... | def link_static_lib (self, objects, output_libname, output_dir=None): """Link a bunch of stuff together to create a static library file. The "bunch of stuff" consists of the list of object files supplied as 'objects', the extra object files supplied to 'add_link_object()' and/or 'set_link_objects()', the libraries sup... | 8,986 |
def fullmodname(path): """Return a plausible module name for the path.""" # If the file 'path' is part of a package, then the filename isn't # enough to uniquely identify it. Try to do the right thing by # looking in sys.path for the longest matching prefix. We'll # assume that the rest is the package name. longest... | def fullmodname(path): """Return a plausible module name for the path.""" # If the file 'path' is part of a package, then the filename isn't # enough to uniquely identify it. Try to do the right thing by # looking in sys.path for the longest matching prefix. We'll # assume that the rest is the package name. longest... | 8,987 |
def write_results_file(self, path, lines, lnotab, lines_hit): """Return a coverage results file in path.""" | def write_results_file(self, path, lines, lnotab, lines_hit): """Return a coverage results file in path.""" | 8,988 |
def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append | def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append | 8,989 |
def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append | def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append | 8,990 |
def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append | def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append | 8,991 |
def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append | def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append | 8,992 |
def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append | def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append | 8,993 |
def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append | def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append | 8,994 |
def output(self, attrs=None, header="Set-Cookie:", sep="\n"): """Return a string suitable for HTTP.""" result = [] items = self.items() items.sort() for K,V in items: result.append( V.output(attrs, header) ) return sep.join(result) | def output(self, attrs=None, header="Set-Cookie:", sep="\015\012"): """Return a string suitable for HTTP.""" result = [] items = self.items() items.sort() for K,V in items: result.append( V.output(attrs, header) ) return sep.join(result) | 8,995 |
def __repr__(self): L = [] items = self.items() items.sort() for K,V in items: L.append( '%s=%s' % (K,repr(V.value) ) ) return '<%s: %s>' % (self.__class__.__name__, _spacejoin(L)) | def __repr__(self): L = [] items = self.items() items.sort() for K,V in items: L.append( '%s=%s' % (K,repr(V.value) ) ) return '<%s: %s>' % (self.__class__.__name__, _spacejoin(L)) | 8,996 |
def __init__(self, server_address, RequestHandlerClass): """Constructor. May be extended, do not override.""" self.server_address = server_address self.RequestHandlerClass = RequestHandlerClass self.socket = socket.socket(self.address_family, self.socket_type) self.server_bind() self.server_activate() | def __init__(self, server_address, RequestHandlerClass): """Constructor. May be extended, do not override.""" self.server_address = server_address self.RequestHandlerClass = RequestHandlerClass self.socket = socket.socket(self.address_family, self.socket_type) self.server_bind() self.server_activate() | 8,997 |
def server_activate(self): """Called by constructor to activate the server. | def server_activate(self): """Called by constructor to activate the server. | 8,998 |
def get_request(self): """Get the request and client address from the socket. | def get_request(self): """Get the request and client address from the socket. | 8,999 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.