diff --git a/pylib/Makefile b/pylib/Makefile index 005673b98..520edf70e 100644 --- a/pylib/Makefile +++ b/pylib/Makefile @@ -5,8 +5,8 @@ MAKEFLAGS += --warn-undefined-variables MAKEFLAGS += --no-builtin-rules RUNARGS := .SUFFIXES: -BLACKARGS := -t py36 anki tests --exclude='backend_pb2|buildinfo' -ISORTARGS := anki tests +BLACKARGS := -t py36 anki tests setup.py --exclude='backend_pb2|buildinfo' +ISORTARGS := anki tests setup.py $(shell mkdir -p .build ../dist) @@ -58,7 +58,7 @@ CHECKDEPS := $(shell find anki tests -name '*.py') @touch $@ .build/lint: $(CHECKDEPS) - pylint -j 0 --rcfile=.pylintrc -f colorized --extension-pkg-whitelist=ankirspy anki + pylint -j 0 --rcfile=.pylintrc -f colorized --extension-pkg-whitelist=ankirspy anki tests setup.py @touch $@ .build/imports: $(CHECKDEPS) diff --git a/pylib/setup.py b/pylib/setup.py index 6cf28b324..c60dffead 100644 --- a/pylib/setup.py +++ b/pylib/setup.py @@ -1,4 +1,4 @@ -import setuptools, sys +import setuptools with open("../meta/version") as fh: version = fh.read().strip() @@ -12,15 +12,14 @@ setuptools.setup( long_description_content_type="text/markdown", url="https://apps.ankiweb.net", packages=setuptools.find_packages(".", exclude=["tests"]), - classifiers=[ - ], - python_requires='>=3.6', + classifiers=[], + python_requires=">=3.6", install_requires=[ - 'beautifulsoup4', - 'requests', - 'decorator', - 'protobuf', + "beautifulsoup4", + "requests", + "decorator", + "protobuf", 'psutil; sys_platform == "win32"', - 'distro; sys_platform != "darwin" and sys_platform != "win32"' - ] + 'distro; sys_platform != "darwin" and sys_platform != "win32"', + ], ) diff --git a/pylib/tests/test_flags.py b/pylib/tests/test_flags.py index 1fb988fc4..283405e81 100644 --- a/pylib/tests/test_flags.py +++ b/pylib/tests/test_flags.py @@ -1,4 +1,4 @@ -from tests.shared import assertException, getEmptyCol +from tests.shared import getEmptyCol def test_flags(): diff --git a/pylib/tests/test_importing.py b/pylib/tests/test_importing.py index ae7406fc1..fc90dcfe0 100644 --- a/pylib/tests/test_importing.py +++ b/pylib/tests/test_importing.py @@ -10,7 +10,6 @@ from anki.importing import ( SupermemoXmlImporter, TextImporter, ) -from anki.utils import ids2str from tests.shared import getEmptyCol, getUpgradeDeckPath testDir = os.path.dirname(__file__) diff --git a/pylib/tests/test_media.py b/pylib/tests/test_media.py index a9e907df3..ca2fa41a4 100644 --- a/pylib/tests/test_media.py +++ b/pylib/tests/test_media.py @@ -2,7 +2,6 @@ import os import tempfile -import time from .shared import getEmptyCol, testDir diff --git a/pylib/tests/test_models.py b/pylib/tests/test_models.py index 5e10c3aa0..1c5c0cccb 100644 --- a/pylib/tests/test_models.py +++ b/pylib/tests/test_models.py @@ -338,7 +338,7 @@ def test_modelChange(): assert deck.db.scalar("select count() from cards where nid = ?", f.id) == 1 -def test_templates(): +def test_templates2(): d = dict(Foo="x", Bar="y") assert anki.template.render("{{Foo}}", d) == "x" assert anki.template.render("{{#Foo}}{{Foo}}{{/Foo}}", d) == "x" diff --git a/pylib/tests/test_schedv1.py b/pylib/tests/test_schedv1.py index 3d24a11d8..3e2fae3ad 100644 --- a/pylib/tests/test_schedv1.py +++ b/pylib/tests/test_schedv1.py @@ -405,7 +405,7 @@ def test_button_spacing(): def test_overdue_lapse(): # disabled in commit 3069729776990980f34c25be66410e947e9d51a2 return - d = getEmptyCol() + d = getEmptyCol() # pylint: disable=unreachable # add a note f = d.newNote() f["Front"] = "one" diff --git a/pylib/tests/test_schedv2.py b/pylib/tests/test_schedv2.py index 6313a19cc..caec5383e 100644 --- a/pylib/tests/test_schedv2.py +++ b/pylib/tests/test_schedv2.py @@ -496,7 +496,7 @@ def test_button_spacing(): def test_overdue_lapse(): # disabled in commit 3069729776990980f34c25be66410e947e9d51a2 return - d = getEmptyCol() + d = getEmptyCol() # pylint: disable=unreachable # add a note f = d.newNote() f["Front"] = "one" @@ -622,28 +622,30 @@ def test_bury(): d.addNote(f) c2 = f.cards()[0] # burying - d.sched.buryCards([c.id], manual=True) + d.sched.buryCards([c.id], manual=True) # pylint: disable=unexpected-keyword-arg c.load() assert c.queue == -3 - d.sched.buryCards([c2.id], manual=False) + d.sched.buryCards([c2.id], manual=False) # pylint: disable=unexpected-keyword-arg c2.load() assert c2.queue == -2 d.reset() assert not d.sched.getCard() - d.sched.unburyCardsForDeck(type="manual") + d.sched.unburyCardsForDeck(type="manual") # pylint: disable=unexpected-keyword-arg c.load() assert c.queue == 0 c2.load() assert c2.queue == -2 - d.sched.unburyCardsForDeck(type="siblings") + d.sched.unburyCardsForDeck( # pylint: disable=unexpected-keyword-arg + type="siblings" + ) c2.load() assert c2.queue == 0 d.sched.buryCards([c.id, c2.id]) - d.sched.unburyCardsForDeck(type="all") + d.sched.unburyCardsForDeck(type="all") # pylint: disable=unexpected-keyword-arg d.reset() diff --git a/qt/Makefile b/qt/Makefile index f0e206355..85ad2c028 100644 --- a/qt/Makefile +++ b/qt/Makefile @@ -5,8 +5,8 @@ MAKEFLAGS += --warn-undefined-variables MAKEFLAGS += --no-builtin-rules .SUFFIXES: -BLACKARGS := -t py36 aqt tests --exclude='aqt/forms|buildinfo' -ISORTARGS := aqt tests +BLACKARGS := -t py36 aqt tests setup.py --exclude='aqt/forms|buildinfo' +ISORTARGS := aqt tests setup.py $(shell mkdir -p .build ../dist) @@ -78,7 +78,7 @@ CHECKDEPS := $(shell find aqt tests -name '*.py') @touch $@ .build/lint: $(CHECKDEPS) - pylint -j 0 --rcfile=.pylintrc -f colorized --extension-pkg-whitelist=PyQt5,ankirspy aqt + pylint -j 0 --rcfile=.pylintrc -f colorized --extension-pkg-whitelist=PyQt5,ankirspy aqt tests setup.py @touch $@ .build/imports: $(CHECKDEPS) diff --git a/qt/setup.py b/qt/setup.py index 7e24c73cc..15882991c 100644 --- a/qt/setup.py +++ b/qt/setup.py @@ -1,15 +1,19 @@ -import setuptools, sys, os +import os + +import setuptools with open("../meta/version") as fh: version = fh.read().strip() + def package_files(directory): entries = [] for (path, directories, filenames) in os.walk(directory): entries.append((path, [os.path.join(path, f) for f in filenames])) return entries -extra_files = package_files('aqt_data') + +extra_files = package_files("aqt_data") setuptools.setup( name="aqt", @@ -21,17 +25,16 @@ setuptools.setup( url="https://apps.ankiweb.net", packages=setuptools.find_packages(".", exclude=["tests"]), data_files=extra_files, - classifiers=[ - ], - python_requires='>=3.6', + classifiers=[], + python_requires=">=3.6", install_requires=[ - 'beautifulsoup4', - 'requests', - 'send2trash', - 'pyaudio', - 'markdown', - 'jsonschema', + "beautifulsoup4", + "requests", + "send2trash", + "pyaudio", + "markdown", + "jsonschema", 'psutil; sys.platform == "win32"', 'pywin32; sys.platform == "win32"', - ] + ], )