bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def create_socket (self, family, type): self.family_and_type = family, type self.socket = socket.socket (family, type) self.socket.setblocking(0) self._fileno = self.socket.fileno() self.add_channel()
def create_socket(self, family, type): self.family_and_type = family, type self.socket = socket.socket (family, type) self.socket.setblocking(0) self._fileno = self.socket.fileno() self.add_channel()
9,200
def create_socket (self, family, type): self.family_and_type = family, type self.socket = socket.socket (family, type) self.socket.setblocking(0) self._fileno = self.socket.fileno() self.add_channel()
def create_socket (self, family, type): self.family_and_type = family, type self.socket = socket.socket(family, type) self.socket.setblocking(0) self._fileno = self.socket.fileno() self.add_channel()
9,201
def set_socket (self, sock, map=None): self.socket = sock
def set_socket(self, sock, map=None): self.socket = sock
9,202
def set_socket (self, sock, map=None): self.socket = sock
def set_socket (self, sock, map=None): self.socket = sock
9,203
def set_reuse_addr (self): # try to re-use a server port if possible try: self.socket.setsockopt ( socket.SOL_SOCKET, socket.SO_REUSEADDR, self.socket.getsockopt (socket.SOL_SOCKET, socket.SO_REUSEADDR) | 1 ) except socket.error: pass
def set_reuse_addr (self): # try to re-use a server port if possible try: self.socket.setsockopt( socket.SOL_SOCKET, socket.SO_REUSEADDR, self.socket.getsockopt (socket.SOL_SOCKET, socket.SO_REUSEADDR) | 1 ) except socket.error: pass
9,204
def set_reuse_addr (self): # try to re-use a server port if possible try: self.socket.setsockopt ( socket.SOL_SOCKET, socket.SO_REUSEADDR, self.socket.getsockopt (socket.SOL_SOCKET, socket.SO_REUSEADDR) | 1 ) except socket.error: pass
def set_reuse_addr (self): # try to re-use a server port if possible try: self.socket.setsockopt ( socket.SOL_SOCKET, socket.SO_REUSEADDR, self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR) | 1 ) except socket.error: pass
9,205
def readable (self): return True
def readable(self): return True
9,206
def writable (self): return not self.accepting
def writable(self): return not self.accepting
9,207
def writable (self): return True
def writable(self): return True
9,208
def listen (self, num): self.accepting = 1 if os.name == 'nt' and num > 5: num = 1 return self.socket.listen (num)
def listen(self, num): self.accepting = 1 if os.name == 'nt' and num > 5: num = 1 return self.socket.listen (num)
9,209
def listen (self, num): self.accepting = 1 if os.name == 'nt' and num > 5: num = 1 return self.socket.listen (num)
def listen (self, num): self.accepting = 1 if os.name == 'nt' and num > 5: num = 1 return self.socket.listen (num)
9,210
def bind (self, addr): self.addr = addr return self.socket.bind (addr)
def bind (self, addr): self.addr = addr return self.socket.bind (addr)
9,211
def accept (self): # XXX can return either an address pair or None try: conn, addr = self.socket.accept() return conn, addr except socket.error, why: if why[0] == EWOULDBLOCK: pass else: raise socket.error, why
def accept(self): # XXX can return either an address pair or None try: conn, addr = self.socket.accept() return conn, addr except socket.error, why: if why[0] == EWOULDBLOCK: pass else: raise socket.error, why
9,212
def send (self, data): try: result = self.socket.send (data) return result except socket.error, why: if why[0] == EWOULDBLOCK: return 0 else: raise socket.error, why return 0
def send(self, data): try: result = self.socket.send(data) return result except socket.error, why: if why[0] == EWOULDBLOCK: return 0 else: raise socket.error, why return 0
9,213
def recv (self, buffer_size): try: data = self.socket.recv (buffer_size) if not data: # a closed connection is indicated by signaling # a read condition, and having recv() return 0. self.handle_close() return '' else: return data except socket.error, why: # winsock sometimes throws ENOTCONN if why[0] in [ECONNRESET, EN...
def recv(self, buffer_size): try: data = self.socket.recv(buffer_size) if not data: # a closed connection is indicated by signaling # a read condition, and having recv() return 0. self.handle_close() return '' else: return data except socket.error, why: # winsock sometimes throws ENOTCONN if why[0] in [ECONNRESET, ENOT...
9,214
def close (self): self.del_channel() self.socket.close()
def close(self): self.del_channel() self.socket.close()
9,215
def __getattr__ (self, attr): return getattr (self.socket, attr)
def __getattr__ (self, attr): return getattr (self.socket, attr)
9,216
def log (self, message): sys.stderr.write ('log: %s\n' % str(message))
def log (self, message): sys.stderr.write ('log: %s\n' % str(message))
9,217
def handle_read_event (self): if self.accepting: # for an accepting socket, getting a read implies # that we are connected if not self.connected: self.connected = 1 self.handle_accept() elif not self.connected: self.handle_connect() self.connected = 1 self.handle_read() else: self.handle_read()
def handle_read_event(self): if self.accepting: # for an accepting socket, getting a read implies # that we are connected if not self.connected: self.connected = 1 self.handle_accept() elif not self.connected: self.handle_connect() self.connected = 1 self.handle_read() else: self.handle_read()
9,218
def handle_write_event (self): # getting a write implies that we are connected if not self.connected: self.handle_connect() self.connected = 1 self.handle_write()
def handle_write_event(self): # getting a write implies that we are connected if not self.connected: self.handle_connect() self.connected = 1 self.handle_write()
9,219
def handle_expt_event (self): self.handle_expt()
def handle_expt_event(self): self.handle_expt()
9,220
def handle_error (self): nil, t, v, tbinfo = compact_traceback()
def handle_error(self): nil, t, v, tbinfo = compact_traceback()
9,221
def handle_error (self): nil, t, v, tbinfo = compact_traceback()
def handle_error (self): nil, t, v, tbinfo = compact_traceback()
9,222
def handle_error (self): nil, t, v, tbinfo = compact_traceback()
def handle_error (self): nil, t, v, tbinfo = compact_traceback()
9,223
def handle_expt (self): self.log_info ('unhandled exception', 'warning')
def handle_expt (self): self.log_info ('unhandled exception', 'warning')
9,224
def handle_close (self): self.log_info ('unhandled close event', 'warning') self.close()
def handle_close (self): self.log_info ('unhandled close event', 'warning') self.close()
9,225
def initiate_send (self): num_sent = 0 num_sent = dispatcher.send (self, self.out_buffer[:512]) self.out_buffer = self.out_buffer[num_sent:]
def initiate_send(self): num_sent = 0 num_sent = dispatcher.send (self, self.out_buffer[:512]) self.out_buffer = self.out_buffer[num_sent:]
9,226
def initiate_send (self): num_sent = 0 num_sent = dispatcher.send (self, self.out_buffer[:512]) self.out_buffer = self.out_buffer[num_sent:]
def initiate_send (self): num_sent = 0 num_sent = dispatcher.send(self, self.out_buffer[:512]) self.out_buffer = self.out_buffer[num_sent:]
9,227
def handle_write (self): self.initiate_send()
def handle_write(self): self.initiate_send()
9,228
def writable (self): return (not self.connected) or len(self.out_buffer)
def writable(self): return (not self.connected) or len(self.out_buffer)
9,229
def send (self, data): if self.debug: self.log_info ('sending %s' % repr(data)) self.out_buffer = self.out_buffer + data self.initiate_send()
def send(self, data): if self.debug: self.log_info ('sending %s' % repr(data)) self.out_buffer = self.out_buffer + data self.initiate_send()
9,230
def send (self, data): if self.debug: self.log_info ('sending %s' % repr(data)) self.out_buffer = self.out_buffer + data self.initiate_send()
def send (self, data): if self.debug: self.log_info('sending %s' % repr(data)) self.out_buffer = self.out_buffer + data self.initiate_send()
9,231
def compact_traceback (): t,v,tb = sys.exc_info() tbinfo = [] while 1: tbinfo.append (( tb.tb_frame.f_code.co_filename, tb.tb_frame.f_code.co_name, str(tb.tb_lineno) )) tb = tb.tb_next if not tb: break # just to be safe del tb file, function, line = tbinfo[-1] info = '[' + '] ['.join(map(lambda x: '|'.join(x), tbinfo...
def compact_traceback(): t,v,tb = sys.exc_info() tbinfo = [] while 1: tbinfo.append (( tb.tb_frame.f_code.co_filename, tb.tb_frame.f_code.co_name, str(tb.tb_lineno) )) tb = tb.tb_next if not tb: break # just to be safe del tb file, function, line = tbinfo[-1] info = '[' + '] ['.join(map(lambda x: '|'.join(x), tbinfo)...
9,232
def compact_traceback (): t,v,tb = sys.exc_info() tbinfo = [] while 1: tbinfo.append (( tb.tb_frame.f_code.co_filename, tb.tb_frame.f_code.co_name, str(tb.tb_lineno) )) tb = tb.tb_next if not tb: break # just to be safe del tb file, function, line = tbinfo[-1] info = '[' + '] ['.join(map(lambda x: '|'.join(x), tbinfo...
def compact_traceback (): t,v,tb = sys.exc_info() tbinfo = [] while 1: tbinfo.append(( tb.tb_frame.f_code.co_filename, tb.tb_frame.f_code.co_name, str(tb.tb_lineno) )) tb = tb.tb_next if not tb: break # just to be safe del tb file, function, line = tbinfo[-1] info = '[' + '] ['.join(map(lambda x: '|'.join(x), tbinfo)...
9,233
def close_all (map=None): if map is None: map=socket_map for x in map.values(): x.socket.close() map.clear()
def close_all(map=None): if map is None: map=socket_map for x in map.values(): x.socket.close() map.clear()
9,234
def close_all (map=None): if map is None: map=socket_map for x in map.values(): x.socket.close() map.clear()
def close_all (map=None): if map is None: map = socket_map for x in map.values(): x.socket.close() map.clear()
9,235
def __init__ (self, fd): self.fd = fd
def __init__(self, fd): self.fd = fd
9,236
def recv (self, *args): return os.read(self.fd, *args)
def recv(self, *args): return os.read(self.fd, *args)
9,237
def send (self, *args): return os.write(self.fd, *args)
def send(self, *args): return os.write(self.fd, *args)
9,238
def close (self): return os.close (self.fd)
def close (self): return os.close (self.fd)
9,239
def fileno (self): return self.fd
def fileno (self): return self.fd
9,240
def __init__ (self, fd): dispatcher.__init__ (self) self.connected = 1 # set it to non-blocking mode flags = fcntl.fcntl (fd, fcntl.F_GETFL, 0) flags = flags | os.O_NONBLOCK fcntl.fcntl (fd, fcntl.F_SETFL, flags) self.set_file (fd)
def __init__ (self, fd): dispatcher.__init__ (self) self.connected = 1 # set it to non-blocking mode flags = fcntl.fcntl(fd, fcntl.F_GETFL, 0) flags = flags | os.O_NONBLOCK fcntl.fcntl (fd, fcntl.F_SETFL, flags) self.set_file (fd)
9,241
def __init__ (self, fd): dispatcher.__init__ (self) self.connected = 1 # set it to non-blocking mode flags = fcntl.fcntl (fd, fcntl.F_GETFL, 0) flags = flags | os.O_NONBLOCK fcntl.fcntl (fd, fcntl.F_SETFL, flags) self.set_file (fd)
def __init__ (self, fd): dispatcher.__init__ (self) self.connected = 1 # set it to non-blocking mode flags = fcntl.fcntl (fd, fcntl.F_GETFL, 0) flags = flags | os.O_NONBLOCK fcntl.fcntl (fd, fcntl.F_SETFL, flags) self.set_file (fd)
9,242
def __calc_date_time(self): # Set self.__date_time, self.__date, & self.__time by using # time.strftime().
def __calc_date_time(self): # Set self.__date_time, self.__date, & self.__time by using # time.strftime().
9,243
def __calc_date_time(self): # Set self.__date_time, self.__date, & self.__time by using # time.strftime().
def __calc_date_time(self): # Set self.__date_time, self.__date, & self.__time by using # time.strftime().
9,244
def __seqToRE(self, to_convert, directive): """Convert a list to a regex string for matching directive.""" def sorter(a, b): """Sort based on length.
def __seqToRE(self, to_convert, directive): """Convert a list to a regex string for matching a directive.""" def sorter(a, b): """Sort based on length.
9,245
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. The format argument may either be a regular expression object compiled by strptime(), or a format string. If False is passed in for data_string then the re object calculated for format will...
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. The format argument may either be a regular expression object compiled by strptime(), or a format string. If False is passed in for data_string then the re object calculated for format will...
9,246
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')
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')
9,247
def __hash__(self): """x.__hash__() <==> hash(x)""" # Decimal integers must hash the same as the ints # Non-integer decimals are normalized and hashed as strings # Normalization assures that hast(100E-1) == hash(10) if self._is_special: if self._isnan(): raise TypeError('Cannot hash a NaN value.') return hash(str(self)...
def __hash__(self): """x.__hash__() <==> hash(x)""" # Decimal integers must hash the same as the ints # Non-integer decimals are normalized and hashed as strings # Normalization assures that hast(100E-1) == hash(10) if self._is_special: if self._isnan(): raise TypeError('Cannot hash a NaN value.') return hash(str(self)...
9,248
def docmodule(self, object, name=None, mod=None): """Produce text documentation for a given module object.""" name = object.__name__ # ignore the passed-in name synop, desc = splitdoc(getdoc(object)) result = self.section('NAME', name + (synop and ' - ' + synop))
def docmodule(self, object, name=None, mod=None): """Produce text documentation for a given module object.""" name = object.__name__ # ignore the passed-in name synop, desc = splitdoc(getdoc(object)) result = self.section('NAME', name + (synop and ' - ' + synop))
9,249
def spilldata(msg, attrs, predicate): ok, attrs = _split_list(attrs, predicate) if ok: hr.maybe() push(msg) for name, kind, homecls, value in ok: if callable(value) or inspect.isdatadescriptor(value): doc = getdoc(value) else: doc = None push(self.docother(getattr(object, name), name, mod, 70, doc) + '\n') return attrs
def spilldata(msg, attrs, predicate): ok, attrs = _split_list(attrs, predicate) if ok: hr.maybe() push(msg) for name, kind, homecls, value in ok: if callable(value) or inspect.isdatadescriptor(value): doc = getdoc(value) else: doc = None push(self.docother(getattr(object, name), name, mod, maxlen=70, doc=doc) + '\n') r...
9,250
def docother(self, object, name=None, mod=None, maxlen=None, doc=None): """Produce text documentation for a data object.""" repr = self.repr(object) if maxlen: line = (name and name + ' = ' or '') + repr chop = maxlen - len(line) if chop < 0: repr = repr[:chop] + '...' line = (name and self.bold(name) + ' = ' or '') + ...
def docother(self, object, name=None, mod=None, parent=None, maxlen=None, doc=None): """Produce text documentation for a data object.""" repr = self.repr(object) if maxlen: line = (name and name + ' = ' or '') + repr chop = maxlen - len(line) if chop < 0: repr = repr[:chop] + '...' line = (name and self.bold(name) + ' ...
9,251
def __getitem__(self, i): if i < 0 or i > 2: raise IndexError return i + 4
def__getitem__(self,i):ifi<0ori>2:raiseIndexErrorreturni+4
9,252
def test_preexec(self): # preexec function p = subprocess.Popen([sys.executable, "-c", 'import sys,os;' \ 'sys.stdout.write(os.getenv("FRUIT"))'], stdout=subprocess.PIPE, preexec_fn=lambda: os.putenv("FRUIT", "apple")) self.assertEqual(p.stdout.read(), "apple")
def test_preexec(self): # preexec function p = subprocess.Popen([sys.executable, "-c", 'import sys,os;' \ 'sys.stdout.write(os.getenv("FRUIT"))'], stdout=subprocess.PIPE, preexec_fn=lambda: os.putenv("FRUIT", "apple")) self.assertEqual(p.stdout.read(), "apple")
9,253
def _formatparam(param, value=None, quote=1): """Convenience function to format and return a key=value pair. This will quote the value if needed or if quote is true. """ if value is not None and len(value) > 0: # TupleType is used for RFC 2231 encoded parameter values where items # are (charset, language, value). cha...
def _formatparam(param, value=None, quote=1): """Convenience function to format and return a key=value pair. This will quote the value if needed or if quote is true. """ if value is not None and len(value) > 0: # TupleType is used for RFC 2231 encoded parameter values where items # are (charset, language, value). cha...
9,254
def set_param(self, param, value, header='Content-Type', requote=1): """Set a parameter in the Content-Type: header.
def set_param(self, param, value, header='Content-Type', requote=1, charset=None, language=''): """Set a parameter in the Content-Type: header.
9,255
def set_param(self, param, value, header='Content-Type', requote=1): """Set a parameter in the Content-Type: header.
def set_param(self, param, value, header='Content-Type', requote=1): """Set a parameter in the Content-Type: header.
9,256
def search_function(encoding): # Cache lookup entry = _cache.get(encoding,_unknown) if entry is not _unknown: return entry # Import the module modname = encoding.replace('-', '_') modname = aliases.aliases.get(modname,modname) try: mod = __import__(modname,globals(),locals(),'*') except ImportError,why: # cache misse...
def search_function(encoding): # Cache lookup entry = _cache.get(encoding,_unknown) if entry is not _unknown: return entry # Import the module modname = encoding.replace('-', '_') modname = aliases.aliases.get(modname,modname) try: mod = __import__(modname,globals(),locals(),'*') except ImportError,why: # cache misse...
9,257
def search_function(encoding): # Cache lookup entry = _cache.get(encoding,_unknown) if entry is not _unknown: return entry # Import the module modname = encoding.replace('-', '_') modname = aliases.aliases.get(modname,modname) try: mod = __import__(modname,globals(),locals(),'*') except ImportError,why: # cache misse...
def search_function(encoding): # Cache lookup entry = _cache.get(encoding,_unknown) if entry is not _unknown: return entry # Import the module modname = encoding.replace('-', '_') modname = aliases.aliases.get(modname,modname) try: mod = __import__(modname,globals(),locals(),'*') except ImportError,why: # cache misse...
9,258
def readframes(self, nframes): if self._data_seek_needed: self._data_chunk.rewind() pos = self._soundpos * self._framesize if pos: self._data_chunk.setpos(pos) self._data_seek_needed = 0 if nframes == 0: return '' if self._sampwidth > 1: # unfortunately the fromfile() method does not take # something that only looks li...
def readframes(self, nframes): if self._data_seek_needed: self._data_chunk.rewind() pos = self._soundpos * self._framesize if pos: self._data_chunk.setpos(pos) self._data_seek_needed = 0 if nframes == 0: return '' if self._sampwidth > 1: # unfortunately the fromfile() method does not take # something that only looks li...
9,259
def writeframesraw(self, data): self._ensure_header_written(len(data)) nframes = len(data) / (self._sampwidth * self._nchannels) if self._convert: data = self._convert(data) if self._sampwidth > 1: import array data = array.array(_array_fmts[self._sampwidth], data) data.byteswap() data.tofile(self._file) self._datawrit...
def writeframesraw(self, data): self._ensure_header_written(len(data)) nframes = len(data) / (self._sampwidth * self._nchannels) if self._convert: data = self._convert(data) if self._sampwidth > 1: import array data = array.array(_array_fmts[self._sampwidth], data) if big_endian: data.byteswap() data.tofile(self._file)...
9,260
def _patchheader(self): if self._datawritten == self._datalength: return curpos = self._file.tell() self._file.seek(self._form_length_pos, 0) _write_long(36 + self._datawritten) self._file.seek(self._data_length_pos, 0) _write_long(self._file, self._datawritten) self._file.seek(curpos, 0) self._datalength = self._dataw...
def _patchheader(self): if self._datawritten == self._datalength: return curpos = self._file.tell() self._file.seek(self._form_length_pos, 0) _write_long(self._file, 36 + self._datawritten) self._file.seek(self._data_length_pos, 0) _write_long(self._file, self._datawritten) self._file.seek(curpos, 0) self._datalength =...
9,261
def run (self):
def run (self):
9,262
def run (self):
def run (self):
9,263
def confirm(outcome, name): global tests tests = tests + 1 if outcome: if verbose: print "Failed", name else: failures.append(name)
def confirm(outcome, name): global tests tests = tests + 1 if outcome: if verbose: print "Passed", name else: failures.append(name)
9,264
# def outputFreeIt(self, name):
# def outputFreeIt(self, name):
9,265
# def outputFreeIt(self, name):
# def outputFreeIt(self, name):
9,266
# def outputFreeIt(self, name):
# def outputFreeIt(self, name):
9,267
# def outputFreeIt(self, name):
# def outputFreeIt(self, name):
9,268
# def outputFreeIt(self, name):
# def outputFreeIt(self, name):
9,269
def opengroup(self, name=None): gid = self.groups self.groups = gid + 1 if name: if self.groupdict.has_key(name): raise error, "can only use each group name once" self.groupdict[name] = gid self.open.append(gid) return gid
def opengroup(self, name=None): gid = self.groups self.groups = gid + 1 if name: ogid = self.groupdict.get(name, None) if ogid is not None: raise error, ("redefinition of group name %s as group %d; " + "was group %d") % (`name`, gid, ogid) self.groupdict[name] = gid self.open.append(gid) return gid
9,270
def test_mktime(self): self.assertRaises(OverflowError, time.mktime, (999999, 999999, 999999, 999999, 999999, 999999, 999999, 999999, 999999))
def test_mktime(self): self.assertRaises(OverflowError, time.mktime, (999999, 999999, 999999, 999999, 999999, 999999, 999999, 999999, 999999))
9,271
def ismount(path): """Test whether a path is a mount point""" return isabs(splitdrive(path)[1])
def ismount(path): """Test whether a path is a mount point (defined as root of drive)""" p = splitdrive(path)[1] return len(p)==1 and p[0] in '/\\'
9,272
def process(template, filename, destname, copy_codefragment, rsrcname=None, others=[], raw=0, progress="default"): if progress == "default": progress = EasyDialogs.ProgressBar("Processing %s..."%os.path.split(filename)[1], 120) progress.label("Compiling...") progress.inc(0) # Read the source and compile it # (there's...
def if ' raise BuildError, "BuildApplet could destroy your sourcefile on OSX, please rename: %s" % filename process(template, if ' raise BuildError, "BuildApplet could destroy your sourcefile on OSX, please rename: %s" % filename filename, if ' raise BuildError, "BuildApplet could destroy your sourcefile on OSX, ple...
9,273
#ifndef kControlCheckBoxUncheckedValue
#ifndefkControlCheckBoxUncheckedValue
9,274
#ifndef kControlCheckBoxUncheckedValue
#ifndefkControlCheckBoxUncheckedValue
9,275
#ifndef kControlCheckBoxUncheckedValue
#ifndefkControlCheckBoxUncheckedValue
9,276
#ifndef kControlCheckBoxUncheckedValue
#ifndefkControlCheckBoxUncheckedValue
9,277
#ifndef kControlCheckBoxUncheckedValue
#ifndefkControlCheckBoxUncheckedValue
9,278
#ifndef kControlCheckBoxUncheckedValue
#ifndefkControlCheckBoxUncheckedValue
9,279
#ifndef kControlCheckBoxUncheckedValue
#ifndefkControlCheckBoxUncheckedValue
9,280
#ifndef kControlCheckBoxUncheckedValue
#ifndefkControlCheckBoxUncheckedValue
9,281
def outputCleanupStructMembers(self): Output("Py_XDECREF(self->ob_callbackdict);") Output("if (self->ob_itself)SetControlReference(self->ob_itself, (long)0); /* Make it forget about us */")
def outputCleanupStructMembers(self): Output("Py_XDECREF(self->ob_callbackdict);") Output("if (self->ob_itself)SetControlReference(self->ob_itself, (long)0); /* Make it forget about us */")
9,282
def outputCleanupStructMembers(self): Output("Py_XDECREF(self->ob_callbackdict);") Output("if (self->ob_itself)SetControlReference(self->ob_itself, (long)0); /* Make it forget about us */")
def outputCleanupStructMembers(self): Output("Py_XDECREF(self->ob_callbackdict);") Output("if (self->ob_itself)SetControlReference(self->ob_itself, (long)0); /* Make it forget about us */")
9,283
def outputCleanupStructMembers(self): Output("Py_XDECREF(self->ob_callbackdict);") Output("if (self->ob_itself)SetControlReference(self->ob_itself, (long)0); /* Make it forget about us */")
def outputCleanupStructMembers(self): Output("Py_XDECREF(self->ob_callbackdict);") Output("if (self->ob_itself)SetControlReference(self->ob_itself, (long)0); /* Make it forget about us */")
9,284
def build(master=None, initialcolor=None, initfile=None, ignore=None, dbfile=None): # create all output widgets s = Switchboard(not ignore and initfile) # defer to the command line chosen color database, falling back to the one # in the .pynche file. if dbfile is None: dbfile = s.optiondb()['DBFILE'] # find a parseable...
def build(master=None, initialcolor=None, initfile=None, ignore=None, dbfile=None): # create all output widgets s = Switchboard(not ignore and initfile) # defer to the command line chosen color database, falling back to the one # in the .pynche file. if dbfile is None: dbfile = s.optiondb().get('DBFILE') # find a parse...
9,285
def _show(title=None, message=None, icon=None, type=None, **options): if icon: options["icon"] = icon if type: options["type"] = type if title: options["title"] = title if message: options["message"] = message return Message(**options).show()
def _show(title=None, message=None, icon=None, type=None, **options): if icon: options["icon"] = icon if type: options["type"] = type if title: options["title"] = title if message: options["message"] = message res = Message(**options).show() if isinstance(res, bool): if res: return YES return NO return res
9,286
def readprofile(self, baseName, className): """Internal function. It reads BASENAME.tcl and CLASSNAME.tcl into the Tcl Interpreter and calls execfile on BASENAME.py and CLASSNAME.py if such a file exists in the home directory.""" import os if os.environ.has_key('HOME'): home = os.environ['HOME'] else: home = os.curdir ...
def readprofile(self, baseName, className): """Internal function. It reads BASENAME.tcl and CLASSNAME.tcl into the Tcl Interpreter and calls execfile on BASENAME.py and CLASSNAME.py if such a file exists in the home directory.""" import os if os.environ.has_key('HOME'): home = os.environ['HOME'] else: home = os.curdir ...
9,287
def readprofile(self, baseName, className): """Internal function. It reads BASENAME.tcl and CLASSNAME.tcl into the Tcl Interpreter and calls execfile on BASENAME.py and CLASSNAME.py if such a file exists in the home directory.""" import os if os.environ.has_key('HOME'): home = os.environ['HOME'] else: home = os.curdir ...
def readprofile(self, baseName, className): """Internal function. It reads BASENAME.tcl and CLASSNAME.tcl into the Tcl Interpreter and calls execfile on BASENAME.py and CLASSNAME.py if such a file exists in the home directory.""" import os if os.environ.has_key('HOME'): home = os.environ['HOME'] else: home = os.curdir ...
9,288
def readprofile(self, baseName, className): """Internal function. It reads BASENAME.tcl and CLASSNAME.tcl into the Tcl Interpreter and calls execfile on BASENAME.py and CLASSNAME.py if such a file exists in the home directory.""" import os if os.environ.has_key('HOME'): home = os.environ['HOME'] else: home = os.curdir ...
def readprofile(self, baseName, className): """Internal function. It reads BASENAME.tcl and CLASSNAME.tcl into the Tcl Interpreter and calls execfile on BASENAME.py and CLASSNAME.py if such a file exists in the home directory.""" import os if os.environ.has_key('HOME'): home = os.environ['HOME'] else: home = os.curdir ...
9,289
def readprofile(self, baseName, className): """Internal function. It reads BASENAME.tcl and CLASSNAME.tcl into the Tcl Interpreter and calls execfile on BASENAME.py and CLASSNAME.py if such a file exists in the home directory.""" import os if os.environ.has_key('HOME'): home = os.environ['HOME'] else: home = os.curdir ...
def readprofile(self, baseName, className): """Internal function. It reads BASENAME.tcl and CLASSNAME.tcl into the Tcl Interpreter and calls execfile on BASENAME.py and CLASSNAME.py if such a file exists in the home directory.""" import os if os.environ.has_key('HOME'): home = os.environ['HOME'] else: home = os.curdir ...
9,290
def _pickle_stat_result(sr): (type, args) = sr.__reduce__() return (_make_stat_result, args)
def _pickle_stat_result(sr): (type, args) = sr.__reduce__() return (_make_stat_result, args)
9,291
def roundtrip(f, s): st1 = f(s) t = st1.totuple() try: st2 = parser.sequence2ast(t) except parser.ParserError: print "Failing syntax tree:" pprint.pprint(t) raise
def roundtrip(f, s): st1 = f(s) t = st1.totuple() try: st2 = parser.sequence2ast(t) except parser.ParserError: raise TestFailed, s
9,292
def roundtrip_fromfile(filename): roundtrip(suite, open(filename).read())
def roundtrip_fromfile(filename): roundtrip(parser.suite, open(filename).read())
9,293
def test_expr(s): print "expr:", s roundtrip(expr, s)
def test_expr(s): print "expr:", s roundtrip(parser.expr, s)
9,294
def test_suite(s): print "suite:", s roundtrip(suite, s)
def test_suite(s): print "suite:", s roundtrip(parser.suite, s)
9,295
def check_bad_tree(tree, label): print print label try: sequence2ast(tree) except parser.ParserError: print "caught expected exception for invalid tree" pass else: print "test failed: did not properly detect invalid tree:" pprint.pprint(tree)
def check_bad_tree(tree, label): print print label try: parser.sequence2ast(tree) except parser.ParserError: print "caught expected exception for invalid tree" pass else: print "test failed: did not properly detect invalid tree:" pprint.pprint(tree)
9,296
def check_bad_tree(tree, label): print print label try: sequence2ast(tree) except parser.ParserError: print "caught expected exception for invalid tree" pass else: print "test failed: did not properly detect invalid tree:" pprint.pprint(tree)
def check_bad_tree(tree, label): print print label try: sequence2ast(tree) except parser.ParserError: print "caught expected exception for invalid tree" else: print "test failed: did not properly detect invalid tree:" pprint.pprint(tree)
9,297
def getproxies_registry(): """Return a dictionary of scheme -> proxy server URL mappings.
def getproxies_registry(): """Return a dictionary of scheme -> proxy server URL mappings.
9,298
def __init__(self): self.funcs = {} self.instance = None
def __init__(self, allow_none): self.funcs = {} self.instance = None
9,299