rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
target = self.getDefault() record.__getattribute__(self.attr).append(target)
if type in ('EPFD','EPFT','EPF2','EPF3','SCHR'): target = self.getDefault() record.__getattribute__(self.attr).append(target) else: target = record.__getattribute__(self.attr)[-1]
def loadData(self,record,ins,type,size,readId): target = self.getDefault() record.__getattribute__(self.attr).append(target) element = self.loaders[type] slots = ['recordType'] slots.extend(element.getSlotsUsed()) target.__slots__ = slots target.recordType = type element.loadData(target,ins,type,size,readId)
8a33ba5ad5c871988acb06c3aff741da65ad6b4a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/8a33ba5ad5c871988acb06c3aff741da65ad6b4a/bosh.py
target = record.__getattribute__(self.attr) if not target: return element = self.loaders[target.recordType] if not element: raise ModError(ins.inName,_('Unexpected type: %d') % target.recordType) element.dumpData(target,out)
for target in record.__getattribute__(self.attr): element = self.loaders[target.recordType] if not element: raise ModError(ins.inName,_('Unexpected type: %d') % target.recordType) element.dumpData(target,out)
def dumpData(self,record,out): target = record.__getattribute__(self.attr) if not target: return element = self.loaders[target.recordType] if not element: raise ModError(ins.inName,_('Unexpected type: %d') % target.recordType) element.dumpData(target,out)
8a33ba5ad5c871988acb06c3aff741da65ad6b4a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/8a33ba5ad5c871988acb06c3aff741da65ad6b4a/bosh.py
for recClass in (MreWeap,MreActi,MreAlch,MreAppa,MreArmo,MreBook,MreClot,MreCont,MreCrea,MreDoor,MreFlor,MreFurn,MreIngr,MreKeym,MreLigh,MreMisc,MreNpc,MreQust,MreSgst,MreSlgm,):
for recClass in (MreWeap,MreActi,MreAlch,MreArmo,MreBook,MreCont,MreCrea,MreDoor,MreFlor,MreFurn,MreIngr,MreKeym,MreLigh,MreMisc,MreNpc,MreQust,MreTerm):
def initPatchFile(self,patchFile,loadMods): """Prepare to handle specified patch mod. All functions are called after this.""" Patcher.initPatchFile(self,patchFile,loadMods) self.id_data = {} #--Names keyed by long fid. self.srcClasses = set() #--Record classes actually provided by src mods/files. self.sourceMods = self.getConfigChecked() self.isActive = len(self.sourceMods) != 0 # self.masters = {} #--Type Fields recAttrs_class = self.recAttrs_class = {} for recClass in (MreWeap,MreActi,MreAlch,MreAppa,MreArmo,MreBook,MreClot,MreCont,MreCrea,MreDoor,MreFlor,MreFurn,MreIngr,MreKeym,MreLigh,MreMisc,MreNpc,MreQust,MreSgst,MreSlgm,): recAttrs_class[recClass] = ('script',) self.longTypes = set(('WEAP','ACTI','ALCH','APPA','ARMO','BOOK','CLOT','CONT','CREA','DOOR','FLOR','FURN','INGR','KEYM','LIGH','MISC','NPC_','QUST','SGST','SLGM'))
4eaa4e98570108979df999e215e656262882d512 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/4eaa4e98570108979df999e215e656262882d512/bosh.py
self.longTypes = set(('WEAP','ACTI','ALCH','APPA','ARMO','BOOK','CLOT','CONT','CREA','DOOR','FLOR','FURN','INGR','KEYM','LIGH','MISC','NPC_','QUST','SGST','SLGM'))
self.longTypes = set(('WEAP','ACTI','ALCH','ARMO','BOOK','CONT','CREA','DOOR','FLOR','FURN','INGR','KEYM','LIGH','MISC','NPC_','QUST','TERM'))
def initPatchFile(self,patchFile,loadMods): """Prepare to handle specified patch mod. All functions are called after this.""" Patcher.initPatchFile(self,patchFile,loadMods) self.id_data = {} #--Names keyed by long fid. self.srcClasses = set() #--Record classes actually provided by src mods/files. self.sourceMods = self.getConfigChecked() self.isActive = len(self.sourceMods) != 0 # self.masters = {} #--Type Fields recAttrs_class = self.recAttrs_class = {} for recClass in (MreWeap,MreActi,MreAlch,MreAppa,MreArmo,MreBook,MreClot,MreCont,MreCrea,MreDoor,MreFlor,MreFurn,MreIngr,MreKeym,MreLigh,MreMisc,MreNpc,MreQust,MreSgst,MreSlgm,): recAttrs_class[recClass] = ('script',) self.longTypes = set(('WEAP','ACTI','ALCH','APPA','ARMO','BOOK','CLOT','CONT','CREA','DOOR','FLOR','FURN','INGR','KEYM','LIGH','MISC','NPC_','QUST','SGST','SLGM'))
4eaa4e98570108979df999e215e656262882d512 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/4eaa4e98570108979df999e215e656262882d512/bosh.py
out.seek(-20,1)
out.seek(-recHeaderSize,1)
def copyPrev(size): ins.seek(-size,1) buff = ins.read(size) out.write(buff)
fa4c366ff44dbdd8f44181353e444f75a7b1a07a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/fa4c366ff44dbdd8f44181353e444f75a7b1a07a/bosh.py
MelStructA('WLST','Ii', 'Weather', (FID,'weather'), 'chance'),
MelStruct('WLST','IiI', 'Weather', (FID,'weather'), 'chance', (FID,'global')),
# def loadData(self,record,ins,type,size,readId):
f9df88e12839bac113a4170447c2846083f37502 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/f9df88e12839bac113a4170447c2846083f37502/bosh.py
(self.folderCount,self.fileCount,lenFolderNames,lenFileNames,fileFlags,fileFlags2) = ins.unpack('6I',recHeaderSize)
(self.folderCount,self.fileCount,lenFolderNames,lenFileNames,fileFlags) = ins.unpack('5I',20)
def scan(self): """Reports on contents.""" ins = bolt.StructFile(self.path.s,'rb') #--Header ins.seek(4*4) (self.folderCount,self.fileCount,lenFolderNames,lenFileNames,fileFlags,fileFlags2) = ins.unpack('6I',recHeaderSize) #--FolderInfos (Initial) folderInfos = self.folderInfos = [] for index in range(self.folderCount): hash,subFileCount,offset = ins.unpack('Q2I',16) folderInfos.append([hash,subFileCount,offset]) #--Update folderInfos for index,folderInfo in enumerate(folderInfos): fileInfos = [] folderName = cstrip(ins.read(ins.unpack('B',1)[0])) folderInfos[index].extend((folderName,fileInfos)) for index in range(folderInfo[1]): filePos = ins.tell() hash,size,offset = ins.unpack('Q2I',16) fileInfos.append([hash,size,offset,'',filePos]) #--File Names fileNames = ins.read(lenFileNames) fileNames = fileNames.split('\x00')[:-1] namesIter = iter(fileNames) for folderInfo in folderInfos: fileInfos = folderInfo[-1] for index,fileInfo in enumerate(fileInfos): fileInfo[3] = namesIter.next() #--Done ins.close()
00d94c53d498ae4b7ef69d1041a3b5916d3fca63 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/00d94c53d498ae4b7ef69d1041a3b5916d3fca63/bosh.py
('Fallout - Sounds.bsa',1138162634),
('Fallout - Sound.bsa',1138162634),
def resetMTimes(self): """Reset dates of bsa files to 'correct' values.""" #--Fix the data of a few archive files bsaTimes = ( ('Fallout - MenuVoices.bsa',1138575220), ('Fallout - Meshes.bsa',1139433736), ('Fallout - Misc.bsa',1138660560), ('Fallout - Sounds.bsa',1138162634), ('Fallout - Textures.bsa',1138162934), ('Fallout - Voices.bsa',1138166742), ) for bsaFile,mtime in bsaTimes: dirs['mods'].join(bsaFile).mtime = mtime
00d94c53d498ae4b7ef69d1041a3b5916d3fca63 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/00d94c53d498ae4b7ef69d1041a3b5916d3fca63/bosh.py
if size == 102:
if size == 186:
def loadData(self,record,ins,type,size,readId): if size == 102: MelStruct.loadData(self,record,ins,type,size,readId) return elif size == 86: #--Else 86 byte record (skips dispVelocity, #-- dispFalloff, dispDampner, dispSize, and damage #-- Two junk? bytes are tacked onto the end #-- Hex editing and the CS confirms that it is NOT #-- damage, so it is probably just filler unpacked = ins.unpack('11f3Bs3Bs3BsB3s6f2s',size,readId) elif size == 62: #--Else 62 byte record (skips most everything #-- Two junk? bytes are tacked onto the end #-- No testing done, but assumed that its the same as the #-- previous truncated record. unpacked = ins.unpack('11f3Bs3Bs3BsB3s2s',size,readId) elif size == 42: #--Else 42 byte record (skips most everything #-- Two junk? bytes are tacked onto the end #-- No testing done, but assumed that its the same as the #-- previous truncated record. unpacked = ins.unpack('10f2s',size,readId) elif size == 2: #--Else 2 byte record (skips everything #-- Two junk? bytes are tacked onto the end #-- No testing done, but assumed that its the same as the #-- previous truncated record. unpacked = ins.unpack('2s',size,readId) else: raise "Unexpected size encountered for WATR subrecord: %s" % size unpacked = unpacked[:-1] unpacked += self.defaults[len(unpacked):] setter = record.__setattr__ for attr,value,action in zip(self.attrs,unpacked,self.actions): if callable(action): value = action(value) setter(attr,value) if self._debug: print unpacked
bb8dded3d0038a77d8e132eb182951a44f590672 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/bb8dded3d0038a77d8e132eb182951a44f590672/bosh.py
elif size == 86: unpacked = ins.unpack('11f3Bs3Bs3BsB3s6f2s',size,readId) elif size == 62: unpacked = ins.unpack('11f3Bs3Bs3BsB3s2s',size,readId) elif size == 42: unpacked = ins.unpack('10f2s',size,readId)
def loadData(self,record,ins,type,size,readId): if size == 102: MelStruct.loadData(self,record,ins,type,size,readId) return elif size == 86: #--Else 86 byte record (skips dispVelocity, #-- dispFalloff, dispDampner, dispSize, and damage #-- Two junk? bytes are tacked onto the end #-- Hex editing and the CS confirms that it is NOT #-- damage, so it is probably just filler unpacked = ins.unpack('11f3Bs3Bs3BsB3s6f2s',size,readId) elif size == 62: #--Else 62 byte record (skips most everything #-- Two junk? bytes are tacked onto the end #-- No testing done, but assumed that its the same as the #-- previous truncated record. unpacked = ins.unpack('11f3Bs3Bs3BsB3s2s',size,readId) elif size == 42: #--Else 42 byte record (skips most everything #-- Two junk? bytes are tacked onto the end #-- No testing done, but assumed that its the same as the #-- previous truncated record. unpacked = ins.unpack('10f2s',size,readId) elif size == 2: #--Else 2 byte record (skips everything #-- Two junk? bytes are tacked onto the end #-- No testing done, but assumed that its the same as the #-- previous truncated record. unpacked = ins.unpack('2s',size,readId) else: raise "Unexpected size encountered for WATR subrecord: %s" % size unpacked = unpacked[:-1] unpacked += self.defaults[len(unpacked):] setter = record.__setattr__ for attr,value,action in zip(self.attrs,unpacked,self.actions): if callable(action): value = action(value) setter(attr,value) if self._debug: print unpacked
bb8dded3d0038a77d8e132eb182951a44f590672 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/bb8dded3d0038a77d8e132eb182951a44f590672/bosh.py
unpacked = ins.unpack('2s',size,readId)
record.damage = ins.unpack('H',size,readId) return else: raise "Unexpected size encountered for WATR subrecord: %s" % size def dumpData(self,record,out): out.packSub(self.subType,'H',record.damage) class MelWatrDnam(MelStruct): """Handle older trucated DNAM for WATR subrecord.""" def loadData(self,record,ins,type,size,readId): if size == 196: MelStruct.loadData(self,record,ins,type,size,readId) return elif size == 184: unpacked = ins.unpack('10f3Bs3Bs3BsI32f',size,readId)
def loadData(self,record,ins,type,size,readId): if size == 102: MelStruct.loadData(self,record,ins,type,size,readId) return elif size == 86: #--Else 86 byte record (skips dispVelocity, #-- dispFalloff, dispDampner, dispSize, and damage #-- Two junk? bytes are tacked onto the end #-- Hex editing and the CS confirms that it is NOT #-- damage, so it is probably just filler unpacked = ins.unpack('11f3Bs3Bs3BsB3s6f2s',size,readId) elif size == 62: #--Else 62 byte record (skips most everything #-- Two junk? bytes are tacked onto the end #-- No testing done, but assumed that its the same as the #-- previous truncated record. unpacked = ins.unpack('11f3Bs3Bs3BsB3s2s',size,readId) elif size == 42: #--Else 42 byte record (skips most everything #-- Two junk? bytes are tacked onto the end #-- No testing done, but assumed that its the same as the #-- previous truncated record. unpacked = ins.unpack('10f2s',size,readId) elif size == 2: #--Else 2 byte record (skips everything #-- Two junk? bytes are tacked onto the end #-- No testing done, but assumed that its the same as the #-- previous truncated record. unpacked = ins.unpack('2s',size,readId) else: raise "Unexpected size encountered for WATR subrecord: %s" % size unpacked = unpacked[:-1] unpacked += self.defaults[len(unpacked):] setter = record.__setattr__ for attr,value,action in zip(self.attrs,unpacked,self.actions): if callable(action): value = action(value) setter(attr,value) if self._debug: print unpacked
bb8dded3d0038a77d8e132eb182951a44f590672 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/bb8dded3d0038a77d8e132eb182951a44f590672/bosh.py
MelString('TNAM','texture'),
MelString('FULL','full'), MelString('NNAM','texture'),
def loadData(self,record,ins,type,size,readId): if size == 102: MelStruct.loadData(self,record,ins,type,size,readId) return elif size == 86: #--Else 86 byte record (skips dispVelocity, #-- dispFalloff, dispDampner, dispSize, and damage #-- Two junk? bytes are tacked onto the end #-- Hex editing and the CS confirms that it is NOT #-- damage, so it is probably just filler unpacked = ins.unpack('11f3Bs3Bs3BsB3s6f2s',size,readId) elif size == 62: #--Else 62 byte record (skips most everything #-- Two junk? bytes are tacked onto the end #-- No testing done, but assumed that its the same as the #-- previous truncated record. unpacked = ins.unpack('11f3Bs3Bs3BsB3s2s',size,readId) elif size == 42: #--Else 42 byte record (skips most everything #-- Two junk? bytes are tacked onto the end #-- No testing done, but assumed that its the same as the #-- previous truncated record. unpacked = ins.unpack('10f2s',size,readId) elif size == 2: #--Else 2 byte record (skips everything #-- Two junk? bytes are tacked onto the end #-- No testing done, but assumed that its the same as the #-- previous truncated record. unpacked = ins.unpack('2s',size,readId) else: raise "Unexpected size encountered for WATR subrecord: %s" % size unpacked = unpacked[:-1] unpacked += self.defaults[len(unpacked):] setter = record.__setattr__ for attr,value,action in zip(self.attrs,unpacked,self.actions): if callable(action): value = action(value) setter(attr,value) if self._debug: print unpacked
bb8dded3d0038a77d8e132eb182951a44f590672 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/bb8dded3d0038a77d8e132eb182951a44f590672/bosh.py
MelWatrData('DATA', '11f3Bs3Bs3BsB3s10fH',('windVelocity',0.100), ('windDirection',90.0),('waveAmp',0.5),('waveFreq',1.0),('sunPower',50.0), ('reflectAmt',0.5),('fresnelAmt',0.0250),('xSpeed',0.0),('ySpeed',0.0), ('fogNear',27852.8),('fogFar',163840.0),('shallowRed',0),('shallowGreen',128), ('shallowBlue',128),('unused1',null1),('deepRed',0),('deepGreen',0), ('deepBlue',25),('unused2',null1),('reflRed',255),('reflGreen',255), ('reflBlue',255),('unused3',null1),('blend',50),('unused4',null3),('rainForce',0.1000), ('rainVelocity',0.6000),('rainFalloff',0.9850),('rainDampner',2.0000), ('rainSize',0.0100),('dispForce',0.4000),('dispVelocity', 0.6000), ('dispFalloff',0.9850),('dispDampner',10.0000),('dispSize',0.0500),('damage',0)),
MelFid('XNAM','effect'), MelWatrData('DATA','10f3Bs3Bs3BsI32fH',('windVelocity',0.100),('windDirection',90.0), ('waveAmp',0.5),('waveFreq',1.0),('sunPower',50.0),('reflectAmt',0.5), ('fresnelAmt',0.0250),('unknown1',0.0),('fogNear',27852.8),('fogFar',163840.0), ('shallowRed',0),('shallowGreen',128),('shallowBlue',128),('unused1',null1), ('deepRed',0),('deepGreen',0),('deepBlue',25),('unused2',null1), ('reflRed',255),('reflGreen',255),('reflBlue',255),('unused3',null1), ('unknown2',0), ('rainForce',0.1000),('rainVelocity',0.6000),('rainFalloff',0.9850),('rainDampner',2.0000),('rainSize',0.0100), ('dispForce',0.4000),('dispVelocity', 0.6000),('dispFalloff',0.9850),('dispDampner',10.0000),('dispSize',0.0500), ('noiseNormalsScale',1.8000),('noiseLayer1WindDirection',0.0000),('noiseLayer2WindDirection',-431602080.0500), ('noiseLayer3WindDirection',-431602080.0500),('noiseLayer1WindVelocity',0.0000), ('noiseLayer2WindVelocity',-431602080.0500),('noiseLayer3WindVelocity',-431602080.0500), ('noiseNormalsDepthFalloffStart',0.00000),('noiseNormalsDepthFalloffEnd',0.10000), ('fogAboveWaterAmount',1.00000),('noiseNormalsUvScale',500.00000), ('fogUnderWaterAmount',1.00000),('fogUnderWaterNear',0.00000),('fogUnderWaterFar',1000.00000), ('distortionAmount',250.00000),('shininess',100.00000),('reflectHdrMult',1.00000), ('lightRadius',10000.00000),('lightBrightness',1.00000), ('noiseLayer1UvScale',100.00000),('noiseLayer2UvScale',100.00000),('noiseLayer3UvScale',100.00000), ('damage',0)), MelWatrDnam('DNAM','10f3Bs3Bs3BsI35f',('windVelocity',0.100),('windDirection',90.0), ('waveAmp',0.5),('waveFreq',1.0),('sunPower',50.0),('reflectAmt',0.5), ('fresnelAmt',0.0250),('unknown1',0.0),('fogNear',27852.8),('fogFar',163840.0), ('shallowRed',0),('shallowGreen',128),('shallowBlue',128),('unused1',null1), ('deepRed',0),('deepGreen',0),('deepBlue',25),('unused2',null1), ('reflRed',255),('reflGreen',255),('reflBlue',255),('unused3',null1), ('unknown2',0), ('rainForce',0.1000),('rainVelocity',0.6000),('rainFalloff',0.9850),('rainDampner',2.0000),('rainSize',0.0100), ('dispForce',0.4000),('dispVelocity', 0.6000),('dispFalloff',0.9850),('dispDampner',10.0000),('dispSize',0.0500), ('noiseNormalsScale',1.8000),('noiseLayer1WindDirection',0.0000),('noiseLayer2WindDirection',-431602080.0500), ('noiseLayer3WindDirection',-431602080.0500),('noiseLayer1WindVelocity',0.0000), ('noiseLayer2WindVelocity',-431602080.0500),('noiseLayer3WindVelocity',-431602080.0500), ('noiseNormalsDepthFalloffStart',0.00000),('noiseNormalsDepthFalloffEnd',0.10000), ('fogAboveWaterAmount',1.00000),('noiseNormalsUvScale',500.00000), ('fogUnderWaterAmount',1.00000),('fogUnderWaterNear',0.00000),('fogUnderWaterFar',1000.00000), ('distortionAmount',250.00000),('shininess',100.00000),('reflectHdrMult',1.00000), ('lightRadius',10000.00000),('lightBrightness',1.00000), ('noiseLayer1UvScale',100.00000),('noiseLayer2UvScale',100.00000),('noiseLayer3UvScale',100.00000), ('noiseLayer1Amp',0.00000),('noiseLayer2Amp',0.00000),('noiseLayer3Amp',0.00000), ),
def loadData(self,record,ins,type,size,readId): if size == 102: MelStruct.loadData(self,record,ins,type,size,readId) return elif size == 86: #--Else 86 byte record (skips dispVelocity, #-- dispFalloff, dispDampner, dispSize, and damage #-- Two junk? bytes are tacked onto the end #-- Hex editing and the CS confirms that it is NOT #-- damage, so it is probably just filler unpacked = ins.unpack('11f3Bs3Bs3BsB3s6f2s',size,readId) elif size == 62: #--Else 62 byte record (skips most everything #-- Two junk? bytes are tacked onto the end #-- No testing done, but assumed that its the same as the #-- previous truncated record. unpacked = ins.unpack('11f3Bs3Bs3BsB3s2s',size,readId) elif size == 42: #--Else 42 byte record (skips most everything #-- Two junk? bytes are tacked onto the end #-- No testing done, but assumed that its the same as the #-- previous truncated record. unpacked = ins.unpack('10f2s',size,readId) elif size == 2: #--Else 2 byte record (skips everything #-- Two junk? bytes are tacked onto the end #-- No testing done, but assumed that its the same as the #-- previous truncated record. unpacked = ins.unpack('2s',size,readId) else: raise "Unexpected size encountered for WATR subrecord: %s" % size unpacked = unpacked[:-1] unpacked += self.defaults[len(unpacked):] setter = record.__setattr__ for attr,value,action in zip(self.attrs,unpacked,self.actions): if callable(action): value = action(value) setter(attr,value) if self._debug: print unpacked
bb8dded3d0038a77d8e132eb182951a44f590672 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/bb8dded3d0038a77d8e132eb182951a44f590672/bosh.py
(_('F Radroach Meat'), '%s '), (_('F. Radroach Meat'), '%s. '), (_('F - Radroach Meat'),'%s - '), (_('(F) Radroach Meat'),'(%s) '),
(_('F Radroach Meat'), '\x07\x07\x07\x07\x07%s '), (_('F. Radroach Meat'), '\x07\x07\x07\x07\x07%s. '), (_('F - Radroach Meat'),'\x07\x07\x07\x07\x07%s - '), (_('(F) Radroach Meat'),'\x07\x07\x07\x07\x07(%s) '),
def __init__(self): MultiTweakItem.__init__(self,_("Ingestibles"), _('Label ingestibles to sort by type. C: Chems, F: Food, S: Stimpack, A: Alcohol.'), 'ALCH', (_('F Radroach Meat'), '%s '), (_('F. Radroach Meat'), '%s. '), (_('F - Radroach Meat'),'%s - '), (_('(F) Radroach Meat'),'(%s) '), )
4fadd0bfb0cf32a8a2e9f4326637b84f096a9c39 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/4fadd0bfb0cf32a8a2e9f4326637b84f096a9c39/bosh.py
(_('S BB Gun'), '%s '), (_('S. BB Gun'), '%s. '), (_('S - BB Gun'),'%s - '), (_('(S) BB Gun'),'(%s) '),
(_('S BB Gun'), '\x07\x07%s '), (_('S. BB Gun'), '\x07\x07%s. '), (_('S - BB Gun'),'\x07\x07%s - '), (_('(S) BB Gun'),'\x07\x07(%s) '),
def __init__(self): MultiTweakItem.__init__(self,_("Weapons"), _('Label ammo and weapons to sort by type and damage.'), 'WEAP', (_('S BB Gun'), '%s '), (_('S. BB Gun'), '%s. '), (_('S - BB Gun'),'%s - '), (_('(S) BB Gun'),'(%s) '), ('----','----'), (_('S10 BB Gun'), '%s%02d '), (_('S10. BB Gun'), '%s%02d. '), (_('S10 - BB Gun'),'%s%02d - '), (_('(S10) BB Gun'),'(%s%02d) '), )
4fadd0bfb0cf32a8a2e9f4326637b84f096a9c39 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/4fadd0bfb0cf32a8a2e9f4326637b84f096a9c39/bosh.py
(_('S10 BB Gun'), '%s%02d '), (_('S10. BB Gun'), '%s%02d. '), (_('S10 - BB Gun'),'%s%02d - '), (_('(S10) BB Gun'),'(%s%02d) '),
(_('S10 BB Gun'), '\x07\x07%s%02d '), (_('S10. BB Gun'), '\x07\x07%s%02d. '), (_('S10 - BB Gun'),'\x07\x07%s%02d - '), (_('(S10) BB Gun'),'\x07\x07(%s%02d) '),
def __init__(self): MultiTweakItem.__init__(self,_("Weapons"), _('Label ammo and weapons to sort by type and damage.'), 'WEAP', (_('S BB Gun'), '%s '), (_('S. BB Gun'), '%s. '), (_('S - BB Gun'),'%s - '), (_('(S) BB Gun'),'(%s) '), ('----','----'), (_('S10 BB Gun'), '%s%02d '), (_('S10. BB Gun'), '%s%02d. '), (_('S10 - BB Gun'),'%s%02d - '), (_('(S10) BB Gun'),'(%s%02d) '), )
4fadd0bfb0cf32a8a2e9f4326637b84f096a9c39 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/4fadd0bfb0cf32a8a2e9f4326637b84f096a9c39/bosh.py
for blockType in ('WEAP',):
for blockType in ('AMMO','WEAP'):
def scanModFile(self,modFile,progress,patchFile): """Scans specified mod file to extract info. May add record to patch mod, but won't alter it.""" mapper = modFile.getLongMapper() #for blockType in ('AMMO','WEAP'): for blockType in ('WEAP',): modBlock = getattr(modFile,blockType) patchBlock = getattr(patchFile,blockType) id_records = patchBlock.id_records for record in modBlock.getActiveRecords(): if mapper(record.fid) not in id_records: record = record.getTypeCopy(mapper) patchBlock.setRecord(record)
4fadd0bfb0cf32a8a2e9f4326637b84f096a9c39 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/4fadd0bfb0cf32a8a2e9f4326637b84f096a9c39/bosh.py
ammoFormat = '\x07' for record in patchFile.AMMO.records: if not record.full: continue record.full = ammoFormat + record.full keep(record.fid) srcMod = record.fid[0] count[srcMod] = count.get(srcMod,0) + 1
def buildPatch(self,log,progress,patchFile): """Edits patch file as desired. Will write to log.""" count = {} format = self.choiceValues[self.chosen][0] showStat = '%02d' in format keep = patchFile.getKeeper() codes = getattr(patchFile,'weaponTags','BESMUTL') #ammoFormat = format.replace('%02d','',1) # for record in patchFile.AMMO.records: # if not record.full: continue # if record.full[0] in '+-=.()[]': continue # record.full = ammoFormat % 'A' + record.full # keep(record.fid) # srcMod = record.fid[0] # count[srcMod] = count.get(srcMod,0) + 1 for record in patchFile.WEAP.records: if not record.full: continue if record.full[0] in '+-=.()[]': continue if not record.etype in range(0,7): continue type = codes[record.etype] if showStat: record.full = format % (type,record.damage) + record.full else: record.full = format % type + record.full keep(record.fid) srcMod = record.fid[0] count[srcMod] = count.get(srcMod,0) + 1 #--Log log(_('* %s: %d') % (self.label,sum(count.values()))) for srcMod in modInfos.getOrdered(count.keys()): log(' * %s: %d' % (srcMod.s,count[srcMod]))
4fadd0bfb0cf32a8a2e9f4326637b84f096a9c39 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/4fadd0bfb0cf32a8a2e9f4326637b84f096a9c39/bosh.py
(_('A Naughty Nightwear'), '%s '), (_('A. Naughty Nightwear'), '%s. '), (_('A - Naughty Nightwear'),'%s - '), (_('(A) Naughty Nightwear'),'(%s) '),
(_('A Naughty Nightwear'), '\x07\x07\x07%s '), (_('A. Naughty Nightwear'), '\x07\x07\x07%s. '), (_('A - Naughty Nightwear'),'\x07\x07\x07%s - '), (_('(A) Naughty Nightwear'),'\x07\x07\x07(%s) '),
def buildPatch(self,log,progress,patchFile): """Edits patch file as desired. Will write to log.""" count = {} format = self.choiceValues[self.chosen][0] showStat = '%02d' in format keep = patchFile.getKeeper() codes = getattr(patchFile,'weaponTags','BESMUTL') #ammoFormat = format.replace('%02d','',1) # for record in patchFile.AMMO.records: # if not record.full: continue # if record.full[0] in '+-=.()[]': continue # record.full = ammoFormat % 'A' + record.full # keep(record.fid) # srcMod = record.fid[0] # count[srcMod] = count.get(srcMod,0) + 1 for record in patchFile.WEAP.records: if not record.full: continue if record.full[0] in '+-=.()[]': continue if not record.etype in range(0,7): continue type = codes[record.etype] if showStat: record.full = format % (type,record.damage) + record.full else: record.full = format % type + record.full keep(record.fid) srcMod = record.fid[0] count[srcMod] = count.get(srcMod,0) + 1 #--Log log(_('* %s: %d') % (self.label,sum(count.values()))) for srcMod in modInfos.getOrdered(count.keys()): log(' * %s: %d' % (srcMod.s,count[srcMod]))
4fadd0bfb0cf32a8a2e9f4326637b84f096a9c39 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/4fadd0bfb0cf32a8a2e9f4326637b84f096a9c39/bosh.py
(_('A01 Naughty Nightwear'), '%s%02d '), (_('A01. Naughty Nightwear'), '%s%02d. '), (_('A01 - Naughty Nightwear'),'%s%02d - '), (_('(A01) Naughty Nightwear'),'(%s%02d) '),
(_('A01 Naughty Nightwear'), '\x07\x07\x07%s%02d '), (_('A01. Naughty Nightwear'), '\x07\x07\x07%s%02d. '), (_('A01 - Naughty Nightwear'),'\x07\x07\x07%s%02d - '), (_('(A01) Naughty Nightwear'),'\x07\x07\x07(%s%02d) '),
def buildPatch(self,log,progress,patchFile): """Edits patch file as desired. Will write to log.""" count = {} format = self.choiceValues[self.chosen][0] showStat = '%02d' in format keep = patchFile.getKeeper() codes = getattr(patchFile,'weaponTags','BESMUTL') #ammoFormat = format.replace('%02d','',1) # for record in patchFile.AMMO.records: # if not record.full: continue # if record.full[0] in '+-=.()[]': continue # record.full = ammoFormat % 'A' + record.full # keep(record.fid) # srcMod = record.fid[0] # count[srcMod] = count.get(srcMod,0) + 1 for record in patchFile.WEAP.records: if not record.full: continue if record.full[0] in '+-=.()[]': continue if not record.etype in range(0,7): continue type = codes[record.etype] if showStat: record.full = format % (type,record.damage) + record.full else: record.full = format % type + record.full keep(record.fid) srcMod = record.fid[0] count[srcMod] = count.get(srcMod,0) + 1 #--Log log(_('* %s: %d') % (self.label,sum(count.values()))) for srcMod in modInfos.getOrdered(count.keys()): log(' * %s: %d' % (srcMod.s,count[srcMod]))
4fadd0bfb0cf32a8a2e9f4326637b84f096a9c39 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/4fadd0bfb0cf32a8a2e9f4326637b84f096a9c39/bosh.py
for recClass in (MreCont,MreDoor,):
for recClass in (MreCont,MreDoor,MreTerm):
def initPatchFile(self,patchFile,loadMods): """Prepare to handle specified patch mod. All functions are called after this.""" Patcher.initPatchFile(self,patchFile,loadMods) self.id_data = {} #--Names keyed by long fid. self.srcClasses = set() #--Record classes actually provided by src mods/files. self.sourceMods = self.getConfigChecked() self.isActive = len(self.sourceMods) != 0 #--Type Fields recAttrs_class = self.recAttrs_class = {} for recClass in (MreActi,MreAlch,MreAmmo,MreFurn,MreMisc,MreMstt,MreProj,MreWeap): recAttrs_class[recClass] = ('destructable',) for recClass in (MreCont,MreDoor,): # TODO: MreTerm recAttrs_class[recClass] = ('destructable','script',) for recClass in (MreLigh,): recAttrs_class[recClass] = ('script',) for recClass in (MreStat,): recAttrs_class[recClass] = ('model',) self.longTypes = set(('ACTI','ALCH','AMMO','FURN','MISC','MSTT','PROJ','WEAP','CONT','DOOR','LIGH','STAT', 'DEBR','EXPL','MGEF','SCPT','SPEL','SOUN','NPC_','WATR','TXST','ENCH','FLST','IPDS','STAT',''))
eb7e3691f93e9d43034012aa4a215fcf525e2374 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/eb7e3691f93e9d43034012aa4a215fcf525e2374/bosh.py
'DEBR','EXPL','MGEF','SCPT','SPEL','SOUN','NPC_','WATR','TXST','ENCH','FLST','IPDS','STAT',''))
'DEBR','EXPL','MGEF','SCPT','SPEL','SOUN','NPC_','WATR','TXST','ENCH','FLST','IPDS','STAT','NOTE','QUST'))
def initPatchFile(self,patchFile,loadMods): """Prepare to handle specified patch mod. All functions are called after this.""" Patcher.initPatchFile(self,patchFile,loadMods) self.id_data = {} #--Names keyed by long fid. self.srcClasses = set() #--Record classes actually provided by src mods/files. self.sourceMods = self.getConfigChecked() self.isActive = len(self.sourceMods) != 0 #--Type Fields recAttrs_class = self.recAttrs_class = {} for recClass in (MreActi,MreAlch,MreAmmo,MreFurn,MreMisc,MreMstt,MreProj,MreWeap): recAttrs_class[recClass] = ('destructable',) for recClass in (MreCont,MreDoor,): # TODO: MreTerm recAttrs_class[recClass] = ('destructable','script',) for recClass in (MreLigh,): recAttrs_class[recClass] = ('script',) for recClass in (MreStat,): recAttrs_class[recClass] = ('model',) self.longTypes = set(('ACTI','ALCH','AMMO','FURN','MISC','MSTT','PROJ','WEAP','CONT','DOOR','LIGH','STAT', 'DEBR','EXPL','MGEF','SCPT','SPEL','SOUN','NPC_','WATR','TXST','ENCH','FLST','IPDS','STAT',''))
eb7e3691f93e9d43034012aa4a215fcf525e2374 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/eb7e3691f93e9d43034012aa4a215fcf525e2374/bosh.py
patchFile.safeSave()
while True: try: patchFile.safeSave() except WindowsError: message = _("The patch cannot be written to (Data\\%s).\nIt might be locking by other processes.\nDo you want to retry or cancel?") % (patchName.s,) if balt.askWarning(self,fill(message,80),_("Couldn't write ")+patchName.s): continue raise break
def Execute(self,event=None): """Do the patch.""" self.EndModal(wx.ID_OK) patchName = self.patchInfo.name progress = balt.Progress(patchName.s,(' '*60+'\n')) try: #--Save configs patchConfigs = {'ImportedMods':set()} for patcher in self.patchers: patcher.saveConfig(patchConfigs) bosh.modInfos.table.setItem(patchName,'bash.patch.configs',patchConfigs) #--Do it log = bolt.LogFile(cStringIO.StringIO()) nullProgress = bolt.Progress() patchers = [patcher for patcher in self.patchers if patcher.isEnabled] patchFile = bosh.PatchFile(self.patchInfo,patchers) patchFile.initData(SubProgress(progress,0,0.1)) #try to speed this up! patchFile.initFactories(SubProgress(progress,0.1,0.2)) #no speeding needed/really possible (less than 1/4 second even with large LO) patchFile.scanLoadMods(SubProgress(progress,0.2,0.8)) #try to speed this up! patchFile.buildPatch(log,SubProgress(progress,0.8,0.9))#no speeding needed/really possible (less than 1/4 second even with large LO) #--Save progress(0.9,patchName.s+_('\nSaving...')) patchFile.safeSave() #--Cleanup self.patchInfo.refresh() modList.RefreshUI(patchName) #--Done progress.Destroy() #--Readme and log log.setHeader(None) log('{{CSS:wtxt_sand_small.css}}') logValue = log.out.getvalue() readme = bosh.modInfos.dir.join('Docs',patchName.sroot+'.txt') readme.open('w').write(logValue) bosh.modInfos.table.setItem(patchName,'doc',readme) #--Convert log/readme to wtxt and show log docsDir = bosh.modInfos.dir.join('Docs') bolt.WryeText.genHtml(readme,None,docsDir) balt.showWryeLog(self.parent,readme.root+'.html',patchName.s,icons=bashBlue) #--Select? message = _("Activate %s?") % (patchName.s,) if bosh.modInfos.isSelected(patchName) or balt.askYes(self.parent,message,patchName.s): try: oldFiles = bosh.modInfos.ordered[:] bosh.modInfos.select(patchName) changedFiles = bolt.listSubtract(bosh.modInfos.ordered,oldFiles) if len(changedFiles) > 1: statusBar.SetText(_("Masters Activated: ") + `len(changedFiles)-1`) except bosh.PluginsFullError: balt.showError(self,_("Unable to add mod %s because load list is full." ) % (fileName.s,)) modList.RefreshUI() except bosh.FileEditError, error: progress.Destroy() balt.showError(self,str(error),_("File Edit Error")) except: progress.Destroy() raise
c3b4c259766144b354e0b0ed5b582bfff373050d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/c3b4c259766144b354e0b0ed5b582bfff373050d/basher.py
class MelSounSndd(MelStruct): """SNDD is an older version of SNDX. Allow it to read in, but not set defaults or write."""
class MelSounSndx(MelStruct): """SNDX is a reduced version of SNDD. Allow it to read in, but not set defaults or write."""
def dumpData(self,record,out): """Conditionally dumps data.""" if record.entryType == 7 and self.subType == 'RDMD': MelOptStruct.dumpData(self,record,out)
42bac2d1bab8d28501bf07ca8a68703266c8bbd9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/42bac2d1bab8d28501bf07ca8a68703266c8bbd9/bosh.py
record.staticAtten = 0 record.stopTime = 0 record.startTime = 0
record.point0 = 0 record.point1 = 0 record.point2 = 0 record.point3 = 0 record.point4 = 0 record.reverb = 0 record.priority = 0 record.unknown = "\0"*8
def loadData(self,record,ins,type,size,readId): MelStruct.loadData(self,record,ins,type,size,readId) record.staticAtten = 0 record.stopTime = 0 record.startTime = 0
42bac2d1bab8d28501bf07ca8a68703266c8bbd9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/42bac2d1bab8d28501bf07ca8a68703266c8bbd9/bosh.py
MelSounSndd('SNDD','=2BbsH2s','minDistance', 'maxDistance', 'freqAdjustment', ('unused1',null1), (_flags,'flags'), ('unused2',null2)), MelOptStruct('SNDX','=2BbsH2sh2B',('minDistance',None), ('maxDistance',None), ('freqAdjustment',None), ('unused1',null1), (_flags,'flags',None), ('unused2',null2), ('staticAtten',None),('stopTime',None),('startTime',None),)
MelOptStruct('SNDD','=2BbsIh2B6HI8s',('minDistance',None), ('maxDistance',None), ('freqAdjustment',None), ('unused1',null1), (_flags,'flags',None),('staticAtten',None),('stopTime',None),('startTime',None), ('point0',0),('point1',0),('point2',0),('point3',0),('point4',0),('reverb',0),('priority',0),'unknown'), MelSounSndx('SNDX','=2BbsIh2B',('minDistance',None), ('maxDistance',None), ('freqAdjustment',None), ('unused1',null1), (_flags,'flags',None),('staticAtten',None),('stopTime',None),('startTime',None),), MelBase('ANAM','_anam'), MelBase('GNAM','_gnam'), MelBase('HNAM','_hnam'),
def dumpData(self,record,out): return
42bac2d1bab8d28501bf07ca8a68703266c8bbd9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/42bac2d1bab8d28501bf07ca8a68703266c8bbd9/bosh.py
MelFid('SNAM','sound'),
MelGroup('destructable', MelBase('DEST','header'), MelStruct('DEST','IhH','health','count','flags'), MelGroups('stages', MelStruct('DSTD','=4B4I','health','index','damageStage','flags', 'selfDamagePerSecond',(FID,'explosion',None),(FID,'debris',None),'debrisCount'), MelString('DMDL','model'), MelBase('DMDT','dmdt'), MelBase('DSTF','footer'), ), ), MelFid('SNAM','soundLooping'), MelFid('VNAM','soundActivation'), MelFid('RNAM','radioStation'), MelFid('WNAM','waterType'),
def getEffectsSummary(self,mgef_school=None,mgef_name=None): """Return a text description of magic effects.""" mgef_school = mgef_school or bush.mgef_school mgef_name = mgef_name or bush.mgef_name buff = cStringIO.StringIO() avEffects = bush.actorValueEffects aValues = bush.actorValues buffWrite = buff.write if self.effects: school = mgef_school[self.effects[0].name] buffWrite(bush.actorValues[20+school] + '\n') for index,effect in enumerate(self.effects): if effect.scriptEffect: effectName = effect.scriptEffect.full or 'Script Effect' else: effectName = mgef_name[effect.name] if effect.name in avEffects: effectName = re.sub(_('(Attribute|Skill)'),aValues[effect.actorValue],effectName) buffWrite('o+*'[effect.recipient]+' '+effectName) if effect.magnitude: buffWrite(' '+`effect.magnitude`+'m') if effect.area: buffWrite(' '+`effect.area`+'a') if effect.duration > 1: buffWrite(' '+`effect.duration`+'d') buffWrite('\n') return buff.getvalue()
6bd5a53acf99e85e527eb9e4ebec85b20c6dd97c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/6bd5a53acf99e85e527eb9e4ebec85b20c6dd97c/bosh.py
MelStructs('DSTD','=4B4I','stages','health','index','damageStage', 'flags','selfDamagePerSecond',(FID,'explosion',None), (FID,'debris',None),'debrisCount'), MelBase('DSTF','footer'),
MelStruct('DEST','IhH','health','count','flags'), MelGroups('stages', MelStruct('DSTD','=4B4I','health','index','damageStage','flags', 'selfDamagePerSecond',(FID,'explosion',None),(FID,'debris',None),'debrisCount'), MelString('DMDL','model'), MelBase('DMDT','_dmdt'), MelBase('DSTF','footer'), ),
def loadData(self,record,ins,type,size,readId): if size == 136: MelStruct.loadData(self,record,ins,type,size,readId) return elif size == 124: #--Else 124 byte record (skips sightUsage, semiAutomaticFireDelayMin and semiAutomaticFireDelayMax... unpacked = ins.unpack('Iff4B5fI4BffII11fIIffI',size,readId) elif size == 120: #--Else 120 byte record (skips resistType, sightUsage, semiAutomaticFireDelayMin and semiAutomaticFireDelayMax... unpacked = ins.unpack('Iff4B5fI4BffII11fIIff',size,readId) else: raise "Unexpected size encountered for WEAP:DNAM subrecord: %s" % size unpacked += self.defaults[len(unpacked):] setter = record.__setattr__ for attr,value,action in zip(self.attrs,unpacked,self.actions): if callable(action): value = action(value) setter(attr,value) if self._debug: print unpacked
6bd5a53acf99e85e527eb9e4ebec85b20c6dd97c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/6bd5a53acf99e85e527eb9e4ebec85b20c6dd97c/bosh.py
(4,'ingredients'),
(4,'foods'), (5,'chems'), (6,'stimpacks'),
def dumpData(self,record,out): if not record.flags.isInterior: MelOptStruct.dumpData(self,record,out)
f929c28026e3bd16332e1f69032af91c7c383beb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/f929c28026e3bd16332e1f69032af91c7c383beb/bosh.py
(8,'apparatus'),
def dumpData(self,record,out): if not record.flags.isInterior: MelOptStruct.dumpData(self,record,out)
f929c28026e3bd16332e1f69032af91c7c383beb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/f929c28026e3bd16332e1f69032af91c7c383beb/bosh.py
(11,'spells'), (12,'magicItems'),
def dumpData(self,record,out): if not record.flags.isInterior: MelOptStruct.dumpData(self,record,out)
f929c28026e3bd16332e1f69032af91c7c383beb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/f929c28026e3bd16332e1f69032af91c7c383beb/bosh.py
def loadData(self,record,ins,type,size,readId): if size == 52: MelStruct.loadData(self,record,ins,type,size,readId) return unpacked = ins.unpack('2iI7i2I',size,readId) unpacked += self.defaults[len(unpacked):] setter = record.__setattr__ for attr,value,action in zip(self.attrs,unpacked,self.actions): if callable(action): value = action(value) setter(attr,value) if self._debug: print unpacked, record.flags.getTrueAttrs()
def loadData(self,record,ins,type,size,readId): if size == 52: MelStruct.loadData(self,record,ins,type,size,readId) return #--Else 42 byte record (skips trainSkill, trainLevel,unused1... unpacked = ins.unpack('2iI7i2I',size,readId) unpacked += self.defaults[len(unpacked):] setter = record.__setattr__ for attr,value,action in zip(self.attrs,unpacked,self.actions): if callable(action): value = action(value) setter(attr,value) if self._debug: print unpacked, record.flags.getTrueAttrs()
f929c28026e3bd16332e1f69032af91c7c383beb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/f929c28026e3bd16332e1f69032af91c7c383beb/bosh.py
MelClasData('DATA','2iI7i2IbB2s','primary1','primary2','specialization','major1','major2','major3','major4','major5','major6','major7',(_flags,'flags',0L),(aiService,'services',0L),('trainSkill',0),('trainLevel',0),('unused1',null2)),
MelClasData('DATA','4I2IbB2s','tagSkill1','tagSkill2','tagSkill3','tagSkill4',(_flags,'flags',0L),(aiService,'services',0L),('trainSkill',0),('trainLevel',0),('unused1',null2)),
def loadData(self,record,ins,type,size,readId): if size == 52: MelStruct.loadData(self,record,ins,type,size,readId) return #--Else 42 byte record (skips trainSkill, trainLevel,unused1... unpacked = ins.unpack('2iI7i2I',size,readId) unpacked += self.defaults[len(unpacked):] setter = record.__setattr__ for attr,value,action in zip(self.attrs,unpacked,self.actions): if callable(action): value = action(value) setter(attr,value) if self._debug: print unpacked, record.flags.getTrueAttrs()
f929c28026e3bd16332e1f69032af91c7c383beb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/f929c28026e3bd16332e1f69032af91c7c383beb/bosh.py
out.write(rowFormat % (type,longid[0].s,longid[1],eid,name,sname))
out.write(rowFormat % (type,longid[0].s,longid[1],eid,name.replace('"', '""'),sname.replace('"', '""')))
def writeToText(self,textPath): """Exports type_id_name to specified text file.""" textPath = GPath(textPath) type_id_name = self.type_id_name type_id_sname = self.type_id_sname out = textPath.open('w') for type in sorted(type_id_name): if type in self.hasShortNameTypes: headFormat = '"%s","%s","%s","%s","%s","%s"\n' rowFormat = '"%s","%s","0x%06X","%s","%s","%s"\n' out.write(headFormat % (_('Type'),_('Mod Name'),_('ObjectIndex'),_('Editor Id'),_('Name'),_('Short Name'))) else: headFormat = '"%s","%s","%s","%s","%s"\n' rowFormat = '"%s","%s","0x%06X","%s","%s"\n' out.write(headFormat % (_('Type'),_('Mod Name'),_('ObjectIndex'),_('Editor Id'),_('Name'))) id_name = type_id_name[type] id_sname = type_id_sname.get(type, {}) longids = id_name.keys() longids.sort(key=lambda a: id_name[a][0]) longids.sort(key=itemgetter(0)) for longid in longids: eid,name = id_name[longid] if type in self.hasShortNameTypes: eid2,sname = id_sname.get(longid,(eid,'')) out.write(rowFormat % (type,longid[0].s,longid[1],eid,name,sname)) else: out.write(rowFormat % (type,longid[0].s,longid[1],eid,name)) out.close()
3207fa7cdf0957166c60eb1dc1f646b588a3a814 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3207fa7cdf0957166c60eb1dc1f646b588a3a814/bosh.py
out.write(rowFormat % (type,longid[0].s,longid[1],eid,name))
out.write(rowFormat % (type,longid[0].s,longid[1],eid,name.replace('"', '""')))
def writeToText(self,textPath): """Exports type_id_name to specified text file.""" textPath = GPath(textPath) type_id_name = self.type_id_name type_id_sname = self.type_id_sname out = textPath.open('w') for type in sorted(type_id_name): if type in self.hasShortNameTypes: headFormat = '"%s","%s","%s","%s","%s","%s"\n' rowFormat = '"%s","%s","0x%06X","%s","%s","%s"\n' out.write(headFormat % (_('Type'),_('Mod Name'),_('ObjectIndex'),_('Editor Id'),_('Name'),_('Short Name'))) else: headFormat = '"%s","%s","%s","%s","%s"\n' rowFormat = '"%s","%s","0x%06X","%s","%s"\n' out.write(headFormat % (_('Type'),_('Mod Name'),_('ObjectIndex'),_('Editor Id'),_('Name'))) id_name = type_id_name[type] id_sname = type_id_sname.get(type, {}) longids = id_name.keys() longids.sort(key=lambda a: id_name[a][0]) longids.sort(key=itemgetter(0)) for longid in longids: eid,name = id_name[longid] if type in self.hasShortNameTypes: eid2,sname = id_sname.get(longid,(eid,'')) out.write(rowFormat % (type,longid[0].s,longid[1],eid,name,sname)) else: out.write(rowFormat % (type,longid[0].s,longid[1],eid,name)) out.close()
3207fa7cdf0957166c60eb1dc1f646b588a3a814 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/3207fa7cdf0957166c60eb1dc1f646b588a3a814/bosh.py
MelStructs('CNTO','Ii','items',(FID,'item'),'count'),
MelGroups('items', MelStruct('CNTO','Ii',(FID,'item',None),('count',1)), MelOptStruct('COED','IIf',(FID,'owner',None),(FID,'glob',None),('condition',1.0)), ), MelGroup('destructable', MelBase('DEST','header'), MelStruct('DEST','IhH','health','count','flags'), MelGroups('stages', MelStruct('DSTD','=4B4I','health','index','damageStage','flags', 'selfDamagePerSecond',(FID,'explosion',None),(FID,'debris',None),'debrisCount'), MelString('DMDL','model'), MelBase('DMDT','_dmdt'), MelBase('DSTF','footer'), ), ),
# def loadData(self,record,ins,type,size,readId):
7588e0d30dff42efbeec928a58eec430fc6aaf2b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/7588e0d30dff42efbeec928a58eec430fc6aaf2b/bosh.py
MelString('DNAM','upperLayer'),
MelString('ANAM','layer2'), MelString('BNAM','layer3'),
def loadData(self,record,ins,type,size,readId): if size == 136: MelStruct.loadData(self,record,ins,type,size,readId) return elif size == 124: #--Else 124 byte record (skips sightUsage, semiAutomaticFireDelayMin and semiAutomaticFireDelayMax... unpacked = ins.unpack('Iff4B5fI4BffII11fIIffI',size,readId) elif size == 120: #--Else 120 byte record (skips resistType, sightUsage, semiAutomaticFireDelayMin and semiAutomaticFireDelayMax... unpacked = ins.unpack('Iff4B5fI4BffII11fIIff',size,readId) else: raise "Unexpected size encountered for WEAP:DNAM subrecord: %s" % size unpacked += self.defaults[len(unpacked):] setter = record.__setattr__ for attr,value,action in zip(self.attrs,unpacked,self.actions): if callable(action): value = action(value) setter(attr,value) if self._debug: print unpacked
b43ff0ace3688d09572eb3abee8871022a44253e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/b43ff0ace3688d09572eb3abee8871022a44253e/bosh.py
MelStructA('NAM0','3Bs3Bs3Bs3Bs','colors','riseRed','riseGreen','riseBlue',('unused1',null1),
MelBase('LNAM','unknown1'), MelStruct('ONAM','4B','cloudSpeed0','cloudSpeed1','cloudSpeed3','cloudSpeed4'), MelBase('PNAM','_pnam'), MelStructA('NAM0','3Bs3Bs3Bs3Bs','colors', 'riseRed','riseGreen','riseBlue',('unused1',null1),
def loadData(self,record,ins,type,size,readId): if size == 136: MelStruct.loadData(self,record,ins,type,size,readId) return elif size == 124: #--Else 124 byte record (skips sightUsage, semiAutomaticFireDelayMin and semiAutomaticFireDelayMax... unpacked = ins.unpack('Iff4B5fI4BffII11fIIffI',size,readId) elif size == 120: #--Else 120 byte record (skips resistType, sightUsage, semiAutomaticFireDelayMin and semiAutomaticFireDelayMax... unpacked = ins.unpack('Iff4B5fI4BffII11fIIff',size,readId) else: raise "Unexpected size encountered for WEAP:DNAM subrecord: %s" % size unpacked += self.defaults[len(unpacked):] setter = record.__setattr__ for attr,value,action in zip(self.attrs,unpacked,self.actions): if callable(action): value = action(value) setter(attr,value) if self._debug: print unpacked
b43ff0ace3688d09572eb3abee8871022a44253e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/b43ff0ace3688d09572eb3abee8871022a44253e/bosh.py
MelStruct('FNAM','4f','fogDayNear','fogDayFar','fogNightNear','fogNightFar'), MelStruct('HNAM','14f', 'eyeAdaptSpeed', 'blurRadius', 'blurPasses', 'emissiveMult', 'targetLum', 'upperLumClamp', 'brightScale', 'brightClamp', 'lumRampNoTex', 'lumRampMin', 'lumRampMax', 'sunlightDimmer', 'grassDimmer', 'treeDimmer'),
MelStruct('FNAM','6f','fogDayNear','fogDayFar','fogNightNear','fogNightFar','fogDayPower','fogNightPower'), MelBase('INAM','_inam'),
def loadData(self,record,ins,type,size,readId): if size == 136: MelStruct.loadData(self,record,ins,type,size,readId) return elif size == 124: #--Else 124 byte record (skips sightUsage, semiAutomaticFireDelayMin and semiAutomaticFireDelayMax... unpacked = ins.unpack('Iff4B5fI4BffII11fIIffI',size,readId) elif size == 120: #--Else 120 byte record (skips resistType, sightUsage, semiAutomaticFireDelayMin and semiAutomaticFireDelayMax... unpacked = ins.unpack('Iff4B5fI4BffII11fIIff',size,readId) else: raise "Unexpected size encountered for WEAP:DNAM subrecord: %s" % size unpacked += self.defaults[len(unpacked):] setter = record.__setattr__ for attr,value,action in zip(self.attrs,unpacked,self.actions): if callable(action): value = action(value) setter(attr,value) if self._debug: print unpacked
b43ff0ace3688d09572eb3abee8871022a44253e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/b43ff0ace3688d09572eb3abee8871022a44253e/bosh.py
recAttrs_class[recClass] = ('model','bodyParts','nift_p','bloodSprayPath','bloodDecalPath')
recAttrs_class[recClass] = ('model','bodyParts','nift_p','bodyPartData','impactDataset')
def initPatchFile(self,patchFile,loadMods): """Prepare to handle specified patch mod. All functions are called after this.""" Patcher.initPatchFile(self,patchFile,loadMods) self.id_data = {} #--Names keyed by long fid. self.srcClasses = set() #--Record classes actually provided by src mods/files. self.sourceMods = self.getConfigChecked() self.isActive = len(self.sourceMods) != 0 #--Type Fields recAttrs_class = self.recAttrs_class = {} for recClass in (MreBsgn,MreLscr, MreClas, MreLtex, MreRegn): recAttrs_class[recClass] = ('iconPath',) for recClass in (MreActi, MreDoor, MreFlor, MreFurn, MreGras, MreStat): recAttrs_class[recClass] = ('model',) for recClass in (MreAlch, MreAmmo, MreAppa, MreBook, MreIngr, MreKeym, MreLigh, MreMisc, MreSgst, MreSlgm, MreTree): recAttrs_class[recClass] = ('largeIconPath','smallIconPath','model') for recClass in (MreWeap,): recAttrs_class[recClass] = ('largeIconPath','smallIconPath','model','shellCasingModel','scopeModel','worldModel','firstPersonModel','animationType','gripAnimation','reloadAnimation') for recClass in (MreArmo, MreClot): recAttrs_class[recClass] = ('maleBody','maleWorld','maleIconPath','maleIcon','femaleBody','femaleWorld','femaleIconPath','femaleIcon','flags') for recClass in (MreCrea,): recAttrs_class[recClass] = ('model','bodyParts','nift_p','bloodSprayPath','bloodDecalPath') for recClass in (MreMgef,): recAttrs_class[recClass] = ('iconPath','model','effectShader','enchantEffect','light') for recClass in (MreEfsh,): recAttrs_class[recClass] = ('particleTexture','fillTexture') for recClass in (MreTxst,): recAttrs_class[recClass] = ('baseImage','normalMap','environmentMapMask','growMap','parallaxMap','environmentMap','decalData','flags') for recClass in (MreExpl,): recAttrs_class[recClass] = ('imagespaceModifier','light','impactdataset','placedImpactObject') for recClass in (MreIpct,): recAttrs_class[recClass] = ('model','effectDuration','effectOrientation','angleThreshold','placementRadius','flags','minWidth','maxWidth','minHeight','maxHeight','depth','shininess','parallaxScale','parallaxPasses','decalFlags','red','green','blue','textureSet') for recClass in (MreIpds,): recAttrs_class[recClass] = ('stone','dirt','grass','metal','wood','organic','cloth','water','hollowMetal','organicBug','organicGlow') for recClass in (MreProj,): recAttrs_class[recClass] = ('model','light','muzzleFlash','explosion','muzzleFlashDuration','fadeDuration','muzzleFlashPath') #--Needs Longs self.longTypes = set(('BSGN','LSCR','CLAS','LTEX','REGN','ACTI','DOOR','FLOR','FURN','GRAS','STAT','ALCH','AMMO','BOOK','INGR','KEYM','LIGH','MISC','SGST','SLGM','WEAP','TREE','ARMO','CLOT','CREA','MGEF','EFSH','TXST','EXPL','IPCT','IPDS','PROJ'))
1602f02ee7f2bfcbb76df6342c3fe4951eebf9c4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/1602f02ee7f2bfcbb76df6342c3fe4951eebf9c4/bosh.py
recAttrs_class[recClass] = ('iconPath','model','effectShader','enchantEffect','light')
recAttrs_class[recClass] = ('iconPath','model','effectShader','objectDisplayShader','light')
def initPatchFile(self,patchFile,loadMods): """Prepare to handle specified patch mod. All functions are called after this.""" Patcher.initPatchFile(self,patchFile,loadMods) self.id_data = {} #--Names keyed by long fid. self.srcClasses = set() #--Record classes actually provided by src mods/files. self.sourceMods = self.getConfigChecked() self.isActive = len(self.sourceMods) != 0 #--Type Fields recAttrs_class = self.recAttrs_class = {} for recClass in (MreBsgn,MreLscr, MreClas, MreLtex, MreRegn): recAttrs_class[recClass] = ('iconPath',) for recClass in (MreActi, MreDoor, MreFlor, MreFurn, MreGras, MreStat): recAttrs_class[recClass] = ('model',) for recClass in (MreAlch, MreAmmo, MreAppa, MreBook, MreIngr, MreKeym, MreLigh, MreMisc, MreSgst, MreSlgm, MreTree): recAttrs_class[recClass] = ('largeIconPath','smallIconPath','model') for recClass in (MreWeap,): recAttrs_class[recClass] = ('largeIconPath','smallIconPath','model','shellCasingModel','scopeModel','worldModel','firstPersonModel','animationType','gripAnimation','reloadAnimation') for recClass in (MreArmo, MreClot): recAttrs_class[recClass] = ('maleBody','maleWorld','maleIconPath','maleIcon','femaleBody','femaleWorld','femaleIconPath','femaleIcon','flags') for recClass in (MreCrea,): recAttrs_class[recClass] = ('model','bodyParts','nift_p','bloodSprayPath','bloodDecalPath') for recClass in (MreMgef,): recAttrs_class[recClass] = ('iconPath','model','effectShader','enchantEffect','light') for recClass in (MreEfsh,): recAttrs_class[recClass] = ('particleTexture','fillTexture') for recClass in (MreTxst,): recAttrs_class[recClass] = ('baseImage','normalMap','environmentMapMask','growMap','parallaxMap','environmentMap','decalData','flags') for recClass in (MreExpl,): recAttrs_class[recClass] = ('imagespaceModifier','light','impactdataset','placedImpactObject') for recClass in (MreIpct,): recAttrs_class[recClass] = ('model','effectDuration','effectOrientation','angleThreshold','placementRadius','flags','minWidth','maxWidth','minHeight','maxHeight','depth','shininess','parallaxScale','parallaxPasses','decalFlags','red','green','blue','textureSet') for recClass in (MreIpds,): recAttrs_class[recClass] = ('stone','dirt','grass','metal','wood','organic','cloth','water','hollowMetal','organicBug','organicGlow') for recClass in (MreProj,): recAttrs_class[recClass] = ('model','light','muzzleFlash','explosion','muzzleFlashDuration','fadeDuration','muzzleFlashPath') #--Needs Longs self.longTypes = set(('BSGN','LSCR','CLAS','LTEX','REGN','ACTI','DOOR','FLOR','FURN','GRAS','STAT','ALCH','AMMO','BOOK','INGR','KEYM','LIGH','MISC','SGST','SLGM','WEAP','TREE','ARMO','CLOT','CREA','MGEF','EFSH','TXST','EXPL','IPCT','IPDS','PROJ'))
1602f02ee7f2bfcbb76df6342c3fe4951eebf9c4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/1602f02ee7f2bfcbb76df6342c3fe4951eebf9c4/bosh.py
recAttrs_class[recClass] = ('imagespaceModifier','light','impactdataset','placedImpactObject')
recAttrs_class[recClass] = ('imageSpaceModifier','light','impactDataset','placedImpactObject')
def initPatchFile(self,patchFile,loadMods): """Prepare to handle specified patch mod. All functions are called after this.""" Patcher.initPatchFile(self,patchFile,loadMods) self.id_data = {} #--Names keyed by long fid. self.srcClasses = set() #--Record classes actually provided by src mods/files. self.sourceMods = self.getConfigChecked() self.isActive = len(self.sourceMods) != 0 #--Type Fields recAttrs_class = self.recAttrs_class = {} for recClass in (MreBsgn,MreLscr, MreClas, MreLtex, MreRegn): recAttrs_class[recClass] = ('iconPath',) for recClass in (MreActi, MreDoor, MreFlor, MreFurn, MreGras, MreStat): recAttrs_class[recClass] = ('model',) for recClass in (MreAlch, MreAmmo, MreAppa, MreBook, MreIngr, MreKeym, MreLigh, MreMisc, MreSgst, MreSlgm, MreTree): recAttrs_class[recClass] = ('largeIconPath','smallIconPath','model') for recClass in (MreWeap,): recAttrs_class[recClass] = ('largeIconPath','smallIconPath','model','shellCasingModel','scopeModel','worldModel','firstPersonModel','animationType','gripAnimation','reloadAnimation') for recClass in (MreArmo, MreClot): recAttrs_class[recClass] = ('maleBody','maleWorld','maleIconPath','maleIcon','femaleBody','femaleWorld','femaleIconPath','femaleIcon','flags') for recClass in (MreCrea,): recAttrs_class[recClass] = ('model','bodyParts','nift_p','bloodSprayPath','bloodDecalPath') for recClass in (MreMgef,): recAttrs_class[recClass] = ('iconPath','model','effectShader','enchantEffect','light') for recClass in (MreEfsh,): recAttrs_class[recClass] = ('particleTexture','fillTexture') for recClass in (MreTxst,): recAttrs_class[recClass] = ('baseImage','normalMap','environmentMapMask','growMap','parallaxMap','environmentMap','decalData','flags') for recClass in (MreExpl,): recAttrs_class[recClass] = ('imagespaceModifier','light','impactdataset','placedImpactObject') for recClass in (MreIpct,): recAttrs_class[recClass] = ('model','effectDuration','effectOrientation','angleThreshold','placementRadius','flags','minWidth','maxWidth','minHeight','maxHeight','depth','shininess','parallaxScale','parallaxPasses','decalFlags','red','green','blue','textureSet') for recClass in (MreIpds,): recAttrs_class[recClass] = ('stone','dirt','grass','metal','wood','organic','cloth','water','hollowMetal','organicBug','organicGlow') for recClass in (MreProj,): recAttrs_class[recClass] = ('model','light','muzzleFlash','explosion','muzzleFlashDuration','fadeDuration','muzzleFlashPath') #--Needs Longs self.longTypes = set(('BSGN','LSCR','CLAS','LTEX','REGN','ACTI','DOOR','FLOR','FURN','GRAS','STAT','ALCH','AMMO','BOOK','INGR','KEYM','LIGH','MISC','SGST','SLGM','WEAP','TREE','ARMO','CLOT','CREA','MGEF','EFSH','TXST','EXPL','IPCT','IPDS','PROJ'))
1602f02ee7f2bfcbb76df6342c3fe4951eebf9c4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6682/1602f02ee7f2bfcbb76df6342c3fe4951eebf9c4/bosh.py
rgb_str = 'rgb('+str(int(color_intensity))+',0,0)' return ImageColor.getrgb(rgb_str)
color_rgb = color_table[int(log_rebase)] return ImageColor.getrgb(color_table[int(log_rebase)])
def getColor(hit_c): global hit_count_max global hit_count_min global hit_count_logmin global hit_count_logrange log_v = math.floor(math.log(hit_c)/math.log(2)) log_rebase = log_v - hit_count_logmin color_intensity=log_rebase*(255 / hit_count_logrange) rgb_str = 'rgb('+str(int(color_intensity))+',0,0)' return ImageColor.getrgb(rgb_str)
d2103ddac27dbfbf65406dc52da7c1c8bbd989ac /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5432/d2103ddac27dbfbf65406dc52da7c1c8bbd989ac/draw_hits.py
for y in range(10):
for y in range(BOTTOM_LEGEND_PX):
def getColor(hit_c): global hit_count_max global hit_count_min global hit_count_logmin global hit_count_logrange log_v = math.floor(math.log(hit_c)/math.log(2)) log_rebase = log_v - hit_count_logmin color_intensity=log_rebase*(255 / hit_count_logrange) rgb_str = 'rgb('+str(int(color_intensity))+',0,0)' return ImageColor.getrgb(rgb_str)
d2103ddac27dbfbf65406dc52da7c1c8bbd989ac /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5432/d2103ddac27dbfbf65406dc52da7c1c8bbd989ac/draw_hits.py
print 'NEW POST: %s: %s (%s)' % (entry.title, entry.link.replace("http://www.streetgeek.com.au/portal/modules.php?name=Forums&file=viewtopic&p=", "http://fj.streetgeek.com.au/"), feed) irc.action(CHANNEL, 'found a new post on %s: %s: %s' % (str(feed), str(entry.title.strip()), str(entry.link.strip().replace("http://www.streetgeek.com.au/portal/modules.php?name=Forums&file=viewtopic&p=", "http://fj.streetgeek.com.au/"))))
link = str(entry.link.replace("http://www.streetgeek.com.au/portal/modules.php?name=Forums&file=viewtopic&p=", "http://fj.streetgeek.com.au/")) print 'NEW POST: %s: %s (%s)' % (entry.title, link, feed) irc.action(CHANNEL, 'found a new post on %s: %s: %s' % (str(feed), str(entry.title), link))
def announce_post(irc, feed, entry): global CHANNEL print 'NEW POST: %s: %s (%s)' % (entry.title, entry.link.replace("http://www.streetgeek.com.au/portal/modules.php?name=Forums&file=viewtopic&p=", "http://fj.streetgeek.com.au/"), feed) irc.action(CHANNEL, 'found a new post on %s: %s: %s' % (str(feed), str(entry.title.strip()), str(entry.link.strip().replace("http://www.streetgeek.com.au/portal/modules.php?name=Forums&file=viewtopic&p=", "http://fj.streetgeek.com.au/"))))
f05ae9855eec1f1cfc94d94ca2b3a82d5debb107 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12995/f05ae9855eec1f1cfc94d94ca2b3a82d5debb107/feedbot.py
message_buffer.append([event.nick, msg[:200], True])
message_buffer.append([event.nick, event.text[:200], True])
def handle_ctcp(event, match): global message_buffer, MAX_MESSAGES, CHANNEL if event.channel == CHANNEL: if event.args[0] == "ACTION": message_buffer.append([event.nick, msg[:200], True]) message_buffer = message_buffer[-MAX_MESSAGES:] return
c6796adce2c451d38d7e9c2859e79e8253c21d17 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12995/c6796adce2c451d38d7e9c2859e79e8253c21d17/regexbot.py
self.channels.remove(channel)
del self.channels[channel.name]
def cleanup(self): # do some cleanup tasks to free some memory # hopefully python's resource counter will properly detect the object as something # that can be disposed of to_delete = [] for channel in self.channels.values(): if len(channel.members) == 0: to_delete.append(channel) for channel in to_delete: self.channels.remove(channel) del to_delete
fd98a3b7022274a1a915b3ff0bd2947a307d5e02 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12995/fd98a3b7022274a1a915b3ff0bd2947a307d5e02/ircserver.py
global message_buffer, MAX_MESSAGES, last_message, flooders nick = event.source().partition("!")[0] msg = event.arguments()[0] if msg.startswith('s/'): parts = msg.split('/') now = datetime.now() delta = now - last_message last_message = now if delta < timedelta(seconds=5): print "Flood protection hit, %s of %s seconds were waited" % (delta.seconds, timedelta(seconds=5).seconds) if event.source() in flooders: connection.kick(event.target(), nick, 'Flood protection activated') else: flooders.append(event.source()) connection.notice(nick, 'Flood protection active, ignoring your request and adding you to "flooders" list until the cooldown has expired. If you persist you will be kicked from the channel. I won\'t respond to ANYONE until people have stopped issuing commands for a few seconds.') return else: flooders = [event.source(),] if len(message_buffer) == 0: connection.privmsg(event.target(), '%s: message buffer is empty' % nick) return if len(parts) == 3: connection.privmsg(event.target(), '%s: invalid regular expression, you forgot the trailing slash, dummy' % nick) return if len(parts) != 4: connection.privmsg(event.target(), '%s: invalid regular expression, not the right amount of slashes' % nick) return if len(parts[1]) == 0: connection.privmsg(event.target(), '%s: original string is empty' % nick) return ignore_case = 'i' in parts[3] e = None try: if ignore_case: e = re.compile(parts[1], re.I) else: e = re.compile(parts[1]) except Exception, ex: connection.privmsg(event.target(), '%s: failure compiling regular expression: %s' % (nick, ex)) return for x in range(len(message_buffer)-1, -1, -1): if e.search(message_buffer[x][1]) != None: new_message = [] try: new_message = [message_buffer[x][0], e.sub(parts[2], message_buffer[x][1]).replace('\n','').replace('\r','')[:200]] del message_buffer[x] message_buffer.append(new_message) except Exception, ex: connection.privmsg(event.target(), '%s: failure replacing: %s' % (nick, ex)) return print new_message connection.privmsg(event.target(), ('<%s> %s' % (new_message[0], new_message[1]))[:200]) return connection.privmsg(event.target(), '%s: no match found' % nick) else: message_buffer.append([nick, msg[:200]]) message_buffer = message_buffer[-MAX_MESSAGES:]
global message_buffer, MAX_MESSAGES, last_message, flooders nick = event.source().partition("!")[0] msg = event.arguments()[0] if msg.startswith('s/'): parts = msg.split('/') now = datetime.now() delta = now - last_message last_message = now if delta < timedelta(seconds=5): print "Flood protection hit, %s of %s seconds were waited" % (delta.seconds, timedelta(seconds=5).seconds) if event.source() in flooders: connection.kick(event.target(), nick, 'Flood protection activated') else: flooders.append(event.source()) connection.notice(nick, 'Flood protection active, ignoring your request and adding you to "flooders" list until the cooldown has expired. If you persist you will be kicked from the channel. I won\'t respond to ANYONE until people have stopped issuing commands for a few seconds.') return else: flooders = [event.source(),] if len(message_buffer) == 0: connection.privmsg(event.target(), '%s: message buffer is empty' % nick) return if len(parts) == 3: connection.privmsg(event.target(), '%s: invalid regular expression, you forgot the trailing slash, dummy' % nick) return if len(parts) != 4: connection.privmsg(event.target(), '%s: invalid regular expression, not the right amount of slashes' % nick) return if len(parts[1]) == 0: connection.privmsg(event.target(), '%s: original string is empty' % nick) return ignore_case = 'i' in parts[3] e = None try: if ignore_case: e = re.compile(parts[1], re.I) else: e = re.compile(parts[1]) except Exception, ex: connection.privmsg(event.target(), '%s: failure compiling regular expression: %s' % (nick, ex)) return for x in range(len(message_buffer)-1, -1, -1): if e.search(message_buffer[x][1]) != None: new_message = [] try: new_message = [message_buffer[x][0], e.sub(parts[2], message_buffer[x][1]).replace('\n','').replace('\r','')[:200]] del message_buffer[x] message_buffer.append(new_message) except Exception, ex: connection.privmsg(event.target(), '%s: failure replacing: %s' % (nick, ex)) return print new_message connection.privmsg(event.target(), ('<%s> %s' % (new_message[0], new_message[1]))[:200]) return connection.privmsg(event.target(), '%s: no match found' % nick) else: message_buffer.append([nick, msg[:200]]) message_buffer = message_buffer[-MAX_MESSAGES:]
def handle_pubmsg(connection, event): global message_buffer, MAX_MESSAGES, last_message, flooders nick = event.source().partition("!")[0] msg = event.arguments()[0] if msg.startswith('s/'): # handle regex parts = msg.split('/') # now flood protect! now = datetime.now() delta = now - last_message last_message = now if delta < timedelta(seconds=5): # 5 seconds between requests # any more are ignored print "Flood protection hit, %s of %s seconds were waited" % (delta.seconds, timedelta(seconds=5).seconds) if event.source() in flooders: # user has recently sent a command connection.kick(event.target(), nick, 'Flood protection activated') else: flooders.append(event.source()) connection.notice(nick, 'Flood protection active, ignoring your request and adding you to "flooders" list until the cooldown has expired. If you persist you will be kicked from the channel. I won\'t respond to ANYONE until people have stopped issuing commands for a few seconds.') return else: # add user to "flooders" list, clear existing ones flooders = [event.source(),] if len(message_buffer) == 0: connection.privmsg(event.target(), '%s: message buffer is empty' % nick) return if len(parts) == 3: connection.privmsg(event.target(), '%s: invalid regular expression, you forgot the trailing slash, dummy' % nick) return if len(parts) != 4: # not a valid regex connection.privmsg(event.target(), '%s: invalid regular expression, not the right amount of slashes' % nick) return # find messages matching the string if len(parts[1]) == 0: connection.privmsg(event.target(), '%s: original string is empty' % nick) return ignore_case = 'i' in parts[3] e = None try: if ignore_case: e = re.compile(parts[1], re.I) else: e = re.compile(parts[1]) except Exception, ex: connection.privmsg(event.target(), '%s: failure compiling regular expression: %s' % (nick, ex)) return # now we have a valid regular expression matcher! for x in range(len(message_buffer)-1, -1, -1): if e.search(message_buffer[x][1]) != None: # match found! new_message = [] # replace the message in the buffer try: new_message = [message_buffer[x][0], e.sub(parts[2], message_buffer[x][1]).replace('\n','').replace('\r','')[:200]] del message_buffer[x] message_buffer.append(new_message) except Exception, ex: connection.privmsg(event.target(), '%s: failure replacing: %s' % (nick, ex)) return # now print the new text print new_message connection.privmsg(event.target(), ('<%s> %s' % (new_message[0], new_message[1]))[:200]) return # no match found connection.privmsg(event.target(), '%s: no match found' % nick) else: # add to buffer message_buffer.append([nick, msg[:200]]) # trim the buffer message_buffer = message_buffer[-MAX_MESSAGES:]
b21e4d678345680c33ac870ee5252aadec4f39cd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12995/b21e4d678345680c33ac870ee5252aadec4f39cd/regexbot.py
self.bind(self._welcome_join, RPL_WELCOME)
def start_channels(self, chans): self._startChannels = chans self.bind(self._welcome_join, RPL_WELCOME)
eeb0349375e3d2a1722a315937eeb1f62d544449 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12995/eeb0349375e3d2a1722a315937eeb1f62d544449/ircasync.py
e = re.compile(parts[1], re.I)
e = re.compile(parts[1])
def handle_pubmsg(connection, event): global message_buffer, MAX_MESSAGES, last_message nick = event.source().partition("!")[0] msg = event.arguments()[0] if msg.startswith('s/'): # handle regex parts = msg.split('/') # now flood protect! now = datetime.now() delta = now - last_message last_message = now if delta < timedelta(seconds=5): # 5 seconds between requests # any more are ignored print "Flood protection hit, %s of %s seconds were waited" % (delta.seconds, timedelta(seconds=5).seconds) connection.kick(event.target(), nick, 'Flood protection activated') return if len(message_buffer) == 0: connection.privmsg(event.target(), '%s: message buffer is empty' % nick) return if len(parts) == 3: connection.privmsg(event.target(), '%s: invalid regular expression, you forgot the trailing slash, dummy' % nick) return if len(parts) != 4: # not a valid regex connection.privmsg(event.target(), '%s: invalid regular expression, not the right amount of slashes' % nick) return # find messages matching the string if len(parts[1]) == 0: connection.privmsg(event.target(), '%s: original string is empty' % nick) return ignore_case = 'i' in parts[3] e = None try: if ignore_case: e = re.compile(parts[1], re.I) else: e = re.compile(parts[1], re.I) except Exception, ex: connection.privmsg(event.target(), '%s: failure compiling regular expression: %s' % (nick, ex)) return # now we have a valid regular expression matcher! for x in range(len(message_buffer)-1, -1, -1): if e.search(message_buffer[x][1]) != None: # match found! new_message = [] # replace the message in the buffer try: new_message = [message_buffer[x][0], e.sub(parts[2], message_buffer[x][1]).replace('\n','').replace('\r','')[:200]] del message_buffer[x] message_buffer.append(new_message) except Exception, ex: connection.privmsg(event.target(), '%s: failure replacing: %s' % (nick, ex)) return # now print the new text print new_message connection.privmsg(event.target(), ('<%s> %s' % (new_message[0], new_message[1]))[:200]) return # no match found connection.privmsg(event.target(), '%s: no match found' % nick) else: # add to buffer message_buffer.append([nick, msg[:200]]) # trim the buffer message_buffer = message_buffer[-MAX_MESSAGES:]
a51c581d30c1bd3b7ad4b1ec6125aa250377c9d0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12995/a51c581d30c1bd3b7ad4b1ec6125aa250377c9d0/regexbot.py
else:
else:
def handle_pubmsg(connection, event): global message_buffer, MAX_MESSAGES, last_message, flooders nick = event.source().partition("!")[0] msg = event.arguments()[0] if msg.startswith('s/'): # handle regex parts = msg.split('/') # now flood protect! now = datetime.now() delta = now - last_message last_message = now if delta < timedelta(seconds=5): # 5 seconds between requests # any more are ignored print "Flood protection hit, %s of %s seconds were waited" % (delta.seconds, timedelta(seconds=5).seconds) if event.source() in flooders: # user has recently sent a command connection.kick(event.target(), nick, 'Flood protection activated') else: flooders.append(event.source()) connection.notice(nick, 'Flood protection active, ignoring your request and adding you to "flooders" list until the cooldown has expired. If you persist you will be kicked from the channel. I won\'t respond to ANYONE until people have stopped issuing commands for a few seconds.') return else: # add user to "flooders" list, clear existing ones flooders = [event.source(),] if len(message_buffer) == 0: connection.privmsg(event.target(), '%s: message buffer is empty' % nick) return if len(parts) == 3: connection.privmsg(event.target(), '%s: invalid regular expression, you forgot the trailing slash, dummy' % nick) return if len(parts) != 4: # not a valid regex connection.privmsg(event.target(), '%s: invalid regular expression, not the right amount of slashes' % nick) return # find messages matching the string if len(parts[1]) == 0: connection.privmsg(event.target(), '%s: original string is empty' % nick) return ignore_case = 'i' in parts[3] e = None try: if ignore_case: e = re.compile(parts[1], re.I) else: e = re.compile(parts[1]) except Exception, ex: connection.privmsg(event.target(), '%s: failure compiling regular expression: %s' % (nick, ex)) return # now we have a valid regular expression matcher! for x in range(len(message_buffer)-1, -1, -1): if e.search(message_buffer[x][1]) != None: # match found! new_message = [] # replace the message in the buffer try: new_message = [message_buffer[x][0], e.sub(parts[2], message_buffer[x][1]).replace('\n','').replace('\r','')[:200]] del message_buffer[x] message_buffer.append(new_message) except Exception, ex: connection.privmsg(event.target(), '%s: failure replacing: %s' % (nick, ex)) return # now print the new text print new_message connection.privmsg(event.target(), ('<%s> %s' % (new_message[0], new_message[1]))[:200]) return # no match found connection.privmsg(event.target(), '%s: no match found' % nick) else: # add to buffer message_buffer.append([nick, msg[:200]]) # trim the buffer message_buffer = message_buffer[-MAX_MESSAGES:]
a1d6a0a9c6b7ff66d12e92192ca8e04c00eb9909 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12995/a1d6a0a9c6b7ff66d12e92192ca8e04c00eb9909/regexbot.py
self.textures.append(tex.name)
print(tex.name) texObj = texList.getTexture(tex.name) if(texObj != None): print(texObj.name + " " + texObj.fileName) self.textures.append(texObj.fileName)
def populate(self, obj, texList): self.name = obj.name.replace(".", "_")
7f0f64079fbcfd35c5688e5f581937044eb29435 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6146/7f0f64079fbcfd35c5688e5f581937044eb29435/dnt_cal3d_export.py
f.write("<MATERIAL NUMMAPS\"" + str(len(self.textures)) + "\">\n")
f.write("<MATERIAL NUMMAPS=\"" + str(len(self.textures)) + "\">\n")
def save(self, directory):
7f0f64079fbcfd35c5688e5f581937044eb29435 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6146/7f0f64079fbcfd35c5688e5f581937044eb29435/dnt_cal3d_export.py
self.textures = cal3dTextures()
def getModel(self):
7f0f64079fbcfd35c5688e5f581937044eb29435 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6146/7f0f64079fbcfd35c5688e5f581937044eb29435/dnt_cal3d_export.py
def prettify_title(title): title = title.lower() title = NON_CHAR.sub('-', title) return title
3b670dc1419c7db911653fefb35f90e3b1fbd776 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/14332/3b670dc1419c7db911653fefb35f90e3b1fbd776/_newpost.py
def prettify_title(title): title = title.lower() title = NON_CHAR.sub('-', title) return title
3b670dc1419c7db911653fefb35f90e3b1fbd776 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/14332/3b670dc1419c7db911653fefb35f90e3b1fbd776/_newpost.py
def prettify_title(title): title = title.lower() title = NON_CHAR.sub('-', title) return title
3b670dc1419c7db911653fefb35f90e3b1fbd776 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/14332/3b670dc1419c7db911653fefb35f90e3b1fbd776/_newpost.py
def prettify_title(title): title = title.lower() title = NON_CHAR.sub('-', title) return title
3b670dc1419c7db911653fefb35f90e3b1fbd776 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/14332/3b670dc1419c7db911653fefb35f90e3b1fbd776/_newpost.py
def prettify_title(title): title = title.lower() title = NON_CHAR.sub('-', title) return title
3b670dc1419c7db911653fefb35f90e3b1fbd776 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/14332/3b670dc1419c7db911653fefb35f90e3b1fbd776/_newpost.py
print "new post '%s' created" % fname
print "new post '%s' created" % fname
def prettify_title(title): title = title.lower() title = NON_CHAR.sub('-', title) return title
3b670dc1419c7db911653fefb35f90e3b1fbd776 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/14332/3b670dc1419c7db911653fefb35f90e3b1fbd776/_newpost.py
return min(voltage_color_list, key=(lambda a: xyYnorm(a[1])))
return min(voltage_color_list, key=(lambda a: xyYnorm(xyYdiff(a[1], target_color))))
def findBestColor(measured_color_red, measured_color_green, measured_color_blue, target_color): """ findBestColor returns a color, which is nearest targetColor. * measured_color -- contains the measured colors for each channel * target_color """ voltage_color_list = [] voltage_color_list.extend( measured_color_red ) voltage_color_list.extend( measured_color_green ) voltage_color_list.extend( measured_color_blue ) return min(voltage_color_list, key=(lambda a: xyYnorm(a[1])))
c86babeb893d16839419d227b4fe18d7dd4f005f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12788/c86babeb893d16839419d227b4fe18d7dd4f005f/iterativeColorTubes.py
if not distro: distro = chkdistro
def info(self, pkg, chkdistro): if not pkg.strip(): return '' _pkg = ''.join([x for x in pkg.strip().split(None,1)[0] if x.isalnum() or x in '.-_+']) if len(pkg.strip().split()) > 1: distro = ''.join([x for x in pkg.strip().split(None,2)[1] if x.isalnum() or x in '-._+']) if not distro: distro = chkdistro if distro not in self.distros: return "%r is not a valid distribution: %s" % (distro, ", ".join(self.distros))
a720d019a434fc3751f5d661c7d8d5235b58d98a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3102/a720d019a434fc3751f5d661c7d8d5235b58d98a/packages.py
conf.registerPlugin('PackageInfo', True)
PackageInfo = conf.registerPlugin('PackageInfo', True)
def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default)
7c5d0366292f9cffa93d7597f25d76b78d284048 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3102/7c5d0366292f9cffa93d7597f25d76b78d284048/config.py
if user and text[0] in str(conf.supybot.reply.whenAddressedBy.get('chars')):
if user and text[0] in list(conf.supybot.reply.whenAddressedBy.chars()):
def privmsg(self, irc, msg, user): channel = self.__getChannel(msg.args[0]) text = self.space_re.subn(' ', msg.args[1].strip())[0] if text[0] == self.registryValue("prefixchar"): text = text[1:].strip() if user and text[0] in str(conf.supybot.reply.whenAddressedBy.get('chars')): return (cmd, rest) = (text.split(' ', 1) + [None])[:2] if cmd not in ("find", "info"): return if not rest: return (term, rest) = (rest.split(' ', 1) + [None])[:2] if cmd == "find": self.real_find(irc, msg, [], term, rest) else: self.real_info(irc, msg, [], term, rest)
283652a263ab69ddf4dea37a7a8e0323c2a2eb2b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3102/283652a263ab69ddf4dea37a7a8e0323c2a2eb2b/plugin.py
if cmd not in ("find", "info"):
if cmd not in my_commands:
def privmsg(self, irc, msg, user): channel = self.__getChannel(msg.args[0]) text = self.space_re.subn(' ', msg.args[1].strip())[0] if text[0] == self.registryValue("prefixchar"): text = text[1:].strip() if user and text[0] in str(conf.supybot.reply.whenAddressedBy.get('chars')): return (cmd, rest) = (text.split(' ', 1) + [None])[:2] if cmd not in ("find", "info"): return if not rest: return (term, rest) = (rest.split(' ', 1) + [None])[:2] if cmd == "find": self.real_find(irc, msg, [], term, rest) else: self.real_info(irc, msg, [], term, rest)
283652a263ab69ddf4dea37a7a8e0323c2a2eb2b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3102/283652a263ab69ddf4dea37a7a8e0323c2a2eb2b/plugin.py
if cmd not in ("find", "info"):
if cmd not in my_commands:
def chanmsg(self, irc, msg, user): channel = self.__getChannel(msg.args[0]) text = self.space_re.subn(' ', msg.args[1].strip())[0] if text[0] != self.registryValue("prefixchar", channel): return text = text[1:] (cmd, rest) = (text.split(' ', 1) + [None])[:2] if cmd not in ("find", "info"): return if not rest: return (term, rest) = (rest.split(' ', 1) + [None])[:2] if cmd == "find": self.real_find(irc, msg, [], term, rest) else: self.real_info(irc, msg, [], term, rest)
283652a263ab69ddf4dea37a7a8e0323c2a2eb2b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3102/283652a263ab69ddf4dea37a7a8e0323c2a2eb2b/plugin.py
if user: return msg channel = self.__getChannel(msg.args[0])
channel = self.__getChannel(msg.args[0]) reply_chars = tuple([self.registryValue("prefixchar", channel)] + list(conf.supybot.reply.whenAddressedBy.chars.get(channel))) my_commands = self.listCommands() if user if not channel and text[0] == self.registryValue("prefixchar") msg.args = (msg.args[0], text[1:]) return msg
def inFilter(self, irc, msg): if msg.command != "PRIVMSG": return msg if not conf.supybot.defaultIgnore(): return msg text = msg.args[1].strip() if len(text) < 6: return msg user = get_user(msg) if user: return msg channel = self.__getChannel(msg.args[0]) if channel: if text[0] not in ('!', '@'): return msg if not text[1:5] in ("info", "find"): return msg
283652a263ab69ddf4dea37a7a8e0323c2a2eb2b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3102/283652a263ab69ddf4dea37a7a8e0323c2a2eb2b/plugin.py
if text[0] not in ('!', '@'):
if text[0] not in reply_chars:
def inFilter(self, irc, msg): if msg.command != "PRIVMSG": return msg if not conf.supybot.defaultIgnore(): return msg text = msg.args[1].strip() if len(text) < 6: return msg user = get_user(msg) if user: return msg channel = self.__getChannel(msg.args[0]) if channel: if text[0] not in ('!', '@'): return msg if not text[1:5] in ("info", "find"): return msg
283652a263ab69ddf4dea37a7a8e0323c2a2eb2b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3102/283652a263ab69ddf4dea37a7a8e0323c2a2eb2b/plugin.py
if not text[1:5] in ("info", "find"):
if not text[1:5] in my_commands:
def inFilter(self, irc, msg): if msg.command != "PRIVMSG": return msg if not conf.supybot.defaultIgnore(): return msg text = msg.args[1].strip() if len(text) < 6: return msg user = get_user(msg) if user: return msg channel = self.__getChannel(msg.args[0]) if channel: if text[0] not in ('!', '@'): return msg if not text[1:5] in ("info", "find"): return msg
283652a263ab69ddf4dea37a7a8e0323c2a2eb2b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3102/283652a263ab69ddf4dea37a7a8e0323c2a2eb2b/plugin.py
if text[1] in ('!', '@'): if text[1:5] in ("info", "find"):
if text[1] in reply_chars: if text[1:5] in my_commands:
def inFilter(self, irc, msg): if msg.command != "PRIVMSG": return msg if not conf.supybot.defaultIgnore(): return msg text = msg.args[1].strip() if len(text) < 6: return msg user = get_user(msg) if user: return msg channel = self.__getChannel(msg.args[0]) if channel: if text[0] not in ('!', '@'): return msg if not text[1:5] in ("info", "find"): return msg
283652a263ab69ddf4dea37a7a8e0323c2a2eb2b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3102/283652a263ab69ddf4dea37a7a8e0323c2a2eb2b/plugin.py
elif text[:4] in ("info", "find"):
elif text[:4] in my_commands:
def inFilter(self, irc, msg): if msg.command != "PRIVMSG": return msg if not conf.supybot.defaultIgnore(): return msg text = msg.args[1].strip() if len(text) < 6: return msg user = get_user(msg) if user: return msg channel = self.__getChannel(msg.args[0]) if channel: if text[0] not in ('!', '@'): return msg if not text[1:5] in ("info", "find"): return msg
283652a263ab69ddf4dea37a7a8e0323c2a2eb2b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3102/283652a263ab69ddf4dea37a7a8e0323c2a2eb2b/plugin.py
"""
""" % (release, release)
def makeSource(release): return """deb http://archive.ubuntu.com/ubuntu/ %s main restricted universe multiverse
b2193d52ad9353e3581ae854c5da52d2073f1610 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3102/b2193d52ad9353e3581ae854c5da52d2073f1610/config.py
aptdir = something("Which directory should be used for the apt cache when looking up packages?", default=supybot.directories.data.dirize('aptdir'))
aptdir = something("Which directory should be used for the apt cache when looking up packages?", default=conf.supybot.directories.data.dirize('aptdir'))
def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default)
b2193d52ad9353e3581ae854c5da52d2073f1610 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3102/b2193d52ad9353e3581ae854c5da52d2073f1610/config.py
while aptdir.beginswith('/var'):
while aptdir.startswith('/var'):
def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default)
b2193d52ad9353e3581ae854c5da52d2073f1610 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3102/b2193d52ad9353e3581ae854c5da52d2073f1610/config.py
aptdir = something("Which directory should be used for the apt cache when looking up packages?", default=supybot.directories.data.dirize('aptdir'))
aptdir = something("Which directory should be used for the apt cache when looking up packages?", default=conf.supybot.directories.data.dirize('aptdir'))
def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default)
b2193d52ad9353e3581ae854c5da52d2073f1610 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3102/b2193d52ad9353e3581ae854c5da52d2073f1610/config.py
for release in default_dist:
try: os.makedirs(aptdir) except OSError: pass for release in default_dists:
def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default)
b2193d52ad9353e3581ae854c5da52d2073f1610 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3102/b2193d52ad9353e3581ae854c5da52d2073f1610/config.py
fd = fileutils.open(filename)
fd = open(filename, 'wb')
def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default)
b2193d52ad9353e3581ae854c5da52d2073f1610 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3102/b2193d52ad9353e3581ae854c5da52d2073f1610/config.py
release = "%s-%s" % sub filename = os.path.join(aptdir, "%s.list" % release)
sub_release = "%s-%s" % (release, sub) filename = os.path.join(aptdir, "%s.list" % sub_release)
def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default)
b2193d52ad9353e3581ae854c5da52d2073f1610 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3102/b2193d52ad9353e3581ae854c5da52d2073f1610/config.py
fd = fileutils.open(filename)
fd = open(filename, 'wb')
def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default)
b2193d52ad9353e3581ae854c5da52d2073f1610 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3102/b2193d52ad9353e3581ae854c5da52d2073f1610/config.py
fd.write(makeSource(release))
fd.write(makeSource(sub_release))
def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default)
b2193d52ad9353e3581ae854c5da52d2073f1610 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3102/b2193d52ad9353e3581ae854c5da52d2073f1610/config.py
(e, o) = commands.getstatusoutput(update_apt) if e != 0:
if commands.getstatus(update_apt) != 0:
def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default)
b2193d52ad9353e3581ae854c5da52d2073f1610 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3102/b2193d52ad9353e3581ae854c5da52d2073f1610/config.py
(e, o) = commands.statusoutput('which apt-file') if e != 0:
if commands.getstatusoutput('which apt-file') != 0:
def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default)
b2193d52ad9353e3581ae854c5da52d2073f1610 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3102/b2193d52ad9353e3581ae854c5da52d2073f1610/config.py
(e, o) = commands.getstatusoutput(update_apt_file) if e != 0:
if commands.getstatusoutput(update_apt_file) != 0:
def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default)
b2193d52ad9353e3581ae854c5da52d2073f1610 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3102/b2193d52ad9353e3581ae854c5da52d2073f1610/config.py
aptdir = supybot.directories.data.dirize('aptdir')
aptdir = conf.supybot.directories.data.dirize('aptdir')
def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default)
b28db494de1ebb6f5185c7a20132329457a1deb4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3102/b28db494de1ebb6f5185c7a20132329457a1deb4/config.py
queue(irc, args[0], reply)
queue(irc, msg.args[0], reply)
def real_info(self, irc, msg, args, package, release): """<package> [<release>]
59f58000914452fe778d6225057ae0914d4a8435 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3102/59f58000914452fe778d6225057ae0914d4a8435/plugin.py
def inFilter(self, irc, msg): if msg.command != "PRIVMSG": return msg if not conf.supybot.defaultIgnore(): return msg text = msg.args[1].strip() if len(text) < 6: return msg user = get_user(msg) if user: return msg channel = self.__getChannel(msg.args[0]) if channel: if text[0] not in ('!', '@'): return msg if not text[1:5] in ("info", "find"): return msg
59f58000914452fe778d6225057ae0914d4a8435 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3102/59f58000914452fe778d6225057ae0914d4a8435/plugin.py
if user if not channel and text[0] == self.registryValue("prefixchar")
if user: if not channel and text[0] == self.registryValue("prefixchar"):
def inFilter(self, irc, msg): if msg.command != "PRIVMSG": return msg if not conf.supybot.defaultIgnore(): return msg text = msg.args[1].strip() if len(text) < 6: return msg user = get_user(msg) channel = self.__getChannel(msg.args[0]) reply_chars = tuple([self.registryValue("prefixchar", channel)] + list(conf.supybot.reply.whenAddressedBy.chars.get(channel))) my_commands = self.listCommands() if user if not channel and text[0] == self.registryValue("prefixchar") msg.args = (msg.args[0], text[1:]) return msg if channel: if text[0] not in reply_chars: return msg if not text[1:5] in my_commands: return msg
dacccac2a69bf7a655ced3b781676e010e56baa1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3102/dacccac2a69bf7a655ced3b781676e010e56baa1/plugin.py
ztc.installPackage(zopyx.imgmap)
ztc.installPackage(zopyx.tinymceplugins.imgmap)
def setUp(cls): fiveconfigure.debug_mode = True ztc.installPackage(zopyx.imgmap) fiveconfigure.debug_mode = False
4da80d3fffb82f9a235c7bbd3d0b21a56794419f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6136/4da80d3fffb82f9a235c7bbd3d0b21a56794419f/tests.py
def test_suite(): return unittest.TestSuite([ # Unit tests #doctestunit.DocFileSuite( # 'README.txt', package='zopyx.imgmap', # setUp=testing.setUp, tearDown=testing.tearDown), #doctestunit.DocTestSuite( # module='zopyx.imgmap.mymodule', # setUp=testing.setUp, tearDown=testing.tearDown), # Integration tests that use PloneTestCase #ztc.ZopeDocFileSuite( # 'README.txt', package='zopyx.imgmap', # test_class=TestCase), #ztc.FunctionalDocFileSuite( # 'browser.txt', package='zopyx.imgmap', # test_class=TestCase), ])
4da80d3fffb82f9a235c7bbd3d0b21a56794419f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6136/4da80d3fffb82f9a235c7bbd3d0b21a56794419f/tests.py
def test_suite(): return unittest.TestSuite([ # Unit tests #doctestunit.DocFileSuite( # 'README.txt', package='zopyx.imgmap', # setUp=testing.setUp, tearDown=testing.tearDown), #doctestunit.DocTestSuite( # module='zopyx.imgmap.mymodule', # setUp=testing.setUp, tearDown=testing.tearDown), # Integration tests that use PloneTestCase #ztc.ZopeDocFileSuite( # 'README.txt', package='zopyx.imgmap', # test_class=TestCase), #ztc.FunctionalDocFileSuite( # 'browser.txt', package='zopyx.imgmap', # test_class=TestCase), ])
4da80d3fffb82f9a235c7bbd3d0b21a56794419f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6136/4da80d3fffb82f9a235c7bbd3d0b21a56794419f/tests.py
def test_suite(): return unittest.TestSuite([ # Unit tests #doctestunit.DocFileSuite( # 'README.txt', package='zopyx.imgmap', # setUp=testing.setUp, tearDown=testing.tearDown), #doctestunit.DocTestSuite( # module='zopyx.imgmap.mymodule', # setUp=testing.setUp, tearDown=testing.tearDown), # Integration tests that use PloneTestCase #ztc.ZopeDocFileSuite( # 'README.txt', package='zopyx.imgmap', # test_class=TestCase), #ztc.FunctionalDocFileSuite( # 'browser.txt', package='zopyx.imgmap', # test_class=TestCase), ])
4da80d3fffb82f9a235c7bbd3d0b21a56794419f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6136/4da80d3fffb82f9a235c7bbd3d0b21a56794419f/tests.py
def test_suite(): return unittest.TestSuite([ # Unit tests #doctestunit.DocFileSuite( # 'README.txt', package='zopyx.imgmap', # setUp=testing.setUp, tearDown=testing.tearDown), #doctestunit.DocTestSuite( # module='zopyx.imgmap.mymodule', # setUp=testing.setUp, tearDown=testing.tearDown), # Integration tests that use PloneTestCase #ztc.ZopeDocFileSuite( # 'README.txt', package='zopyx.imgmap', # test_class=TestCase), #ztc.FunctionalDocFileSuite( # 'browser.txt', package='zopyx.imgmap', # test_class=TestCase), ])
4da80d3fffb82f9a235c7bbd3d0b21a56794419f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6136/4da80d3fffb82f9a235c7bbd3d0b21a56794419f/tests.py
for anchor in soup.find('a'):
for anchor in soup.findAll('a'):
def __call__(self):
3f42bfa1618087db955e128b1d6add324f76d38f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6136/3f42bfa1618087db955e128b1d6add324f76d38f/document.py
result.append(dict(name=name, text=text)) return
result.append(dict(name=name, text=name)) return demjson.encode(result)
def __call__(self):
3f42bfa1618087db955e128b1d6add324f76d38f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6136/3f42bfa1618087db955e128b1d6add324f76d38f/document.py
def create_button(self, button_name): button = QPushButton(button_name) button.setFlat(True) button.setCheckable(True) button.clicked.connect(self.clickedButton) return button def update_label_buttons(self): label_vlayout = self.create_choice_list("Labels") self.label_buttongroup = QButtonGroup() for label_name in self.label_names: button = QPushButton(label_name) button.setFlat(True) button.setCheckable(True) button.clicked.connect(self.clickedLabelButton) label_vlayout.addWidget(button) self.label_buttongroup.addButton(button) if label_name == self.last_checked_label: button.setChecked(True)
def __init__(self, parent=None): QWidget.__init__(self, parent)
142f548695693cef661e597f3671d76c6a78dea0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/142/142f548695693cef661e597f3671d76c6a78dea0/buttonarea.py
self.hlayout.addLayout(label_vlayout)
self.hlayout.setAlignment(Qt.AlignLeft) self.hlayout.addWidget(self.label_button_list)
def update_label_buttons(self): label_vlayout = self.create_choice_list("Labels") self.label_buttongroup = QButtonGroup() for label_name in self.label_names: button = QPushButton(label_name) button.setFlat(True) button.setCheckable(True) button.clicked.connect(self.clickedLabelButton) label_vlayout.addWidget(button) self.label_buttongroup.addButton(button) if label_name == self.last_checked_label: button.setChecked(True)
142f548695693cef661e597f3671d76c6a78dea0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/142/142f548695693cef661e597f3671d76c6a78dea0/buttonarea.py
print self.hlayout.parent()
def init_button_lists(self): for label_name in self.label_names: button = self.label_button_list.add_button(label_name) button.clicked.connect(self.clickedLabelButton)
def update_label_buttons(self): label_vlayout = self.create_choice_list("Labels") self.label_buttongroup = QButtonGroup() for label_name in self.label_names: button = QPushButton(label_name) button.setFlat(True) button.setCheckable(True) button.clicked.connect(self.clickedLabelButton) label_vlayout.addWidget(button) self.label_buttongroup.addButton(button) if label_name == self.last_checked_label: button.setChecked(True)
142f548695693cef661e597f3671d76c6a78dea0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/142/142f548695693cef661e597f3671d76c6a78dea0/buttonarea.py
def update_buttons(self): layout = self.hlayout.takeAt(1) for button in self.property_buttons: button.hide() del button
for key, property_values in self.properties.iteritems(): if key in ["type", "class"]: continue button_list = ButtonListWidget(key) for value in property_values: button_list.add_button(value) button_list.hide() print key self.property_button_lists[key] = button_list self.hlayout.addWidget(button_list)
def update_buttons(self): layout = self.hlayout.takeAt(1) for button in self.property_buttons: button.hide() del button
142f548695693cef661e597f3671d76c6a78dea0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/142/142f548695693cef661e597f3671d76c6a78dea0/buttonarea.py
dynamic_hlayout = QHBoxLayout() self.property_buttons = [] if self.last_checked_label != None: for key in self.label_properties[self.last_checked_label].keys(): if key in ["type", "class"]: continue vlayout = self.create_choice_list(key) buttongroup = QButtonGroup() for value in self.properties[key]: button = self.create_button(value) self.property_buttons.append(button) vlayout.addWidget(button) buttongroup.addButton(button) dynamic_hlayout.addLayout(vlayout) self.hlayout.addLayout(dynamic_hlayout)
def show_only_label_properties(self, label_name): print "sdf", self.property_button_lists for name, button_list in self.property_button_lists.iteritems(): if name in self.label_properties[label_name].keys(): button_list.show() else: button_list.hide()
def update_buttons(self): layout = self.hlayout.takeAt(1) for button in self.property_buttons: button.hide() del button
142f548695693cef661e597f3671d76c6a78dea0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/142/142f548695693cef661e597f3671d76c6a78dea0/buttonarea.py
return self.label_buttongroup.checkedButton() def create_choice_list(self, list_name, elements = []): vlayout = QVBoxLayout() vlayout.setSpacing(0) vlayout.addWidget(QLabel("<center><b>" + list_name + "</b></center>")) if len(elements) > 0: buttongroup = QButtonGroup() for element in elements: self.create_button(element) return vlayout
return self.label_button_list.get_checked_button()
def get_checked_label_button(self): return self.label_buttongroup.checkedButton()
142f548695693cef661e597f3671d76c6a78dea0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/142/142f548695693cef661e597f3671d76c6a78dea0/buttonarea.py