<s> import os , string , random <EOL> _devNull = None <EOL> def getDevNull ( ) : <EOL> global _devNull <EOL> if _devNull is None : <EOL> _devNull = open ( os . devnull , '<STR_LIT:wb>' ) <EOL> return _devNull <EOL> def deleteDirContent ( dir ) : <EOL> for file in os . listdir ( dir ) : <EOL> file_path = os . path . join ( dir , file ) <EOL> if os . path . isdir ( file_path ) : <EOL> deleteDir ( file_path ) <EOL> else : <EOL> os . unlink ( file_path ) <EOL> def deleteDir ( dir ) : <EOL> deleteDirContent ( dir ) <EOL> os . rmdir ( dir ) <EOL> def mInsertCommit ( dbBe , commits ) : <EOL> for commit in commits : <EOL> insertCommit ( dbBe , commit ) <EOL> def insertCommit ( dbBe , commit ) : <EOL> if not hasattr ( commit , "<STR_LIT:id>" ) or commit . id is None : <EOL> dbBe . insertCommit ( commit ) <EOL> def mInsertOnStatus ( status , dbBe , commits ) : <EOL> for commit in commits : <EOL> insertOnStatus ( status , dbBe , commit ) <EOL> def insertOnStatus ( status , dbBe , commit ) : <EOL> if commit . status == status : <EOL> insertCommit ( dbBe , commit ) <EOL> def filterOnStatus ( status , commits ) : <EOL> return [ commit for commit in commits if commit . status == status ] <EOL> def filterOnStatusBase ( statusBase , commits ) : <EOL> return [ commit for commit in commits if '<STR_LIT:_>' in commit . status and commit . status [ : commit . status . rfind ( '<STR_LIT:_>' ) ] == statusBase ] <EOL> def filterOnStatusExt ( statusExt , commits ) : <EOL> return [ commit for commit in commits if '<STR_LIT:_>' in commit . status and commit . status [ commit . status . rfind ( '<STR_LIT:_>' ) + <NUM_LIT:1> : ] == statusExt ] <EOL> def filterOnSource ( source , commits ) : <EOL> return [ commit for commit in commits if commit . repository == source ] <EOL> def getExePath ( file ) : <EOL> """<STR_LIT>""" <EOL> for directory in os . environ [ "<STR_LIT>" ] . split ( '<STR_LIT::>' ) : <EOL> filePath = os . path . join ( directory , file ) <EOL> if os . path . exists ( filePath ) and os . path . isfile ( filePath ) : <EOL> return filePath <EOL> raise Exception ( "<STR_LIT>" ) <EOL> def generateRandomString ( length , characters = string . ascii_lowercase ) : <EOL> return '<STR_LIT>' . join ( random . choice ( characters ) for i in range ( length ) ) </s>
