mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Make ThreadSafePrefs an instance of MutableMapping
So dict(prefs) works and th etest does not need to be changed
This commit is contained in:
parent
4e766ab401
commit
06a665012b
@ -7,6 +7,7 @@ __copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import os, traceback, weakref
|
||||
from polyglot.builtins import iteritems, zip
|
||||
from collections.abc import MutableMapping
|
||||
|
||||
from calibre import force_unicode, isbytestring
|
||||
from calibre.constants import preferred_encoding
|
||||
@ -52,7 +53,7 @@ def set_global_state(db):
|
||||
set_saved_searches(db, 'saved_searches')
|
||||
|
||||
|
||||
class ThreadSafePrefs:
|
||||
class ThreadSafePrefs(MutableMapping):
|
||||
|
||||
def __init__(self, db):
|
||||
self.db = weakref.ref(db)
|
||||
|
@ -189,7 +189,7 @@ class LegacyTest(BaseTest):
|
||||
db = self.init_old()
|
||||
newstag = ndb.new_api.get_item_id('tags', 'news')
|
||||
|
||||
self.assertEqual(dict(db.prefs), ndb.prefs.copy())
|
||||
self.assertEqual(dict(db.prefs), dict(ndb.prefs))
|
||||
|
||||
for meth, args in iteritems({
|
||||
'find_identical_books': [(Metadata('title one', ['author one']),), (Metadata('unknown'),), (Metadata('xxxx'),)],
|
||||
|
Loading…
x
Reference in New Issue
Block a user