mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
add black, update for new isort
people updating from a previous build, make sure you run pip install --reinstall requirements.check
This commit is contained in:
parent
b51cf71d35
commit
9ebc15c748
5 changed files with 28 additions and 6 deletions
|
@ -1,2 +1,8 @@
|
||||||
[settings]
|
[settings]
|
||||||
skip=aqt/forms
|
skip=aqt/forms
|
||||||
|
multi_line_output=3
|
||||||
|
include_trailing_comma=True
|
||||||
|
force_grid_wrap=0
|
||||||
|
use_parentheses=True
|
||||||
|
line_length=88
|
||||||
|
ensure_newline_before_comments=true
|
||||||
|
|
19
Makefile
19
Makefile
|
@ -7,6 +7,7 @@ MAKEFLAGS += --warn-undefined-variables
|
||||||
MAKEFLAGS += --no-builtin-rules
|
MAKEFLAGS += --no-builtin-rules
|
||||||
RUNARGS :=
|
RUNARGS :=
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
|
BLACKARGS := -t py36 anki aqt
|
||||||
|
|
||||||
$(shell mkdir -p .build)
|
$(shell mkdir -p .build)
|
||||||
|
|
||||||
|
@ -112,7 +113,7 @@ run: build
|
||||||
######################
|
######################
|
||||||
|
|
||||||
.PHONY: check
|
.PHONY: check
|
||||||
check: mypy pyimports pytest pylint checkpretty
|
check: mypy pyimports pyfmt pytest pylint checkpretty
|
||||||
|
|
||||||
# Checking python
|
# Checking python
|
||||||
######################
|
######################
|
||||||
|
@ -132,24 +133,32 @@ PYCHECKDEPS := $(BUILDDEPS) .build/pycheckreqs $(shell find anki aqt -name '*.py
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
.build/pyimports: $(PYCHECKDEPS)
|
.build/pyimports: $(PYCHECKDEPS)
|
||||||
isort -rc anki aqt --check # if this fails, run 'make fixpyimports'
|
isort anki aqt --check # if this fails, run 'make fixpyimports'
|
||||||
|
touch $@
|
||||||
|
|
||||||
|
.build/pyfmt: $(PYCHECKDEPS)
|
||||||
|
black --check $(BLACKARGS) # if this fails, run 'make fixpyfmt'
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
.build/pytype: $(PYCHECKDEPS) .build/pytypereqs
|
.build/pytype: $(PYCHECKDEPS) .build/pytypereqs
|
||||||
pytype --config pytype.conf
|
pytype --config pytype.conf
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
.PHONY: mypy pytest pylint pytype pyimports fixpyimports
|
.PHONY: mypy pytest pylint pytype pyimports pyfmt
|
||||||
mypy: .build/mypy
|
mypy: .build/mypy
|
||||||
pytest: .build/pytest
|
pytest: .build/pytest
|
||||||
pylint: .build/pylint
|
pylint: .build/pylint
|
||||||
pytype: .build/pytype
|
pytype: .build/pytype
|
||||||
pyimports: .build/pyimports
|
pyimports: .build/pyimports
|
||||||
|
pyfmt: .build/pyfmt
|
||||||
|
|
||||||
.PHONY: fixpyimports
|
.PHONY: fixpyimports fixpyfmt
|
||||||
|
|
||||||
fixpyimports:
|
fixpyimports:
|
||||||
isort -rc anki aqt
|
isort anki aqt
|
||||||
|
|
||||||
|
fixpyfmt:
|
||||||
|
black $(BLACKARGS) anki aqt
|
||||||
|
|
||||||
# Checking typescript
|
# Checking typescript
|
||||||
######################
|
######################
|
||||||
|
|
|
@ -12,5 +12,8 @@ if sys.version_info[0] < 3 or sys.version_info[1] < 5:
|
||||||
if sys.getfilesystemencoding().lower() in ("ascii", "ansi_x3.4-1968"):
|
if sys.getfilesystemencoding().lower() in ("ascii", "ansi_x3.4-1968"):
|
||||||
raise Exception("Anki requires a UTF-8 locale.")
|
raise Exception("Anki requires a UTF-8 locale.")
|
||||||
|
|
||||||
|
# fmt: off
|
||||||
version="2.1.17" # build scripts grep this line, so preserve formatting
|
version="2.1.17" # build scripts grep this line, so preserve formatting
|
||||||
|
# fmt: on
|
||||||
|
|
||||||
__all__ = ["Collection"]
|
__all__ = ["Collection"]
|
||||||
|
|
|
@ -9,10 +9,12 @@
|
||||||
# included implicitly in the past, and relied upon by some add-ons
|
# included implicitly in the past, and relied upon by some add-ons
|
||||||
import cgi
|
import cgi
|
||||||
import decimal
|
import decimal
|
||||||
|
|
||||||
# useful for add-ons
|
# useful for add-ons
|
||||||
import logging
|
import logging
|
||||||
import logging.config
|
import logging.config
|
||||||
import logging.handlers
|
import logging.handlers
|
||||||
|
|
||||||
# required by requests library
|
# required by requests library
|
||||||
import queue
|
import queue
|
||||||
import typing
|
import typing
|
||||||
|
|
|
@ -2,4 +2,6 @@ nose
|
||||||
mock
|
mock
|
||||||
mypy==0.750
|
mypy==0.750
|
||||||
pylint
|
pylint
|
||||||
isort
|
# fixme: when isort 5.0 is released, switch to pypy
|
||||||
|
git+https://github.com/dae/isort
|
||||||
|
black
|
||||||
|
|
Loading…
Reference in a new issue