bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def handle_error(self, request, client_address): """Handle an error gracefully. May be overridden.
def handle_error(self, request, client_address): """Handle an error gracefully. May be overridden.
9,000
def process_request(self, request, client_address): """Fork a new subprocess to process the request.""" self.collect_children() pid = os.fork() if pid: # Parent process if self.active_children is None: self.active_children = [] self.active_children.append(pid) return else: # Child process. # This must never return, hen...
def process_request(self, request, client_address): """Fork a new subprocess to process the request.""" self.collect_children() pid = os.fork() if pid: # Parent process if self.active_children is None: self.active_children = [] self.active_children.append(pid) return else: # Child process. # This must never return, hen...
9,001
def itemconfigure(self, index, cnf=None, **kw): """Configure resources of an item.
def itemconfigure(self, index, cnf=None, **kw): """Configure resources of an item.
9,002
def help_b(self): print """b(reak) ([file:]lineno | function) [, "condition"]
def help_b(self): print """b(reak) ([file:]lineno | function) [, "condition"]
9,003
def help_cl(self): print """cl(ear) [lineno]
def help_cl(self): print """cl(ear) [lineno]
9,004
def help_cl(self): print """cl(ear) [lineno]
def help_cl(self): print """cl(ear) [lineno]
9,005
def output_tp_init(self): if self.output_tp_initBody: Output("static int %s_init(PyObject *self, PyObject *args, PyObject *kwds)", self.prefix) OutLbrace() self.output_tp_initBody() OutRbrace() else: Output("#define %s_tp_init 0", self.prefix) Output()
def output_tp_init(self): if self.output_tp_initBody: Output("static int %s_tp_init(PyObject *self, PyObject *args, PyObject *kwds)", self.prefix) OutLbrace() self.output_tp_initBody() OutRbrace() else: Output("#define %s_tp_init 0", self.prefix) Output()
9,006
def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = rest.rfind('?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = rest.find('/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scrip...
def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = rest.rfind('?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = rest.find('/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scrip...
9,007
def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = rest.rfind('?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = rest.find('/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scrip...
def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = rest.rfind('?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = rest.find('/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scrip...
9,008
def _generate_one_template(self, tmpl): resultname, datasource, dataname, key = tmpl result = '' if key: # This is a multi-element rule. Run for every item in dict[key] if self.dict.has_key(key): keyvalues = self.dict[key] try: if not type(keyvalues) in (type(()), type([])): raise Error, "List or tuple expected for %s"...
def _generate_one_template(self, tmpl): resultname, datasource, dataname, key = tmpl result = '' if key: # This is a multi-element rule. Run for every item in dict[key] if self.dict.has_key(key): keyvalues = self.dict[key] try: if not type(keyvalues) in (type(()), type([])): raise Error, "List or tuple expected for %s"...
9,009
def yview(self, *what): """Query and change vertical position of the view.""" if not what: return self._getdoubles(self.tk.call(self._w, 'yview')) self.tk.call((self._w, 'yview') + what)
def xview_moveto(self, fraction): """Adjusts the view in the window so that FRACTION of the total width of the canvas is off-screen to the left.""" self.tk.call(self._w, 'xview', 'moveto', fraction) def xview_scroll(self, number, what): """Shift the x-view according to NUMBER which is measured in "units" or "pages" (WH...
9,010
def yview(self, *what): """Query and change vertical position of the view.""" if not what: return self._getdoubles(self.tk.call(self._w, 'yview')) self.tk.call((self._w, 'yview') + what)
def yview(self, *what): """Query and change vertical position of the view.""" if not args: return self._getdoubles(self.tk.call(self._w, 'yview')) self.tk.call((self._w, 'yview') + what)
9,011
def yview(self, *what): """Query and change vertical position of the view.""" if not what: return self._getdoubles(self.tk.call(self._w, 'yview')) self.tk.call((self._w, 'yview') + what)
def yview(self, *what): """Query and change vertical position of the view.""" if not what: return self._getdoubles(self.tk.call(self._w, 'yview')) self.tk.call((self._w, 'yview') + what)
9,012
def CreatePageFontTab(self): #tkVars self.fontSize=StringVar(self) self.fontBold=BooleanVar(self) self.fontName=StringVar(self) self.spaceNum=IntVar(self) self.tabCols=IntVar(self) self.indentBySpaces=BooleanVar(self) self.editFont=tkFont.Font(self,('courier',12,'normal')) ##widget creation #body frame frame=self.tabPa...
def CreatePageFontTab(self): #tkVars self.fontSize=StringVar(self) self.fontBold=BooleanVar(self) self.fontName=StringVar(self) self.spaceNum=IntVar(self) self.indentBySpaces=BooleanVar(self) self.editFont=tkFont.Font(self,('courier',12,'normal')) ##widget creation #body frame frame=self.tabPages.pages['Fonts/Tabs']['...
9,013
def CreatePageFontTab(self): #tkVars self.fontSize=StringVar(self) self.fontBold=BooleanVar(self) self.fontName=StringVar(self) self.spaceNum=IntVar(self) self.tabCols=IntVar(self) self.indentBySpaces=BooleanVar(self) self.editFont=tkFont.Font(self,('courier',12,'normal')) ##widget creation #body frame frame=self.tabPa...
def CreatePageFontTab(self): #tkVars self.fontSize=StringVar(self) self.fontBold=BooleanVar(self) self.fontName=StringVar(self) self.spaceNum=IntVar(self) self.tabCols=IntVar(self) self.indentBySpaces=BooleanVar(self) self.editFont=tkFont.Font(self,('courier',12,'normal')) ##widget creation #body frame frame=self.tabPa...
9,014
def AttachVarCallbacks(self): self.fontSize.trace_variable('w',self.VarChanged_fontSize) self.fontName.trace_variable('w',self.VarChanged_fontName) self.fontBold.trace_variable('w',self.VarChanged_fontBold) self.spaceNum.trace_variable('w',self.VarChanged_spaceNum) self.tabCols.trace_variable('w',self.VarChanged_tabCol...
def AttachVarCallbacks(self): self.fontSize.trace_variable('w',self.VarChanged_fontSize) self.fontName.trace_variable('w',self.VarChanged_fontName) self.fontBold.trace_variable('w',self.VarChanged_fontBold) self.spaceNum.trace_variable('w',self.VarChanged_spaceNum) self.indentBySpaces.trace_variable('w',self.VarChange...
9,015
def VarChanged_tabCols(self,*params): value=self.tabCols.get() self.AddChangedItem('main','Indent','tab-cols',value)
def VarChanged_tabCols(self,*params): value=self.tabCols.get() self.AddChangedItem('main','Indent','tab-cols',value)
9,016
def retry_http_basic_auth(self, host, req, realm): user,pw = self.passwd.find_user_password(realm, host) if pw: raw = "%s:%s" % (user, pw) auth = 'Basic %s' % base64.encodestring(raw).strip() if req.headers.get(self.auth_header, None) == auth: return None req.add_header(self.auth_header, auth) return self.parent.open(r...
def retry_http_basic_auth(self, host, req, realm): user,pw = self.passwd.find_user_password(realm, host) if pw is not None: raw = "%s:%s" % (user, pw) auth = 'Basic %s' % base64.encodestring(raw).strip() if req.headers.get(self.auth_header, None) == auth: return None req.add_header(self.auth_header, auth) return self.p...
9,017
def scanvars(reader, frame, locals): """Scan one logical line of Python and look up values of variables used.""" import tokenize, keyword vars, lasttoken, parent, prefix = [], None, None, '' for ttype, token, start, end, line in tokenize.generate_tokens(reader): if ttype == tokenize.NEWLINE: break if ttype == tokenize....
def scanvars(reader, frame, locals): """Scan one logical line of Python and look up values of variables used.""" import tokenize, keyword vars, lasttoken, parent, prefix, value = [], None, None, '', __UNDEF__ for ttype, token, start, end, line in tokenize.generate_tokens(reader): if ttype == tokenize.NEWLINE: break if ...
9,018
def main(): format = SV.RGB8_FRAMES qsize = 2 audio = 0 rate = 2 width = 0 norecord = 0 drop = 0 mono = 0 grey = 0 monotreshold = -1 opts, args = getopt.getopt(sys.argv[1:], 'aq:r:w:ndgmM:') for opt, arg in opts: if opt == '-a': audio = 1 elif opt == '-q': qsize = string.atoi(arg) elif opt == '-r': rate = string.atoi(...
def main(): format = SV.RGB8_FRAMES qsize = 2 audio = 0 rate = 2 width = 0 norecord = 0 drop = 0 mono = 0 grey = 0 monotreshold = -1 opts, args = getopt.getopt(sys.argv[1:], 'aq:r:w:ndgmM:') for opt, arg in opts: if opt == '-a': audio = 1 elif opt == '-q': qsize = string.atoi(arg) elif opt == '-r': rate = string.atoi(...
9,019
def main(): format = SV.RGB8_FRAMES qsize = 2 audio = 0 rate = 2 width = 0 norecord = 0 drop = 0 mono = 0 grey = 0 monotreshold = -1 opts, args = getopt.getopt(sys.argv[1:], 'aq:r:w:ndgmM:') for opt, arg in opts: if opt == '-a': audio = 1 elif opt == '-q': qsize = string.atoi(arg) elif opt == '-r': rate = string.atoi(...
def main(): format = SV.RGB8_FRAMES qsize = 2 audio = 0 rate = 2 width = 0 norecord = 0 drop = 0 mono = 0 grey = 0 monotreshold = -1 opts, args = getopt.getopt(sys.argv[1:], 'aq:r:w:ndgmM:') for opt, arg in opts: if opt == '-a': audio = 1 elif opt == '-q': qsize = string.atoi(arg) elif opt == '-r': rate = string.atoi(...
9,020
def record(v, info, filename, audiofilename, mono, grey, monotreshold): import thread format, x, y, qsize, rate = info fps = 59.64 # Fields per second # XXX (Strange: need fps of Indigo monitor, not of PAL or NTSC!) tpf = 1000.0 / fps # Time per field in msec if filename: vout = VFile.VoutFile().init(filename) if mono:...
def record(v, info, filename, audiofilename, mono, grey, monotreshold): import thread format, x, y, qsize, rate = info fps = 59.64 # Fields per second # XXX (Strange: need fps of Indigo monitor, not of PAL or NTSC!) tpf = 1000.0 / fps # Time per field in msec if filename: vout = VFile.VoutFile().init(filename) if mono:...
9,021
def record(v, info, filename, audiofilename, mono, grey, monotreshold): import thread format, x, y, qsize, rate = info fps = 59.64 # Fields per second # XXX (Strange: need fps of Indigo monitor, not of PAL or NTSC!) tpf = 1000.0 / fps # Time per field in msec if filename: vout = VFile.VoutFile().init(filename) if mono:...
def record(v, info, filename, audiofilename, mono, grey, monotreshold): import thread format, x, y, qsize, rate = info fps = 59.64 # Fields per second # XXX (Strange: need fps of Indigo monitor, not of PAL or NTSC!) tpf = 1000.0 / fps # Time per field in msec if filename: vout = VFile.VoutFile().init(filename) if mono:...
9,022
def testratecv(data): if verbose: print 'ratecv' state = (-8000, ((256, 512),)) if audioop.ratecv(data[0], 1, 1, 8000, 16000, state) != \ ('\001\000\000\001\001\002', state): return 0 return 1
def testratecv(data): if verbose: print 'ratecv' state = None d1, state = audioop.ratecv(data[0], 1, 1, 8000, 16000, state) d2, state = audioop.ratecv(data[0], 1, 1, 8000, 16000, state) if d1 + d2 != '\000\000\001\001\002\001\000\000\001\001\002': return 0 return 1
9,023
def contextfactory(func): """@contextfactory decorator. Typical usage: @contextmanager def some_generator(<arguments>): <setup> try: yield <value> finally: <cleanup> This makes this: with some_generator(<arguments>) as <variable>: <body> equivalent to this: <setup> try: <variable> = <value> <body> finally: <clean...
def contextfactory(func): """@contextfactory decorator. Typical usage: @contextfactory def some_generator(<arguments>): <setup> try: yield <value> finally: <cleanup> This makes this: with some_generator(<arguments>) as <variable>: <body> equivalent to this: <setup> try: <variable> = <value> <body> finally: <clean...
9,024
def read(self,size=None): if self.extrasize <= 0 and self.fileobj is None: return ''
def read(self, size=None): if self.extrasize <= 0 and self.fileobj is None: return ''
9,025
def _unread(self, buf): self.extrabuf = buf + self.extrabuf self.extrasize = len(buf) + self.extrasize
def _unread(self, buf): self.extrabuf = buf + self.extrabuf self.extrasize = len(buf) + self.extrasize
9,026
def readline(self): bufs = [] readsize = 100 while 1: c = self.read(readsize) i = string.find(c, '\n') if i >= 0 or c == '': bufs.append(c[:i]) self._unread(c[i+1:]) return string.join(bufs, '') bufs.append(c) readsize = readsize * 2
def readline(self): bufs = [] readsize = 100 while 1: c = self.read(readsize) i = string.find(c, '\n') if i >= 0 or c == '': bufs.append(c[:i+1]) self._unread(c[i+1:]) return string.join(bufs, '') bufs.append(c) readsize = readsize * 2
9,027
def get_python_version (): """Return a string containing the major and minor Python version, leaving off the patchlevel. Sample return values could be '1.5' or '2.2'. """ return sys.version[:3]
def get_python_version(): """Return a string containing the major and minor Python version, leaving off the patchlevel. Sample return values could be '1.5' or '2.2'. """ return sys.version[:3]
9,028
def get_python_inc(plat_specific=0, prefix=None): """Return the directory containing installed Python header files. If 'plat_specific' is false (the default), this is the path to the non-platform-specific header files, i.e. Python.h and so on; otherwise, this is the path to platform-specific header files (namely pycon...
def get_python_inc(plat_specific=0, prefix=None): """Return the directory containing installed Python header files. If 'plat_specific' is false (the default), this is the path to the non-platform-specific header files, i.e. Python.h and so on; otherwise, this is the path to platform-specific header files (namely pycon...
9,029
def get_python_lib(plat_specific=0, standard_lib=0, prefix=None): """Return the directory containing the Python library (standard or site additions). If 'plat_specific' is true, return the directory containing platform-specific modules, i.e. any module from a non-pure-Python module distribution; otherwise, return the ...
def get_python_lib(plat_specific=0, standard_lib=0, prefix=None): """Return the directory containing the Python library (standard or site additions). If 'plat_specific' is true, return the directory containing platform-specific modules, i.e. any module from a non-pure-Python module distribution; otherwise, return the ...
9,030
def get_config_h_filename(): """Return full pathname of installed pyconfig.h file.""" if python_build: inc_dir = os.curdir else: inc_dir = get_python_inc(plat_specific=1) if sys.version < '2.2': config_h = 'config.h' else: # The name of the config.h file changed in 2.2 config_h = 'pyconfig.h' return os.path.join(inc_di...
def get_config_h_filename(): """Return full pathname of installed pyconfig.h file.""" if python_build: inc_dir = os.curdir else: inc_dir = get_python_inc(plat_specific=1) if get_python_version() < '2.2': config_h = 'config.h' else: # The name of the config.h file changed in 2.2 config_h = 'pyconfig.h' return os.path.jo...
9,031
def _init_posix(): """Initialize the module as appropriate for POSIX systems.""" g = {} # load the installed Makefile: try: filename = get_makefile_filename() parse_makefile(filename, g) except IOError, msg: my_msg = "invalid Python installation: unable to open %s" % filename if hasattr(msg, "strerror"): my_msg = my_ms...
def _init_posix(): """Initialize the module as appropriate for POSIX systems.""" g = {} # load the installed Makefile: try: filename = get_makefile_filename() parse_makefile(filename, g) except IOError, msg: my_msg = "invalid Python installation: unable to open %s" % filename if hasattr(msg, "strerror"): my_msg = my_ms...
9,032
def _init_posix(): """Initialize the module as appropriate for POSIX systems.""" g = {} # load the installed Makefile: try: filename = get_makefile_filename() parse_makefile(filename, g) except IOError, msg: my_msg = "invalid Python installation: unable to open %s" % filename if hasattr(msg, "strerror"): my_msg = my_ms...
def _init_posix(): """Initialize the module as appropriate for POSIX systems.""" g = {} # load the installed Makefile: try: filename = get_makefile_filename() parse_makefile(filename, g) except IOError, msg: my_msg = "invalid Python installation: unable to open %s" % filename if hasattr(msg, "strerror"): my_msg = my_ms...
9,033
def make_escapes(pass_iso8859): global escapes for i in range(256): if pass_iso8859: # Allow iso-8859 characters to pass through so that e.g. 'msgid # "Hhe"' would result not result in 'msgid "H\366he"'. Otherwise # we escape any character outside the 32..126 range. i = i % 128 if 32 <= i <= 126: escapes.append(chr(i)...
def make_escapes(pass_iso8859): global escapes for i in range(256): if pass_iso8859: # Allow iso-8859 characters to pass through so that e.g. 'msgid # "Hhe"' would result not result in 'msgid "H\366he"'. Otherwise # we escape any character outside the 32..126 range. i = i % 128 if 32 <= i <= 126: escapes.append(chr(i)...
9,034
def main(): default_keywords = ['_'] try: opts, args = getopt.getopt( sys.argv[1:], 'ad:Ehk:n:o:p:Vvw:x:', ['extract-all', 'default-domain', 'escape', 'help', 'keyword', 'add-location', 'no-location', 'output=', 'output-dir=', 'verbose', 'version', 'width=', 'exclude-file=', ]) except getopt.error, msg: usage(1, msg) ...
def main(): default_keywords = ['_'] try: opts, args = getopt.getopt( sys.argv[1:], 'ad:Ehk:n:o:p:Vvw:x:', ['extract-all', 'default-domain', 'escape', 'help', 'keyword', 'add-location', 'no-location', 'output=', 'output-dir=', 'verbose', 'version', 'width=', 'exclude-file=', ]) except getopt.error, msg: usage(1, msg) ...
9,035
def preProcess(self): resdir = "Contents/Resources" if self.executable is not None: if self.mainprogram is None: execname = self.name else: execname = os.path.basename(self.executable) execpath = pathjoin(self.execdir, execname) if not self.symlink_exec: self.files.append((self.executable, execpath)) self.binaries.appe...
def preProcess(self): resdir = "Contents/Resources" if self.executable is not None: if self.mainprogram is None: execname = self.name else: execname = os.path.basename(self.executable) execpath = pathjoin(self.execdir, execname) if not self.symlink_exec: self.files.append((self.executable, execpath)) self.binaries.appe...
9,036
def preProcess(self): resdir = "Contents/Resources" if self.executable is not None: if self.mainprogram is None: execname = self.name else: execname = os.path.basename(self.executable) execpath = pathjoin(self.execdir, execname) if not self.symlink_exec: self.files.append((self.executable, execpath)) self.binaries.appe...
def preProcess(self): resdir = "Contents/Resources" if self.executable is not None: if self.mainprogram is None: execname = self.name else: execname = os.path.basename(self.executable) execpath = pathjoin(self.execdir, execname) if not self.symlink_exec: self.files.append((self.executable, execpath)) self.binaries.appe...
9,037
def preProcess(self): resdir = "Contents/Resources" if self.executable is not None: if self.mainprogram is None: execname = self.name else: execname = os.path.basename(self.executable) execpath = pathjoin(self.execdir, execname) if not self.symlink_exec: self.files.append((self.executable, execpath)) self.binaries.appe...
def preProcess(self): resdir = "Contents/Resources" if self.executable is not None: if self.mainprogram is None: execname = self.name else: execname = os.path.basename(self.executable) execpath = pathjoin(self.execdir, execname) if not self.symlink_exec: self.files.append((self.executable, execpath)) self.binaries.appe...
9,038
def mk16pixmap(w, h, data): """kludge a pixmap together""" rv = struct.pack("lhhhhhhhlllhhhhlll", id(data), w*2 + 0x8000, 0, 0, h, w, 0, 0, 0, # XXXX? 72<<16, 72<<16, 16, 16, # XXXX 3, 5, 0, 0, 0) print 'Our pixmap, size %d:'%len(rv) dumppixmap(rv) return Qd.RawBitMap(rv)
def mk16pixmap(w, h, data): """kludge a pixmap together""" rv = struct.pack("lhhhhhhhlllhhhhlll", id(data)+12, w*2 + 0x8000, 0, 0, h, w, 0, 0, 0, # XXXX? 72<<16, 72<<16, 16, 16, # XXXX 3, 5, 0, 0, 0) print 'Our pixmap, size %d:'%len(rv) dumppixmap(rv) return Qd.RawBitMap(rv)
9,039
def do_update(self, *args): pass currect = self.fitrect() print 'PICT:', self.pictrect print 'WIND:', currect print 'ARGS:', (self.pixmap, self.wid.GetWindowPort().portBits, self.pictrect, currect, QuickDraw.srcCopy, None) self.info() Qd.CopyBits(self.pixmap, self.wid.GetWindowPort().portBits, self.pictrect, currect, Q...
def do_update(self, *args): pass currect = self.fitrect() print 'PICT:', self.pictrect print 'WIND:', currect print 'ARGS:', (self.pixmap, self.wid.GetWindowPort().portBits, self.pictrect, currect, QuickDraw.srcCopy+QuickDraw.ditherCopy, None) self.info() Qd.CopyBits(self.pixmap, self.wid.GetWindowPort().portBits, self...
9,040
def __init__(self, host='localhost', port=DEFAULT_LOGGING_CONFIG_PORT, handler=None): ThreadingTCPServer.__init__(self, (host, port), handler) logging._acquireLock() self.abort = 0 logging._releaseLock() self.timeout = 1
def __init__(self, host='localhost', port=DEFAULT_LOGGING_CONFIG_PORT, handler=None): ThreadingTCPServer.__init__(self, (host, port), handler) logging._acquireLock() self.abort = 0 logging._releaseLock() self.timeout = 1
9,041
def serve(rcvr, hdlr): server = rcvr(handler=hdlr) global _listener logging._acquireLock() _listener = server logging._releaseLock() server.serve_until_stopped()
def serve(rcvr, hdlr, port): server = rcvr(port=port, handler=hdlr) global _listener logging._acquireLock() _listener = server logging._releaseLock() server.serve_until_stopped()
9,042
def serve(rcvr, hdlr): server = rcvr(handler=hdlr) global _listener logging._acquireLock() _listener = server logging._releaseLock() server.serve_until_stopped()
def serve(rcvr, hdlr): server = rcvr(handler=hdlr) global _listener logging._acquireLock() _listener = server logging._releaseLock() server.serve_until_stopped()
9,043
def RemoveKeybindings(self): "Remove the keybindings before they are changed." # Called from configDialog.py self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() keydefs = self.Bindings.default_keydefs for event, keylist in keydefs.items(): self.text.event_delete(event, *keylist) for extensionName in self.get_stan...
def RemoveKeybindings(self): "Remove the keybindings before they are changed." # Called from configDialog.py self.Bindings.default_keydefs = keydefs = idleConf.GetCurrentKeySet() for event, keylist in keydefs.items(): self.text.event_delete(event, *keylist) for extensionName in self.get_standard_extension_names(): keyd...
9,044
def RemoveKeybindings(self): "Remove the keybindings before they are changed." # Called from configDialog.py self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() keydefs = self.Bindings.default_keydefs for event, keylist in keydefs.items(): self.text.event_delete(event, *keylist) for extensionName in self.get_stan...
def RemoveKeybindings(self): "Remove the keybindings before they are changed." # Called from configDialog.py self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() keydefs = self.Bindings.default_keydefs for event, keylist in keydefs.items(): self.text.event_delete(event, *keylist) for extensionName in self.get_stan...
9,045
def ApplyKeybindings(self): "Update the keybindings after they are changed" # Called from configDialog.py self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() self.apply_bindings() for extensionName in self.get_standard_extension_names(): keydefs = idleConf.GetExtensionBindings(extensionName) if keydefs: self.appl...
def ApplyKeybindings(self): "Update the keybindings after they are changed" # Called from configDialog.py self.Bindings.default_keydefs = keydefs = idleConf.GetCurrentKeySet() self.apply_bindings() for extensionName in self.get_standard_extension_names(): keydefs = idleConf.GetExtensionBindings(extensionName) if keydef...
9,046
def ApplyKeybindings(self): "Update the keybindings after they are changed" # Called from configDialog.py self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() self.apply_bindings() for extensionName in self.get_standard_extension_names(): keydefs = idleConf.GetExtensionBindings(extensionName) if keydefs: self.appl...
def ApplyKeybindings(self): "Update the keybindings after they are changed" # Called from configDialog.py self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() self.apply_bindings() for extensionName in self.get_standard_extension_names(): xkeydefs = idleConf.GetExtensionBindings(extensionName) if xkeydefs: self.ap...
9,047
def ApplyKeybindings(self): "Update the keybindings after they are changed" # Called from configDialog.py self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() self.apply_bindings() for extensionName in self.get_standard_extension_names(): keydefs = idleConf.GetExtensionBindings(extensionName) if keydefs: self.appl...
def ApplyKeybindings(self): "Update the keybindings after they are changed" # Called from configDialog.py self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() self.apply_bindings() for extensionName in self.get_standard_extension_names(): keydefs = idleConf.GetExtensionBindings(extensionName) if keydefs: self.appl...
9,048
def ApplyKeybindings(self): "Update the keybindings after they are changed" # Called from configDialog.py self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() self.apply_bindings() for extensionName in self.get_standard_extension_names(): keydefs = idleConf.GetExtensionBindings(extensionName) if keydefs: self.appl...
def ApplyKeybindings(self): "Update the keybindings after they are changed" # Called from configDialog.py self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() self.apply_bindings() for extensionName in self.get_standard_extension_names(): keydefs = idleConf.GetExtensionBindings(extensionName) if keydefs: self.appl...
9,049
def ApplyKeybindings(self): "Update the keybindings after they are changed" # Called from configDialog.py self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() self.apply_bindings() for extensionName in self.get_standard_extension_names(): keydefs = idleConf.GetExtensionBindings(extensionName) if keydefs: self.appl...
def ApplyKeybindings(self): "Update the keybindings after they are changed" # Called from configDialog.py self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() self.apply_bindings() for extensionName in self.get_standard_extension_names(): keydefs = idleConf.GetExtensionBindings(extensionName) if keydefs: self.appl...
9,050
def ApplyKeybindings(self): "Update the keybindings after they are changed" # Called from configDialog.py self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() self.apply_bindings() for extensionName in self.get_standard_extension_names(): keydefs = idleConf.GetExtensionBindings(extensionName) if keydefs: self.appl...
def ApplyKeybindings(self): "Update the keybindings after they are changed" # Called from configDialog.py self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() self.apply_bindings() for extensionName in self.get_standard_extension_names(): keydefs = idleConf.GetExtensionBindings(extensionName) if keydefs: self.appl...
9,051
def ApplyKeybindings(self): "Update the keybindings after they are changed" # Called from configDialog.py self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() self.apply_bindings() for extensionName in self.get_standard_extension_names(): keydefs = idleConf.GetExtensionBindings(extensionName) if keydefs: self.appl...
def ApplyKeybindings(self): "Update the keybindings after they are changed" # Called from configDialog.py self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() self.apply_bindings() for extensionName in self.get_standard_extension_names(): keydefs = idleConf.GetExtensionBindings(extensionName) if keydefs: self.appl...
9,052
def ApplyKeybindings(self): "Update the keybindings after they are changed" # Called from configDialog.py self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() self.apply_bindings() for extensionName in self.get_standard_extension_names(): keydefs = idleConf.GetExtensionBindings(extensionName) if keydefs: self.appl...
def ApplyKeybindings(self): "Update the keybindings after they are changed" # Called from configDialog.py self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() self.apply_bindings() for extensionName in self.get_standard_extension_names(): keydefs = idleConf.GetExtensionBindings(extensionName) if keydefs: self.appl...
9,053
def ApplyKeybindings(self): "Update the keybindings after they are changed" # Called from configDialog.py self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() self.apply_bindings() for extensionName in self.get_standard_extension_names(): keydefs = idleConf.GetExtensionBindings(extensionName) if keydefs: self.appl...
def ApplyKeybindings(self): "Update the keybindings after they are changed" # Called from configDialog.py self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() self.apply_bindings() for extensionName in self.get_standard_extension_names(): keydefs = idleConf.GetExtensionBindings(extensionName) if keydefs: self.appl...
9,054
def make_file(self, binary=None): """Overridable: return a readable & writable file.
def make_file(self, binary=None): """Overridable: return a readable & writable file.
9,055
def __init__(self, environ=os.environ): self.dict = self.data = parse(environ=environ) self.query_string = environ['QUERY_STRING']
def __init__(self, environ=os.environ): self.dict = self.data = parse(environ=environ) self.query_string = environ['QUERY_STRING']
9,056
def __init__(self, environ=os.environ): self.dict = self.data = parse(environ=environ) self.query_string = environ['QUERY_STRING']
def __init__(self, environ=os.environ): self.dict = self.data = parse(environ=environ) self.query_string = environ['QUERY_STRING']
9,057
def values(self): lis = [] for each in self.dict.values(): if len( each ) == 1 : lis.append(each[0]) else: lis.append(each) return lis
def values(self): lis = [] for each in self.dict.values(): if len( each ) == 1 : lis.append(each[0]) else: lis.append(each) return lis
9,058
def items(self): lis = [] for key,value in self.dict.items(): if len(value) == 1 : lis.append((key, value[0])) else: lis.append((key, value)) return lis
def items(self): lis = [] for key,value in self.dict.items(): if len(value) == 1 : lis.append((key, value[0])) else: lis.append((key, value)) return lis
9,059
def __getitem__( self, key ): v = SvFormContentDict.__getitem__( self, key ) if v[0] in string.digits+'+-.' : try: return string.atoi( v ) except ValueError: try: return string.atof( v ) except ValueError: pass return string.strip(v)
def __getitem__(self, key): v = SvFormContentDict.__getitem__(self, key) if v[0] in string.digits + '+-.': try: return string.atoi(v) except ValueError: try: return string.atof( v ) except ValueError: pass return string.strip(v)
9,060
def __getitem__( self, key ): v = SvFormContentDict.__getitem__( self, key ) if v[0] in string.digits+'+-.' : try: return string.atoi( v ) except ValueError: try: return string.atof( v ) except ValueError: pass return string.strip(v)
def __getitem__( self, key ): v = SvFormContentDict.__getitem__( self, key ) if v[0] in string.digits+'+-.' : try: return string.atoi( v ) except ValueError: try: return string.atof(v) except ValueError: pass return string.strip(v)
9,061
def values( self ): lis = [] for key in self.keys(): try: lis.append( self[key] ) except IndexError: lis.append( self.dict[key] ) return lis
def values(self): result = [] for key in self.keys(): try: lis.append( self[key] ) except IndexError: lis.append( self.dict[key] ) return lis
9,062
def values( self ): lis = [] for key in self.keys(): try: lis.append( self[key] ) except IndexError: lis.append( self.dict[key] ) return lis
def values( self ): lis = [] for key in self.keys(): try: result.append(self[key]) except IndexError: lis.append( self.dict[key] ) return lis
9,063
def values( self ): lis = [] for key in self.keys(): try: lis.append( self[key] ) except IndexError: lis.append( self.dict[key] ) return lis
def values( self ): lis = [] for key in self.keys(): try: lis.append( self[key] ) except IndexError: lis.append( self.dict[key] ) return lis
9,064
def items( self ): lis = [] for key in self.keys(): try: lis.append( (key, self[key]) ) except IndexError: lis.append( (key, self.dict[key]) ) return lis
def items( self ): lis = [] for key in self.keys(): try: result.append((key, self[key])) except IndexError: lis.append( (key, self.dict[key]) ) return lis
9,065
def items( self ): lis = [] for key in self.keys(): try: lis.append( (key, self[key]) ) except IndexError: lis.append( (key, self.dict[key]) ) return lis
def items( self ): lis = [] for key in self.keys(): try: lis.append( (key, self[key]) ) except IndexError: lis.append( (key, self.dict[key]) ) return lis
9,066
def indexed_value(self, key, location): if self.dict.has_key(key): if len (self.dict[key]) > location: return self.dict[key][location] else: return None else: return None
def indexed_value(self, key, location): if self.dict.has_key(key): if len(self.dict[key]) > location: return self.dict[key][location] else: return None else: return None
9,067
def test(environ=os.environ): """Robust test CGI script, usable as main program. Write minimal HTTP headers and dump all information provided to the script in HTML form. """ import traceback print "Content-type: text/html" print sys.stderr = sys.stdout try: form = FieldStorage() # Replace with other classes to test...
def test(environ=os.environ): """Robust test CGI script, usable as main program. Write minimal HTTP headers and dump all information provided to the script in HTML form. """ import traceback print "Content-type: text/html" print sys.stderr = sys.stdout try: form = FieldStorage() # Replace with other classes to test...
9,068
def g(f=f): f()
def g(f=f): f()
9,069
def TemporaryFile(mode='w+b', bufsize=-1, suffix=""): """Create and return a temporary file (opened read-write by default).""" name = mktemp(suffix) if os.name == 'posix': # Unix -- be very careful fd = os.open(name, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0700) try: os.unlink(name) return os.fdopen(fd, mode, bufsize) except: ...
def TemporaryFile(mode='w+b', bufsize=-1, suffix=""): """Create and return a temporary file (opened read-write by default).""" name = mktemp(suffix) if os.name == 'posix': # Unix -- be very careful fd = os.open(name, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0700) try: os.unlink(name) return os.fdopen(fd, mode, bufsize) except: ...
9,070
def __init__(self, label="Working...", maxval=100): self.label = label self.maxval = maxval self.curval = -1 self.d = GetNewDialog(259, -1) tp, text_h, rect = self.d.GetDialogItem(2) SetDialogItemText(text_h, "Progress...") self._update(0)
def __init__(self, label="Working...", maxval=100): self.label = label self.maxval = maxval self.curval = -1 self.d = GetNewDialog(259, -1) tp, text_h, rect = self.d.GetDialogItem(2) SetDialogItemText(text_h, label) self._update(0)
9,071
def _update(self, value): tp, h, bar_rect = self.d.GetDialogItem(3) Qd.SetPort(self.d) Qd.FrameRect(bar_rect) # Draw outline inner_rect = Qd.InsetRect(bar_rect, 1, 1) Qd.ForeColor(QuickDraw.whiteColor) Qd.BackColor(QuickDraw.whiteColor) Qd.PaintRect(inner_rect) # Clear internal l, t, r, b = inner_rect r = int(l + (r...
def _update(self, value): tp, h, bar_rect = self.d.GetDialogItem(3) Qd.SetPort(self.d) Qd.FrameRect(bar_rect) # Draw outline inner_rect = Qd.InsetRect(bar_rect, 1, 1) Qd.ForeColor(QuickDraw.whiteColor) Qd.BackColor(QuickDraw.whiteColor) Qd.PaintRect(inner_rect) # Clear internal l, t, r, b = inner_rect r = int(l + (r...
9,072
def get_file(): return __file__
def get_file(): return __file__
9,073
def test_expat_nsattrs_wattr(): parser = create_parser(1) gather = AttrGatherer() parser.setContentHandler(gather) parser.feed("<doc xmlns:ns='%s' ns:attr='val'/>" % ns_uri) parser.close() attrs = gather._attrs return attrs.getLength() == 1 and \ attrs.getNames() == [(ns_uri, "attr")] and \ attrs.getQNames() == [] a...
def test_expat_nsattrs_wattr(): parser = create_parser(1) gather = AttrGatherer() parser.setContentHandler(gather) parser.feed("<doc xmlns:ns='%s' ns:attr='val'/>" % ns_uri) parser.close() attrs = gather._attrs return attrs.getLength() == 1 and \ attrs.getNames() == [(ns_uri, "attr")] and \ (attrs.getQNames() == [] ...
9,074
def _run_exitfuncs(): """run any registered exit functions _exithandlers is traversed in reverse order so functions are executed last in, first out. """ exc_info = None while _exithandlers: func, targs, kargs = _exithandlers.pop() try: func(*targs, **kargs) except SystemExit: exc_info = sys.exc_info() except: import ...
def _run_exitfuncs(): """run any registered exit functions _exithandlers is traversed in reverse order so functions are executed last in, first out. """ exc_info = None while _exithandlers: func, targs, kargs = _exithandlers.pop() try: func(*targs, **kargs) except SystemExit: exc_info = sys.exc_info() except: import ...
9,075
def register(func, *targs, **kargs): """register a function to be executed upon normal program termination func - function to be called at exit targs - optional arguments to pass to func kargs - optional keyword arguments to pass to func """ _exithandlers.append((func, targs, kargs))
def register(func, *targs, **kargs): """register a function to be executed upon normal program termination func - function to be called at exit targs - optional arguments to pass to func kargs - optional keyword arguments to pass to func """ _exithandlers.append((func, targs, kargs))
9,076
def register(func, *targs, **kargs): """register a function to be executed upon normal program termination func - function to be called at exit targs - optional arguments to pass to func kargs - optional keyword arguments to pass to func """ _exithandlers.append((func, targs, kargs))
def register(func, *targs, **kargs): """register a function to be executed upon normal program termination func - function to be called at exit targs - optional arguments to pass to func kargs - optional keyword arguments to pass to func """ _exithandlers.append((func, targs, kargs))
9,077
def check_module_event(self, event): filename = self.getfilename() if not filename: return if not self.tabnanny(filename): return self.checksyntax(filename)
def check_module_event(self, event=None): filename = self.getfilename() if not filename: return if not self.tabnanny(filename): return self.checksyntax(filename)
9,078
def run_module_event(self, event): """Run the module after setting up the environment.
def run_module_event(self, event): """Run the module after setting up the environment.
9,079
def _closeCursors(self, save=1): if self.dbc: c = self.dbc self.dbc = None if save: self.saved_dbc_key = c.current(0,0,0)[0] c.close() del c for cref in self._cursor_refs.values(): c = cref() if c is not None: c.close()
def _closeCursors(self, save=1): if self.dbc: c = self.dbc self.dbc = None if save: try: self.saved_dbc_key = c.current(0,0,0)[0] except db.DBError: pass c.close() del c for cref in self._cursor_refs.values(): c = cref() if c is not None: c.close()
9,080
def feed(self, data, isFinal = 0): if not self._parsing: self._parsing = 1 self.reset() self._cont_handler.startDocument()
def feed(self, data, isFinal = 0): if not self._parsing: self._parsing = 1 self._cont_handler.startDocument()
9,081
def reportdiff(expected, output): print "*" * 70 import difflib a = expected.splitlines() b = output.splitlines() sm = difflib.SequenceMatcher(a=a, b=b) tuples = sm.get_opcodes() def pair(x0, x1): x0 += 1 if x0 >= x1: return str(x0) else: return "%d,%d" % (x0, x1) for op, a0, a1, b0, b1 in tuples: if op == 'equal': pas...
def reportdiff(expected, output): print "*" * 70 a = expected.splitlines(1) b = output.splitlines(1) sm = difflib.SequenceMatcher(a=a, b=b) tuples = sm.get_opcodes() def pair(x0, x1): x0 += 1 if x0 >= x1: return str(x0) else: return "%d,%d" % (x0, x1) for op, a0, a1, b0, b1 in tuples: if op == 'equal': pass elif op == ...
9,082
def pair(x0, x1): x0 += 1 if x0 >= x1: return str(x0) else: return "%d,%d" % (x0, x1)
def pair(x0, x1): x0 += 1 if x0 >= x1: return str(x0) else: return "%d,%d" % (x0, x1)
9,083
def pair(x0, x1): x0 += 1 if x0 >= x1: return str(x0) else: return "%d,%d" % (x0, x1)
def pair(x0, x1): x0 += 1 if x0 >= x1: return str(x0) else: return "%d,%d" % (x0, x1)
9,084
def pair(x0, x1): x0 += 1 if x0 >= x1: return str(x0) else: return "%d,%d" % (x0, x1)
def pair(x0, x1): x0 += 1 if x0 >= x1: return str(x0) else: return "%d,%d" % (x0, x1)
9,085
def pair(x0, x1): x0 += 1 if x0 >= x1: return str(x0) else: return "%d,%d" % (x0, x1)
def pair(x0, x1): x0 += 1 if x0 >= x1: return str(x0) else: return "%d,%d" % (x0, x1)
9,086
def pair(x0, x1): x0 += 1 if x0 >= x1: return str(x0) else: return "%d,%d" % (x0, x1)
def pair(x0, x1): x0 += 1 if x0 >= x1: return str(x0) else: return "%d,%d" % (x0, x1)
9,087
def check_all(modname): names = {} try: exec "import %s" % modname in names except ImportError: # silent fail here seems the best route since some modules # may not be available in all environments return verify(hasattr(sys.modules[modname], "__all__"), "%s has no __all__ attribute" % modname) names = {} exec "from %s ...
def check_all(modname): names = {} try: exec "import %s" % modname in names except ImportError: # silent fail here seems the best route since some modules # may not be available in all environments return verify(hasattr(sys.modules[modname], "__all__"), "%s has no __all__ attribute" % modname) names = {} exec "from %s ...
9,088
def test_repeat_large(self, size): return self.basic_test_repeat(size)
defdef basic_test_inplace_repeat(self, size): l = [''] l *= size self.assertEquals(len(l), size) self.failUnless(l[0] is l[-1]) del l l = [''] * size l *= 2 self.assertEquals(len(l), size * 2) self.failUnless(l[size - 1] is l[-1]) @bigmemtest(minsize=_2G // 2 + 2, memuse=16) def test_inplace_repeat_small(self, size):...
9,089
def basic_test_extend(self, size): l = [file] * size l.extend(l) self.assertEquals(len(l), size * 2) self.failUnless(l[0] is l[-1]) self.failUnless(l[size - 1] is l[size + 1])
def basic_test_extend(self, size): l = [file] * size l.extend(l) self.assertEquals(len(l), size * 2) self.failUnless(l[0] is l[-1]) self.failUnless(l[size - 1] is l[size + 1])
9,090
def test_extend_small(self, size): return self.basic_test_extend(size)
def test_extend_small(self, size): return self.basic_test_extend(size)
9,091
def user_line(self, frame): # get the currently executing function ##print>>sys.__stderr__, "*function: ", frame.f_code.co_name ##print>>sys.__stderr__, "*file: ", frame.f_code.co_filename ##print>>sys.__stderr__, "*line number: ", frame.f_code.co_firstlineno co_filename = frame.f_code.co_filename co_name = frame.f_cod...
def user_line(self, frame): # get the currently executing function ##print>>sys.__stderr__, "*function: ", frame.f_code.co_name ##print>>sys.__stderr__, "*file: ", frame.f_code.co_filename ##print>>sys.__stderr__, "*line number: ", frame.f_code.co_firstlineno co_filename = frame.f_code.co_filename co_name = frame.f_cod...
9,092
def user_line(self, frame): # get the currently executing function ##print>>sys.__stderr__, "*function: ", frame.f_code.co_name ##print>>sys.__stderr__, "*file: ", frame.f_code.co_filename ##print>>sys.__stderr__, "*line number: ", frame.f_code.co_firstlineno co_filename = frame.f_code.co_filename co_name = frame.f_cod...
def user_line(self, frame): # get the currently executing function ##print>>sys.__stderr__, "*function: ", frame.f_code.co_name ##print>>sys.__stderr__, "*file: ", frame.f_code.co_filename ##print>>sys.__stderr__, "*line number: ", frame.f_code.co_firstlineno co_filename = frame.f_code.co_filename co_name = frame.f_cod...
9,093
def iteritems(self): return WeakValuedItemIterator(self)
def iteritems(self): return WeakValuedItemIterator(self)
9,094
def iterkeys(self): return self.data.iterkeys()
def iterkeys(self): return self.data.iterkeys()
9,095
def itervalues(self): return WeakValuedValueIterator(self)
def itervalues(self): return WeakValuedValueIterator(self)
9,096
def iteritems(self): return WeakKeyedItemIterator(self)
def iteritems(self): return WeakKeyedItemIterator(self)
9,097
def iterkeys(self): return WeakKeyedKeyIterator(self)
def iterkeys(self): return WeakKeyedKeyIterator(self)
9,098
def update(self, dict=None, **kwargs): d = self.data if dict is not None: if not hasattr(dict, "items"): dict = type({})(dict) for key, value in dict.items(): d[ref(key, self._remove)] = value if len(kwargs): self.update(kwargs)
def update(self, dict=None, **kwargs): d = self.data if dict is not None: if not hasattr(dict, "items"): dict = type({})(dict) for key, value in dict.items(): d[ref(key, self._remove)] = value if len(kwargs): self.update(kwargs)
9,099