mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 00:12:25 -04:00
add missing copyright headers to *.py
This commit is contained in:
parent
dac990e4c2
commit
948fc5f777
47 changed files with 175 additions and 11 deletions
|
@ -1,4 +1,6 @@
|
|||
#!/usr/bin/env python3
|
||||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
#
|
||||
# See README.md
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: UTF-8 -*-
|
||||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import os
|
||||
import json
|
||||
import re
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: UTF-8 -*-
|
||||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
"""
|
||||
Tool to extract core strings and keys from .ftl files.
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: UTF-8 -*-
|
||||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
"""
|
||||
Parse and re-serialize ftl files to get them in a consistent form.
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import os
|
||||
import format
|
||||
import sys
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
#
|
||||
# A helper script to update commit references to the latest translations,
|
||||
# and copy source files to the translation repos. Requires access to the
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: UTF-8 -*-
|
||||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
"""
|
||||
Tool to apply transform to an ftl string and its translations.
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import sys
|
||||
import os
|
||||
import click
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
from typing import NoReturn
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
# coding: utf-8
|
||||
|
||||
from tests.shared import getEmptyCol
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
# coding: utf-8
|
||||
|
||||
import os
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
# coding: utf-8
|
||||
|
||||
from anki.errors import DeckRenameError
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
# coding: utf-8
|
||||
|
||||
import os
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
# coding: utf-8
|
||||
import pytest
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
from tests.shared import getEmptyCol
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
# coding: utf-8
|
||||
|
||||
import os
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
# coding: utf-8
|
||||
|
||||
import os
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
# coding: utf-8
|
||||
|
||||
import os
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
# coding: utf-8
|
||||
import time
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# coding: utf-8
|
||||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import copy
|
||||
import time
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# coding: utf-8
|
||||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import copy
|
||||
import os
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: UTF-8 -*-
|
||||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import os
|
||||
import tempfile
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
from tests.shared import getEmptyCol
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# coding: utf-8
|
||||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import time
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
# a quick script to compare methods in the two schedulers
|
||||
|
||||
import inspect
|
||||
|
|
|
@ -112,6 +112,9 @@ hooks = [
|
|||
]
|
||||
|
||||
prefix = """\
|
||||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
# This file is automatically generated; edit tools/genhooks.py instead.
|
||||
# Please import from anki.hooks instead of this file.
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#!/usr/bin/env
|
||||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
#
|
||||
# Wrapper for protoc that strips the dirname from the output files,
|
||||
# and generates mypy typechecking info.
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import difflib
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
"""
|
||||
Basic text to speech support.
|
||||
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def fix_pywin32_in_bazel(force=False):
|
||||
if sys.platform != "win32":
|
||||
return
|
||||
|
@ -15,6 +19,7 @@ def fix_pywin32_in_bazel(force=False):
|
|||
|
||||
# trigger pywin32 bootstrap
|
||||
import site
|
||||
|
||||
site.addsitedir(path)
|
||||
|
||||
# sys.path has been extended; use final
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
#!/usr/bin/env python3
|
||||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
try:
|
||||
import bazelfixes
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import multiprocessing
|
||||
import os
|
||||
import subprocess
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import os.path
|
||||
from tempfile import TemporaryDirectory
|
||||
from zipfile import ZipFile
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import anki.lang
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: UTF-8 -*-
|
||||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import json
|
||||
import re
|
||||
|
@ -31,7 +32,11 @@ for line in open(input_scss):
|
|||
colors.setdefault(var, []).append(val)
|
||||
|
||||
with open(output_py, "w") as buf:
|
||||
buf.write("""\
|
||||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
""")
|
||||
buf.write("# this file is auto-generated from _vars.scss\n")
|
||||
for color, (day, night) in colors.items():
|
||||
color = color.replace("-", "_").upper()
|
||||
buf.write(f"{color} = (\"{day}\", \"{night}\")\n")
|
||||
buf.write(f'{color} = ("{day}", "{night}")\n')
|
||||
|
|
|
@ -11,6 +11,9 @@ import sys
|
|||
from hookslib import Hook, write_file
|
||||
|
||||
prefix = """\
|
||||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
# This file is automatically generated; edit tools/genhooks_gui.py instead.
|
||||
# Please import from anki.hooks instead of this file.
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import re
|
||||
import sys
|
||||
|
@ -9,10 +11,12 @@ release_mode = sys.argv[3] == "release"
|
|||
|
||||
version_re = re.compile('anki_version = "(.*)"')
|
||||
|
||||
|
||||
def output(text: str) -> None:
|
||||
"Add text with a '\n' to stdout; avoiding a '\r' on Windows"
|
||||
sys.stdout.buffer.write(text.encode("utf8") + b"\n")
|
||||
|
||||
|
||||
# extract version number from defs.bzl
|
||||
for line in open(defs_file).readlines():
|
||||
if ver := version_re.match(line):
|
||||
|
|
42
scripts/copyright_headers.py
Normal file
42
scripts/copyright_headers.py
Normal file
|
@ -0,0 +1,42 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import os, sys
|
||||
from pathlib import Path
|
||||
|
||||
nonstandard_header = {
|
||||
"pip/pyqt5/install_pyqt5.py",
|
||||
"pylib/anki/importing/pauker.py",
|
||||
"pylib/anki/importing/supermemo_xml.py",
|
||||
"pylib/anki/statsbg.py",
|
||||
"pylib/tools/protoc-gen-mypy.py",
|
||||
"qt/aqt/mpv.py",
|
||||
"qt/aqt/winpaths.py",
|
||||
}
|
||||
|
||||
if not os.path.exists("WORKSPACE"):
|
||||
print("run from workspace root")
|
||||
sys.exit(1)
|
||||
|
||||
found = False
|
||||
for dirpath, dirnames, fnames in os.walk("."):
|
||||
dir = Path(dirpath)
|
||||
if "bazel-" in dirpath:
|
||||
continue
|
||||
if "qt/forms" in dirpath:
|
||||
continue
|
||||
for fname in fnames:
|
||||
if fname.endswith(".py"):
|
||||
path = dir / fname
|
||||
with open(path) as f:
|
||||
top = f.read(256)
|
||||
if not top.strip():
|
||||
continue
|
||||
if str(path) in nonstandard_header:
|
||||
continue
|
||||
if "Ankitects Pty Ltd and contributors" not in top:
|
||||
print("missing standard copyright header:", path)
|
||||
found = True
|
||||
|
||||
if found:
|
||||
sys.exit(1)
|
Loading…
Reference in a new issue