StylisticFingerprinting.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:StylisticFingerprinting 作者: robertyuyang 项目源码 文件源码
def main():
  filenames = ParseArguments(sys.argv[1:])

  # Change stderr to write with replacement characters so we don't die
  # if we try to print something containing non-ASCII characters.
  sys.stderr = codecs.StreamReaderWriter(sys.stderr,
                                         codecs.getreader('utf8'),
                                         codecs.getwriter('utf8'),
                                         'replace')

  _cpplint_state.ResetErrorCounts()

  f = open(_output_file, 'w')

  title = 'path,dir,'
  for i in range(1, 16):
    title += 'PFM%d' % i + ',' 
  for i in range(1, 21):
    title += 'PRM%d' % i + ',' 
  for i in range(1, 26):
    title += 'PLM%d' % i + ',' 
  f.write(title) 

  for filename in filenames:
    #added by Robert
    global _current_filenmae
    _current_filenmae = filename
    print 'current file name: ' + filename
    global _stat
    _stat = _Stat()
    #added by Robert End
    ProcessFile(filename, _cpplint_state.verbose_level, [ExtraCheckLine])
    #added by Roebrt
    global _output_file
    _stat.WriteFile(filename, f)
    #added by Robert end  

  f.close()

  _cpplint_state.PrintErrorCounts()

  _stat.PrintValidFiles() #added by Robert



  sys.exit(_cpplint_state.error_count > 0)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号