refactoring

This commit is contained in:
St.Huang 2018-07-14 21:37:21 +08:00
parent d7e01295f4
commit 5b511de9e7
2 changed files with 3 additions and 8 deletions

View File

@ -19,8 +19,6 @@
import inspect import inspect
import os import os
import sys
import types
# use ntpath module to ensure the windows-style (e.g. '\\LDOCE.css') # use ntpath module to ensure the windows-style (e.g. '\\LDOCE.css')
# path can be processed on Unix platform. # path can be processed on Unix platform.
# However, anki version on mac platforms doesn't including this package? # However, anki version on mac platforms doesn't including this package?
@ -193,6 +191,7 @@ class Service(object):
if self._exporters else (None, None) if self._exporters else (None, None)
# query interval: default 500ms # query interval: default 500ms
self.query_interval = 0.5 self.query_interval = 0.5
self.word = ''
def cache_this(self, result): def cache_this(self, result):
self.cache[self.word].update(result) self.cache[self.word].update(result)
@ -291,7 +290,7 @@ class WebService(Service):
socket.setdefaulttimeout(timeout) socket.setdefaulttimeout(timeout)
try: try:
return urllib.urlretrieve(url, filename) return urllib.urlretrieve(url, filename)
except Exception as e: except:
pass pass
class TinyDownloadError(ValueError): class TinyDownloadError(ValueError):

View File

@ -19,15 +19,11 @@
import inspect import inspect
import os import os
from functools import wraps
from hashlib import md5 from hashlib import md5
from aqt import mw
from aqt.qt import QThread
from aqt.utils import showInfo
from .base import LocalService, MdxService, StardictService, WebService, service_wrap from .base import LocalService, MdxService, StardictService, WebService, service_wrap
from ..context import config from ..context import config
from ..utils import MapDict, importlib from ..utils import importlib
class ServiceManager(object): class ServiceManager(object):