add missing copyright headers to *.py

This commit is contained in:
Damien Elmes 2021-04-13 18:45:05 +10:00
parent dac990e4c2
commit 948fc5f777
47 changed files with 175 additions and 11 deletions

View file

@ -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

View file

@ -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

View file

@ -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.

View file

@ -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.

View 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 format
import sys

View file

@ -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

View file

@ -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.

View 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 sys
import os
import click

View 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
from typing import NoReturn

View 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 subprocess
import sys

View 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 subprocess
import sys

View 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 subprocess
import sys

View 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

View 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 shutil
import tempfile

View 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
# coding: utf-8
from tests.shared import getEmptyCol

View 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
# coding: utf-8
import os

View 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
# coding: utf-8
from anki.errors import DeckRenameError

View 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
# coding: utf-8
import os

View 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
# coding: utf-8
import pytest

View 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
from tests.shared import getEmptyCol

View 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
# coding: utf-8
import os

View 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
# coding: utf-8
import os

View 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
# coding: utf-8
import os

View 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
# coding: utf-8
import time

View file

@ -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

View file

@ -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

View file

@ -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

View 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
from tests.shared import getEmptyCol

View file

@ -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

View 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
# a quick script to compare methods in the two schedulers
import inspect

View file

@ -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.

View 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.

View file

@ -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

View 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
"""
Basic text to speech support.

View file

@ -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

View file

@ -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

View 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 subprocess
import sys

View 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 subprocess
import sys

View 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 multiprocessing
import os
import subprocess

View 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

View 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.path
from tempfile import TemporaryDirectory
from zipfile import ZipFile

View 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 anki.lang

View file

@ -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')

View file

@ -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.

View 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

View file

@ -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):

View 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)