Remove wrap/unwrap for bytes in plistlib not needed on py3

This commit is contained in:
Kovid Goyal 2020-07-14 09:16:25 +05:30
parent 7f7204e6eb
commit 4ab24b8ea2
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 2 additions and 15 deletions

View File

@ -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()

View File

@ -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