1 Star 0 Fork 0

jiangyunxing/DeepSpeedExamples

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
check-license.py 1.11 KB
一键复制 编辑 原始数据 按行查看 历史
Zhewei Yao 提交于 2023-04-12 01:32 +08:00 . DeepSpeed Chat Release (#264)
#!/usr/bin/env python3
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0
# DeepSpeed Team
from __future__ import annotations
"""
Modified from https://github.com/jlebar/pre-commit-hooks/blob/master/check_do_not_submit.py
"""
import subprocess
import sys
def err(s: str) -> None:
print(s, file=sys.stderr)
COPYRIGHT = [
r"^\(\/\/\|#\) Copyright (c) Microsoft Corporation.$", r"^\(\/\/\|#\) SPDX-License-Identifier: Apache-2.0$",
r"^\(\/\/\|#\) DeepSpeed Team$"
]
success = True
failures = []
for f in sys.argv[1:]:
for copyright_line in COPYRIGHT:
if not success:
continue
res = subprocess.run(["git", "grep", "--quiet", "-e", copyright_line, f], capture_output=True)
if res.returncode == 1:
success = False
failures.append(f)
elif res.returncode == 2:
err(f"Error invoking grep on {', '.join(sys.argv[1:])}:")
err(res.stderr.decode("utf-8"))
sys.exit(2)
if not success:
err(f'{failures}: Missing license at top of file')
err(res.stdout.decode("utf-8"))
sys.exit(1)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jiangkaiwen/DeepSpeedExamples.git
git@gitee.com:jiangkaiwen/DeepSpeedExamples.git
jiangkaiwen
DeepSpeedExamples
DeepSpeedExamples
master

搜索帮助