CoolFace
Modelpublic

youssefedweqd/working

sourceHugging Faceapache-2.0updated 1y agoView on Hugging Face
0likes6downloads
check_license.py39 linesDownload Raw Back to tests
1# Copyright 2025 the LlamaFactory team.2#3# Licensed under the Apache License, Version 2.0 (the "License");4# you may not use this file except in compliance with the License.5# You may obtain a copy of the License at6#7#     http://www.apache.org/licenses/LICENSE-2.08#9# Unless required by applicable law or agreed to in writing, software10# distributed under the License is distributed on an "AS IS" BASIS,11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12# See the License for the specific language governing permissions and13# limitations under the License.14 15import sys16from pathlib import Path17 18 19KEYWORDS = ("Copyright", "2025", "LlamaFactory")20 21 22def main():23    path_list: list[Path] = []24    for check_dir in sys.argv[1:]:25        path_list.extend(Path(check_dir).glob("**/*.py"))26 27    for path in path_list:28        with open(path.absolute(), encoding="utf-8") as f:29            file_content = f.read().strip().split("\n")30            if not file_content[0]:31                continue32 33            print(f"Check license: {path}")34            assert all(keyword in file_content[0] for keyword in KEYWORDS), f"File {path} does not contain license."35 36 37if __name__ == "__main__":38    main()39