mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
update to latest isort, pylint and pytest
This commit is contained in:
parent
20432ccecf
commit
603210149c
12 changed files with 20 additions and 17 deletions
|
@ -24,7 +24,7 @@ endif
|
||||||
.DELETE_ON_ERROR:
|
.DELETE_ON_ERROR:
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
BLACKARGS := -t py36 anki tests setup.py tools/*.py --exclude='_pb2|buildinfo|_gen'
|
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)
|
$(shell mkdir -p .build ../dist)
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ from anki.tags import TagManager
|
||||||
from anki.utils import devMode, ids2str, intTime
|
from anki.utils import devMode, ids2str, intTime
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from anki.rsbackend import TRValue, FormatTimeSpanContextValue
|
from anki.rsbackend import FormatTimeSpanContextValue, TRValue
|
||||||
|
|
||||||
|
|
||||||
class Collection:
|
class Collection:
|
||||||
|
|
|
@ -307,7 +307,9 @@ class SupermemoXmlImporter(NoteImporter):
|
||||||
return sys.stdin
|
return sys.stdin
|
||||||
|
|
||||||
# try to open with urllib (if source is http, ftp, or file URL)
|
# 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:
|
try:
|
||||||
return urllib.request.urlopen(source)
|
return urllib.request.urlopen(source)
|
||||||
|
|
|
@ -386,7 +386,7 @@ class TimedLog:
|
||||||
|
|
||||||
|
|
||||||
def versionWithBuild() -> str:
|
def versionWithBuild() -> str:
|
||||||
from anki.buildinfo import version, buildhash
|
from anki.buildinfo import buildhash, version
|
||||||
|
|
||||||
return "%s (%s)" % (version, buildhash)
|
return "%s (%s)" % (version, buildhash)
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,5 @@ wheel
|
||||||
mypy
|
mypy
|
||||||
mypy_protobuf>=1.21
|
mypy_protobuf>=1.21
|
||||||
black
|
black
|
||||||
# fixme: remove pin when https://github.com/pytest-dev/pytest/issues/7558 closed
|
pytest>=6.0.1
|
||||||
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
|
|
||||||
stringcase==1.2.0
|
stringcase==1.2.0
|
||||||
|
|
|
@ -27,7 +27,7 @@ endif
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
|
|
||||||
BLACKARGS := -t py36 aqt tests setup.py tools/*.py --exclude='aqt/forms|buildinfo|colors'
|
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)
|
$(shell mkdir -p .build ../dist)
|
||||||
|
|
||||||
|
|
|
@ -500,7 +500,7 @@ section of the manual, and ensure that location is not read-only.""",
|
||||||
QApplication.setAttribute(Qt.AA_DisableWindowContextHelpButton)
|
QApplication.setAttribute(Qt.AA_DisableWindowContextHelpButton)
|
||||||
|
|
||||||
# proxy configured?
|
# proxy configured?
|
||||||
from urllib.request import proxy_bypass, getproxies
|
from urllib.request import getproxies, proxy_bypass
|
||||||
|
|
||||||
disable_proxies = False
|
disable_proxies = False
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -1450,7 +1450,8 @@ will be lost. Continue?"""
|
||||||
sys.stdout = self._oldStdout
|
sys.stdout = self._oldStdout
|
||||||
|
|
||||||
def _card_repr(self, card: anki.cards.Card) -> None:
|
def _card_repr(self, card: anki.cards.Card) -> None:
|
||||||
import pprint, copy
|
import copy
|
||||||
|
import pprint
|
||||||
|
|
||||||
if not card:
|
if not card:
|
||||||
print("no card")
|
print("no card")
|
||||||
|
@ -1499,7 +1500,8 @@ will be lost. Continue?"""
|
||||||
self.onDebugRet(frm)
|
self.onDebugRet(frm)
|
||||||
|
|
||||||
def onDebugRet(self, frm):
|
def onDebugRet(self, frm):
|
||||||
import pprint, traceback
|
import pprint
|
||||||
|
import traceback
|
||||||
|
|
||||||
text = frm.text.toPlainText()
|
text = frm.text.toPlainText()
|
||||||
card = self._debugCard
|
card = self._debugCard
|
||||||
|
|
|
@ -68,7 +68,10 @@ class MPVTimeoutError(MPVError):
|
||||||
|
|
||||||
if isWin:
|
if isWin:
|
||||||
# pylint: disable=import-error
|
# 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:
|
class MPVBase:
|
||||||
|
|
|
@ -31,8 +31,8 @@ from anki.utils import isLin, isWin
|
||||||
# external module access in Windows
|
# external module access in Windows
|
||||||
if isWin:
|
if isWin:
|
||||||
import pythoncom
|
import pythoncom
|
||||||
import win32com
|
|
||||||
import pywintypes
|
import pywintypes
|
||||||
|
import win32com
|
||||||
|
|
||||||
if isLin:
|
if isLin:
|
||||||
import fcntl
|
import fcntl
|
||||||
|
|
|
@ -141,7 +141,7 @@ class ProfileManager:
|
||||||
shutil.move(oldBase, self.base)
|
shutil.move(oldBase, self.base)
|
||||||
|
|
||||||
def _tryToMigrateFolder(self, oldBase):
|
def _tryToMigrateFolder(self, oldBase):
|
||||||
from PyQt5 import QtWidgets, QtGui
|
from PyQt5 import QtGui, QtWidgets
|
||||||
|
|
||||||
app = QtWidgets.QApplication([])
|
app = QtWidgets.QApplication([])
|
||||||
icon = QtGui.QIcon()
|
icon = QtGui.QIcon()
|
||||||
|
|
|
@ -753,6 +753,7 @@ def qtMenuShortcutWorkaround(qmenu):
|
||||||
def supportText():
|
def supportText():
|
||||||
import platform
|
import platform
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from aqt import mw
|
from aqt import mw
|
||||||
|
|
||||||
if isWin:
|
if isWin:
|
||||||
|
|
Loading…
Reference in a new issue