rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
self.fp.write("
if self.fp: self.fp.write("
def fillclasspropsandelems(self, cls): [name, code, desc, properties, elements] = cls cname = identify(name) if self.classcodes[code] != cname: # This is an other name (plural or so) for something else. Skip. return plist = [] elist = [] for prop in properties: [pname, pcode, what] = prop if pcode == 'c@#!': continue pname = identify(pname) plist.append(pname) for elem in elements: [ecode, keyform] = elem if ecode == 'c@#!': continue name, ename, module = self.findcodename('class', ecode) if not name: self.fp.write("# XXXX %s element %s not found!!\n"%(cname, `ecode`)) else: elist.append((name, ename)) self.fp.write("%s._propdict = {\n"%cname) for n in plist: self.fp.write("\t'%s' : %s,\n"%(n, n)) self.fp.write("}\n") self.fp.write("%s._elemdict = {\n"%cname) for n, fulln in elist: self.fp.write("\t'%s' : %s,\n"%(n, fulln)) self.fp.write("}\n")
b18e37723e6f3e7fe6bae03f14e954721df23eaf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b18e37723e6f3e7fe6bae03f14e954721df23eaf/gensuitemodule.py
self.fp.write("%s._propdict = {\n"%cname) for n in plist: self.fp.write("\t'%s' : %s,\n"%(n, n)) self.fp.write("}\n") self.fp.write("%s._elemdict = {\n"%cname) for n, fulln in elist: self.fp.write("\t'%s' : %s,\n"%(n, fulln)) self.fp.write("}\n")
if self.fp: self.fp.write("%s._propdict = {\n"%cname) for n in plist: self.fp.write("\t'%s' : %s,\n"%(n, n)) self.fp.write("}\n") self.fp.write("%s._elemdict = {\n"%cname) for n, fulln in elist: self.fp.write("\t'%s' : %s,\n"%(n, fulln)) self.fp.write("}\n")
def fillclasspropsandelems(self, cls): [name, code, desc, properties, elements] = cls cname = identify(name) if self.classcodes[code] != cname: # This is an other name (plural or so) for something else. Skip. return plist = [] elist = [] for prop in properties: [pname, pcode, what] = prop if pcode == 'c@#!': continue pname = identify(pname) plist.append(pname) for elem in elements: [ecode, keyform] = elem if ecode == 'c@#!': continue name, ename, module = self.findcodename('class', ecode) if not name: self.fp.write("# XXXX %s element %s not found!!\n"%(cname, `ecode`)) else: elist.append((name, ename)) self.fp.write("%s._propdict = {\n"%cname) for n in plist: self.fp.write("\t'%s' : %s,\n"%(n, n)) self.fp.write("}\n") self.fp.write("%s._elemdict = {\n"%cname) for n, fulln in elist: self.fp.write("\t'%s' : %s,\n"%(n, fulln)) self.fp.write("}\n")
b18e37723e6f3e7fe6bae03f14e954721df23eaf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b18e37723e6f3e7fe6bae03f14e954721df23eaf/gensuitemodule.py
self.compcodes[code] = iname self.fp.write("class %s(aetools.NComparison):\n" % iname) self.fp.write('\t"""%s - %s """\n' % (name, comment))
self.namemappers[0].addnamecode('comparison', iname, code) if self.fp: self.fp.write("class %s(aetools.NComparison):\n" % iname) self.fp.write('\t"""%s - %s """\n' % (name, comment))
def compilecomparison(self, comp): [name, code, comment] = comp iname = identify(name) self.compcodes[code] = iname self.fp.write("class %s(aetools.NComparison):\n" % iname) self.fp.write('\t"""%s - %s """\n' % (name, comment))
b18e37723e6f3e7fe6bae03f14e954721df23eaf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b18e37723e6f3e7fe6bae03f14e954721df23eaf/gensuitemodule.py
self.fp.write("%s = {\n" % name) for item in items: self.compileenumerator(item) self.fp.write("}\n\n") self.enumcodes[code] = name
if self.fp: self.fp.write("%s = {\n" % name) for item in items: self.compileenumerator(item) self.fp.write("}\n\n") self.namemappers[0].addnamecode('enum', name, code)
def compileenumeration(self, enum): [code, items] = enum name = "_Enum_%s" % identify(code) self.fp.write("%s = {\n" % name) for item in items: self.compileenumerator(item) self.fp.write("}\n\n") self.enumcodes[code] = name return code
b18e37723e6f3e7fe6bae03f14e954721df23eaf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b18e37723e6f3e7fe6bae03f14e954721df23eaf/gensuitemodule.py
self.fp.write("
if self.fp: self.fp.write("
def checkforenum(self, enum): """This enum code is used by an event. Make sure it's available""" name, fullname, module = self.findcodename('enum', enum) if not name: self.fp.write("# XXXX enum %s not found!!\n"%(enum)) return if module: self.fp.write("from %s import %s\n"%(module, name))
b18e37723e6f3e7fe6bae03f14e954721df23eaf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b18e37723e6f3e7fe6bae03f14e954721df23eaf/gensuitemodule.py
self.fp.write("from %s import %s\n"%(module, name))
if self.fp: self.fp.write("from %s import %s\n"%(module, name))
def checkforenum(self, enum): """This enum code is used by an event. Make sure it's available""" name, fullname, module = self.findcodename('enum', enum) if not name: self.fp.write("# XXXX enum %s not found!!\n"%(enum)) return if module: self.fp.write("from %s import %s\n"%(module, name))
b18e37723e6f3e7fe6bae03f14e954721df23eaf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b18e37723e6f3e7fe6bae03f14e954721df23eaf/gensuitemodule.py
for k in self.classcodes.keys(): self.fp.write("\t%s : %s,\n" % (`k`, self.classcodes[k]))
for k, v in self.namemappers[0].getall('class'): self.fp.write("\t%s : %s,\n" % (`k`, v))
def dumpindex(self): self.fp.write("\n#\n# Indices of types declared in this module\n#\n") self.fp.write("_classdeclarations = {\n") for k in self.classcodes.keys(): self.fp.write("\t%s : %s,\n" % (`k`, self.classcodes[k])) self.fp.write("}\n") self.fp.write("\n_propdeclarations = {\n") for k in self.propcodes.keys(): self.fp.write("\t%s : %s,\n" % (`k`, self.propcodes[k])) self.fp.write("}\n") self.fp.write("\n_compdeclarations = {\n") for k in self.compcodes.keys(): self.fp.write("\t%s : %s,\n" % (`k`, self.compcodes[k])) self.fp.write("}\n") self.fp.write("\n_enumdeclarations = {\n") for k in self.enumcodes.keys(): self.fp.write("\t%s : %s,\n" % (`k`, self.enumcodes[k])) self.fp.write("}\n")
b18e37723e6f3e7fe6bae03f14e954721df23eaf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b18e37723e6f3e7fe6bae03f14e954721df23eaf/gensuitemodule.py
for k in self.propcodes.keys(): self.fp.write("\t%s : %s,\n" % (`k`, self.propcodes[k]))
for k, v in self.namemappers[0].getall('property'): self.fp.write("\t%s : %s,\n" % (`k`, v))
def dumpindex(self): self.fp.write("\n#\n# Indices of types declared in this module\n#\n") self.fp.write("_classdeclarations = {\n") for k in self.classcodes.keys(): self.fp.write("\t%s : %s,\n" % (`k`, self.classcodes[k])) self.fp.write("}\n") self.fp.write("\n_propdeclarations = {\n") for k in self.propcodes.keys(): self.fp.write("\t%s : %s,\n" % (`k`, self.propcodes[k])) self.fp.write("}\n") self.fp.write("\n_compdeclarations = {\n") for k in self.compcodes.keys(): self.fp.write("\t%s : %s,\n" % (`k`, self.compcodes[k])) self.fp.write("}\n") self.fp.write("\n_enumdeclarations = {\n") for k in self.enumcodes.keys(): self.fp.write("\t%s : %s,\n" % (`k`, self.enumcodes[k])) self.fp.write("}\n")
b18e37723e6f3e7fe6bae03f14e954721df23eaf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b18e37723e6f3e7fe6bae03f14e954721df23eaf/gensuitemodule.py
for k in self.compcodes.keys(): self.fp.write("\t%s : %s,\n" % (`k`, self.compcodes[k]))
for k, v in self.namemappers[0].getall('comparison'): self.fp.write("\t%s : %s,\n" % (`k`, v))
def dumpindex(self): self.fp.write("\n#\n# Indices of types declared in this module\n#\n") self.fp.write("_classdeclarations = {\n") for k in self.classcodes.keys(): self.fp.write("\t%s : %s,\n" % (`k`, self.classcodes[k])) self.fp.write("}\n") self.fp.write("\n_propdeclarations = {\n") for k in self.propcodes.keys(): self.fp.write("\t%s : %s,\n" % (`k`, self.propcodes[k])) self.fp.write("}\n") self.fp.write("\n_compdeclarations = {\n") for k in self.compcodes.keys(): self.fp.write("\t%s : %s,\n" % (`k`, self.compcodes[k])) self.fp.write("}\n") self.fp.write("\n_enumdeclarations = {\n") for k in self.enumcodes.keys(): self.fp.write("\t%s : %s,\n" % (`k`, self.enumcodes[k])) self.fp.write("}\n")
b18e37723e6f3e7fe6bae03f14e954721df23eaf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b18e37723e6f3e7fe6bae03f14e954721df23eaf/gensuitemodule.py
for k in self.enumcodes.keys(): self.fp.write("\t%s : %s,\n" % (`k`, self.enumcodes[k]))
for k, v in self.namemappers[0].getall('enum'): self.fp.write("\t%s : %s,\n" % (`k`, v))
def dumpindex(self): self.fp.write("\n#\n# Indices of types declared in this module\n#\n") self.fp.write("_classdeclarations = {\n") for k in self.classcodes.keys(): self.fp.write("\t%s : %s,\n" % (`k`, self.classcodes[k])) self.fp.write("}\n") self.fp.write("\n_propdeclarations = {\n") for k in self.propcodes.keys(): self.fp.write("\t%s : %s,\n" % (`k`, self.propcodes[k])) self.fp.write("}\n") self.fp.write("\n_compdeclarations = {\n") for k in self.compcodes.keys(): self.fp.write("\t%s : %s,\n" % (`k`, self.compcodes[k])) self.fp.write("}\n") self.fp.write("\n_enumdeclarations = {\n") for k in self.enumcodes.keys(): self.fp.write("\t%s : %s,\n" % (`k`, self.enumcodes[k])) self.fp.write("}\n")
b18e37723e6f3e7fe6bae03f14e954721df23eaf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b18e37723e6f3e7fe6bae03f14e954721df23eaf/gensuitemodule.py
tag = self.stack[-1][0]
tag = self.stack[-1][0]
def parse_endtag(self, i): rawdata = self.rawdata end = endbracketfind.match(rawdata, i+1) if end is None: return -1 res = tagfind.match(rawdata, i+2) if res is None: if self.literal: self.handle_data(rawdata[i]) return i+1 if not self.__accept_missing_endtag_name: self.syntax_error('no name specified in end tag') tag = self.stack[-1][0] k = i+2 else: tag = res.group(0) if self.__map_case: tag = string.lower(tag) if self.literal: if not self.stack or tag != self.stack[-1][0]: self.handle_data(rawdata[i]) return i+1 self.literal = 0 k = res.end(0) if endbracket.match(rawdata, k) is None: self.syntax_error('garbage in end tag') self.finish_endtag(tag) return end.end(0)
884a2df5104a297086f472c2c1b276da522139e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/884a2df5104a297086f472c2c1b276da522139e5/xmllib.py
if not self.filename and self.get_saved():
try: interp = self.editwin.interp except: interp = None if not self.filename and self.get_saved() and not interp:
def open(self, event=None, editFile=None): if self.editwin.flist: if not editFile: filename = self.askopenfile() else: filename=editFile if filename: # if the current window has no filename and hasn't been # modified, we replace it's contents (no loss). Otherwise # we open a new window. if not self.filename and self.get_saved(): self.editwin.flist.open(filename, self.loadfile) else: self.editwin.flist.open(filename) else: self.text.focus_set()
1adc6597ef7af29c2a8477b3c84d8af08810e345 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1adc6597ef7af29c2a8477b3c84d8af08810e345/IOBinding.py
def open(self, event=None, editFile=None): if self.editwin.flist: if not editFile: filename = self.askopenfile() else: filename=editFile if filename: # if the current window has no filename and hasn't been # modified, we replace it's contents (no loss). Otherwise # we open a new window. if not self.filename and self.get_saved(): self.editwin.flist.open(filename, self.loadfile) else: self.editwin.flist.open(filename) else: self.text.focus_set()
1adc6597ef7af29c2a8477b3c84d8af08810e345 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1adc6597ef7af29c2a8477b3c84d8af08810e345/IOBinding.py
ctype = string.lower(info['content-type'])
ctype = string.lower(cgi.parse_header(info['content-type'])[0])
def checkforhtml(self, info, url): if info.has_key('content-type'): ctype = string.lower(info['content-type']) else: if url[-1:] == "/": return 1 ctype, encoding = mimetypes.guess_type(url) if ctype == 'text/html': return 1 else: self.note(1, " Not HTML, mime type %s", ctype) return 0
4541fa8b765a50f5da7286593cf91d4bae1fd169 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4541fa8b765a50f5da7286593cf91d4bae1fd169/webchecker.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()
9b1724cdfb0920fcdd61ccee7684a62a64c2609a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9b1724cdfb0920fcdd61ccee7684a62a64c2609a/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()
9b1724cdfb0920fcdd61ccee7684a62a64c2609a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9b1724cdfb0920fcdd61ccee7684a62a64c2609a/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()
9b1724cdfb0920fcdd61ccee7684a62a64c2609a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9b1724cdfb0920fcdd61ccee7684a62a64c2609a/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()
9b1724cdfb0920fcdd61ccee7684a62a64c2609a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9b1724cdfb0920fcdd61ccee7684a62a64c2609a/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()
9b1724cdfb0920fcdd61ccee7684a62a64c2609a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9b1724cdfb0920fcdd61ccee7684a62a64c2609a/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()
9b1724cdfb0920fcdd61ccee7684a62a64c2609a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9b1724cdfb0920fcdd61ccee7684a62a64c2609a/configDialog.py
file = unquote(file)
def open_local_file(self, url): import mimetypes, mimetools, StringIO mtype = mimetypes.guess_type(url)[0] headers = mimetools.Message(StringIO.StringIO( 'Content-Type: %s\n' % (mtype or 'text/plain'))) host, file = splithost(url) if not host: return addinfourl( open(url2pathname(file), 'rb'), headers, 'file:'+file) host, port = splitport(host) if not port and socket.gethostbyname(host) in ( localhost(), thishost()): file = unquote(file) return addinfourl( open(url2pathname(file), 'rb'), headers, 'file:'+file) raise IOError, ('local file error', 'not on local host')
90a3c0dd22d2ec83a9d90b50083d2d67c509c335 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/90a3c0dd22d2ec83a9d90b50083d2d67c509c335/urllib.py
self.user = unquote(user or '') self.passwd = unquote(passwd or '')
self.user = user self.passwd = passwd
def __init__(self, user, passwd, host, port, dirs): self.user = unquote(user or '') self.passwd = unquote(passwd or '') self.host = host self.port = port self.dirs = [] for dir in dirs: self.dirs.append(unquote(dir)) self.init()
90a3c0dd22d2ec83a9d90b50083d2d67c509c335 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/90a3c0dd22d2ec83a9d90b50083d2d67c509c335/urllib.py
self.dirs = [] for dir in dirs: self.dirs.append(unquote(dir))
self.dirs = dirs
def __init__(self, user, passwd, host, port, dirs): self.user = unquote(user or '') self.passwd = unquote(passwd or '') self.host = host self.port = port self.dirs = [] for dir in dirs: self.dirs.append(unquote(dir)) self.init()
90a3c0dd22d2ec83a9d90b50083d2d67c509c335 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/90a3c0dd22d2ec83a9d90b50083d2d67c509c335/urllib.py
install.select_scheme ('nt') for key in ('purelib', 'platlib', 'headers', 'scripts', 'data'): attrname = 'install_' + key attr = getattr (install, attrname) if attr: attr = string.replace (attr, '\\', os.sep) setattr (install, attrname, attr)
install.prefix = "Python" install.select_scheme('nt')
def run (self): if (sys.platform != "win32" and (self.distribution.has_ext_modules() or self.distribution.has_c_libraries())): raise DistutilsPlatformError \ ("distribution contains extensions and/or C libraries; " "must be compiled on a Windows 32 platform")
6f4e0e039b7455dbe9a025e19316d0485d45a0a4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6f4e0e039b7455dbe9a025e19316d0485d45a0a4/bdist_wininst.py
def unix_getpass(prompt='Password: '):
def unix_getpass(prompt='Password: ', stream=None):
def unix_getpass(prompt='Password: '): """Prompt for a password, with echo turned off. Restore terminal settings at end. """ try: fd = sys.stdin.fileno() except: return default_getpass(prompt) old = termios.tcgetattr(fd) # a copy to save new = old[:] new[3] = new[3] & ~termios.ECHO # 3 == 'lflags' try: termios.tcsetattr(fd, termios.TCSADRAIN, new) passwd = _raw_input(prompt) finally: termios.tcsetattr(fd, termios.TCSADRAIN, old) sys.stdout.write('\n') return passwd
42477b4f8585f5cfd3d8dba2b8a5b0f74c5a13af /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/42477b4f8585f5cfd3d8dba2b8a5b0f74c5a13af/getpass.py
passwd = _raw_input(prompt)
passwd = _raw_input(prompt, stream)
def unix_getpass(prompt='Password: '): """Prompt for a password, with echo turned off. Restore terminal settings at end. """ try: fd = sys.stdin.fileno() except: return default_getpass(prompt) old = termios.tcgetattr(fd) # a copy to save new = old[:] new[3] = new[3] & ~termios.ECHO # 3 == 'lflags' try: termios.tcsetattr(fd, termios.TCSADRAIN, new) passwd = _raw_input(prompt) finally: termios.tcsetattr(fd, termios.TCSADRAIN, old) sys.stdout.write('\n') return passwd
42477b4f8585f5cfd3d8dba2b8a5b0f74c5a13af /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/42477b4f8585f5cfd3d8dba2b8a5b0f74c5a13af/getpass.py
sys.stdout.write('\n')
stream.write('\n')
def unix_getpass(prompt='Password: '): """Prompt for a password, with echo turned off. Restore terminal settings at end. """ try: fd = sys.stdin.fileno() except: return default_getpass(prompt) old = termios.tcgetattr(fd) # a copy to save new = old[:] new[3] = new[3] & ~termios.ECHO # 3 == 'lflags' try: termios.tcsetattr(fd, termios.TCSADRAIN, new) passwd = _raw_input(prompt) finally: termios.tcsetattr(fd, termios.TCSADRAIN, old) sys.stdout.write('\n') return passwd
42477b4f8585f5cfd3d8dba2b8a5b0f74c5a13af /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/42477b4f8585f5cfd3d8dba2b8a5b0f74c5a13af/getpass.py
def win_getpass(prompt='Password: '):
def win_getpass(prompt='Password: ', stream=None):
def win_getpass(prompt='Password: '): """Prompt for password with echo off, using Windows getch().""" if sys.stdin is not sys.__stdin__: return default_getpass(prompt) import msvcrt for c in prompt: msvcrt.putch(c) pw = "" while 1: c = msvcrt.getch() if c == '\r' or c == '\n': break if c == '\003': raise KeyboardInterrupt if c == '\b': pw = pw[:-1] else: pw = pw + c msvcrt.putch('\r') msvcrt.putch('\n') return pw
42477b4f8585f5cfd3d8dba2b8a5b0f74c5a13af /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/42477b4f8585f5cfd3d8dba2b8a5b0f74c5a13af/getpass.py
return default_getpass(prompt)
return default_getpass(prompt, stream)
def win_getpass(prompt='Password: '): """Prompt for password with echo off, using Windows getch().""" if sys.stdin is not sys.__stdin__: return default_getpass(prompt) import msvcrt for c in prompt: msvcrt.putch(c) pw = "" while 1: c = msvcrt.getch() if c == '\r' or c == '\n': break if c == '\003': raise KeyboardInterrupt if c == '\b': pw = pw[:-1] else: pw = pw + c msvcrt.putch('\r') msvcrt.putch('\n') return pw
42477b4f8585f5cfd3d8dba2b8a5b0f74c5a13af /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/42477b4f8585f5cfd3d8dba2b8a5b0f74c5a13af/getpass.py
def default_getpass(prompt='Password: '): print "Warning: Problem with getpass. Passwords may be echoed." return _raw_input(prompt)
def default_getpass(prompt='Password: ', stream=None): print >>sys.stderr, "Warning: Problem with getpass. Passwords may be echoed." return _raw_input(prompt, stream)
def default_getpass(prompt='Password: '): print "Warning: Problem with getpass. Passwords may be echoed." return _raw_input(prompt)
42477b4f8585f5cfd3d8dba2b8a5b0f74c5a13af /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/42477b4f8585f5cfd3d8dba2b8a5b0f74c5a13af/getpass.py
def _raw_input(prompt=""):
def _raw_input(prompt="", stream=None):
def _raw_input(prompt=""): # A raw_input() replacement that doesn't save the string in the # GNU readline history. prompt = str(prompt) if prompt: sys.stdout.write(prompt) line = sys.stdin.readline() if not line: raise EOFError if line[-1] == '\n': line = line[:-1] return line
42477b4f8585f5cfd3d8dba2b8a5b0f74c5a13af /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/42477b4f8585f5cfd3d8dba2b8a5b0f74c5a13af/getpass.py
sys.stdout.write(prompt)
stream.write(prompt)
def _raw_input(prompt=""): # A raw_input() replacement that doesn't save the string in the # GNU readline history. prompt = str(prompt) if prompt: sys.stdout.write(prompt) line = sys.stdin.readline() if not line: raise EOFError if line[-1] == '\n': line = line[:-1] return line
42477b4f8585f5cfd3d8dba2b8a5b0f74c5a13af /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/42477b4f8585f5cfd3d8dba2b8a5b0f74c5a13af/getpass.py
replacement repl"""
replacement repl. repl can be either a string or a callable; if a callable, it's passed the match object and must return a replacement string to be used."""
def sub(pattern, repl, string, count=0): """Return the string obtained by replacing the leftmost non-overlapping occurrences of the pattern in string by the replacement repl""" return _compile(pattern, 0).sub(repl, string, count)
8901987dc5265c407c474061672b77c237f3400a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8901987dc5265c407c474061672b77c237f3400a/sre.py
substitutions that were made."""
substitutions that were made. repl can be either a string or a callable; if a callable, it's passed the match object and must return a replacement string to be used."""
def subn(pattern, repl, string, count=0): """Return a 2-tuple containing (new_string, number). new_string is the string obtained by replacing the leftmost non-overlapping occurrences of the pattern in the source string by the replacement repl. number is the number of substitutions that were made.""" return _compile(pattern, 0).subn(repl, string, count)
8901987dc5265c407c474061672b77c237f3400a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8901987dc5265c407c474061672b77c237f3400a/sre.py
cre = re.compile(r'def\s+%s\s*[(]' % funcname)
cre = re.compile(r'def\s+%s\s*[(]' % re.escape(funcname))
def find_function(funcname, filename): cre = re.compile(r'def\s+%s\s*[(]' % funcname) try: fp = open(filename) except IOError: return None # consumer of this info expects the first line to be 1 lineno = 1 answer = None while 1: line = fp.readline() if line == '': break if cre.match(line): answer = funcname, filename, lineno break lineno = lineno + 1 fp.close() return answer
851069b87ea76bb548a1df03e44a8309b81f5d23 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/851069b87ea76bb548a1df03e44a8309b81f5d23/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
a8d98c709bb1cd4a168df2ac52c3544e51521693 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a8d98c709bb1cd4a168df2ac52c3544e51521693/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
a8d98c709bb1cd4a168df2ac52c3544e51521693 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a8d98c709bb1cd4a168df2ac52c3544e51521693/sre.py
return self.try_cpp(headers=[header], include_dirs=include_dirs)
return self.try_cpp(body="/* No body */", headers=[header], include_dirs=include_dirs)
def check_header (self, header, include_dirs=None, library_dirs=None, lang="c"): """Determine if the system header file named by 'header_file' exists and can be found by the preprocessor; return true if so, false otherwise. """ return self.try_cpp(headers=[header], include_dirs=include_dirs)
347cdfcbc0a00e4e1780673ac8dd2eed0bdefbcc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/347cdfcbc0a00e4e1780673ac8dd2eed0bdefbcc/config.py
str = '<?xml version="1.0" ?>\n<a b="c"/>'
str = '<?xml version="1.0" ?><a b="c"/>'
def testWriteXML(): str = '<?xml version="1.0" ?>\n<a b="c"/>' dom = parseString(str) domstr = dom.toxml() dom.unlink() confirm(str == domstr)
d2b9565d572761b7027f216799c3094e169892ff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d2b9565d572761b7027f216799c3094e169892ff/test_minidom.py
confirm(doc.toxml() == u'<?xml version="1.0" ?>\n<foo>\u20ac</foo>' and doc.toxml('utf-8') == '<?xml version="1.0" encoding="utf-8"?>\n<foo>\xe2\x82\xac</foo>' and doc.toxml('iso-8859-15') == '<?xml version="1.0" encoding="iso-8859-15"?>\n<foo>\xa4</foo>',
confirm(doc.toxml() == u'<?xml version="1.0" ?><foo>\u20ac</foo>' and doc.toxml('utf-8') == '<?xml version="1.0" encoding="utf-8"?><foo>\xe2\x82\xac</foo>' and doc.toxml('iso-8859-15') == '<?xml version="1.0" encoding="iso-8859-15"?><foo>\xa4</foo>',
def testEncodings(): doc = parseString('<foo>&#x20ac;</foo>') confirm(doc.toxml() == u'<?xml version="1.0" ?>\n<foo>\u20ac</foo>' and doc.toxml('utf-8') == '<?xml version="1.0" encoding="utf-8"?>\n<foo>\xe2\x82\xac</foo>' and doc.toxml('iso-8859-15') == '<?xml version="1.0" encoding="iso-8859-15"?>\n<foo>\xa4</foo>', "testEncodings - encoding EURO SIGN") doc.unlink()
d2b9565d572761b7027f216799c3094e169892ff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d2b9565d572761b7027f216799c3094e169892ff/test_minidom.py
if 0: not sys.platform.startswith('win'):
if 0:
def test_basic(): test_support.requires('network') import urllib socket.RAND_status() try: socket.RAND_egd(1) except TypeError: pass else: print "didn't raise TypeError" socket.RAND_add("this is a random string", 75.0) f = urllib.urlopen('https://sf.net') buf = f.read() f.close()
d43957d8dc16b4a6b0f380491be0d7b52ad940b6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d43957d8dc16b4a6b0f380491be0d7b52ad940b6/test_socket_ssl.py
expand_tabs if true (default), tabs in input text will be expanded to spaces before further processing. Each tab will become 1 .. 8 spaces, depending on its position in its line. If false, each tab is treated as a single character. replace_whitespace if true (default), all whitespace characters in the input text are replaced by spaces after tab expansion. Note that expand_tabs is false and replace_whitespace is true, every tab will be converted to a single space! break_long_words if true (default), words longer than the line width constraint will be broken. If false, those words will not be broken, and some lines might be longer than the width constraint.
expand_tabs (default: true) Expand tabs in input text to spaces before further processing. Each tab will become 1 .. 8 spaces, depending on its position in its line. If false, each tab is treated as a single character. replace_whitespace (default: true) Replace all whitespace characters in the input text by spaces after tab expansion. Note that if expand_tabs is false and replace_whitespace is true, every tab will be converted to a single space! fix_sentence_endings (default: false) Ensure that sentence-ending punctuation is always followed by two spaces. Off by default becaus the algorithm is (unavoidably) imperfect. break_long_words (default: true) Break words longer than the line width constraint. If false, those words will not be broken, and some lines might be longer than the width constraint.
def islower (c): return c in string.lowercase
94c339d2acca04b8fde6662dc4b5290fced3464d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/94c339d2acca04b8fde6662dc4b5290fced3464d/textwrap.py
if (chunks[i][-1] == "." and
if (chunks[i][-1] in punct and
def _fix_sentence_endings (self, chunks): """_fix_sentence_endings(chunks : [string])
94c339d2acca04b8fde6662dc4b5290fced3464d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/94c339d2acca04b8fde6662dc4b5290fced3464d/textwrap.py
self._fix_sentence_endings(chunks)
if self.fix_sentence_endings: self._fix_sentence_endings(chunks)
def wrap (self, text, width): """wrap(text : string, width : int) -> [string]
94c339d2acca04b8fde6662dc4b5290fced3464d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/94c339d2acca04b8fde6662dc4b5290fced3464d/textwrap.py
s.stdin = FileWrapper(sys.stdin) s.stdout = FileWrapper(sys.stdout) s.stderr = FileWrapper(sys.stderr) sys.stdin = FileDelegate(s, 'stdin') sys.stdout = FileDelegate(s, 'stdout') sys.stderr = FileDelegate(s, 'stderr')
s.stdin = self.restricted_stdin s.stdout = self.restricted_stdout s.stderr = self.restricted_stdout sys.stdin = self.delegate_stdin sys.stdout = self.delegate_stdout sys.stderr = self.delegate_stderr def reset_files(self): self.restore_files() s = self.modules['sys'] self.restricted_stdin = s.stdin self.restricted_stdout = s.stdout self.restricted_stdout = s.stderr
def set_files(self): s = self.modules['sys'] s.stdin = FileWrapper(sys.stdin) s.stdout = FileWrapper(sys.stdout) s.stderr = FileWrapper(sys.stderr)
e3a335f9133cae9a1bbe5c112bf1c94316111187 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e3a335f9133cae9a1bbe5c112bf1c94316111187/rexec.py
def restore_files(files): sys.stdin = self.save_sydin
def restore_files(self): sys.stdin = self.save_stdin
def restore_files(files):
e3a335f9133cae9a1bbe5c112bf1c94316111187 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e3a335f9133cae9a1bbe5c112bf1c94316111187/rexec.py
(ccshared,) = sysconfig.get_config_vars('CCSHARED') args['compiler_so'] = compiler + ' ' + ccshared
(ccshared,opt) = sysconfig.get_config_vars('CCSHARED','OPT') args['compiler_so'] = compiler + ' ' + opt + ' ' + ccshared
def build_extensions(self):
82f616c3d5877f32d5bc978a4cf4f96296939fb5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/82f616c3d5877f32d5bc978a4cf4f96296939fb5/setup.py
self.chunksize = struct.unpack(strflag+'l', file.read(4))[0]
self.chunksize = struct.unpack(strflag+'L', file.read(4))[0]
def __init__(self, file, align=True, bigendian=True, inclheader=False): import struct self.closed = False self.align = align # whether to align to word (2-byte) boundaries if bigendian: strflag = '>' else: strflag = '<' self.file = file self.chunkname = file.read(4) if len(self.chunkname) < 4: raise EOFError try: self.chunksize = struct.unpack(strflag+'l', file.read(4))[0] except struct.error: raise EOFError if inclheader: self.chunksize = self.chunksize - 8 # subtract header self.size_read = 0 try: self.offset = self.file.tell() except (AttributeError, IOError): self.seekable = False else: self.seekable = True
d89d942242f73cd0a497d661e6a20845b432c308 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d89d942242f73cd0a497d661e6a20845b432c308/chunk.py
pat = re.compile(r'^\s*class\s*' + name + r'\b')
pat = re.compile(r'^(\s*)class\s*' + name + r'\b') candidates = []
def findsource(object): """Return the entire source file and starting line number for an object. The argument may be a module, class, method, function, traceback, frame, or code object. The source code is returned as a list of all the lines in the file and the line number indexes a line in that list. An IOError is raised if the source code cannot be retrieved.""" file = getsourcefile(object) or getfile(object) module = getmodule(object, file) if module: lines = linecache.getlines(file, module.__dict__) else: lines = linecache.getlines(file) if not lines: raise IOError('could not get source code') if ismodule(object): return lines, 0 if isclass(object): name = object.__name__ pat = re.compile(r'^\s*class\s*' + name + r'\b') for i in range(len(lines)): if pat.match(lines[i]): return lines, i else: raise IOError('could not find class definition') if ismethod(object): object = object.im_func if isfunction(object): object = object.func_code if istraceback(object): object = object.tb_frame if isframe(object): object = object.f_code if iscode(object): if not hasattr(object, 'co_firstlineno'): raise IOError('could not find function definition') lnum = object.co_firstlineno - 1 pat = re.compile(r'^(\s*def\s)|(.*(?<!\w)lambda(:|\s))|^(\s*@)') while lnum > 0: if pat.match(lines[lnum]): break lnum = lnum - 1 return lines, lnum raise IOError('could not find code object')
4e01b174abbf39806311eb29c72aecc6a2693563 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4e01b174abbf39806311eb29c72aecc6a2693563/inspect.py
if pat.match(lines[i]): return lines, i
match = pat.match(lines[i]) if match: if lines[i][0] == 'c': return lines, i candidates.append((match.group(1), i)) if candidates: candidates.sort() return lines, candidates[0][1]
def findsource(object): """Return the entire source file and starting line number for an object. The argument may be a module, class, method, function, traceback, frame, or code object. The source code is returned as a list of all the lines in the file and the line number indexes a line in that list. An IOError is raised if the source code cannot be retrieved.""" file = getsourcefile(object) or getfile(object) module = getmodule(object, file) if module: lines = linecache.getlines(file, module.__dict__) else: lines = linecache.getlines(file) if not lines: raise IOError('could not get source code') if ismodule(object): return lines, 0 if isclass(object): name = object.__name__ pat = re.compile(r'^\s*class\s*' + name + r'\b') for i in range(len(lines)): if pat.match(lines[i]): return lines, i else: raise IOError('could not find class definition') if ismethod(object): object = object.im_func if isfunction(object): object = object.func_code if istraceback(object): object = object.tb_frame if isframe(object): object = object.f_code if iscode(object): if not hasattr(object, 'co_firstlineno'): raise IOError('could not find function definition') lnum = object.co_firstlineno - 1 pat = re.compile(r'^(\s*def\s)|(.*(?<!\w)lambda(:|\s))|^(\s*@)') while lnum > 0: if pat.match(lines[lnum]): break lnum = lnum - 1 return lines, lnum raise IOError('could not find code object')
4e01b174abbf39806311eb29c72aecc6a2693563 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4e01b174abbf39806311eb29c72aecc6a2693563/inspect.py
copier = x.__deepcopy__ except AttributeError:
issc = issubclass(type(x), type) except TypeError: issc = 0 if issc: y = _deepcopy_dispatch[type](x, memo) else:
def deepcopy(x, memo = None): """Deep copy operation on arbitrary Python objects. See the module's __doc__ string for more info. """ if memo is None: memo = {} d = id(x) if d in memo: return memo[d] try: copierfunction = _deepcopy_dispatch[type(x)] except KeyError: try: copier = x.__deepcopy__ except AttributeError: try: reductor = x.__reduce__ except AttributeError: raise error, \ "un-deep-copyable object of type %s" % type(x) else: y = _reconstruct(x, reductor(), 1, memo) else: y = copier(memo) else: y = copierfunction(x, memo) memo[d] = y return y
5364c8a84bfea180e82d3a2c7964e76f85fc7436 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5364c8a84bfea180e82d3a2c7964e76f85fc7436/copy.py
reductor = x.__reduce__
copier = x.__deepcopy__
def deepcopy(x, memo = None): """Deep copy operation on arbitrary Python objects. See the module's __doc__ string for more info. """ if memo is None: memo = {} d = id(x) if d in memo: return memo[d] try: copierfunction = _deepcopy_dispatch[type(x)] except KeyError: try: copier = x.__deepcopy__ except AttributeError: try: reductor = x.__reduce__ except AttributeError: raise error, \ "un-deep-copyable object of type %s" % type(x) else: y = _reconstruct(x, reductor(), 1, memo) else: y = copier(memo) else: y = copierfunction(x, memo) memo[d] = y return y
5364c8a84bfea180e82d3a2c7964e76f85fc7436 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5364c8a84bfea180e82d3a2c7964e76f85fc7436/copy.py
raise error, \ "un-deep-copyable object of type %s" % type(x)
try: reductor = x.__reduce__ except AttributeError: raise error, \ "un-deep-copyable object of type %s" % type(x) else: y = _reconstruct(x, reductor(), 1, memo)
def deepcopy(x, memo = None): """Deep copy operation on arbitrary Python objects. See the module's __doc__ string for more info. """ if memo is None: memo = {} d = id(x) if d in memo: return memo[d] try: copierfunction = _deepcopy_dispatch[type(x)] except KeyError: try: copier = x.__deepcopy__ except AttributeError: try: reductor = x.__reduce__ except AttributeError: raise error, \ "un-deep-copyable object of type %s" % type(x) else: y = _reconstruct(x, reductor(), 1, memo) else: y = copier(memo) else: y = copierfunction(x, memo) memo[d] = y return y
5364c8a84bfea180e82d3a2c7964e76f85fc7436 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5364c8a84bfea180e82d3a2c7964e76f85fc7436/copy.py
y = _reconstruct(x, reductor(), 1, memo) else: y = copier(memo)
y = copier(memo)
def deepcopy(x, memo = None): """Deep copy operation on arbitrary Python objects. See the module's __doc__ string for more info. """ if memo is None: memo = {} d = id(x) if d in memo: return memo[d] try: copierfunction = _deepcopy_dispatch[type(x)] except KeyError: try: copier = x.__deepcopy__ except AttributeError: try: reductor = x.__reduce__ except AttributeError: raise error, \ "un-deep-copyable object of type %s" % type(x) else: y = _reconstruct(x, reductor(), 1, memo) else: y = copier(memo) else: y = copierfunction(x, memo) memo[d] = y return y
5364c8a84bfea180e82d3a2c7964e76f85fc7436 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5364c8a84bfea180e82d3a2c7964e76f85fc7436/copy.py
def quoteaddr(addr): """Quote a subset of the email addresses defined by RFC 821. Should be able to handle anything rfc822.parseaddr can handle. """ m = (None, None) try: m = email.Utils.parseaddr(addr)[1] except AttributeError: pass if m == (None, None): # Indicates parse failure or AttributeError #something weird here.. punt -ddm return "<%s>" % addr else: return "<%s>" % m
be8536c577cbb73b74818d6259fb5abe52e6d9ae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/be8536c577cbb73b74818d6259fb5abe52e6d9ae/smtplib.py
To understand what this class does, it helps to have a copy of RFC-822 in front of you.
To understand what this class does, it helps to have a copy of RFC 2822 in front of you.
def quote(str): """Add quotes around a string.""" return str.replace('\\', '\\\\').replace('"', '\\"')
78ec6245fafc8ef7e28921a1951782be3b00e371 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/78ec6245fafc8ef7e28921a1951782be3b00e371/_parseaddr.py
ad = self.getaddress() if ad: return ad + self.getaddrlist() else: return []
result = [] while 1: ad = self.getaddress() if ad: result += ad else: break return result
def getaddrlist(self): """Parse all addresses.
78ec6245fafc8ef7e28921a1951782be3b00e371 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/78ec6245fafc8ef7e28921a1951782be3b00e371/_parseaddr.py
expectaddrspec = 1
def getrouteaddr(self): """Parse a route address (Return-path value).
78ec6245fafc8ef7e28921a1951782be3b00e371 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/78ec6245fafc8ef7e28921a1951782be3b00e371/_parseaddr.py
"""Parse an RFC-822 addr-spec."""
"""Parse an RFC 2822 addr-spec."""
def getaddrspec(self): """Parse an RFC-822 addr-spec.""" aslist = []
78ec6245fafc8ef7e28921a1951782be3b00e371 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/78ec6245fafc8ef7e28921a1951782be3b00e371/_parseaddr.py
If `allowcomments' is non-zero, embedded RFC-822 comments are allowed within the parsed fragment.
If `allowcomments' is non-zero, embedded RFC 2822 comments are allowed within the parsed fragment.
def getdelimited(self, beginchar, endchars, allowcomments = 1): """Parse a header fragment delimited by special characters.
78ec6245fafc8ef7e28921a1951782be3b00e371 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/78ec6245fafc8ef7e28921a1951782be3b00e371/_parseaddr.py
"""Parse an RFC-822 domain-literal."""
"""Parse an RFC 2822 domain-literal."""
def getdomainliteral(self): """Parse an RFC-822 domain-literal.""" return '[%s]' % self.getdelimited('[', ']\r', 0)
78ec6245fafc8ef7e28921a1951782be3b00e371 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/78ec6245fafc8ef7e28921a1951782be3b00e371/_parseaddr.py
def getatom(self): """Parse an RFC-822 atom."""
def getatom(self, atomends=None): """Parse an RFC 2822 atom. Optional atomends specifies a different set of end token delimiters (the default is to use self.atomends). This is used e.g. in getphraselist() since phrase endings must not include the `.' (which is legal in phrases)."""
def getatom(self): """Parse an RFC-822 atom.""" atomlist = ['']
78ec6245fafc8ef7e28921a1951782be3b00e371 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/78ec6245fafc8ef7e28921a1951782be3b00e371/_parseaddr.py
while self.pos < len(self.field): if self.field[self.pos] in self.atomends:
if atomends is None: atomends = self.atomends while self.pos < len(self.field): if self.field[self.pos] in atomends:
def getatom(self): """Parse an RFC-822 atom.""" atomlist = ['']
78ec6245fafc8ef7e28921a1951782be3b00e371 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/78ec6245fafc8ef7e28921a1951782be3b00e371/_parseaddr.py
"""Parse a sequence of RFC-822 phrases. A phrase is a sequence of words, which are in turn either RFC-822 atoms or quoted-strings. Phrases are canonicalized by squeezing all runs of continuous whitespace into one space.
"""Parse a sequence of RFC 2822 phrases. A phrase is a sequence of words, which are in turn either RFC 2822 atoms or quoted-strings. Phrases are canonicalized by squeezing all runs of continuous whitespace into one space.
def getphraselist(self): """Parse a sequence of RFC-822 phrases.
78ec6245fafc8ef7e28921a1951782be3b00e371 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/78ec6245fafc8ef7e28921a1951782be3b00e371/_parseaddr.py
elif self.field[self.pos] in self.atomends: break else: plist.append(self.getatom())
elif self.field[self.pos] in self.phraseends: break else: plist.append(self.getatom(self.phraseends))
def getphraselist(self): """Parse a sequence of RFC-822 phrases.
78ec6245fafc8ef7e28921a1951782be3b00e371 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/78ec6245fafc8ef7e28921a1951782be3b00e371/_parseaddr.py
"""An AddressList encapsulates a list of parsed RFC822 addresses."""
"""An AddressList encapsulates a list of parsed RFC 2822 addresses."""
def getphraselist(self): """Parse a sequence of RFC-822 phrases.
78ec6245fafc8ef7e28921a1951782be3b00e371 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/78ec6245fafc8ef7e28921a1951782be3b00e371/_parseaddr.py
def __init__(self, host, port = NNTP_PORT):
def __init__(self, host, port = NNTP_PORT, user=None, password=None):
def __init__(self, host, port = NNTP_PORT): self.host = host self.port = port self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.connect(self.host, self.port) self.file = self.sock.makefile('rb') self.debugging = 0 self.welcome = self.getresp()
385960fda8702a0f55687196147f4cb10038f6cb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/385960fda8702a0f55687196147f4cb10038f6cb/nntplib.py
authorization = self.headers.getheader("authorization") if authorization: authorization = authorization.split() if len(authorization) == 2: import base64, binascii env['AUTH_TYPE'] = authorization[0] if authorization[0].lower() == "basic": try: authorization = base64.decodestring(authorization[1]) except binascii.Error: pass else: authorization = authorization.split(':') if len(authorization) == 2: env['REMOTE_USER'] = authorization[0]
def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = rest.rfind('?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = rest.find('/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scriptname) if not os.path.exists(scriptfile): self.send_error(404, "No such CGI script (%r)" % scriptname) return if not os.path.isfile(scriptfile): self.send_error(403, "CGI script is not a plain file (%r)" % scriptname) return ispy = self.is_python(scriptname) if not ispy: if not (self.have_fork or self.have_popen2 or self.have_popen3): self.send_error(403, "CGI script is not a Python script (%r)" % scriptname) return if not self.is_executable(scriptfile): self.send_error(403, "CGI script is not executable (%r)" % scriptname) return
30e24b2614bccd0b9f3c930c5b76e7f2ae469aff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/30e24b2614bccd0b9f3c930c5b76e7f2ae469aff/CGIHTTPServer.py
a_gusi = ResLoader(fss, 'GU\267I', OVERRIDE_GUSI_ID, default=gusi_loader) a_path = StrListLoader(fss, 'STR
a_gusi = GusiLoader( ResLoader(fss, 'GU\267I', OVERRIDE_GUSI_ID, default=gusi_loader)) a_path = StrListLoader( ResLoader(fss, 'STR
def AppletOptions(file): fss = macfs.FSSpec(file) a_popt = PoptLoader(ResLoader(fss, 'Popt', OVERRIDE_POPT_ID, default=popt_loader)) a_dir = ResLoader(fss, 'alis', OVERRIDE_DIR_ID, default=dir) a_gusi = ResLoader(fss, 'GU\267I', OVERRIDE_GUSI_ID, default=gusi_loader) a_path = StrListLoader(fss, 'STR#', OVERRIDE_PATH_ID, default=path_loader) return PythonOptions(a_popt, a_dir, a_gusi, a_path)
382738bdcbd41d69e5eea616e7e0647d5ab79a22 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/382738bdcbd41d69e5eea616e7e0647d5ab79a22/pythonprefs.py
if msg[0] in (errno.EACCES, errno.ENODEV):
if msg[0] in (errno.EACCES, errno.ENODEV, errno.EBUSY):
def play_sound_file(path): fp = open(path, 'r') size, enc, rate, nchannels, extra = sunaudio.gethdr(fp) data = fp.read() fp.close() if enc != SND_FORMAT_MULAW_8: print "Expect .au file with 8-bit mu-law samples" return try: a = linuxaudiodev.open('w') except linuxaudiodev.error, msg: if msg[0] in (errno.EACCES, errno.ENODEV): raise TestSkipped, msg raise TestFailed, msg # convert the data to 16-bit signed data = audioop.ulaw2lin(data, 2) # set the data format if sys.byteorder == 'little': fmt = linuxaudiodev.AFMT_S16_LE else: fmt = linuxaudiodev.AFMT_S16_BE # at least check that these methods can be invoked a.bufsize() a.obufcount() a.obuffree() a.getptr() a.fileno() # set parameters based on .au file headers a.setparameters(rate, 16, nchannels, fmt) a.write(data) a.flush() a.close()
9e0d4edd01fd84fc562607783b2347e0f473c00f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9e0d4edd01fd84fc562607783b2347e0f473c00f/test_linuxaudiodev.py
if not hasattr(socket, "ssl"): raise test_support.TestSkipped("socket module has no ssl support")
def test_basic(): test_support.requires('network') if not hasattr(socket, "ssl"): raise test_support.TestSkipped("socket module has no ssl support") import urllib socket.RAND_status() try: socket.RAND_egd(1) except TypeError: pass else: print "didn't raise TypeError" socket.RAND_add("this is a random string", 75.0) f = urllib.urlopen('https://sf.net') buf = f.read() f.close()
91724a95d18df50c8760b7576feccdc2af699d88 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/91724a95d18df50c8760b7576feccdc2af699d88/test_socket_ssl.py
self.text.insert(mark, str(s), tags)
self.text.insert(mark, s, tags)
def write(self, s, tags=(), mark="iomark"): self.text.mark_gravity(mark, RIGHT) self.text.insert(mark, str(s), tags) self.text.mark_gravity(mark, LEFT) self.text.see(mark) self.text.update()
a9ce79edc3675ca9071a5418ad1959a9bf81ccf3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a9ce79edc3675ca9071a5418ad1959a9bf81ccf3/OutputWindow.py
srpms = glob.glob(os.path.join(rpm_dir['SRPMS'], "*.rpm")) rpms = glob.glob(os.path.join(rpm_dir['RPMS'], "*/*.rpm")) assert len(srpms) == 1, \ "unexpected number of SRPM files found: %s" % srpms assert len(rpms) == 1, \ "unexpected number of RPM files found: %s" % rpms self.move_file(srpms[0], self.dist_dir) self.move_file(rpms[0], self.dist_dir)
if not self.binary_only: srpms = glob.glob(os.path.join(rpm_dir['SRPMS'], "*.rpm")) assert len(srpms) == 1, \ "unexpected number of SRPM files found: %s" % srpms self.move_file(srpms[0], self.dist_dir) if not self.source_only: rpms = glob.glob(os.path.join(rpm_dir['RPMS'], "*/*.rpm")) assert len(rpms) == 1, \ "unexpected number of RPM files found: %s" % rpms self.move_file(rpms[0], self.dist_dir)
def run (self):
a8437f3a92bd6c09bebc57cefa09ff9ecfda18ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a8437f3a92bd6c09bebc57cefa09ff9ecfda18ab/bdist_rpm.py
def wm_iconbitmap(self, bitmap=None):
def wm_iconbitmap(self, bitmap=None, default=None):
def wm_iconbitmap(self, bitmap=None): """Set bitmap for the iconified widget to BITMAP. Return the bitmap if None is given.""" return self.tk.call('wm', 'iconbitmap', self._w, bitmap)
54b0f6be5007b7bafa038f8ee7dd3af6b280fd4c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54b0f6be5007b7bafa038f8ee7dd3af6b280fd4c/Tkinter.py
the bitmap if None is given.""" return self.tk.call('wm', 'iconbitmap', self._w, bitmap)
the bitmap if None is given. Under Windows, the DEFAULT parameter can be used to set the icon for the widget and any descendents that don't have an icon set explicitely. DEFAULT can be the relative path to a .ico file (example: root.iconbitmap(default='myicon.ico') ). See Tk documentation for more information.""" if default: return self.tk.call('wm', 'iconbitmap', self._w, '-default', default) else: return self.tk.call('wm', 'iconbitmap', self._w, bitmap)
def wm_iconbitmap(self, bitmap=None): """Set bitmap for the iconified widget to BITMAP. Return the bitmap if None is given.""" return self.tk.call('wm', 'iconbitmap', self._w, bitmap)
54b0f6be5007b7bafa038f8ee7dd3af6b280fd4c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54b0f6be5007b7bafa038f8ee7dd3af6b280fd4c/Tkinter.py
import pdb ; pdb.set_trace()
def buildcopy(top, dummy, list): import macostools for src, dst in list: src = os.path.join(top, src) dst = os.path.join(top, dst) import pdb ; pdb.set_trace() macostools.copy(src, dst)
44a63e227e0cc24962cf30ed40c284e3e15ccbcf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/44a63e227e0cc24962cf30ed40c284e3e15ccbcf/ConfigurePython.py
FInfo = OpaqueByValueStructType("FInfo", "PyMac_BuildFInfo", "PyMac_GetFInfo") FInfo_ptr = OpaqueType("FInfo", "PyMac_BuildFInfo", "PyMac_GetFInfo")
FInfo = OpaqueType("FInfo", "FInfo") FInfo_ptr = OpaqueType("FInfo", "FInfo")
def declare(self, name): Output("%s %s__buf__;", self.typeName, name) Output("%s *%s = &%s__buf__;", self.typeName, name, name)
4ead31c4f8aed3e43fdb5afb615d8c3ca3367563 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4ead31c4f8aed3e43fdb5afb615d8c3ca3367563/filesupport.py
extern PyObject *FSRef_New(FSRef *itself); extern PyObject *FSSpec_New(FSSpec *itself); extern PyObject *Alias_New(AliasHandle itself); extern int FSRef_Convert(PyObject *v, FSRef *p_itself); extern int FSSpec_Convert(PyObject *v, FSSpec *p_itself); extern int Alias_Convert(PyObject *v, AliasHandle *p_itself); static int myPyMac_GetFSSpec(PyObject *v, FSSpec *spec); static int myPyMac_GetFSRef(PyObject *v, FSRef *fsr);
static PyObject *FInfo_New(FInfo *itself); static PyObject *FSRef_New(FSRef *itself); static PyObject *FSSpec_New(FSSpec *itself); static PyObject *Alias_New(AliasHandle itself); static int FInfo_Convert(PyObject *v, FInfo *p_itself); static int Alias_Convert(PyObject *v, AliasHandle *p_itself);
#ifdef WITHOUT_FRAMEWORKS
4ead31c4f8aed3e43fdb5afb615d8c3ca3367563 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4ead31c4f8aed3e43fdb5afb615d8c3ca3367563/filesupport.py
return myPyMac_GetFSSpec(v, *spec);
return PyMac_GetFSSpec(v, *spec);
#ifdef WITHOUT_FRAMEWORKS
4ead31c4f8aed3e43fdb5afb615d8c3ca3367563 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4ead31c4f8aed3e43fdb5afb615d8c3ca3367563/filesupport.py
return myPyMac_GetFSRef(v, *ref);
return PyMac_GetFSRef(v, *ref);
#ifdef WITHOUT_FRAMEWORKS
4ead31c4f8aed3e43fdb5afb615d8c3ca3367563 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4ead31c4f8aed3e43fdb5afb615d8c3ca3367563/filesupport.py
/* ** Parse/generate objsect */ static PyObject * PyMac_BuildFInfo(FInfo *itself) { return Py_BuildValue("O&O&HO&h", PyMac_BuildOSType, itself->fdType, PyMac_BuildOSType, itself->fdCreator, itself->fdFlags, PyMac_BuildPoint, &itself->fdLocation, itself->fdFldr); } static int PyMac_GetFInfo(PyObject *v, FInfo *itself) { return PyArg_ParseTuple(v, "O&O&HO&h", PyMac_GetOSType, &itself->fdType, PyMac_GetOSType, &itself->fdCreator, &itself->fdFlags, PyMac_GetPoint, &itself->fdLocation, &itself->fdFldr); }
#ifdef WITHOUT_FRAMEWORKS
4ead31c4f8aed3e43fdb5afb615d8c3ca3367563 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4ead31c4f8aed3e43fdb5afb615d8c3ca3367563/filesupport.py
static int myPyMac_GetFSSpec(PyObject *v, FSSpec *spec)
int PyMac_GetFSSpec(PyObject *v, FSSpec *spec)
#ifdef WITHOUT_FRAMEWORKS
4ead31c4f8aed3e43fdb5afb615d8c3ca3367563 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4ead31c4f8aed3e43fdb5afb615d8c3ca3367563/filesupport.py
if ( myPyMac_GetFSRef(v, &fsr) ) {
if ( PyMac_GetFSRef(v, &fsr) ) {
#ifdef WITHOUT_FRAMEWORKS
4ead31c4f8aed3e43fdb5afb615d8c3ca3367563 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4ead31c4f8aed3e43fdb5afb615d8c3ca3367563/filesupport.py
static int myPyMac_GetFSRef(PyObject *v, FSRef *fsr)
int PyMac_GetFSRef(PyObject *v, FSRef *fsr)
#ifdef WITHOUT_FRAMEWORKS
4ead31c4f8aed3e43fdb5afb615d8c3ca3367563 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4ead31c4f8aed3e43fdb5afb615d8c3ca3367563/filesupport.py
class FSSpecDefinition(PEP253Mixin, GlobalObjectDefinition):
class FInfoDefinition(PEP253Mixin, ObjectDefinition): getsetlist = [ ("Type", "return Py_BuildValue(\"O&\", PyMac_BuildOSType, self->ob_itself.fdType);", "return PyArg_Parse(v, \"O&\", PyMac_GetOSType, &self->ob_itself.fdType)-1;", "4-char file type" ), ("Creator", "return Py_BuildValue(\"O&\", PyMac_BuildOSType, self->ob_itself.fdCreator);", "return PyArg_Parse(v, \"O&\", PyMac_GetOSType, &self->ob_itself.fdCreator)-1;", "4-char file creator" ), ("Flags", "return Py_BuildValue(\"H\", self->ob_itself.fdFlags);", "return PyArg_Parse(v, \"H\", &self->ob_itself.fdFlags)-1;", "Finder flag bits" ), ("Location", "return Py_BuildValue(\"O&\", PyMac_BuildPoint, self->ob_itself.fdLocation);", "return PyArg_Parse(v, \"O&\", PyMac_GetPoint, &self->ob_itself.fdLocation)-1;", "(x, y) location of the file's icon in its parent finder window" ), ("Fldr", "return Py_BuildValue(\"h\", self->ob_itself.fdFldr);", "return PyArg_Parse(v, \"h\", &self->ob_itself.fdFldr)-1;", "Original folder, for 'put away'" ), ] def __init__(self, name, prefix, itselftype): ObjectDefinition.__init__(self, name, prefix, itselftype) self.argref = "*" def outputCheckNewArg(self): Output("if (itself == NULL) return PyMac_Error(resNotFound);") def output_tp_newBody(self): Output("PyObject *self;"); Output() Output("if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;") Output("memset(&((%s *)self)->ob_itself, 0, sizeof(%s));", self.objecttype, self.itselftype) Output("return self;") def output_tp_initBody(self): Output("%s *itself = NULL;", self.itselftype) Output("char *kw[] = {\"itself\", 0};") Output() Output("if (PyArg_ParseTupleAndKeywords(args, kwds, \"|O&\", kw, FInfo_Convert, &itself))") OutLbrace() Output("if (itself) memcpy(&((%s *)self)->ob_itself, itself, sizeof(%s));", self.objecttype, self.itselftype) Output("return 0;") OutRbrace() Output("return -1;") class FSSpecDefinition(PEP253Mixin, ObjectDefinition):
#ifdef WITHOUT_FRAMEWORKS
4ead31c4f8aed3e43fdb5afb615d8c3ca3367563 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4ead31c4f8aed3e43fdb5afb615d8c3ca3367563/filesupport.py
GlobalObjectDefinition.__init__(self, name, prefix, itselftype)
ObjectDefinition.__init__(self, name, prefix, itselftype)
def __init__(self, name, prefix, itselftype): GlobalObjectDefinition.__init__(self, name, prefix, itselftype) self.argref = "*" # Store FSSpecs, but pass them by address
4ead31c4f8aed3e43fdb5afb615d8c3ca3367563 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4ead31c4f8aed3e43fdb5afb615d8c3ca3367563/filesupport.py
self.objecttype, self.objecttype)
self.objecttype, self.itselftype)
def output_tp_newBody(self): Output("PyObject *self;"); Output() Output("if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;") Output("memset(&((%s *)self)->ob_itself, 0, sizeof(%s));", self.objecttype, self.objecttype) Output("return self;")
4ead31c4f8aed3e43fdb5afb615d8c3ca3367563 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4ead31c4f8aed3e43fdb5afb615d8c3ca3367563/filesupport.py
Output("if (myPyMac_GetFSSpec(v, &((%s *)self)->ob_itself)) return 0;", self.objecttype)
Output("if (PyMac_GetFSSpec(v, &((%s *)self)->ob_itself)) return 0;", self.objecttype)
def output_tp_initBody(self): Output("PyObject *v = NULL;") Output("char *rawdata = NULL;") Output("int rawdatalen = 0;") Output("char *kw[] = {\"itself\", \"rawdata\", 0};") Output() Output("if (!PyArg_ParseTupleAndKeywords(args, kwds, \"|Os#\", kw, &v, &rawdata, &rawdatalen))") Output("return -1;") Output("if (v && rawdata)") OutLbrace() Output("PyErr_SetString(PyExc_TypeError, \"Only one of itself or rawdata may be specified\");") Output("return -1;") OutRbrace() Output("if (!v && !rawdata)") OutLbrace() Output("PyErr_SetString(PyExc_TypeError, \"One of itself or rawdata must be specified\");") Output("return -1;") OutRbrace() Output("if (rawdata)") OutLbrace() Output("if (rawdatalen != sizeof(%s))", self.itselftype) OutLbrace() Output("PyErr_SetString(PyExc_TypeError, \"%s rawdata incorrect size\");", self.itselftype) Output("return -1;") OutRbrace() Output("memcpy(&((%s *)self)->ob_itself, rawdata, rawdatalen);", self.objecttype) Output("return 0;") OutRbrace() Output("if (myPyMac_GetFSSpec(v, &((%s *)self)->ob_itself)) return 0;", self.objecttype) Output("return -1;")
4ead31c4f8aed3e43fdb5afb615d8c3ca3367563 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4ead31c4f8aed3e43fdb5afb615d8c3ca3367563/filesupport.py
class FSRefDefinition(PEP253Mixin, GlobalObjectDefinition):
class FSRefDefinition(PEP253Mixin, ObjectDefinition):
def outputRepr(self): Output() Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype) OutLbrace() Output("char buf[512];") Output("""PyOS_snprintf(buf, sizeof(buf), \"%%s((%%d, %%ld, '%%.*s'))\", self->ob_type->tp_name, self->ob_itself.vRefNum, self->ob_itself.parID, self->ob_itself.name[0], self->ob_itself.name+1);""") Output("return PyString_FromString(buf);") OutRbrace()
4ead31c4f8aed3e43fdb5afb615d8c3ca3367563 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4ead31c4f8aed3e43fdb5afb615d8c3ca3367563/filesupport.py
GlobalObjectDefinition.__init__(self, name, prefix, itselftype)
ObjectDefinition.__init__(self, name, prefix, itselftype)
def __init__(self, name, prefix, itselftype): GlobalObjectDefinition.__init__(self, name, prefix, itselftype) self.argref = "*" # Store FSRefs, but pass them by address
4ead31c4f8aed3e43fdb5afb615d8c3ca3367563 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4ead31c4f8aed3e43fdb5afb615d8c3ca3367563/filesupport.py
self.objecttype, self.objecttype)
self.objecttype, self.itselftype)
def output_tp_newBody(self): Output("PyObject *self;"); Output() Output("if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;") Output("memset(&((%s *)self)->ob_itself, 0, sizeof(%s));", self.objecttype, self.objecttype) Output("return self;")
4ead31c4f8aed3e43fdb5afb615d8c3ca3367563 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4ead31c4f8aed3e43fdb5afb615d8c3ca3367563/filesupport.py
Output("if (myPyMac_GetFSRef(v, &((%s *)self)->ob_itself)) return 0;", self.objecttype)
Output("if (PyMac_GetFSRef(v, &((%s *)self)->ob_itself)) return 0;", self.objecttype)
def output_tp_initBody(self): Output("PyObject *v = NULL;") Output("char *rawdata = NULL;") Output("int rawdatalen = 0;") Output("char *kw[] = {\"itself\", \"rawdata\", 0};") Output() Output("if (!PyArg_ParseTupleAndKeywords(args, kwds, \"|Os#\", kw, &v, &rawdata, &rawdatalen))") Output("return -1;") Output("if (v && rawdata)") OutLbrace() Output("PyErr_SetString(PyExc_TypeError, \"Only one of itself or rawdata may be specified\");") Output("return -1;") OutRbrace() Output("if (!v && !rawdata)") OutLbrace() Output("PyErr_SetString(PyExc_TypeError, \"One of itself or rawdata must be specified\");") Output("return -1;") OutRbrace() Output("if (rawdata)") OutLbrace() Output("if (rawdatalen != sizeof(%s))", self.itselftype) OutLbrace() Output("PyErr_SetString(PyExc_TypeError, \"%s rawdata incorrect size\");", self.itselftype) Output("return -1;") OutRbrace() Output("memcpy(&((%s *)self)->ob_itself, rawdata, rawdatalen);", self.objecttype) Output("return 0;") OutRbrace() Output("if (myPyMac_GetFSRef(v, &((%s *)self)->ob_itself)) return 0;", self.objecttype) Output("return -1;")
4ead31c4f8aed3e43fdb5afb615d8c3ca3367563 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4ead31c4f8aed3e43fdb5afb615d8c3ca3367563/filesupport.py
class AliasDefinition(PEP253Mixin, GlobalObjectDefinition):
class AliasDefinition(PEP253Mixin, ObjectDefinition):
def output_tp_initBody(self): Output("PyObject *v = NULL;") Output("char *rawdata = NULL;") Output("int rawdatalen = 0;") Output("char *kw[] = {\"itself\", \"rawdata\", 0};") Output() Output("if (!PyArg_ParseTupleAndKeywords(args, kwds, \"|Os#\", kw, &v, &rawdata, &rawdatalen))") Output("return -1;") Output("if (v && rawdata)") OutLbrace() Output("PyErr_SetString(PyExc_TypeError, \"Only one of itself or rawdata may be specified\");") Output("return -1;") OutRbrace() Output("if (!v && !rawdata)") OutLbrace() Output("PyErr_SetString(PyExc_TypeError, \"One of itself or rawdata must be specified\");") Output("return -1;") OutRbrace() Output("if (rawdata)") OutLbrace() Output("if (rawdatalen != sizeof(%s))", self.itselftype) OutLbrace() Output("PyErr_SetString(PyExc_TypeError, \"%s rawdata incorrect size\");", self.itselftype) Output("return -1;") OutRbrace() Output("memcpy(&((%s *)self)->ob_itself, rawdata, rawdatalen);", self.objecttype) Output("return 0;") OutRbrace() Output("if (myPyMac_GetFSRef(v, &((%s *)self)->ob_itself)) return 0;", self.objecttype) Output("return -1;")
4ead31c4f8aed3e43fdb5afb615d8c3ca3367563 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4ead31c4f8aed3e43fdb5afb615d8c3ca3367563/filesupport.py
GlobalObjectDefinition.outputStructMembers(self)
ObjectDefinition.outputStructMembers(self)
def outputStructMembers(self): GlobalObjectDefinition.outputStructMembers(self) Output("void (*ob_freeit)(%s ptr);", self.itselftype)
4ead31c4f8aed3e43fdb5afb615d8c3ca3367563 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4ead31c4f8aed3e43fdb5afb615d8c3ca3367563/filesupport.py
GlobalObjectDefinition.outputInitStructMembers(self)
ObjectDefinition.outputInitStructMembers(self)
def outputInitStructMembers(self): GlobalObjectDefinition.outputInitStructMembers(self) Output("it->ob_freeit = NULL;")
4ead31c4f8aed3e43fdb5afb615d8c3ca3367563 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4ead31c4f8aed3e43fdb5afb615d8c3ca3367563/filesupport.py
def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts."
a8ea31ecff6636d871656ac5dae3f13b7e517455 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a8ea31ecff6636d871656ac5dae3f13b7e517455/buildpkg.py
for pat in ("*upgrade", "*install"):
for pat in ("*upgrade", "*install", "*flight"):
def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts."
a8ea31ecff6636d871656ac5dae3f13b7e517455 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a8ea31ecff6636d871656ac5dae3f13b7e517455/buildpkg.py
elif f in ["pre-upgrade", "pre-install", "post-upgrade", "post-install"]: files.append((f, self.packageInfo["Title"]+"."+f)) elif f[-8:] == "-upgrade":
elif basename(f) in ["pre_upgrade", "pre_install", "post_upgrade", "post_install"]: files.append((f, packageName+"."+basename(f))) elif basename(f) in ["preflight", "postflight"]: files.append((f, f)) elif f[-8:] == "_upgrade":
def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts."
a8ea31ecff6636d871656ac5dae3f13b7e517455 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a8ea31ecff6636d871656ac5dae3f13b7e517455/buildpkg.py
elif f[-8:] == "-install":
elif f[-8:] == "_install":
def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts."
a8ea31ecff6636d871656ac5dae3f13b7e517455 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a8ea31ecff6636d871656ac5dae3f13b7e517455/buildpkg.py
prog = prog + self.compiler.exe_extension
if self.compiler.exe_extension is not None: prog = prog + self.compiler.exe_extension
def _link (self, body, headers, include_dirs, libraries, library_dirs, lang): (src, obj) = self._compile(body, headers, include_dirs, lang) prog = os.path.splitext(os.path.basename(src))[0] self.compiler.link_executable([obj], prog, libraries=libraries, library_dirs=library_dirs, target_lang=lang)
6e4dd00e61faeb94bee8aebebeada1d80cbb92e9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6e4dd00e61faeb94bee8aebebeada1d80cbb92e9/config.py