Fix flake8 E721

This commit is contained in:
Odd Stråbø 2024-06-10 15:40:09 +00:00
parent 6a99d8ef4b
commit 415fa8ce97
5 changed files with 12 additions and 8 deletions

View file

@ -619,7 +619,7 @@ def browse(media, view_id=None, folder=None, server_id=None, api_client=None):
actions = Actions(server_id, api_client) actions = Actions(server_id, api_client)
list_li = [] list_li = []
listing = listing if type(listing) == list else listing.get("Items", []) listing = listing if isinstance(listing, list) else listing.get("Items", [])
for item in listing: for item in listing:

View file

@ -16,7 +16,7 @@ LOG = LazyLogger(__name__)
def translate(string): def translate(string):
"""Get add-on string. Returns in unicode.""" """Get add-on string. Returns in unicode."""
if type(string) != int: if not isinstance(string, int):
string = STRINGS[string] string = STRINGS[string]
result = xbmcaddon.Addon("plugin.video.jellyfin").getLocalizedString(string) result = xbmcaddon.Addon("plugin.video.jellyfin").getLocalizedString(string)

View file

@ -26,7 +26,7 @@ def progress(message=None):
dialog = xbmcgui.DialogProgressBG() dialog = xbmcgui.DialogProgressBG()
if item and type(item) == dict: if item and isinstance(item, dict):
dialog.create( dialog.create(
translate("addon_name"), translate("addon_name"),
@ -74,7 +74,7 @@ def jellyfin_item(func):
def wrapper(self, item, *args, **kwargs): def wrapper(self, item, *args, **kwargs):
e_item = self.jellyfin_db.get_item_by_id( e_item = self.jellyfin_db.get_item_by_id(
item["Id"] if type(item) == dict else item item["Id"] if isinstance(item, dict) else item
) )
return func(self, item, e_item=e_item, *args, **kwargs) return func(self, item, e_item=e_item, *args, **kwargs)

View file

@ -104,7 +104,7 @@ class Objects(object):
if obj_key: if obj_key:
obj = ( obj = (
[d[obj_key] for d in obj if d.get(obj_key)] [d[obj_key] for d in obj if d.get(obj_key)]
if type(obj) == list if isinstance(obj, list)
else obj.get(obj_key) else obj.get(obj_key)
) )

View file

@ -444,7 +444,7 @@ class Views(object):
etree.SubElement(xml, "content") etree.SubElement(xml, "content")
label = xml.find("label") label = xml.find("label")
label.text = str(name) if type(name) == int else name label.text = str(name) if isinstance(name, int) else name
content = xml.find("content") content = xml.find("content")
content.text = view["Media"] content.text = view["Media"]
@ -847,7 +847,9 @@ class Views(object):
else: else:
window_path = "ActivateWindow(Videos,%s,return)" % path window_path = "ActivateWindow(Videos,%s,return)" % path
node_label = translate(node_label) if type(node_label) == int else node_label node_label = (
translate(node_label) if isinstance(node_label, int) else node_label
)
node_label = node_label or view["Name"] node_label = node_label or view["Name"]
if node in ("all", "music"): if node in ("all", "music"):
@ -896,7 +898,9 @@ class Views(object):
else: else:
window_path = "ActivateWindow(Videos,%s,return)" % path window_path = "ActivateWindow(Videos,%s,return)" % path
node_label = translate(node_label) if type(node_label) == int else node_label node_label = (
translate(node_label) if isinstance(node_label, int) else node_label
)
node_label = node_label or view["Name"] node_label = node_label or view["Name"]
if node == "all": if node == "all":