mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-26 02:36:10 +00:00
Merge pull request #879 from oddstr13/pr-flake8-3
Enable flake8 pre-commit
This commit is contained in:
commit
6a072cc71b
7 changed files with 20 additions and 13 deletions
|
@ -20,10 +20,12 @@ repos:
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
|
|
||||||
# - repo: https://github.com/pycqa/flake8
|
- repo: https://github.com/pycqa/flake8
|
||||||
# rev: 7.0.0
|
rev: 7.0.0
|
||||||
# hooks:
|
hooks:
|
||||||
# - id: flake8
|
- id: flake8
|
||||||
|
additional_dependencies:
|
||||||
|
- flake8-import-order
|
||||||
|
|
||||||
# - repo: https://github.com/pre-commit/mirrors-mypy
|
# - repo: https://github.com/pre-commit/mirrors-mypy
|
||||||
# rev: v1.9.0
|
# rev: v1.9.0
|
||||||
|
|
|
@ -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:
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -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":
|
||||||
|
|
3
tox.ini
3
tox.ini
|
@ -1,9 +1,10 @@
|
||||||
[flake8]
|
[flake8]
|
||||||
max-line-length = 9999
|
max-line-length = 9999
|
||||||
import-order-style = pep8
|
import-order-style = pep8
|
||||||
exclude = .git,.vscode,libraries,build.py,.github
|
exclude = .git,.vscode
|
||||||
extend-ignore =
|
extend-ignore =
|
||||||
I202
|
I202
|
||||||
|
E203
|
||||||
per-file-ignores =
|
per-file-ignores =
|
||||||
*/__init__.py: F401
|
*/__init__.py: F401
|
||||||
tests/test_imports.py: F401
|
tests/test_imports.py: F401
|
||||||
|
|
Loading…
Reference in a new issue