parameters: (filename, logger)
return_statement: return True
docstring: If a nav file is not valid, wipe it.
docstring_summary: If a nav file is not valid, wipe it.
docstring_tokens: If a nav file is not valid wipe it .
function: def validateNavOrWipe(filename, logger):
      '''If a nav file is not valid, wipe it.'''
      
      if not os.path.exists(filename):
          return False
  
      try:
          f = open(filename)
          line = f.readline()
          m = re.match("^.*?DOCTYPE\s+HTML", line)
          if m:
              logger.info("Bad nav data, will wipe: " + filename)
              os.system("rm -f " + filename)
              return False
      except UnicodeDecodeError as e:
           # If it cannot be decoded, the file is likely in binary, hence valid
           return True
           
      return True
function_tokens: def validateNavOrWipe ( filename , logger ) : if not os . path . exists ( filename ) : return False try : f = open ( filename ) line = f . readline ( ) m = re . match ( "^.*?DOCTYPE\s+HTML" , line ) if m : logger . info ( "Bad nav data, will wipe: " + filename ) os . system ( "rm -f " + filename ) return False except UnicodeDecodeError as e : # If it cannot be decoded, the file is likely in binary, hence valid return True return True