2 Star 0 Fork 0

mirrors_gnu/solfege

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
mychecker 1.03 KB
一键复制 编辑 原始数据 按行查看 历史
Tom Cato Amundsen 提交于 2013-03-29 01:55 . Initial commit
#!/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)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_gnu/solfege.git
[email protected]:mirrors_gnu/solfege.git
mirrors_gnu
solfege
solfege
master

搜索帮助