mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Remove wrap/unwrap for bytes in plistlib not needed on py3
This commit is contained in:
parent
7f7204e6eb
commit
4ab24b8ea2
@ -363,25 +363,18 @@ class XMLConfig(dict):
|
||||
self.update(d)
|
||||
|
||||
def __getitem__(self, key):
|
||||
from polyglot.plistlib import unwrap_bytes
|
||||
try:
|
||||
ans = dict.__getitem__(self, key)
|
||||
return unwrap_bytes(ans)
|
||||
return dict.__getitem__(self, key)
|
||||
except KeyError:
|
||||
return self.defaults.get(key, None)
|
||||
|
||||
def get(self, key, default=None):
|
||||
from polyglot.plistlib import unwrap_bytes
|
||||
try:
|
||||
ans = dict.__getitem__(self, key)
|
||||
return unwrap_bytes(ans)
|
||||
return dict.__getitem__(self, key)
|
||||
except KeyError:
|
||||
return self.defaults.get(key, default)
|
||||
|
||||
def __setitem__(self, key, val):
|
||||
from polyglot.plistlib import wrap_bytes
|
||||
if isinstance(val, bytes):
|
||||
val = wrap_bytes(val)
|
||||
dict.__setitem__(self, key, val)
|
||||
self.commit()
|
||||
|
||||
|
@ -2,11 +2,5 @@
|
||||
# vim:fileencoding=utf-8
|
||||
# License: GPL v3 Copyright: 2019, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
|
||||
def unwrap_bytes(x):
|
||||
return x
|
||||
|
||||
def wrap_bytes(x):
|
||||
return x
|
||||
|
||||
from plistlib import loads, dumps, Data # noqa
|
||||
loads_binary_or_xml = loads
|
||||
|
Loading…
x
Reference in New Issue
Block a user