rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
"""Fail if the two objects are unequal as determined by the '!='
"""Fail if the two objects are unequal as determined by the '=='
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`))
c377cbfdaf9feb02bc5bea347cbe4c587ef33a10 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c377cbfdaf9feb02bc5bea347cbe4c587ef33a10/unittest.py
if first != second:
if not 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`))
c377cbfdaf9feb02bc5bea347cbe4c587ef33a10 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c377cbfdaf9feb02bc5bea347cbe4c587ef33a10/unittest.py
chars = self.text.get("1.0", "end-1c")
chars = str(self.text.get("1.0", "end-1c"))
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
a2bc259dd71d53f643db13ac5077fafe9d5bacae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a2bc259dd71d53f643db13ac5077fafe9d5bacae/IOBinding.py
def readline(self, size=None, keepends=True):
714f87821f0f5a84ca43ce640407c15f689fa47c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/714f87821f0f5a84ca43ce640407c15f689fa47c/codecs.py
def readline(self, size=None, keepends=True):
714f87821f0f5a84ca43ce640407c15f689fa47c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/714f87821f0f5a84ca43ce640407c15f689fa47c/codecs.py
print 'builtin theme'
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(): #default theme selected print 'builtin theme' itemList=idleConf.GetSectionList('default','highlight') itemList.sort() print 'builtin items:',itemList self.optMenuThemeBuiltin.SetMenu(itemList,currentOption) itemList=idleConf.GetSectionList('user','highlight') itemList.sort() print 'user items:',itemList if not itemList: self.radioThemeCustom.config(state=DISABLED) self.customTheme.set('- no custom themes -') else: self.optMenuThemeCustom.SetMenu(itemList,itemList[0]) else: #user theme selected print 'user theme' itemList=idleConf.GetSectionList('user','highlight') itemList.sort() print 'user items:',itemList self.optMenuThemeCustom.SetMenu(itemList,currentOption) itemList=idleConf.GetSectionList('default','highlight') itemList.sort() print 'builtin items:',itemList self.optMenuThemeBuiltin.SetMenu(itemList,itemList[0]) self.SetThemeType() ##load theme element option menu themeNames=self.themeElements.keys() themeNames.sort(self.__ThemeNameIndexCompare) self.optMenuHighlightTarget.SetMenu(themeNames,themeNames[0]) self.PaintThemeSample() self.SetHighlightTarget()
dfd0b296d766645bd2e01955a61f52643a483922 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dfd0b296d766645bd2e01955a61f52643a483922/configDialog.py
print 'builtin items:',itemList
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(): #default theme selected print 'builtin theme' itemList=idleConf.GetSectionList('default','highlight') itemList.sort() print 'builtin items:',itemList self.optMenuThemeBuiltin.SetMenu(itemList,currentOption) itemList=idleConf.GetSectionList('user','highlight') itemList.sort() print 'user items:',itemList if not itemList: self.radioThemeCustom.config(state=DISABLED) self.customTheme.set('- no custom themes -') else: self.optMenuThemeCustom.SetMenu(itemList,itemList[0]) else: #user theme selected print 'user theme' itemList=idleConf.GetSectionList('user','highlight') itemList.sort() print 'user items:',itemList self.optMenuThemeCustom.SetMenu(itemList,currentOption) itemList=idleConf.GetSectionList('default','highlight') itemList.sort() print 'builtin items:',itemList self.optMenuThemeBuiltin.SetMenu(itemList,itemList[0]) self.SetThemeType() ##load theme element option menu themeNames=self.themeElements.keys() themeNames.sort(self.__ThemeNameIndexCompare) self.optMenuHighlightTarget.SetMenu(themeNames,themeNames[0]) self.PaintThemeSample() self.SetHighlightTarget()
dfd0b296d766645bd2e01955a61f52643a483922 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dfd0b296d766645bd2e01955a61f52643a483922/configDialog.py
print 'user items:',itemList
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(): #default theme selected print 'builtin theme' itemList=idleConf.GetSectionList('default','highlight') itemList.sort() print 'builtin items:',itemList self.optMenuThemeBuiltin.SetMenu(itemList,currentOption) itemList=idleConf.GetSectionList('user','highlight') itemList.sort() print 'user items:',itemList if not itemList: self.radioThemeCustom.config(state=DISABLED) self.customTheme.set('- no custom themes -') else: self.optMenuThemeCustom.SetMenu(itemList,itemList[0]) else: #user theme selected print 'user theme' itemList=idleConf.GetSectionList('user','highlight') itemList.sort() print 'user items:',itemList self.optMenuThemeCustom.SetMenu(itemList,currentOption) itemList=idleConf.GetSectionList('default','highlight') itemList.sort() print 'builtin items:',itemList self.optMenuThemeBuiltin.SetMenu(itemList,itemList[0]) self.SetThemeType() ##load theme element option menu themeNames=self.themeElements.keys() themeNames.sort(self.__ThemeNameIndexCompare) self.optMenuHighlightTarget.SetMenu(themeNames,themeNames[0]) self.PaintThemeSample() self.SetHighlightTarget()
dfd0b296d766645bd2e01955a61f52643a483922 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dfd0b296d766645bd2e01955a61f52643a483922/configDialog.py
print 'user theme'
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(): #default theme selected print 'builtin theme' itemList=idleConf.GetSectionList('default','highlight') itemList.sort() print 'builtin items:',itemList self.optMenuThemeBuiltin.SetMenu(itemList,currentOption) itemList=idleConf.GetSectionList('user','highlight') itemList.sort() print 'user items:',itemList if not itemList: self.radioThemeCustom.config(state=DISABLED) self.customTheme.set('- no custom themes -') else: self.optMenuThemeCustom.SetMenu(itemList,itemList[0]) else: #user theme selected print 'user theme' itemList=idleConf.GetSectionList('user','highlight') itemList.sort() print 'user items:',itemList self.optMenuThemeCustom.SetMenu(itemList,currentOption) itemList=idleConf.GetSectionList('default','highlight') itemList.sort() print 'builtin items:',itemList self.optMenuThemeBuiltin.SetMenu(itemList,itemList[0]) self.SetThemeType() ##load theme element option menu themeNames=self.themeElements.keys() themeNames.sort(self.__ThemeNameIndexCompare) self.optMenuHighlightTarget.SetMenu(themeNames,themeNames[0]) self.PaintThemeSample() self.SetHighlightTarget()
dfd0b296d766645bd2e01955a61f52643a483922 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dfd0b296d766645bd2e01955a61f52643a483922/configDialog.py
print 'user items:',itemList
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(): #default theme selected print 'builtin theme' itemList=idleConf.GetSectionList('default','highlight') itemList.sort() print 'builtin items:',itemList self.optMenuThemeBuiltin.SetMenu(itemList,currentOption) itemList=idleConf.GetSectionList('user','highlight') itemList.sort() print 'user items:',itemList if not itemList: self.radioThemeCustom.config(state=DISABLED) self.customTheme.set('- no custom themes -') else: self.optMenuThemeCustom.SetMenu(itemList,itemList[0]) else: #user theme selected print 'user theme' itemList=idleConf.GetSectionList('user','highlight') itemList.sort() print 'user items:',itemList self.optMenuThemeCustom.SetMenu(itemList,currentOption) itemList=idleConf.GetSectionList('default','highlight') itemList.sort() print 'builtin items:',itemList self.optMenuThemeBuiltin.SetMenu(itemList,itemList[0]) self.SetThemeType() ##load theme element option menu themeNames=self.themeElements.keys() themeNames.sort(self.__ThemeNameIndexCompare) self.optMenuHighlightTarget.SetMenu(themeNames,themeNames[0]) self.PaintThemeSample() self.SetHighlightTarget()
dfd0b296d766645bd2e01955a61f52643a483922 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dfd0b296d766645bd2e01955a61f52643a483922/configDialog.py
print 'builtin items:',itemList
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(): #default theme selected print 'builtin theme' itemList=idleConf.GetSectionList('default','highlight') itemList.sort() print 'builtin items:',itemList self.optMenuThemeBuiltin.SetMenu(itemList,currentOption) itemList=idleConf.GetSectionList('user','highlight') itemList.sort() print 'user items:',itemList if not itemList: self.radioThemeCustom.config(state=DISABLED) self.customTheme.set('- no custom themes -') else: self.optMenuThemeCustom.SetMenu(itemList,itemList[0]) else: #user theme selected print 'user theme' itemList=idleConf.GetSectionList('user','highlight') itemList.sort() print 'user items:',itemList self.optMenuThemeCustom.SetMenu(itemList,currentOption) itemList=idleConf.GetSectionList('default','highlight') itemList.sort() print 'builtin items:',itemList self.optMenuThemeBuiltin.SetMenu(itemList,itemList[0]) self.SetThemeType() ##load theme element option menu themeNames=self.themeElements.keys() themeNames.sort(self.__ThemeNameIndexCompare) self.optMenuHighlightTarget.SetMenu(themeNames,themeNames[0]) self.PaintThemeSample() self.SetHighlightTarget()
dfd0b296d766645bd2e01955a61f52643a483922 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dfd0b296d766645bd2e01955a61f52643a483922/configDialog.py
raise RuntimeError, "no clue how to do this on Mac OS"
if not os.path.isabs(pathname): return os.path.join(new_root, pathname) else: elements = string.split(pathname, ":", 1) pathname = ":" + elements[1] return os.path.join(new_root, pathname)
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 not os.path.isabs (pathname): return os.path.join (new_root, pathname) else: return os.path.join (new_root, pathname[1:]) elif os.name == 'nt': (drive, path) = os.path.splitdrive (pathname) if path[0] == '\\': path = path[1:] return os.path.join (new_root, path) elif os.name == 'mac': raise RuntimeError, "no clue how to do this on Mac OS" else: raise DistutilsPlatformError, \ "nothing known about platform '%s'" % os.name
f5855746fe0851e5a80b32061cb819021285ff25 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f5855746fe0851e5a80b32061cb819021285ff25/util.py
code = compile(line + '\n', '<stdin>', 'single')
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: exc_type_name = sys.exc_type.__name__ print '***', exc_type_name + ':', sys.exc_value
f17361d314f118610d6e9ad4ca603350fc986abb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f17361d314f118610d6e9ad4ca603350fc986abb/pdb.py
self.compiler = new_compiler ( compiler="msvc",
self.compiler = new_compiler (compiler=self.compiler,
def run (self):
e401e15d18e1a9458c2b05a59792760caeec758a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e401e15d18e1a9458c2b05a59792760caeec758a/build_ext.py
extra_args = ext.extra_compile_args
extra_args = ext.extra_compile_args or []
def build_extensions (self):
e401e15d18e1a9458c2b05a59792760caeec758a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e401e15d18e1a9458c2b05a59792760caeec758a/build_ext.py
extra_args = ext.extra_link_args
extra_args = ext.extra_link_args or []
def build_extensions (self):
e401e15d18e1a9458c2b05a59792760caeec758a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e401e15d18e1a9458c2b05a59792760caeec758a/build_ext.py
self.rfile = self.connection.makefile('rb', 0) self.wfile = self.connection.makefile('wb', 0)
self.rfile = self.connection.makefile('rb', self.rbufsize) self.wfile = self.connection.makefile('wb', self.wbufsize)
def setup(self): self.connection = self.request self.rfile = self.connection.makefile('rb', 0) self.wfile = self.connection.makefile('wb', 0)
01fed4d4e6a2d5f4ff85236bb3430cdfef5e4ada /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/01fed4d4e6a2d5f4ff85236bb3430cdfef5e4ada/SocketServer.py
if not host: return addinfo(open(file, 'r'), noheaders())
if not host: return addinfo(open(_fixpath(file), 'r'), noheaders())
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', 'not on local host')
dc3e3f69db6a6aa5aed1d604d53c0b4cf156add8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dc3e3f69db6a6aa5aed1d604d53c0b4cf156add8/urllib.py
return addinfo(open(file, 'r'), noheaders())
return addinfo(open(_fixpath(file), 'r'), noheaders())
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', 'not on local host')
dc3e3f69db6a6aa5aed1d604d53c0b4cf156add8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dc3e3f69db6a6aa5aed1d604d53c0b4cf156add8/urllib.py
genpluginproject("carbon", "_CF", sources=[":cf:_CFmodule.c", ":cf:pycfbridge.c"], outputdir="::Lib:Carbon")
genpluginproject("carbon", "_CF", sources=["_CFmodule.c", "pycfbridge.c"], outputdir="::Lib:Carbon")
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 architecture == "all": # For the time being we generate two project files. Not as nice as # a single multitarget project, but easier to implement for now. genpluginproject("ppc", module, project, projectdir, sources, sourcedirs, libraries, extradirs, extraexportsymbols, outputdir, libraryflags, stdlibraryflags, prefixname, initialize) genpluginproject("carbon", module, project, projectdir, sources, sourcedirs, libraries, extradirs, extraexportsymbols, outputdir, libraryflags, stdlibraryflags, prefixname, initialize) return templatename = "template-%s" % architecture targetname = "%s.%s" % (module, architecture) dllname = "%s.%s.slb" % (module, architecture) if not project: if architecture != "ppc": project = "%s.%s.mcp"%(module, architecture) else: project = "%s.mcp"%module if not projectdir: projectdir = PROJECTDIR if not sources: sources = [module + 'module.c'] if not sourcedirs: for moduledir in MODULEDIRS: if '%' in moduledir: # For historical reasons an initial _ in the modulename # is not reflected in the folder name if module[0] == '_': modulewithout_ = module[1:] else: modulewithout_ = module moduledir = moduledir % modulewithout_ fn = os.path.join(projectdir, os.path.join(moduledir, sources[0])) if os.path.exists(fn): moduledir, sourcefile = os.path.split(fn) sourcedirs = [relpath(projectdir, moduledir)] sources[0] = sourcefile break else: print "Warning: %s: sourcefile not found: %s"%(module, sources[0]) sourcedirs = [] if prefixname: pass elif architecture == "carbon": prefixname = "mwerks_shcarbon_pch" else: prefixname = "mwerks_plugin_config.h" dict = { "sysprefix" : relpath(projectdir, sys.prefix), "sources" : sources, "extrasearchdirs" : sourcedirs + extradirs, "libraries": libraries, "mac_outputdir" : outputdir, "extraexportsymbols" : extraexportsymbols, "mac_targetname" : targetname, "mac_dllname" : dllname, "prefixname" : prefixname, } if libraryflags: dict['libraryflags'] = libraryflags if stdlibraryflags: dict['stdlibraryflags'] = stdlibraryflags if initialize: dict['initialize'] = initialize mkcwproject.mkproject(os.path.join(projectdir, project), module, dict, force=FORCEREBUILD, templatename=templatename)
66e794d74372ee43c027adc808d57734d102a2a1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66e794d74372ee43c027adc808d57734d102a2a1/genpluginprojects.py
run_unittest(LongReprTest)
if os.name != 'mac': run_unittest(LongReprTest)
def __repr__(self): raise Exception("This should be caught by Repr.repr_instance")
a44361ea363ca96cab1a95c5fbea73d17ef891ee /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a44361ea363ca96cab1a95c5fbea73d17ef891ee/test_repr.py
u2 = random()
u2 = 1.0 - random()
def normalvariate(self, mu, sigma): """Normal distribution.
73ced7ee995180c0bd8d96ff7d7fb614a744ad7d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/73ced7ee995180c0bd8d96ff7d7fb614a744ad7d/random.py
u2 = random()
if not 1e-7 < u1 < .9999999: continue u2 = 1.0 - random()
def gammavariate(self, alpha, beta): """Gamma distribution. Not the gamma function!
73ced7ee995180c0bd8d96ff7d7fb614a744ad7d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/73ced7ee995180c0bd8d96ff7d7fb614a744ad7d/random.py
u = self.random()
u = 1.0 - self.random()
def paretovariate(self, alpha): """Pareto distribution. alpha is the shape parameter.""" # Jain, pg. 495
73ced7ee995180c0bd8d96ff7d7fb614a744ad7d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/73ced7ee995180c0bd8d96ff7d7fb614a744ad7d/random.py
u = self.random()
u = 1.0 - self.random()
def weibullvariate(self, alpha, beta): """Weibull distribution.
73ced7ee995180c0bd8d96ff7d7fb614a744ad7d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/73ced7ee995180c0bd8d96ff7d7fb614a744ad7d/random.py
print "self.bdist_dir = %s" % self.bdist_dir print "self.format = %s" % self.format
def run (self):
8fd7ba2c6a333993480a0a9f52332463de79b95f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8fd7ba2c6a333993480a0a9f52332463de79b95f/bdist_dumb.py
if (not rframe is frame) and rcur:
if (rframe is frame) and rcur:
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
5a28bfbbc7707b6820b3ecf31589d04ee9120da5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5a28bfbbc7707b6820b3ecf31589d04ee9120da5/profile.py
path = list (path)
path = list (package)
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)."""
631e6a0c070810b064c48ff6cf777ebb0276f038 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/631e6a0c070810b064c48ff6cf777ebb0276f038/build_py.py
return apply (os.path.join, path)
if path: return apply (os.path.join, path) else: return ''
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)."""
631e6a0c070810b064c48ff6cf777ebb0276f038 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/631e6a0c070810b064c48ff6cf777ebb0276f038/build_py.py
return apply (os.path.join, tail)
if tail: return apply (os.path.join, tail) else: return ''
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)."""
631e6a0c070810b064c48ff6cf777ebb0276f038 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/631e6a0c070810b064c48ff6cf777ebb0276f038/build_py.py
if package != "":
if package:
def check_package (self, package, package_dir):
631e6a0c070810b064c48ff6cf777ebb0276f038 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/631e6a0c070810b064c48ff6cf777ebb0276f038/build_py.py
outfile_path = package
outfile_path = list (package)
def build_module (self, module, module_file, package):
631e6a0c070810b064c48ff6cf777ebb0276f038 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/631e6a0c070810b064c48ff6cf777ebb0276f038/build_py.py
def parse(filename_or_stream, handler, errorHandler=ErrorHandler()): parser = ExpatParser() parser.setContentHandler(handler) parser.setErrorHandler(errorHandler) parser.parse(filename_or_stream)
ae43e5205d7eec667e86c6dbf6714ec2fc12cf26 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ae43e5205d7eec667e86c6dbf6714ec2fc12cf26/__init__.py
self._preprocess(body, headers, lang)
self._preprocess(body, headers, include_dirs, lang)
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. ('body' probably isn't of much use, but what the heck.) """ from distutils.ccompiler import CompileError self._check_compiler() ok = 1 try: self._preprocess(body, headers, lang) except CompileError: ok = 0
6fb8d3a3d6dc74a971811f2936343725f3cdea12 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6fb8d3a3d6dc74a971811f2936343725f3cdea12/config.py
(src, out) = self._preprocess(body, headers, lang)
(src, out) = self._preprocess(body, headers, include_dirs, lang)
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 both 'body' and 'headers' are None, preprocesses an empty file -- which can be useful to determine the symbols the preprocessor and compiler set by default. """
6fb8d3a3d6dc74a971811f2936343725f3cdea12 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6fb8d3a3d6dc74a971811f2936343725f3cdea12/config.py
if pattern.search(pattern):
if pattern.search(line):
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 both 'body' and 'headers' are None, preprocesses an empty file -- which can be useful to determine the symbols the preprocessor and compiler set by default. """
6fb8d3a3d6dc74a971811f2936343725f3cdea12 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6fb8d3a3d6dc74a971811f2936343725f3cdea12/config.py
self._compile(body, headers, lang)
self._compile(body, headers, include_dirs, lang)
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: ok = 0
6fb8d3a3d6dc74a971811f2936343725f3cdea12 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6fb8d3a3d6dc74a971811f2936343725f3cdea12/config.py
try: str(u'Hello \u00E1') except Exception, e: sampleUnicodeEncodeError = e try: unicode('\xff') except Exception, e: sampleUnicodeDecodeError = e
def testAttributes(self): # test that exception attributes are happy try: str(u'Hello \u00E1') except Exception, e: sampleUnicodeEncodeError = e
38f6237dfe1355192a11fe004d32f547cd1eadbd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/38f6237dfe1355192a11fe004d32f547cd1eadbd/test_exceptions.py
(sampleUnicodeEncodeError, {'message' : '', 'args' : ('ascii', u'Hello \xe1', 6, 7, 'ordinal not in range(128)'), 'encoding' : 'ascii', 'object' : u'Hello \xe1', 'start' : 6, 'reason' : 'ordinal not in range(128)'}), (sampleUnicodeDecodeError,
(UnicodeEncodeError, ('ascii', u'a', 0, 1, 'ordinal not in range'), {'message' : '', 'args' : ('ascii', u'a', 0, 1, 'ordinal not in range'), 'encoding' : 'ascii', 'object' : u'a', 'start' : 0, 'reason' : 'ordinal not in range'}), (UnicodeDecodeError, ('ascii', '\xff', 0, 1, 'ordinal not in range'),
def testAttributes(self): # test that exception attributes are happy try: str(u'Hello \u00E1') except Exception, e: sampleUnicodeEncodeError = e
38f6237dfe1355192a11fe004d32f547cd1eadbd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/38f6237dfe1355192a11fe004d32f547cd1eadbd/test_exceptions.py
'ordinal not in range(128)'),
'ordinal not in range'),
def testAttributes(self): # test that exception attributes are happy try: str(u'Hello \u00E1') except Exception, e: sampleUnicodeEncodeError = e
38f6237dfe1355192a11fe004d32f547cd1eadbd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/38f6237dfe1355192a11fe004d32f547cd1eadbd/test_exceptions.py
'start' : 0, 'reason' : 'ordinal not in range(128)'}),
'start' : 0, 'reason' : 'ordinal not in range'}),
def testAttributes(self): # test that exception attributes are happy try: str(u'Hello \u00E1') except Exception, e: sampleUnicodeEncodeError = e
38f6237dfe1355192a11fe004d32f547cd1eadbd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/38f6237dfe1355192a11fe004d32f547cd1eadbd/test_exceptions.py
for args in exceptionList: expected = args[-1] try: exc = args[0] if len(args) == 2: raise exc else: raise exc(*args[1])
for exc, args, expected in exceptionList: try: raise exc(*args)
def testAttributes(self): # test that exception attributes are happy try: str(u'Hello \u00E1') except Exception, e: sampleUnicodeEncodeError = e
38f6237dfe1355192a11fe004d32f547cd1eadbd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/38f6237dfe1355192a11fe004d32f547cd1eadbd/test_exceptions.py
if (e is not exc and type(e) is not exc):
if type(e) is not exc:
def testAttributes(self): # test that exception attributes are happy try: str(u'Hello \u00E1') except Exception, e: sampleUnicodeEncodeError = e
38f6237dfe1355192a11fe004d32f547cd1eadbd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/38f6237dfe1355192a11fe004d32f547cd1eadbd/test_exceptions.py
p = subprocess.Popen(cmdline, close_fds=True)
if sys.platform[:3] == 'win': p = subprocess.Popen(cmdline) else: p = subprocess.Popen(cmdline, close_fds=True)
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
1f2157896524c174f39143bc8e4c8dbf22027a24 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1f2157896524c174f39143bc8e4c8dbf22027a24/webbrowser.py
setsid = getattr(os, 'setsid', None) if not setsid: setsid = getattr(os, 'setpgrp', None)
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 False
1f2157896524c174f39143bc8e4c8dbf22027a24 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1f2157896524c174f39143bc8e4c8dbf22027a24/webbrowser.py
p = subprocess.Popen(cmdline, close_fds=True, preexec_fn=setsid)
if sys.platform[:3] == 'win': p = subprocess.Popen(cmdline) else: setsid = getattr(os, 'setsid', None) if not setsid: setsid = getattr(os, 'setpgrp', None) p = subprocess.Popen(cmdline, close_fds=True, preexec_fn=setsid)
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 False
1f2157896524c174f39143bc8e4c8dbf22027a24 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1f2157896524c174f39143bc8e4c8dbf22027a24/webbrowser.py
option = string.lower(option)
option = self.optionxform(option)
def get(self, section, option, raw=0, vars=None): """Get an option value for a given section.
9e480adf9b3520ea3deb322fd1214f53a2293a0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9e480adf9b3520ea3deb322fd1214f53a2293a0d/ConfigParser.py
__SECTCRE = re.compile(
SECTCRE = re.compile(
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
9e480adf9b3520ea3deb322fd1214f53a2293a0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9e480adf9b3520ea3deb322fd1214f53a2293a0d/ConfigParser.py
__OPTCRE = re.compile(
OPTCRE = re.compile(
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
9e480adf9b3520ea3deb322fd1214f53a2293a0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9e480adf9b3520ea3deb322fd1214f53a2293a0d/ConfigParser.py
mo = self.__SECTCRE.match(line)
mo = self.SECTCRE.match(line)
def __read(self, fp): """Parse a sectioned setup file.
9e480adf9b3520ea3deb322fd1214f53a2293a0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9e480adf9b3520ea3deb322fd1214f53a2293a0d/ConfigParser.py
mo = self.__OPTCRE.match(line)
mo = self.OPTCRE.match(line)
def __read(self, fp): """Parse a sectioned setup file.
9e480adf9b3520ea3deb322fd1214f53a2293a0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9e480adf9b3520ea3deb322fd1214f53a2293a0d/ConfigParser.py
src_extensions = _c_extensions + _cpp_extensions
src_extensions = (_c_extensions + _cpp_extensions + _rc_extensions + _mc_extensions) res_extension = '.res'
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,';')
9c0ea13ece57d3c5f518e5b1d0d75cc83a7a1c38 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9c0ea13ece57d3c5f518e5b1d0d75cc83a7a1c38/msvccompiler.py
self.mkpath (os.path.dirname (obj))
def compile (self, sources, output_dir=None, macros=None, include_dirs=None, debug=0, extra_preargs=None, extra_postargs=None):
9c0ea13ece57d3c5f518e5b1d0d75cc83a7a1c38 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9c0ea13ece57d3c5f518e5b1d0d75cc83a7a1c38/msvccompiler.py
m235 to share a single generator". Unfortunately, using generators this way creates a reference-cycle that the garbage collector (currently) can't clean up, so we have to explicitly break the cycle (by calling the inner generator's close() method)
m235 to share a single generator".
... def tail(g):
b3deb94dc6fab592a825811e8a985fd2d8bbe2b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b3deb94dc6fab592a825811e8a985fd2d8bbe2b4/test_generators.py
... return m1.close, mRes >>> closer, it = m235()
... return mRes >>> it = m235()
... def _m235():
b3deb94dc6fab592a825811e8a985fd2d8bbe2b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b3deb94dc6fab592a825811e8a985fd2d8bbe2b4/test_generators.py
>>> closer()
... def _m235():
b3deb94dc6fab592a825811e8a985fd2d8bbe2b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b3deb94dc6fab592a825811e8a985fd2d8bbe2b4/test_generators.py
are quite straightforwardly expressed with this Python idiom. The problem is that this creates an uncollectable reference cycle, and we have to explicitly close the innermost generator to clean up the cycle. XXX As of 14-Apr-2006, Tim doubts that anyone understands _why_ some cycle XXX is uncollectable here.
are quite straightforwardly expressed with this Python idiom.
... def _m235():
b3deb94dc6fab592a825811e8a985fd2d8bbe2b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b3deb94dc6fab592a825811e8a985fd2d8bbe2b4/test_generators.py
... return realfib.close, fibRes >>> closer, fibber = fib() >>> firstn(fibber, 17)
... return fibRes >>> firstn(fib(), 17)
... def _fib():
b3deb94dc6fab592a825811e8a985fd2d8bbe2b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b3deb94dc6fab592a825811e8a985fd2d8bbe2b4/test_generators.py
>>> closer() XXX Again the tee-based approach leaks without an explicit close().
... def _fib():
b3deb94dc6fab592a825811e8a985fd2d8bbe2b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b3deb94dc6fab592a825811e8a985fd2d8bbe2b4/test_generators.py
information. The application must not attempt to read from the array outside of the specified range."""
information."""
def ignorableWhitespace(self, whitespace): """Receive notification of ignorable whitespace in element content.
e143bbb61034396cd2d5c4ecaa4f313e62ea2a3e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e143bbb61034396cd2d5c4ecaa4f313e62ea2a3e/handler.py
pat = r'''-..x..x..x
pat = r'''[l-]..x..x..x
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. /bin/ls # and end with the name of the file. '''
fa699126b5e1c649365aacbedb17a1b69e69bb49 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/fa699126b5e1c649365aacbedb17a1b69e69bb49/test_commands.py
fp.write("\t\taetools.enumsubst(_arguments, %s, _Enum_%s)\n" %
if ename <> '****': fp.write("\t\taetools.enumsubst(_arguments, %s, _Enum_%s)\n" %
fp.write("\tdef %s(self, "%funcname)
a2408e9d6a20995d750c955621a7506b71da5434 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a2408e9d6a20995d750c955621a7506b71da5434/gensuitemodule.py
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))
if hasattr(type(x), '__name__'): methodname = 'repr_' + join(split(type(x).__name__), '_') if hasattr(self, methodname): return getattr(self, methodname)(x, level) 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))
0fe8fce7e3de8549ae4a26cfe3299872bf2b446c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0fe8fce7e3de8549ae4a26cfe3299872bf2b446c/pydoc.py
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)
if hasattr(type(x), '__name__'): methodname = 'repr_' + join(split(type(x).__name__), '_') if hasattr(self, methodname): return getattr(self, methodname)(x, level) 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)
0fe8fce7e3de8549ae4a26cfe3299872bf2b446c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0fe8fce7e3de8549ae4a26cfe3299872bf2b446c/pydoc.py
else: a.write(data) a.close()
a.bufsize() a.obufcount() a.obuffree() a.getptr() a.fileno() a.setparameters(rate, 8, nchannels, linuxaudiodev.AFMT_MU_LAW, 1) a.write(data) a.flush() a.close() def test_errors(): a = linuxaudiodev.open("w") size = 8 fmt = linuxaudiodev.AFMT_U8 rate = 8000 nchannels = 1 try: a.setparameters(-1, size, nchannels, fmt) except ValueError, msg: print msg try: a.setparameters(rate, -2, nchannels, fmt) except ValueError, msg: print msg try: a.setparameters(rate, size, 3, fmt) except ValueError, msg: print msg try: a.setparameters(rate, size, nchannels, 177) except ValueError, msg: print msg try: a.setparameters(rate, size, nchannels, linuxaudiodev.AFMT_U16_LE) except ValueError, msg: print msg try: a.setparameters(rate, 16, nchannels, fmt) except ValueError, msg: print msg
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()
e2b7c4dea38568ac7fa1576167fb1b32bf9cdf3f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e2b7c4dea38568ac7fa1576167fb1b32bf9cdf3f/test_linuxaudiodev.py
self.write('<OBJECT type="text/sitemap">\n') self.tab('\t<param name="Local" value="%s/%s">\n' % (self.path, href))
self.hrefstack.append(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))
454540774618c35374ecd0042ab689692040c425 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/454540774618c35374ecd0042ab689692040c425/prechm.py
self.tab('\t<param name="Name" value="%s">\n' % self.saved_get()) self.tab('\t</OBJECT>\n')
title = cgi.escape(self.saved_get(), True) path = self.path + '/' + self.hrefstack.pop() if len(self.hrefstack) == 0: self.tab(object_sitemap % (title, path))
def anchor_end(self): if self.proc: self.tab('\t<param name="Name" value="%s">\n' % self.saved_get()) self.tab('\t</OBJECT>\n')
454540774618c35374ecd0042ab689692040c425 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/454540774618c35374ecd0042ab689692040c425/prechm.py
output.write(object_sitemap % (book.directory + "/" + book.firstpage, book.title))
path = book.directory + "/" + book.firstpage output.write('<LI>') output.write(object_sitemap % (book.title, path))
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(contents_footer)
454540774618c35374ecd0042ab689692040c425 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/454540774618c35374ecd0042ab689692040c425/prechm.py
def __init__ (self, option_table=None):
576298d3b2f5e4c071e6f68879b8f900bdc9b80e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/576298d3b2f5e4c071e6f68879b8f900bdc9b80e/fancy_getopt.py
assert "invalid option tuple: %r" % (option,)
raise ValueError, "invalid option tuple: %r" % (option,)
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 = {}
576298d3b2f5e4c071e6f68879b8f900bdc9b80e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/576298d3b2f5e4c071e6f68879b8f900bdc9b80e/fancy_getopt.py
data = s[:n]
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)
aa93517de8b5e2b41644a22ae81ddec4f5d72991 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/aa93517de8b5e2b41644a22ae81ddec4f5d72991/xdrlib.py
def __init__(self, recipients): self.recipients = recipients self.args = ( recipients,)
7bc82bb1f0ce5c841382587839c218b6cc63e1ff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7bc82bb1f0ce5c841382587839c218b6cc63e1ff/smtplib.py
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)
self.putcmd("helo", _get_fqdn_hostname(name))
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.helo_resp=msg return (code,msg)
7bc82bb1f0ce5c841382587839c218b6cc63e1ff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7bc82bb1f0ce5c841382587839c218b6cc63e1ff/smtplib.py
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)
self.putcmd("ehlo", _get_fqdn_hostname(name))
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() # According to RFC1869 some (badly written) # MTA's will disconnect on an ehlo. Toss an exception if # that happens -ddm if code == -1 and len(msg) == 0: raise SMTPServerDisconnected("Server not connected") self.ehlo_resp=msg if code<>250: return (code,msg) self.does_esmtp=1 #parse the ehlo response -ddm resp=string.split(self.ehlo_resp,'\n') del resp[0] for each in resp: m=re.match(r'(?P<feature>[A-Za-z0-9][A-Za-z0-9\-]*)',each) if m: feature=string.lower(m.group("feature")) params=string.strip(m.string[m.end("feature"):]) self.esmtp_features[feature]=params return (code,msg)
7bc82bb1f0ce5c841382587839c218b6cc63e1ff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7bc82bb1f0ce5c841382587839c218b6cc63e1ff/smtplib.py
imclass = object.im_class
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: imclass = object.im_class if imclass is not cl: url = '%s.html#%s-%s' % ( imclass.__module__, imclass.__name__, name) note = ' from <a href="%s">%s</a>' % ( url, classname(imclass, mod)) skipdocs = 1 else: note = (object.im_self and ' method of %s instance' + object.im_self.__class__ or ' unbound %s method' % object.im_class.__name__) object = object.im_func
6dcfa3884d3e4a6fe8dc57eec4d8df1980cda04e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6dcfa3884d3e4a6fe8dc57eec4d8df1980cda04e/pydoc.py
note = (object.im_self and ' method of %s instance' + object.im_self.__class__ or ' unbound %s method' % object.im_class.__name__)
inst = object.im_self note = (inst and ' method of %s instance' % classname(inst.__class__, mod) or ' unbound %s method' % classname(imclass, mod))
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: imclass = object.im_class if imclass is not cl: url = '%s.html#%s-%s' % ( imclass.__module__, imclass.__name__, name) note = ' from <a href="%s">%s</a>' % ( url, classname(imclass, mod)) skipdocs = 1 else: note = (object.im_self and ' method of %s instance' + object.im_self.__class__ or ' unbound %s method' % object.im_class.__name__) object = object.im_func
6dcfa3884d3e4a6fe8dc57eec4d8df1980cda04e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6dcfa3884d3e4a6fe8dc57eec4d8df1980cda04e/pydoc.py
note = (object.im_self and ' method of %s instance' + object.im_self.__class__ or ' unbound %s method' % classname(imclass, mod))
inst = object.im_self note = (inst and ' method of %s instance' % classname(inst.__class__, mod) or ' unbound %s method' % classname(imclass, mod))
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, mod) skipdocs = 1 else: note = (object.im_self and ' method of %s instance' + object.im_self.__class__ or ' unbound %s method' % classname(imclass, mod)) object = object.im_func
6dcfa3884d3e4a6fe8dc57eec4d8df1980cda04e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6dcfa3884d3e4a6fe8dc57eec4d8df1980cda04e/pydoc.py
args=(key, self.update, self.done)).start()
args=(self.update, key, self.done)).start()
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') self.expand()
6dcfa3884d3e4a6fe8dc57eec4d8df1980cda04e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6dcfa3884d3e4a6fe8dc57eec4d8df1980cda04e/pydoc.py
packkey(ae, key, value)
ae.AEPutAttributeDesc(key, pack(value))
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)
5b7338519507e984778355d1628ec65bfa59bb39 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5b7338519507e984778355d1628ec65bfa59bb39/aetools.py
arguments[key] = edict[v]
arguments[key] = Enum(edict[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] = edict[v] elif not v in ok: raise TypeError, 'Unknown enumerator: %s'%v
5b7338519507e984778355d1628ec65bfa59bb39 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5b7338519507e984778355d1628ec65bfa59bb39/aetools.py
if len (line) > 0 and line[0] != ' self.onecmd (line)
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)
08454596d1390dbee114ce48d8ed24160057145c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/08454596d1390dbee114ce48d8ed24160057145c/pdb.py
if not line:
if not line.strip():
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 = line.split() # split into ';;' separated commands # unless it's an alias command if args[0] != 'alias': marker = line.find(';;') if marker >= 0: # queue up everything after marker next = line[marker+2:].lstrip() self.cmdqueue.append(next) line = line[:marker].rstrip() return line
08454596d1390dbee114ce48d8ed24160057145c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/08454596d1390dbee114ce48d8ed24160057145c/pdb.py
if ( not line or (line[0] == ' (line[:3] == '"""') or line[:3] == "'''" ):
if (not line or (line[0] == ' (line[:3] == '"""') or line[:3] == "'''"):
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."""
08454596d1390dbee114ce48d8ed24160057145c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/08454596d1390dbee114ce48d8ed24160057145c/pdb.py
if (count > 0):
if count > 0:
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 crossings' % count else: reply = reply + '1 crossing' print reply + ' of breakpoint %d.' % bpnum else: print 'Will stop next time breakpoint', print bpnum, 'is reached.'
08454596d1390dbee114ce48d8ed24160057145c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/08454596d1390dbee114ce48d8ed24160057145c/pdb.py
if (count > 1):
if count > 1:
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 crossings' % count else: reply = reply + '1 crossing' print reply + ' of breakpoint %d.' % bpnum else: print 'Will stop next time breakpoint', print bpnum, 'is reached.'
08454596d1390dbee114ce48d8ed24160057145c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/08454596d1390dbee114ce48d8ed24160057145c/pdb.py
if args[0] in self.aliases and len (args) == 1:
if args[0] in self.aliases and len(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:])
08454596d1390dbee114ce48d8ed24160057145c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/08454596d1390dbee114ce48d8ed24160057145c/pdb.py
p = _cache.get(key)
cachekey = (type(key[0]),) + key p = _cache.get(cachekey)
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) except error, v: raise error, v # invalid expression if len(_cache) >= _MAXCACHE: _cache.clear() _cache[key] = p return p
0f5bf1ebdd426fb17f92d00b319a55b014021c30 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0f5bf1ebdd426fb17f92d00b319a55b014021c30/sre.py
_cache[key] = p
_cache[cachekey] = p
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) except error, v: raise error, v # invalid expression if len(_cache) >= _MAXCACHE: _cache.clear() _cache[key] = p return p
0f5bf1ebdd426fb17f92d00b319a55b014021c30 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0f5bf1ebdd426fb17f92d00b319a55b014021c30/sre.py
while f and f is not self.botframe:
while f is not None:
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 <= self.curindex < len(self.stack): self.curframe = self.stack[self.curindex][0] else: self.curframe = None
7ac1c81f4f4b45722a0589e3ff42861b7082835a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7ac1c81f4f4b45722a0589e3ff42861b7082835a/pdb.py
while t:
while t is not None:
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 <= self.curindex < len(self.stack): self.curframe = self.stack[self.curindex][0] else: self.curframe = None
7ac1c81f4f4b45722a0589e3ff42861b7082835a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7ac1c81f4f4b45722a0589e3ff42861b7082835a/pdb.py
if 0 <= self.curindex < len(self.stack): self.curframe = self.stack[self.curindex][0] else: self.curframe = None
self.curframe = self.stack[self.curindex][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 if 0 <= self.curindex < len(self.stack): self.curframe = self.stack[self.curindex][0] else: self.curframe = None
7ac1c81f4f4b45722a0589e3ff42861b7082835a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7ac1c81f4f4b45722a0589e3ff42861b7082835a/pdb.py
pass
return
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: pass finally: self.reset()
7ac1c81f4f4b45722a0589e3ff42861b7082835a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7ac1c81f4f4b45722a0589e3ff42861b7082835a/pdb.py
print '*** Post Mortem Debugging:' sys.trace = None del sys.trace try: self.ask_user(None, sys.exc_traceback) except PdbQuit: pass
t = sys.exc_traceback
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: pass finally: self.reset()
7ac1c81f4f4b45722a0589e3ff42861b7082835a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7ac1c81f4f4b45722a0589e3ff42861b7082835a/pdb.py
self.reset()
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.ask_user(self.botframe, t) except PdbQuit: pass finally: self.forget()
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: pass finally: self.reset()
7ac1c81f4f4b45722a0589e3ff42861b7082835a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7ac1c81f4f4b45722a0589e3ff42861b7082835a/pdb.py
return
return None
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
7ac1c81f4f4b45722a0589e3ff42861b7082835a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7ac1c81f4f4b45722a0589e3ff42861b7082835a/pdb.py
return frame.f_locals['__args__'] = arg
return None if arg is None: print '[Entering non-function block.]' else: frame.f_locals['__args__'] = arg
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
7ac1c81f4f4b45722a0589e3ff42861b7082835a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7ac1c81f4f4b45722a0589e3ff42861b7082835a/pdb.py
if self.stop_here(frame): print '!!! return', `arg` return
self.lastretval = arg return None
def dispatch_return(self, frame, arg): if self.stop_here(frame): print '!!! return', `arg` return
7ac1c81f4f4b45722a0589e3ff42861b7082835a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7ac1c81f4f4b45722a0589e3ff42861b7082835a/pdb.py
print '!!! exception', arg[0] + ':', `arg[1]`
print '!!!', arg[0] + ':', `arg[1]`
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
7ac1c81f4f4b45722a0589e3ff42861b7082835a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7ac1c81f4f4b45722a0589e3ff42861b7082835a/pdb.py
"""Yield submodule names+loaders recursively, for path or sys.path"""
"""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 output. Note that this function must import all *packages* (NOT all modules!) on the given path, in order to access the __path__ attribute to find submodules. 'onerror' is a function which gets called with one argument (the name of the package which was being imported) if an ImportError occurs trying to import a package. By default the ImportError is caught and ignored. Examples: walk_packages() : list all modules python can access walk_packages(ctypes.__path__, ctypes.__name__+'.') : list all submodules of ctypes """
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: if onerror is not None: onerror() else: path = getattr(sys.modules[name], '__path__', None) or [] # don't traverse path items we've seen before path = [p for p in path if not seen(p)] for item in walk_packages(path, name+'.'): yield item
69b9b677b091fe770d73a22e0d4a11a15364bc4a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/69b9b677b091fe770d73a22e0d4a11a15364bc4a/pkgutil.py
onerror()
onerror(name)
def seen(p, m={}): if p in m: return True m[p] = True
69b9b677b091fe770d73a22e0d4a11a15364bc4a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/69b9b677b091fe770d73a22e0d4a11a15364bc4a/pkgutil.py