-
Notifications
You must be signed in to change notification settings - Fork 8
/
notice.py
26 lines (20 loc) · 889 Bytes
/
notice.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Copyright (c) 2019-2025 Sequentia Developers.
# Distributed under the terms of the MIT License (see the LICENSE file).
# SPDX-License-Identifier: MIT
# This source code is part of the Sequentia project (https://github.com/eonu/sequentia).
"""Adds a notice to the top of all Python source code files.
This script is based on:
https://github.com/fatiando/maintenance/issues/10#issuecomment-718754908
"""
from pathlib import Path
notice = """
# Copyright (c) 2019-2025 Sequentia Developers.
# Distributed under the terms of the MIT License (see the LICENSE file).
# SPDX-License-Identifier: MIT
# This source code is part of the Sequentia project (https://github.com/eonu/sequentia).
""".strip()
for f in Path(".").glob("**/*.py"):
if not str(f).startswith("."):
code = f.read_text()
if not code.startswith(notice):
f.write_text(f"{notice}\n\n{code}")