update to latest isort, pylint and pytest

This commit is contained in:
Damien Elmes 2020-08-31 12:05:36 +10:00
parent 20432ccecf
commit 603210149c
12 changed files with 20 additions and 17 deletions

View file

@ -24,7 +24,7 @@ endif
.DELETE_ON_ERROR:
.SUFFIXES:
BLACKARGS := -t py36 anki tests setup.py tools/*.py --exclude='_pb2|buildinfo|_gen'
ISORTARGS := anki tests setup.py
ISORTARGS := --profile black anki tests setup.py
$(shell mkdir -p .build ../dist)

View file

@ -33,7 +33,7 @@ from anki.tags import TagManager
from anki.utils import devMode, ids2str, intTime
if TYPE_CHECKING:
from anki.rsbackend import TRValue, FormatTimeSpanContextValue
from anki.rsbackend import FormatTimeSpanContextValue, TRValue
class Collection:

View file

@ -307,7 +307,9 @@ class SupermemoXmlImporter(NoteImporter):
return sys.stdin
# try to open with urllib (if source is http, ftp, or file URL)
import urllib.request, urllib.parse, urllib.error
import urllib.error
import urllib.parse
import urllib.request
try:
return urllib.request.urlopen(source)

View file

@ -386,7 +386,7 @@ class TimedLog:
def versionWithBuild() -> str:
from anki.buildinfo import version, buildhash
from anki.buildinfo import buildhash, version
return "%s (%s)" % (version, buildhash)

View file

@ -2,10 +2,5 @@ wheel
mypy
mypy_protobuf>=1.21
black
# fixme: remove pin when https://github.com/pytest-dev/pytest/issues/7558 closed
pytest<6
# fixme: when isort 5.0 is released, switch to pypi
git+https://github.com/ankitects/isort#egg=isort
# fixme: when pylint supports isort 5.0, switch to pypi
git+https://github.com/ankitects/pylint#egg=pylint
pytest>=6.0.1
stringcase==1.2.0

View file

@ -27,7 +27,7 @@ endif
.SUFFIXES:
BLACKARGS := -t py36 aqt tests setup.py tools/*.py --exclude='aqt/forms|buildinfo|colors'
ISORTARGS := aqt tests setup.py
ISORTARGS := --profile black aqt tests setup.py
$(shell mkdir -p .build ../dist)

View file

@ -500,7 +500,7 @@ section of the manual, and ensure that location is not read-only.""",
QApplication.setAttribute(Qt.AA_DisableWindowContextHelpButton)
# proxy configured?
from urllib.request import proxy_bypass, getproxies
from urllib.request import getproxies, proxy_bypass
disable_proxies = False
try:

View file

@ -1450,7 +1450,8 @@ will be lost. Continue?"""
sys.stdout = self._oldStdout
def _card_repr(self, card: anki.cards.Card) -> None:
import pprint, copy
import copy
import pprint
if not card:
print("no card")
@ -1499,7 +1500,8 @@ will be lost. Continue?"""
self.onDebugRet(frm)
def onDebugRet(self, frm):
import pprint, traceback
import pprint
import traceback
text = frm.text.toPlainText()
card = self._debugCard

View file

@ -68,7 +68,10 @@ class MPVTimeoutError(MPVError):
if isWin:
# pylint: disable=import-error
import win32file, win32pipe, pywintypes, winerror # pytype: disable=import-error
import pywintypes
import win32file # pytype: disable=import-error
import win32pipe
import winerror
class MPVBase:

View file

@ -31,8 +31,8 @@ from anki.utils import isLin, isWin
# external module access in Windows
if isWin:
import pythoncom
import win32com
import pywintypes
import win32com
if isLin:
import fcntl

View file

@ -141,7 +141,7 @@ class ProfileManager:
shutil.move(oldBase, self.base)
def _tryToMigrateFolder(self, oldBase):
from PyQt5 import QtWidgets, QtGui
from PyQt5 import QtGui, QtWidgets
app = QtWidgets.QApplication([])
icon = QtGui.QIcon()

View file

@ -753,6 +753,7 @@ def qtMenuShortcutWorkaround(qmenu):
def supportText():
import platform
import time
from aqt import mw
if isWin: