1 Star 1 Fork 0

浮沉的鸟/DMS

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
summary_condeLine.py 2.06 KB
一键复制 编辑 原始数据 按行查看 历史
import subprocess
from collections import defaultdict
apps = ["databaseDemo", "ADVANCE", "BIS", "LIMS", "SEQ", "EMR", "USER", "PROJECT"]
line_counts = defaultdict(dict)
for app in apps:
res1 = ""
res2 = ""
if app == "databaseDemo":
# 计算后端代码
backend_files = ["supervisord.ini", "README.md", "gunicorn.conf.py", "databaseDemo.conf", "bkdb.sh",
"db_pool/mysql/base.py"]
backend_dirs = ["util/*", "databaseDemo/*"]
res1 = subprocess.check_output("wc -l {} 2>/dev/null |tail -n1".format(" ".join(backend_files + backend_dirs)), shell=True)
# 计算前端代码
frontend_files = ["static/javascript/custom.js", "templates/base.html", "templates/single_page.html"]
res2 = subprocess.check_output("wc -l {} 2>/dev/null |tail -n1".format(" ".join(frontend_files)), shell=True)
else:
res1 = subprocess.check_output("wc -l {}/* 2>/dev/null |tail -n1".format(app), shell=True)
# 计算前端代码
if app == "USER":
frontend_files = ["templates/registration_base.html", "templates/{}/*".format(app),
"templates/registration/*"]
res2 = subprocess.check_output("wc -l {} 2>/dev/null |tail -n1".format(" ".join(frontend_files)), shell=True)
else:
res2 = subprocess.check_output("wc -l templates/{}/* 2>/dev/null |tail -n1".format(app), shell=True)
line_counts[app]["backend"] = int(str(res1).split()[1])
try:
line_counts[app]["frontend"] = int(str(res2).split()[1])
except IndexError:
line_counts[app]["frontend"] = 0
print("\t".join(["App", "backend", "frontend", "Total"]))
sum_count = [0]*2
for app in apps:
print("{}\t{}\t{}\t{}".format(app, line_counts[app]["backend"], line_counts[app]["frontend"],
line_counts[app]["backend"]+line_counts[app]["frontend"]))
sum_count[0] += line_counts[app]["backend"]
sum_count[1] += line_counts[app]["frontend"]
print("All\t{}\t{}\t{}".format(sum_count[0], sum_count[1], sum_count[0] + sum_count[1]))
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/fcnd007/DMS.git
git@gitee.com:fcnd007/DMS.git
fcnd007
DMS
DMS
master

搜索帮助