From 5045ddc04b118da4150d0657bf63089c5bd46660 Mon Sep 17 00:00:00 2001 From: blacktwin Date: Tue, 28 Jul 2020 11:13:51 -0400 Subject: [PATCH] removed deprecated _str function as py2 support has been dropped update _str references to use builin str instead update settings.Preferences class for py2 drop --- plexapi/settings.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/plexapi/settings.py b/plexapi/settings.py index aec215840..a62460bdf 100644 --- a/plexapi/settings.py +++ b/plexapi/settings.py @@ -101,12 +101,11 @@ class Setting(PlexObject): """ _bool_cast = lambda x: True if x == 'true' or x == '1' else False _bool_str = lambda x: str(x).lower() - _str = lambda x: str(x).encode('utf-8') TYPES = { 'bool': {'type': bool, 'cast': _bool_cast, 'tostr': _bool_str}, - 'double': {'type': float, 'cast': float, 'tostr': _str}, - 'int': {'type': int, 'cast': int, 'tostr': _str}, - 'text': {'type': str, 'cast': _str, 'tostr': _str}, + 'double': {'type': float, 'cast': float, 'tostr': str}, + 'int': {'type': int, 'cast': int, 'tostr': str}, + 'text': {'type': str, 'cast': str, 'tostr': str}, } def _loadData(self, data): @@ -171,8 +170,5 @@ class Preferences(Setting): def _default(self): """ Set the default value for this setting.""" key = '%s/prefs?' % self._initpath - if self.type == 'int': - url = key + '%s=%s' % (self.id, self.default) - else: - url = key + '%s=%s' % (self.id, self.default.decode()) + url = key + '%s=%s' % (self.id, self.default) self._server.query(url, method=self._server._session.put)