mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-11-21 22:13:04 -05:00
27 lines
550 B
Python
27 lines
550 B
Python
#!/usr/bin/env python
|
|
# vim:fileencoding=utf-8
|
|
# License: GPL v3 Copyright: 2019, Kovid Goyal <kovid at kovidgoyal.net>
|
|
|
|
|
|
|
|
from polyglot.builtins import is_py3
|
|
|
|
if is_py3:
|
|
from plistlib import loads, dumps # noqa
|
|
|
|
def unwrap_bytes(x):
|
|
return x
|
|
|
|
def wrap_bytes(x):
|
|
return x
|
|
else:
|
|
from plistlib import readPlistFromString as loads, writePlistToString as dumps, Data # noqa
|
|
|
|
def unwrap_bytes(x):
|
|
if isinstance(x, Data):
|
|
x = x.data
|
|
return x
|
|
|
|
def wrap_bytes(x):
|
|
return Data(x)
|