Simplify boolean

This commit is contained in:
Brian Pepple 2020-09-27 11:10:51 -04:00 committed by Odd Stråbø
parent ba164d1358
commit b110f1cf13
9 changed files with 9 additions and 9 deletions

View file

@ -46,7 +46,7 @@ class Connect(object):
if server['Id'] == server_id:
credentials['Servers'] = [server]
server_select = True if server_id is None and not settings('SyncInstallRunDone.bool') else False
server_select = server_id is None and not settings('SyncInstallRunDone.bool')
new_credentials = self.register_client(credentials, options, server_id, server_select)
for server in servers:

View file

@ -41,7 +41,7 @@ class ContextMenu(xbmcgui.WindowXMLDialog):
self._options = options
def is_selected(self):
return True if self.selected_option else False
return bool(self.selected_option)
def get_selected(self):
return self.selected_option

View file

@ -40,7 +40,7 @@ class LoginManual(xbmcgui.WindowXMLDialog):
setattr(self, key, value)
def is_logged_in(self):
return True if self._user else False
return bool(self._user)
def get_user(self):
return self._user

View file

@ -31,7 +31,7 @@ class ResumeDialog(xbmcgui.WindowXMLDialog):
self._resume_point = time
def is_selected(self):
return True if self.selected_option is not None else False
return self.selected_option is not None
def get_selected(self):
return self.selected_option

View file

@ -48,7 +48,7 @@ class ServerConnect(xbmcgui.WindowXMLDialog):
setattr(self, key, value)
def is_server_selected(self):
return True if self._selected_server else False
return bool(self._selected_server)
def get_server(self):
return self._selected_server

View file

@ -48,7 +48,7 @@ class ServerManual(xbmcgui.WindowXMLDialog):
setattr(self, key, value)
def is_connected(self):
return True if self._server else False
return bool(self._server)
def get_server(self):
return self._server

View file

@ -39,7 +39,7 @@ class UsersConnect(xbmcgui.WindowXMLDialog):
setattr(self, key, value)
def is_user_selected(self):
return True if self._user else False
return bool(self._user)
def get_user(self):
return self._user

View file

@ -69,7 +69,7 @@ def validate_view(library_id, item_id):
LOG.exception(error)
return False
return True if len(result['Items']) else False
return bool(len(result['Items']))
def get_single_item(parent_id, media):

View file

@ -95,7 +95,7 @@ class Actions(object):
if choice is None:
raise Exception("User backed out of resume dialog.")
item["resumePlayback"] = False if not choice else True
item["resumePlayback"] = bool(choice)
if settings('enableCinema.bool') and not item["resumePlayback"]:
self._set_intros(item)