bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def failUnlessEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '!=' operator. """ if first != second: raise self.failureException, \ (msg or '%s != %s' % (`first`, `second`)) | def failUnlessEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ if first != second: raise self.failureException, \ (msg or '%s != %s' % (`first`, `second`)) | 23,000 |
def failUnlessEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '!=' operator. """ if first != second: raise self.failureException, \ (msg or '%s != %s' % (`first`, `second`)) | def failUnlessEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '!=' operator. """ if not first == second: raise self.failureException, \ (msg or '%s != %s' % (`first`, `second`)) | 23,001 |
def writefile(self, filename): self.fixlastline() try: f = open(filename, "w") chars = self.text.get("1.0", "end-1c") f.write(chars) f.close() ## print "saved to", `filename` return 1 except IOError, msg: tkMessageBox.showerror("I/O Error", str(msg), master=self.text) return 0 | def writefile(self, filename): self.fixlastline() try: f = open(filename, "w") chars = str(self.text.get("1.0", "end-1c")) f.write(chars) f.close() ## print "saved to", `filename` return 1 except IOError, msg: tkMessageBox.showerror("I/O Error", str(msg), master=self.text) return 0 | 23,002 |
def readline(self, size=None, keepends=True): | def readline(self, size=None, keepends=True): | 23,003 |
def readline(self, size=None, keepends=True): | def readline(self, size=None, keepends=True): | 23,004 |
def LoadThemeCfg(self): ##current theme type radiobutton self.themeIsBuiltin.set(idleConf.GetOption('main','Theme','default', type='bool',default=1)) ##currently set theme currentOption=idleConf.CurrentTheme() print 'current option',currentOption ##load available theme option menus if self.themeIsBuiltin.get(): #defaul... | def LoadThemeCfg(self): ##current theme type radiobutton self.themeIsBuiltin.set(idleConf.GetOption('main','Theme','default', type='bool',default=1)) ##currently set theme currentOption=idleConf.CurrentTheme() print 'current option',currentOption ##load available theme option menus if self.themeIsBuiltin.get(): #defaul... | 23,005 |
def LoadThemeCfg(self): ##current theme type radiobutton self.themeIsBuiltin.set(idleConf.GetOption('main','Theme','default', type='bool',default=1)) ##currently set theme currentOption=idleConf.CurrentTheme() print 'current option',currentOption ##load available theme option menus if self.themeIsBuiltin.get(): #defaul... | def LoadThemeCfg(self): ##current theme type radiobutton self.themeIsBuiltin.set(idleConf.GetOption('main','Theme','default', type='bool',default=1)) ##currently set theme currentOption=idleConf.CurrentTheme() print 'current option',currentOption ##load available theme option menus if self.themeIsBuiltin.get(): #defaul... | 23,006 |
def LoadThemeCfg(self): ##current theme type radiobutton self.themeIsBuiltin.set(idleConf.GetOption('main','Theme','default', type='bool',default=1)) ##currently set theme currentOption=idleConf.CurrentTheme() print 'current option',currentOption ##load available theme option menus if self.themeIsBuiltin.get(): #defaul... | def LoadThemeCfg(self): ##current theme type radiobutton self.themeIsBuiltin.set(idleConf.GetOption('main','Theme','default', type='bool',default=1)) ##currently set theme currentOption=idleConf.CurrentTheme() print 'current option',currentOption ##load available theme option menus if self.themeIsBuiltin.get(): #defaul... | 23,007 |
def LoadThemeCfg(self): ##current theme type radiobutton self.themeIsBuiltin.set(idleConf.GetOption('main','Theme','default', type='bool',default=1)) ##currently set theme currentOption=idleConf.CurrentTheme() print 'current option',currentOption ##load available theme option menus if self.themeIsBuiltin.get(): #defaul... | def LoadThemeCfg(self): ##current theme type radiobutton self.themeIsBuiltin.set(idleConf.GetOption('main','Theme','default', type='bool',default=1)) ##currently set theme currentOption=idleConf.CurrentTheme() print 'current option',currentOption ##load available theme option menus if self.themeIsBuiltin.get(): #defaul... | 23,008 |
def LoadThemeCfg(self): ##current theme type radiobutton self.themeIsBuiltin.set(idleConf.GetOption('main','Theme','default', type='bool',default=1)) ##currently set theme currentOption=idleConf.CurrentTheme() print 'current option',currentOption ##load available theme option menus if self.themeIsBuiltin.get(): #defaul... | def LoadThemeCfg(self): ##current theme type radiobutton self.themeIsBuiltin.set(idleConf.GetOption('main','Theme','default', type='bool',default=1)) ##currently set theme currentOption=idleConf.CurrentTheme() print 'current option',currentOption ##load available theme option menus if self.themeIsBuiltin.get(): #defaul... | 23,009 |
def LoadThemeCfg(self): ##current theme type radiobutton self.themeIsBuiltin.set(idleConf.GetOption('main','Theme','default', type='bool',default=1)) ##currently set theme currentOption=idleConf.CurrentTheme() print 'current option',currentOption ##load available theme option menus if self.themeIsBuiltin.get(): #defaul... | def LoadThemeCfg(self): ##current theme type radiobutton self.themeIsBuiltin.set(idleConf.GetOption('main','Theme','default', type='bool',default=1)) ##currently set theme currentOption=idleConf.CurrentTheme() print 'current option',currentOption ##load available theme option menus if self.themeIsBuiltin.get(): #defaul... | 23,010 |
def change_root (new_root, pathname): """Return 'pathname' with 'new_root' prepended. If 'pathname' is relative, this is equivalent to "os.path.join(new_root,pathname)". Otherwise, it requires making 'pathname' relative and then joining the two, which is tricky on DOS/Windows and Mac OS. """ if os.name == 'posix': if ... | def change_root (new_root, pathname): """Return 'pathname' with 'new_root' prepended. If 'pathname' is relative, this is equivalent to "os.path.join(new_root,pathname)". Otherwise, it requires making 'pathname' relative and then joining the two, which is tricky on DOS/Windows and Mac OS. """ if os.name == 'posix': if ... | 23,011 |
def default(self, line): if line[:1] == '!': line = line[1:] locals = self.curframe.f_locals globals = self.curframe.f_globals globals['__privileged__'] = 1 code = compile(line + '\n', '<stdin>', 'single') try: exec code in globals, locals except: if type(sys.exc_type) == type(''): exc_type_name = sys.exc_type else: ex... | def default(self, line): if line[:1] == '!': line = line[1:] locals = self.curframe.f_locals globals = self.curframe.f_globals globals['__privileged__'] = 1 try: exec code in globals, locals except: if type(sys.exc_type) == type(''): exc_type_name = sys.exc_type else: exc_type_name = sys.exc_type.__name__ print '***', ... | 23,012 |
def run (self): | def run (self): | 23,013 |
def build_extensions (self): | def build_extensions (self): | 23,014 |
def build_extensions (self): | def build_extensions (self): | 23,015 |
def setup(self): self.connection = self.request self.rfile = self.connection.makefile('rb', 0) self.wfile = self.connection.makefile('wb', 0) | def setup(self): self.connection = self.request self.rfile = self.connection.makefile('rb', 0) self.wfile = self.connection.makefile('wb', 0) | 23,016 |
def open_local_file(self, url): host, file = splithost(url) if not host: return addinfo(open(file, 'r'), noheaders()) host, port = splitport(host) if not port and socket.gethostbyname(host) in ( localhost(), thishost()): file = unquote(file) return addinfo(open(file, 'r'), noheaders()) raise IOError, ('local file error... | def open_local_file(self, url): host, file = splithost(url) if not host: return addinfo(open(_fixpath(file), 'r'), noheaders()) host, port = splitport(host) if not port and socket.gethostbyname(host) in ( localhost(), thishost()): file = unquote(file) return addinfo(open(file, 'r'), noheaders()) raise IOError, ('local ... | 23,017 |
def open_local_file(self, url): host, file = splithost(url) if not host: return addinfo(open(file, 'r'), noheaders()) host, port = splitport(host) if not port and socket.gethostbyname(host) in ( localhost(), thishost()): file = unquote(file) return addinfo(open(file, 'r'), noheaders()) raise IOError, ('local file error... | def open_local_file(self, url): host, file = splithost(url) if not host: return addinfo(open(_fixpath(file), 'r'), noheaders()) host, port = splitport(host) if not port and socket.gethostbyname(host) in ( localhost(), thishost()): file = unquote(file) return addinfo(open(_fixpath(file), 'r'), noheaders()) raise IOError... | 23,018 |
def genpluginproject(architecture, module, project=None, projectdir=None, sources=[], sourcedirs=[], libraries=[], extradirs=[], extraexportsymbols=[], outputdir=":::Lib:lib-dynload", libraryflags=None, stdlibraryflags=None, prefixname=None, initialize=None): if CARBON_ONLY and architecture == "ppc": return if architec... | def genpluginproject(architecture, module, project=None, projectdir=None, sources=[], sourcedirs=[], libraries=[], extradirs=[], extraexportsymbols=[], outputdir=":::Lib:lib-dynload", libraryflags=None, stdlibraryflags=None, prefixname=None, initialize=None): if CARBON_ONLY and architecture == "ppc": return if architec... | 23,019 |
def __repr__(self): raise Exception("This should be caught by Repr.repr_instance") | def __repr__(self): raise Exception("This should be caught by Repr.repr_instance") | 23,020 |
def normalvariate(self, mu, sigma): """Normal distribution. | def normalvariate(self, mu, sigma): """Normal distribution. | 23,021 |
def gammavariate(self, alpha, beta): """Gamma distribution. Not the gamma function! | def gammavariate(self, alpha, beta): """Gamma distribution. Not the gamma function! | 23,022 |
def paretovariate(self, alpha): """Pareto distribution. alpha is the shape parameter.""" # Jain, pg. 495 | def paretovariate(self, alpha): """Pareto distribution. alpha is the shape parameter.""" # Jain, pg. 495 | 23,023 |
def weibullvariate(self, alpha, beta): """Weibull distribution. | def weibullvariate(self, alpha, beta): """Weibull distribution. | 23,024 |
def run (self): | def run (self): | 23,025 |
def trace_dispatch_exception(self, frame, t): rt, rtt, rct, rfn, rframe, rcur = self.cur if (not rframe is frame) and rcur: return self.trace_dispatch_return(rframe, t) return 0 | def trace_dispatch_exception(self, frame, t): rt, rtt, rct, rfn, rframe, rcur = self.cur if (rframe is frame) and rcur: return self.trace_dispatch_return(rframe, t) return 0 | 23,026 |
def get_package_dir (self, package): """Return the directory, relative to the top of the source distribution, where package 'package' should be found (at least according to the 'package_dir' option, if any).""" | def get_package_dir (self, package): """Return the directory, relative to the top of the source distribution, where package 'package' should be found (at least according to the 'package_dir' option, if any).""" | 23,027 |
def get_package_dir (self, package): """Return the directory, relative to the top of the source distribution, where package 'package' should be found (at least according to the 'package_dir' option, if any).""" | def get_package_dir (self, package): """Return the directory, relative to the top of the source distribution, where package 'package' should be found (at least according to the 'package_dir' option, if any).""" | 23,028 |
def get_package_dir (self, package): """Return the directory, relative to the top of the source distribution, where package 'package' should be found (at least according to the 'package_dir' option, if any).""" | def get_package_dir (self, package): """Return the directory, relative to the top of the source distribution, where package 'package' should be found (at least according to the 'package_dir' option, if any).""" | 23,029 |
def check_package (self, package, package_dir): | def check_package (self, package, package_dir): | 23,030 |
def build_module (self, module, module_file, package): | def build_module (self, module, module_file, package): | 23,031 |
def parse(filename_or_stream, handler, errorHandler=ErrorHandler()): parser = ExpatParser() parser.setContentHandler(handler) parser.setErrorHandler(errorHandler) parser.parse(filename_or_stream) | defparse(filename_or_stream,handler,errorHandler=ErrorHandler()):parser=ExpatParser()parser.setContentHandler(handler)parser.setErrorHandler(errorHandler)parser.parse(filename_or_stream) | 23,032 |
def try_cpp (self, body=None, headers=None, include_dirs=None, lang="c"): """Construct a source file from 'body' (a string containing lines of C/C++ code) and 'headers' (a list of header files to include) and run it through the preprocessor. Return true if the preprocessor succeeded, false if there were any errors. ('... | def try_cpp (self, body=None, headers=None, include_dirs=None, lang="c"): """Construct a source file from 'body' (a string containing lines of C/C++ code) and 'headers' (a list of header files to include) and run it through the preprocessor. Return true if the preprocessor succeeded, false if there were any errors. ('... | 23,033 |
def search_cpp (self, pattern, body=None, headers=None, include_dirs=None, lang="c"): """Construct a source file (just like 'try_cpp()'), run it through the preprocessor, and return true if any line of the output matches 'pattern'. 'pattern' should either be a compiled regex object or a string containing a regex. If ... | def search_cpp (self, pattern, body=None, headers=None, include_dirs=None, lang="c"): """Construct a source file (just like 'try_cpp()'), run it through the preprocessor, and return true if any line of the output matches 'pattern'. 'pattern' should either be a compiled regex object or a string containing a regex. If ... | 23,034 |
def search_cpp (self, pattern, body=None, headers=None, include_dirs=None, lang="c"): """Construct a source file (just like 'try_cpp()'), run it through the preprocessor, and return true if any line of the output matches 'pattern'. 'pattern' should either be a compiled regex object or a string containing a regex. If ... | def search_cpp (self, pattern, body=None, headers=None, include_dirs=None, lang="c"): """Construct a source file (just like 'try_cpp()'), run it through the preprocessor, and return true if any line of the output matches 'pattern'. 'pattern' should either be a compiled regex object or a string containing a regex. If ... | 23,035 |
def try_compile (self, body, headers=None, include_dirs=None, lang="c"): """Try to compile a source file built from 'body' and 'headers'. Return true on success, false otherwise. """ from distutils.ccompiler import CompileError self._check_compiler() try: self._compile(body, headers, lang) ok = 1 except CompileError: o... | def try_compile (self, body, headers=None, include_dirs=None, lang="c"): """Try to compile a source file built from 'body' and 'headers'. Return true on success, false otherwise. """ from distutils.ccompiler import CompileError self._check_compiler() try: self._compile(body, headers, include_dirs, lang) ok = 1 except C... | 23,036 |
def testAttributes(self): # test that exception attributes are happy try: str(u'Hello \u00E1') except Exception, e: sampleUnicodeEncodeError = e | def testAttributes(self): # test that exception attributes are happy try: str(u'Hello \u00E1') except Exception, e: sampleUnicodeEncodeError = e | 23,037 |
def testAttributes(self): # test that exception attributes are happy try: str(u'Hello \u00E1') except Exception, e: sampleUnicodeEncodeError = e | def testAttributes(self): # test that exception attributes are happy try: str(u'Hello \u00E1') except Exception, e: sampleUnicodeEncodeError = e | 23,038 |
def testAttributes(self): # test that exception attributes are happy try: str(u'Hello \u00E1') except Exception, e: sampleUnicodeEncodeError = e | def testAttributes(self): # test that exception attributes are happy try: str(u'Hello \u00E1') except Exception, e: sampleUnicodeEncodeError = e | 23,039 |
def testAttributes(self): # test that exception attributes are happy try: str(u'Hello \u00E1') except Exception, e: sampleUnicodeEncodeError = e | def testAttributes(self): # test that exception attributes are happy try: str(u'Hello \u00E1') except Exception, e: sampleUnicodeEncodeError = e | 23,040 |
def testAttributes(self): # test that exception attributes are happy try: str(u'Hello \u00E1') except Exception, e: sampleUnicodeEncodeError = e | def testAttributes(self): # test that exception attributes are happy try: str(u'Hello \u00E1') except Exception, e: sampleUnicodeEncodeError = e | 23,041 |
def testAttributes(self): # test that exception attributes are happy try: str(u'Hello \u00E1') except Exception, e: sampleUnicodeEncodeError = e | def testAttributes(self): # test that exception attributes are happy try: str(u'Hello \u00E1') except Exception, e: sampleUnicodeEncodeError = e | 23,042 |
def open(self, url, new=0, autoraise=1): cmdline = [self.name] + [arg.replace("%s", url) for arg in self.args] try: p = subprocess.Popen(cmdline, close_fds=True) return not p.wait() except OSError: return False | def open(self, url, new=0, autoraise=1): cmdline = [self.name] + [arg.replace("%s", url) for arg in self.args] try: if sys.platform[:3] == 'win': p = subprocess.Popen(cmdline) else: p = subprocess.Popen(cmdline, close_fds=True) return not p.wait() except OSError: return False | 23,043 |
def open(self, url, new=0, autoraise=1): cmdline = [self.name] + [arg.replace("%s", url) for arg in self.args] setsid = getattr(os, 'setsid', None) if not setsid: setsid = getattr(os, 'setpgrp', None) try: p = subprocess.Popen(cmdline, close_fds=True, preexec_fn=setsid) return (p.poll() is None) except OSError: return ... | def open(self, url, new=0, autoraise=1): cmdline = [self.name] + [arg.replace("%s", url) for arg in self.args] try: p = subprocess.Popen(cmdline, close_fds=True, preexec_fn=setsid) return (p.poll() is None) except OSError: return False | 23,044 |
def open(self, url, new=0, autoraise=1): cmdline = [self.name] + [arg.replace("%s", url) for arg in self.args] setsid = getattr(os, 'setsid', None) if not setsid: setsid = getattr(os, 'setpgrp', None) try: p = subprocess.Popen(cmdline, close_fds=True, preexec_fn=setsid) return (p.poll() is None) except OSError: return ... | def open(self, url, new=0, autoraise=1): cmdline = [self.name] + [arg.replace("%s", url) for arg in self.args] setsid = getattr(os, 'setsid', None) if not setsid: setsid = getattr(os, 'setpgrp', None) try: if sys.platform[:3] == 'win': p = subprocess.Popen(cmdline) else: setsid = getattr(os, 'setsid', None) if not sets... | 23,045 |
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. | 23,046 |
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 | 23,047 |
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 | 23,048 |
def __read(self, fp): """Parse a sectioned setup file. | def __read(self, fp): """Parse a sectioned setup file. | 23,049 |
def __read(self, fp): """Parse a sectioned setup file. | def __read(self, fp): """Parse a sectioned setup file. | 23,050 |
def set_path_env_var (name, version_number): """Set environment variable 'name' to an MSVC path type value obtained from 'get_msvc_paths()'. This is equivalent to a SET command prior to execution of spawned commands.""" p = get_msvc_paths (name, version_number) if p: os.environ[name] = string.join (p,';') | def set_path_env_var (name, version_number): """Set environment variable 'name' to an MSVC path type value obtained from 'get_msvc_paths()'. This is equivalent to a SET command prior to execution of spawned commands.""" p = get_msvc_paths (name, version_number) if p: os.environ[name] = string.join (p,';') | 23,051 |
def compile (self, sources, output_dir=None, macros=None, include_dirs=None, debug=0, extra_preargs=None, extra_postargs=None): | def compile (self, sources, output_dir=None, macros=None, include_dirs=None, debug=0, extra_preargs=None, extra_postargs=None): | 23,052 |
... def tail(g): | ... def tail(g): | 23,053 |
... def _m235(): | ... def _m235(): | 23,054 |
... def _m235(): | ... def _m235(): | 23,055 |
... def _m235(): | ... def _m235(): | 23,056 |
... def _fib(): | ... def _fib(): | 23,057 |
... def _fib(): | ... def _fib(): | 23,058 |
def ignorableWhitespace(self, whitespace): """Receive notification of ignorable whitespace in element content. | def ignorableWhitespace(self, whitespace): """Receive notification of ignorable whitespace in element content. | 23,059 |
def test_getstatus(self): # This pattern should match 'ls -ld /bin/ls' on any posix # system, however perversely configured. pat = r'''-..x..x..x # It is executable. \s+\d+ # It has some number of links. \s+\w+\s+\w+ # It has a user and group, which may # be named anything. [^/]* # Skip the date. /bi... | def test_getstatus(self): # This pattern should match 'ls -ld /bin/ls' on any posix # system, however perversely configured. pat = r'''[l-]..x..x..x # It is executable. \s+\d+ # It has some number of links. \s+\w+\s+\w+ # It has a user and group, which may # be named anything. [^/]* # Skip the date. ... | 23,060 |
fp.write("\tdef %s(self, "%funcname) | fp.write("\tdef %s(self, "%funcname) | 23,061 |
def repr1(self, x, level): methodname = 'repr_' + join(split(type(x).__name__), '_') if hasattr(self, methodname): return getattr(self, methodname)(x, level) else: return self.escape(cram(stripid(repr(x)), self.maxother)) | def repr1(self, x, level): methodname = 'repr_' + join(split(type(x).__name__), '_') if hasattr(self, methodname): return getattr(self, methodname)(x, level) else: return self.escape(cram(stripid(repr(x)), self.maxother)) | 23,062 |
def repr1(self, x, level): methodname = 'repr_' + join(split(type(x).__name__), '_') if hasattr(self, methodname): return getattr(self, methodname)(x, level) else: return cram(stripid(repr(x)), self.maxother) | def repr1(self, x, level): methodname = 'repr_' + join(split(type(x).__name__), '_') if hasattr(self, methodname): return getattr(self, methodname)(x, level) else: return cram(stripid(repr(x)), self.maxother) | 23,063 |
def play_sound_file(path): fp = open(path, 'r') data = fp.read() fp.close() try: a = linuxaudiodev.open('w') except linuxaudiodev.error, msg: if msg[0] in (errno.EACCES, errno.ENODEV): raise TestSkipped, msg raise TestFailed, msg else: a.write(data) a.close() | def play_sound_file(path): fp = open(path, 'r') data = fp.read() fp.close() try: a = linuxaudiodev.open('w') except linuxaudiodev.error, msg: if msg[0] in (errno.EACCES, errno.ENODEV): raise TestSkipped, msg raise TestFailed, msg a.bufsize() a.obufcount() a.obuffree() a.getptr() a.fileno() a.setparameters(rate, 8, ... | 23,064 |
def anchor_bgn(self, href, name, type): if self.proc: self.saved_clear() self.write('<OBJECT type="text/sitemap">\n') self.tab('\t<param name="Local" value="%s/%s">\n' % (self.path, href)) | def anchor_bgn(self, href, name, type): if self.proc: self.saved_clear() self.write('<OBJECT type="text/sitemap">\n') self.tab('\t<param name="Local" value="%s/%s">\n' % (self.path, href)) | 23,065 |
def anchor_end(self): if self.proc: self.tab('\t<param name="Name" value="%s">\n' % self.saved_get()) self.tab('\t</OBJECT>\n') | def anchor_end(self): if self.proc: self.tab('\t<param name="Name" value="%s">\n' % self.saved_get()) self.tab('\t</OBJECT>\n') | 23,066 |
def do_content(library, version, output): output.write(contents_header % version) for book in library: print '\t', book.title, '-', book.firstpage output.write(object_sitemap % (book.directory + "/" + book.firstpage, book.title)) if book.contentpage: content(book.directory, book.contentpage, output) output.write(conten... | def do_content(library, version, output): output.write(contents_header % version) for book in library: print '\t', book.title, '-', book.firstpage path = book.directory + "/" + book.firstpage output.write('<LI>') output.write(object_sitemap % (book.title, path)) if book.contentpage: content(book.directory, book.content... | 23,067 |
def __init__ (self, option_table=None): | def __init__ (self, option_table=None): | 23,068 |
def _grok_option_table (self): """Populate the various data structures that keep tabs on the option table. Called by 'getopt()' before it can do anything worthwhile. """ self.long_opts = [] self.short_opts = [] self.short2long.clear() self.repeat = {} | def _grok_option_table (self): """Populate the various data structures that keep tabs on the option table. Called by 'getopt()' before it can do anything worthwhile. """ self.long_opts = [] self.short_opts = [] self.short2long.clear() self.repeat = {} | 23,069 |
def pack_fstring(self, n, s): if n < 0: raise ValueError, 'fstring size must be nonnegative' n = ((n+3)/4)*4 data = s[:n] data = data + (n - len(data)) * '\0' self.__buf.write(data) | def pack_fstring(self, n, s): if n < 0: raise ValueError, 'fstring size must be nonnegative' n = ((n+3)/4)*4 data = data + (n - len(data)) * '\0' self.__buf.write(data) | 23,070 |
def __init__(self, recipients): self.recipients = recipients self.args = ( recipients,) | def__init__(self,recipients):self.recipients=recipientsself.args=(recipients,) | 23,071 |
def helo(self, name=''): """SMTP 'helo' command. Hostname to send for this command defaults to the FQDN of the local host. """ name=string.strip(name) if len(name)==0: name = socket.gethostname() try: name = socket.gethostbyaddr(name)[0] except socket.error: pass self.putcmd("helo",name) (code,msg)=self.getreply() self... | def helo(self, name=''): """SMTP 'helo' command. Hostname to send for this command defaults to the FQDN of the local host. """ self.putcmd("helo", _get_fqdn_hostname(name)) (code,msg)=self.getreply() self.helo_resp=msg return (code,msg) | 23,072 |
def ehlo(self, name=''): """ SMTP 'ehlo' command. Hostname to send for this command defaults to the FQDN of the local host. """ name=string.strip(name) if len(name)==0: name = socket.gethostname() try: name = socket.gethostbyaddr(name)[0] except socket.error: pass self.putcmd("ehlo",name) (code,msg)=self.getreply() # A... | def ehlo(self, name=''): """ SMTP 'ehlo' command. Hostname to send for this command defaults to the FQDN of the local host. """ self.putcmd("ehlo", _get_fqdn_hostname(name)) (code,msg)=self.getreply() # According to RFC1869 some (badly written) # MTA's will disconnect on an ehlo. Toss an exception if # that happens -dd... | 23,073 |
def docroutine(self, object, name=None, mod=None, funcs={}, classes={}, methods={}, cl=None): """Produce HTML documentation for a function or method object.""" realname = object.__name__ name = name or realname anchor = (cl and cl.__name__ or '') + '-' + name note = '' skipdocs = 0 if inspect.ismethod(object): if cl: i... | def docroutine(self, object, name=None, mod=None, funcs={}, classes={}, methods={}, cl=None): """Produce HTML documentation for a function or method object.""" realname = object.__name__ name = name or realname anchor = (cl and cl.__name__ or '') + '-' + name note = '' skipdocs = 0 if inspect.ismethod(object): if cl: i... | 23,074 |
def docroutine(self, object, name=None, mod=None, funcs={}, classes={}, methods={}, cl=None): """Produce HTML documentation for a function or method object.""" realname = object.__name__ name = name or realname anchor = (cl and cl.__name__ or '') + '-' + name note = '' skipdocs = 0 if inspect.ismethod(object): if cl: i... | def docroutine(self, object, name=None, mod=None, funcs={}, classes={}, methods={}, cl=None): """Produce HTML documentation for a function or method object.""" realname = object.__name__ name = name or realname anchor = (cl and cl.__name__ or '') + '-' + name note = '' skipdocs = 0 if inspect.ismethod(object): if cl: i... | 23,075 |
def docroutine(self, object, name=None, mod=None, cl=None): """Produce text documentation for a function or method object.""" realname = object.__name__ name = name or realname note = '' skipdocs = 0 if inspect.ismethod(object): imclass = object.im_class if cl: if imclass is not cl: note = ' from ' + classname(imclass,... | def docroutine(self, object, name=None, mod=None, cl=None): """Produce text documentation for a function or method object.""" realname = object.__name__ name = name or realname note = '' skipdocs = 0 if inspect.ismethod(object): imclass = object.im_class if cl: if imclass is not cl: note = ' from ' + classname(imclass,... | 23,076 |
def search(self, event=None): key = self.search_ent.get() self.stop_btn.pack(side='right') self.stop_btn.config(state='normal') self.search_lbl.config(text='Searching for "%s"...' % key) self.search_ent.forget() self.search_lbl.pack(side='left') self.result_lst.delete(0, 'end') self.goto_btn.config(state='disabled') se... | def search(self, event=None): key = self.search_ent.get() self.stop_btn.pack(side='right') self.stop_btn.config(state='normal') self.search_lbl.config(text='Searching for "%s"...' % key) self.search_ent.forget() self.search_lbl.pack(side='left') self.result_lst.delete(0, 'end') self.goto_btn.config(state='disabled') se... | 23,077 |
def packevent(ae, parameters = {}, attributes = {}): for key, value in parameters.items(): packkey(ae, key, value) for key, value in attributes.items(): packkey(ae, key, value) | def packevent(ae, parameters = {}, attributes = {}): for key, value in parameters.items(): ae.AEPutAttributeDesc(key, pack(value)) for key, value in attributes.items(): ae.AEPutAttributeDesc(key, pack(value)) | 23,078 |
def enumsubst(arguments, key, edict): """Substitute a single enum keyword argument, if it occurs""" if not arguments.has_key(key) or edict is None: return v = arguments[key] ok = edict.values() if edict.has_key(v): arguments[key] = edict[v] elif not v in ok: raise TypeError, 'Unknown enumerator: %s'%v | def enumsubst(arguments, key, edict): """Substitute a single enum keyword argument, if it occurs""" if not arguments.has_key(key) or edict is None: return v = arguments[key] ok = edict.values() if edict.has_key(v): arguments[key] = Enum(edict[v]) elif not v in ok: raise TypeError, 'Unknown enumerator: %s'%v | 23,079 |
def execRcLines(self): if self.rcLines: # Make local copy because of recursion rcLines = self.rcLines # executed only once self.rcLines = [] for line in rcLines: line = line[:-1] if len (line) > 0 and line[0] != '#': self.onecmd (line) | def execRcLines(self): if self.rcLines: # Make local copy because of recursion rcLines = self.rcLines # executed only once self.rcLines = [] for line in rcLines: line = line[:-1] if len (line) > 0 and line[0] != '#': self.onecmd (line) | 23,080 |
def precmd(self, line): """Handle alias expansion and ';;' separator.""" if not line: return line args = line.split() while args[0] in self.aliases: line = self.aliases[args[0]] ii = 1 for tmpArg in args[1:]: line = line.replace("%" + str(ii), tmpArg) ii = ii + 1 line = line.replace("%*", ' '.join(args[1:])) args = lin... | def precmd(self, line): """Handle alias expansion and ';;' separator.""" if not line.strip(): return line args = line.split() while args[0] in self.aliases: line = self.aliases[args[0]] ii = 1 for tmpArg in args[1:]: line = line.replace("%" + str(ii), tmpArg) ii = ii + 1 line = line.replace("%*", ' '.join(args[1:])) ar... | 23,081 |
def checkline(self, filename, lineno): """Return line number of first line at or after input argument such that if the input points to a 'def', the returned line number is the first non-blank/non-comment line to follow. If the input points to a blank or comment line, return 0. At end of file, also return 0.""" | def checkline(self, filename, lineno): """Return line number of first line at or after input argument such that if the input points to a 'def', the returned line number is the first non-blank/non-comment line to follow. If the input points to a blank or comment line, return 0. At end of file, also return 0.""" | 23,082 |
def do_ignore(self,arg): """arg is bp number followed by ignore count.""" args = arg.split() bpnum = int(args[0].strip()) try: count = int(args[1].strip()) except: count = 0 bp = bdb.Breakpoint.bpbynumber[bpnum] if bp: bp.ignore = count if (count > 0): reply = 'Will ignore next ' if (count > 1): reply = reply + '%d cro... | def do_ignore(self,arg): """arg is bp number followed by ignore count.""" args = arg.split() bpnum = int(args[0].strip()) try: count = int(args[1].strip()) except: count = 0 bp = bdb.Breakpoint.bpbynumber[bpnum] if bp: bp.ignore = count if count > 0: reply = 'Will ignore next ' if (count > 1): reply = reply + '%d cross... | 23,083 |
def do_ignore(self,arg): """arg is bp number followed by ignore count.""" args = arg.split() bpnum = int(args[0].strip()) try: count = int(args[1].strip()) except: count = 0 bp = bdb.Breakpoint.bpbynumber[bpnum] if bp: bp.ignore = count if (count > 0): reply = 'Will ignore next ' if (count > 1): reply = reply + '%d cro... | def do_ignore(self,arg): """arg is bp number followed by ignore count.""" args = arg.split() bpnum = int(args[0].strip()) try: count = int(args[1].strip()) except: count = 0 bp = bdb.Breakpoint.bpbynumber[bpnum] if bp: bp.ignore = count if (count > 0): reply = 'Will ignore next ' if count > 1: reply = reply + '%d cross... | 23,084 |
def do_alias(self, arg): args = arg.split() if len(args) == 0: keys = self.aliases.keys() keys.sort() for alias in keys: print "%s = %s" % (alias, self.aliases[alias]) return if args[0] in self.aliases and len (args) == 1: print "%s = %s" % (args[0], self.aliases[args[0]]) else: self.aliases[args[0]] = ' '.join(args[1:... | def do_alias(self, arg): args = arg.split() if len(args) == 0: keys = self.aliases.keys() keys.sort() for alias in keys: print "%s = %s" % (alias, self.aliases[alias]) return if args[0] in self.aliases and len(args) == 1: print "%s = %s" % (args[0], self.aliases[args[0]]) else: self.aliases[args[0]] = ' '.join(args[1:]... | 23,085 |
def _compile(*key): # internal: compile pattern p = _cache.get(key) if p is not None: return p pattern, flags = key if isinstance(pattern, _pattern_type): return pattern if not sre_compile.isstring(pattern): raise TypeError, "first argument must be string or compiled pattern" try: p = sre_compile.compile(pattern, flags... | def _compile(*key): # internal: compile pattern cachekey = (type(key[0]),) + key p = _cache.get(cachekey) if p is not None: return p pattern, flags = key if isinstance(pattern, _pattern_type): return pattern if not sre_compile.isstring(pattern): raise TypeError, "first argument must be string or compiled pattern" try: ... | 23,086 |
def _compile(*key): # internal: compile pattern p = _cache.get(key) if p is not None: return p pattern, flags = key if isinstance(pattern, _pattern_type): return pattern if not sre_compile.isstring(pattern): raise TypeError, "first argument must be string or compiled pattern" try: p = sre_compile.compile(pattern, flags... | def _compile(*key): # internal: compile pattern p = _cache.get(key) if p is not None: return p pattern, flags = key if isinstance(pattern, _pattern_type): return pattern if not sre_compile.isstring(pattern): raise TypeError, "first argument must be string or compiled pattern" try: p = sre_compile.compile(pattern, flags... | 23,087 |
def setup(self, f, t): self.lineno = None self.stack = [] if t and t.tb_frame is f: t = t.tb_next while f and f is not self.botframe: self.stack.append((f, f.f_lineno)) f = f.f_back self.stack.reverse() self.curindex = max(0, len(self.stack) - 1) while t: self.stack.append((t.tb_frame, t.tb_lineno)) t = t.tb_next if 0 ... | def setup(self, f, t): self.lineno = None self.stack = [] if t and t.tb_frame is f: t = t.tb_next while f is not None: self.stack.append((f, f.f_lineno)) f = f.f_back self.stack.reverse() self.curindex = max(0, len(self.stack) - 1) while t: self.stack.append((t.tb_frame, t.tb_lineno)) t = t.tb_next if 0 <= self.curinde... | 23,088 |
def setup(self, f, t): self.lineno = None self.stack = [] if t and t.tb_frame is f: t = t.tb_next while f and f is not self.botframe: self.stack.append((f, f.f_lineno)) f = f.f_back self.stack.reverse() self.curindex = max(0, len(self.stack) - 1) while t: self.stack.append((t.tb_frame, t.tb_lineno)) t = t.tb_next if 0 ... | def setup(self, f, t): self.lineno = None self.stack = [] if t and t.tb_frame is f: t = t.tb_next while f and f is not self.botframe: self.stack.append((f, f.f_lineno)) f = f.f_back self.stack.reverse() self.curindex = max(0, len(self.stack) - 1) while t is not None: self.stack.append((t.tb_frame, t.tb_lineno)) t = t.t... | 23,089 |
def setup(self, f, t): self.lineno = None self.stack = [] if t and t.tb_frame is f: t = t.tb_next while f and f is not self.botframe: self.stack.append((f, f.f_lineno)) f = f.f_back self.stack.reverse() self.curindex = max(0, len(self.stack) - 1) while t: self.stack.append((t.tb_frame, t.tb_lineno)) t = t.tb_next if 0 ... | def setup(self, f, t): self.lineno = None self.stack = [] if t and t.tb_frame is f: t = t.tb_next while f and f is not self.botframe: self.stack.append((f, f.f_lineno)) f = f.f_back self.stack.reverse() self.curindex = max(0, len(self.stack) - 1) while t: self.stack.append((t.tb_frame, t.tb_lineno)) t = t.tb_next self.... | 23,090 |
def runctx(self, cmd, globals, locals): self.reset() sys.trace = self.dispatch try: exec(cmd + '\n', globals, locals) except PdbQuit: pass except: print '***', sys.exc_type + ':', `sys.exc_value` print '*** Post Mortem Debugging:' sys.trace = None del sys.trace try: self.ask_user(None, sys.exc_traceback) except PdbQuit... | def runctx(self, cmd, globals, locals): self.reset() sys.trace = self.dispatch try: exec(cmd + '\n', globals, locals) except PdbQuit: return except: print '***', sys.exc_type + ':', `sys.exc_value` print '*** Post Mortem Debugging:' sys.trace = None del sys.trace try: self.ask_user(None, sys.exc_traceback) except PdbQu... | 23,091 |
def runctx(self, cmd, globals, locals): self.reset() sys.trace = self.dispatch try: exec(cmd + '\n', globals, locals) except PdbQuit: pass except: print '***', sys.exc_type + ':', `sys.exc_value` print '*** Post Mortem Debugging:' sys.trace = None del sys.trace try: self.ask_user(None, sys.exc_traceback) except PdbQuit... | def runctx(self, cmd, globals, locals): self.reset() sys.trace = self.dispatch try: exec(cmd + '\n', globals, locals) except PdbQuit: pass except: print '***', sys.exc_type + ':', `sys.exc_value` t = sys.exc_traceback finally: self.reset() | 23,092 |
def runctx(self, cmd, globals, locals): self.reset() sys.trace = self.dispatch try: exec(cmd + '\n', globals, locals) except PdbQuit: pass except: print '***', sys.exc_type + ':', `sys.exc_value` print '*** Post Mortem Debugging:' sys.trace = None del sys.trace try: self.ask_user(None, sys.exc_traceback) except PdbQuit... | def runctx(self, cmd, globals, locals): self.trace = None del self.trace self.forget() print '!!! Post-mortem debugging' self.pmd(t) def pmd(self, traceback): t = traceback if self.botframe is not None: while t is not None: if t.tb_frame is not self.botframe: break t = t.tb_next else: t = sys.exc_traceback try: self.a... | 23,093 |
def dispatch_call(self, frame, arg): if self.botframe is None: self.botframe = frame return if not (self.stop_here(frame) or self.break_anywhere(frame)): return frame.f_locals['__args__'] = arg return self.dispatch | def dispatch_call(self, frame, arg): if self.botframe is None: self.botframe = frame return None if not (self.stop_here(frame) or self.break_anywhere(frame)): return None frame.f_locals['__args__'] = arg return None self.dispatch | 23,094 |
def dispatch_call(self, frame, arg): if self.botframe is None: self.botframe = frame return if not (self.stop_here(frame) or self.break_anywhere(frame)): return frame.f_locals['__args__'] = arg return self.dispatch | def dispatch_call(self, frame, arg): if self.botframe is None: self.botframe = frame return if not (self.stop_here(frame) or self.break_anywhere(frame)): return None if arg is None: print '[Entering non-function block.]' else: frame.f_locals['__args__'] = arg return self.dispatch | 23,095 |
def dispatch_return(self, frame, arg): if self.stop_here(frame): print '!!! return', `arg` return | def dispatch_return(self, frame, arg): self.lastretval = arg return None | 23,096 |
def dispatch_exception(self, frame, arg): if self.stop_here(frame): print '!!! exception', arg[0] + ':', `arg[1]` self.ask_user(frame, arg[2]) return self.dispatch | def dispatch_exception(self, frame, arg): if self.stop_here(frame): print '!!!', arg[0] + ':', `arg[1]` self.ask_user(frame, arg[2]) return self.dispatch | 23,097 |
def walk_packages(path=None, prefix='', onerror=None): """Yield submodule names+loaders recursively, for path or sys.path""" def seen(p, m={}): if p in m: return True m[p] = True for importer, name, ispkg in iter_modules(path, prefix): yield importer, name, ispkg if ispkg: try: __import__(name) except ImportError: i... | def walk_packages(path=None, prefix='', onerror=None): """Yields (module_loader, name, ispkg) for all modules recursively on path, or, if path is None, all accessible modules. 'path' should be either None or a list of paths to look for modules in. 'prefix' is a string to output on the front of every module name on ou... | 23,098 |
def seen(p, m={}): if p in m: return True m[p] = True | def seen(p, m={}): if p in m: return True m[p] = True | 23,099 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.