代码拉取完成,页面将自动刷新
#!/usr/bin/python
# Solfege - free ear training software
# Copyright (C) 2007 Tom Cato Amundsen
# License is GPL, see file COPYING
# I use this script with pychecker 0.8.17
import os
import shutil
import sys
def tmpfilename(s):
p, fn = os.path.split(s)
return os.path.join(p, "pychecker-tmp-" + fn)
def check_file(fn):
tmpfn = tmpfilename(fn)
s = open(fn, 'rU').read()
outfile = open(tmpfn, 'w')
lines = s.split("\n")
two_first_are_empty = True
for x in range(2):
if not lines[x].startswith("#") or not lines[x].strip():
two_first_are_empty = False
head = [x for x in lines if '__future__' in x]
head.append("import solfege.i18n")
head.append("solfege.i18n.setup('.')")
lines = [x for x in lines if '__future__' not in x]
outfile.write("\n".join(head))
outfile.write("\n".join(lines[int(two_first_are_empty)*2:]))
outfile.close()
os.system('pychecker --limit 60 %s' % tmpfn)
os.remove(tmpfn)
os.remove(tmpfn+"c")
for fn in sys.argv[1:]:
check_file(fn)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。