tidy up unused imports
This commit is contained in:
parent
6e077ab414
commit
ebdd8dae4b
@ -11,10 +11,11 @@ import stat
|
||||
import datetime
|
||||
import copy
|
||||
import traceback
|
||||
import json
|
||||
|
||||
from anki.lang import _, ngettext
|
||||
from anki.utils import ids2str, fieldChecksum, stripHTML, \
|
||||
intTime, splitFields, joinFields, maxID, json, devMode, stripHTMLMedia
|
||||
from anki.utils import ids2str, fieldChecksum, \
|
||||
intTime, splitFields, joinFields, maxID, devMode, stripHTMLMedia
|
||||
from anki.hooks import runFilter, runHook
|
||||
from anki.models import ModelManager
|
||||
from anki.media import MediaManager
|
||||
|
@ -2,7 +2,6 @@
|
||||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import os
|
||||
from anki.lang import _
|
||||
|
||||
# whether new cards should be mixed with reviews, or shown first or last
|
||||
|
@ -4,8 +4,9 @@
|
||||
|
||||
import copy, operator
|
||||
import unicodedata
|
||||
import json
|
||||
|
||||
from anki.utils import intTime, ids2str, json
|
||||
from anki.utils import intTime, ids2str
|
||||
from anki.hooks import runHook
|
||||
from anki.consts import *
|
||||
from anki.lang import _
|
||||
|
@ -3,9 +3,10 @@
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import re, os, zipfile, shutil, unicodedata
|
||||
import json
|
||||
|
||||
from anki.lang import _
|
||||
from anki.utils import ids2str, splitFields, json, namedtmp
|
||||
from anki.utils import ids2str, splitFields, namedtmp
|
||||
from anki.hooks import runHook
|
||||
from anki import Collection
|
||||
|
||||
|
@ -5,10 +5,9 @@
|
||||
import os
|
||||
import unicodedata
|
||||
from anki import Collection
|
||||
from anki.utils import intTime, splitFields, joinFields, incGuid
|
||||
from anki.utils import intTime, splitFields, joinFields
|
||||
from anki.importing.base import Importer
|
||||
from anki.lang import _
|
||||
from anki.lang import ngettext
|
||||
|
||||
GUID = 1
|
||||
MID = 2
|
||||
|
@ -4,7 +4,8 @@
|
||||
|
||||
import zipfile, os
|
||||
import unicodedata
|
||||
from anki.utils import tmpfile, json
|
||||
import json
|
||||
from anki.utils import tmpfile
|
||||
from anki.importing.anki2 import Anki2Importer
|
||||
|
||||
class AnkiPackageImporter(Anki2Importer):
|
||||
|
@ -2,7 +2,6 @@
|
||||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import codecs
|
||||
import csv
|
||||
import re
|
||||
|
||||
|
@ -9,9 +9,10 @@ import unicodedata
|
||||
import sys
|
||||
import zipfile
|
||||
import pathlib
|
||||
from io import StringIO
|
||||
import json
|
||||
import os
|
||||
|
||||
from anki.utils import checksum, isWin, isMac, json
|
||||
from anki.utils import checksum, isWin, isMac
|
||||
from anki.db import DB, DBError
|
||||
from anki.consts import *
|
||||
from anki.latex import mungeQA
|
||||
|
@ -2,9 +2,9 @@
|
||||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import copy, re
|
||||
import copy, re, json
|
||||
from anki.utils import intTime, joinFields, splitFields, ids2str,\
|
||||
checksum, json
|
||||
checksum
|
||||
from anki.lang import _
|
||||
from anki.consts import *
|
||||
from anki.hooks import runHook
|
||||
|
@ -4,9 +4,11 @@
|
||||
|
||||
import copy
|
||||
import re
|
||||
import json
|
||||
import os
|
||||
|
||||
from anki.lang import _
|
||||
from anki.utils import intTime, json, isWin
|
||||
from anki.utils import intTime, isWin
|
||||
from anki.db import DB
|
||||
from anki.collection import _Collection
|
||||
from anki.consts import *
|
||||
|
@ -6,9 +6,11 @@ import io
|
||||
import gzip
|
||||
import random
|
||||
import requests
|
||||
import json
|
||||
import os
|
||||
|
||||
from anki.db import DB, DBError
|
||||
from anki.utils import ids2str, intTime, json, platDesc, checksum, devMode
|
||||
from anki.utils import ids2str, intTime, platDesc, checksum, devMode
|
||||
from anki.consts import *
|
||||
from anki.utils import versionWithBuild
|
||||
from .hooks import runHook
|
||||
|
@ -10,7 +10,8 @@ tracked, so unused tags can only be removed from the list with a DB check.
|
||||
This module manages the tag cache and tags for notes.
|
||||
"""
|
||||
|
||||
from anki.utils import intTime, ids2str, json
|
||||
import json
|
||||
from anki.utils import intTime, ids2str
|
||||
from anki.hooks import runHook
|
||||
import re
|
||||
|
||||
|
@ -17,7 +17,6 @@ import locale
|
||||
from hashlib import sha1
|
||||
import platform
|
||||
import traceback
|
||||
import json
|
||||
from contextlib import contextmanager
|
||||
|
||||
from anki.lang import _, ngettext
|
||||
|
@ -9,7 +9,7 @@ from aqt.utils import saveGeom, restoreGeom, showWarning, askUser, shortcut, \
|
||||
tooltip, openHelp, addCloseShortcut, downArrow
|
||||
from anki.sound import clearAudioQueue
|
||||
from anki.hooks import addHook, remHook, runHook
|
||||
from anki.utils import stripHTMLMedia, htmlToTextLine, isMac
|
||||
from anki.utils import htmlToTextLine, isMac
|
||||
import aqt.editor, aqt.modelchooser, aqt.deckchooser
|
||||
|
||||
class AddCards(QDialog):
|
||||
|
@ -14,9 +14,9 @@ import json
|
||||
from aqt.qt import *
|
||||
import anki
|
||||
import aqt.forms
|
||||
from anki.utils import fmtTimeSpan, ids2str, stripHTMLMedia, htmlToTextLine, \
|
||||
from anki.utils import fmtTimeSpan, ids2str, htmlToTextLine, \
|
||||
isWin, intTime, \
|
||||
isMac, isLin, bodyClass
|
||||
isMac, bodyClass
|
||||
from aqt.utils import saveGeom, restoreGeom, saveSplitter, restoreSplitter, \
|
||||
saveHeader, restoreHeader, saveState, restoreState, getTag, \
|
||||
showInfo, askUser, tooltip, openHelp, showWarning, shortcut, mungeQA, \
|
||||
@ -25,7 +25,7 @@ from anki.lang import _
|
||||
from anki.hooks import runHook, addHook, remHook, runFilter
|
||||
from aqt.webview import AnkiWebView
|
||||
from anki.consts import *
|
||||
from anki.sound import playFromText, clearAudioQueue, allSounds, play
|
||||
from anki.sound import clearAudioQueue, allSounds, play
|
||||
|
||||
|
||||
# Data model
|
||||
|
@ -4,8 +4,8 @@
|
||||
|
||||
from aqt.qt import *
|
||||
from aqt.utils import askUser, getOnlyText, openLink, showWarning, shortcut, \
|
||||
openHelp, downArrow
|
||||
from anki.utils import isMac, ids2str, fmtTimeSpan
|
||||
openHelp
|
||||
from anki.utils import ids2str, fmtTimeSpan
|
||||
from anki.errors import DeckRenameError
|
||||
import aqt
|
||||
from anki.sound import clearAudioQueue
|
||||
|
@ -7,7 +7,7 @@ from anki.consts import NEW_CARDS_RANDOM
|
||||
from aqt.qt import *
|
||||
import aqt
|
||||
from aqt.utils import showInfo, showWarning, openHelp, getOnlyText, askUser, \
|
||||
tooltip, saveGeom, restoreGeom, downArrow
|
||||
tooltip, saveGeom, restoreGeom
|
||||
from anki.lang import _, ngettext
|
||||
|
||||
class DeckConf(QDialog):
|
||||
|
@ -2,10 +2,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import time, re, traceback
|
||||
import time, re
|
||||
from aqt.qt import *
|
||||
from anki.sync import AnkiRequestsClient
|
||||
from aqt.utils import showWarning
|
||||
from anki.hooks import addHook, remHook
|
||||
import aqt
|
||||
from anki.lang import _
|
||||
|
@ -2,25 +2,24 @@
|
||||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
import re
|
||||
import os
|
||||
import ctypes
|
||||
import urllib.request, urllib.parse, urllib.error
|
||||
import warnings
|
||||
import html
|
||||
import mimetypes
|
||||
import base64
|
||||
import unicodedata
|
||||
import json
|
||||
|
||||
from anki.lang import _
|
||||
from aqt.qt import *
|
||||
from anki.utils import stripHTML, isWin, isMac, namedtmp, json, stripHTMLMedia, \
|
||||
from anki.utils import isWin, namedtmp, stripHTMLMedia, \
|
||||
checksum
|
||||
import anki.sound
|
||||
from anki.hooks import runHook, runFilter, addHook
|
||||
from aqt.sound import getAudio
|
||||
from aqt.webview import AnkiWebView
|
||||
from aqt.utils import shortcut, showInfo, showWarning, getFile, \
|
||||
openHelp, tooltip, downArrow, qtMenuShortcutWorkaround
|
||||
openHelp, tooltip, qtMenuShortcutWorkaround
|
||||
import aqt
|
||||
from bs4 import BeautifulSoup
|
||||
import requests
|
||||
|
@ -6,7 +6,7 @@ import re
|
||||
|
||||
from aqt.qt import *
|
||||
import aqt
|
||||
from aqt.utils import getSaveFile, tooltip, showWarning, askUser, \
|
||||
from aqt.utils import getSaveFile, tooltip, showWarning, \
|
||||
checkInvalidFilename, showInfo
|
||||
from anki.exporting import exporters
|
||||
from anki.hooks import addHook, remHook
|
||||
|
@ -5,7 +5,6 @@
|
||||
from aqt.qt import *
|
||||
from anki.hooks import addHook, remHook, runHook
|
||||
from aqt.utils import shortcut
|
||||
import aqt
|
||||
from anki.lang import _
|
||||
|
||||
class ModelChooser(QHBoxLayout):
|
||||
|
@ -3,7 +3,6 @@
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
from aqt.utils import openLink, shortcut, tooltip, askUserDialog
|
||||
from anki.utils import isMac
|
||||
import aqt
|
||||
from anki.sound import clearAudioQueue
|
||||
from anki.lang import _
|
||||
|
@ -4,7 +4,7 @@
|
||||
# this file is imported as part of the bundling process to ensure certain
|
||||
# modules are included in the distribution
|
||||
|
||||
# pylint: disable=import-error
|
||||
# pylint: disable=import-error,unused-import
|
||||
|
||||
# required by requests library
|
||||
import queue
|
||||
|
@ -5,8 +5,7 @@
|
||||
import datetime, time
|
||||
from aqt.qt import *
|
||||
import anki.lang
|
||||
from aqt.utils import openFolder, showWarning, getText, openHelp, showInfo, \
|
||||
askUser
|
||||
from aqt.utils import openFolder, openHelp, showInfo, askUser
|
||||
import aqt
|
||||
from anki.lang import _
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
# - Saves in pickles rather than json to easily store Qt window state.
|
||||
# - Saves in sqlite rather than a flat file so the config can't be corrupted
|
||||
|
||||
import os
|
||||
import random
|
||||
import pickle
|
||||
import shutil
|
||||
@ -16,7 +15,7 @@ import re
|
||||
|
||||
from aqt.qt import *
|
||||
from anki.db import DB
|
||||
from anki.utils import isMac, isWin, intTime, checksum
|
||||
from anki.utils import isMac, isWin, intTime
|
||||
import anki.lang
|
||||
from aqt.utils import showWarning
|
||||
from aqt import appHelpSite
|
||||
@ -136,7 +135,7 @@ a flash drive.""" % self.base)
|
||||
def find_class(self, module, name):
|
||||
if module == "PyQt5.sip":
|
||||
try:
|
||||
import PyQt5.sip
|
||||
import PyQt5.sip # pylint: disable=unused-import
|
||||
except:
|
||||
# use old sip location
|
||||
module = "sip"
|
||||
|
@ -1,7 +1,8 @@
|
||||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
# fixme: make sure not to optimize imports on this file
|
||||
# make sure not to optimize imports on this file
|
||||
# pylint: disable=unused-import
|
||||
|
||||
import os
|
||||
|
||||
|
@ -7,10 +7,11 @@ import re
|
||||
import html
|
||||
import unicodedata as ucd
|
||||
import html.parser
|
||||
import json
|
||||
|
||||
from anki.lang import _, ngettext
|
||||
from aqt.qt import *
|
||||
from anki.utils import stripHTML, json, bodyClass
|
||||
from anki.utils import stripHTML, bodyClass
|
||||
from anki.hooks import addHook, runHook, runFilter
|
||||
from anki.sound import playFromText, clearAudioQueue, play
|
||||
from aqt.utils import mungeQA, tooltip, askUserDialog, \
|
||||
|
@ -2,11 +2,9 @@
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import time
|
||||
import traceback
|
||||
import gc
|
||||
|
||||
from aqt.qt import *
|
||||
import aqt
|
||||
from anki import Collection
|
||||
from anki.sync import Syncer, RemoteServer, FullSyncer, MediaSyncer, \
|
||||
RemoteMediaServer
|
||||
|
@ -6,8 +6,8 @@ import sys
|
||||
import math
|
||||
from anki.hooks import runHook
|
||||
from aqt.qt import *
|
||||
from aqt.utils import openLink, showWarning, tooltip
|
||||
from anki.utils import isMac, isWin, isLin, devMode
|
||||
from aqt.utils import openLink, tooltip
|
||||
from anki.utils import isMac, isWin, isLin
|
||||
from anki.lang import _
|
||||
|
||||
# Page for debug messages
|
||||
|
@ -30,7 +30,7 @@ do
|
||||
pyuic5 --from-imports $i -o $py.tmp
|
||||
(cat <<EOF; tail -n +3 $py.tmp) | perl -p -e 's/(QtGui\.QApplication\.)?_?translate\(".*?", /_(/; s/, None.*/))/' > $py
|
||||
# -*- coding: utf-8 -*-
|
||||
# pylint: disable=unsubscriptable-object
|
||||
# pylint: disable=unsubscriptable-object,unused-import
|
||||
from anki.lang import _
|
||||
EOF
|
||||
rm $py.tmp
|
||||
|
Loading…
Reference in New Issue
Block a user