mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2025-10-14 04:42:06 +00:00
Make mypy happy(er)
This commit is contained in:
parent
a051d8c4d0
commit
10ea2887a2
11 changed files with 31 additions and 20 deletions
5
build.py
5
build.py
|
@ -41,8 +41,11 @@ def create_addon_xml(config: dict, source: str, py_version: str) -> None:
|
|||
|
||||
# Populate dependencies in template
|
||||
dependencies = config['dependencies'].get(py_version)
|
||||
requires_el = root.find('requires')
|
||||
assert isinstance(requires_el, ET.Element), "Unable to find requires element in template"
|
||||
|
||||
for dep in dependencies:
|
||||
ET.SubElement(root.find('requires'), 'import', attrib=dep)
|
||||
ET.SubElement(requires_el, 'import', attrib=dep)
|
||||
|
||||
# Populate version string
|
||||
addon_version = config.get('version')
|
||||
|
|
|
@ -144,12 +144,12 @@ class Connect(object):
|
|||
|
||||
''' Save user info.
|
||||
'''
|
||||
self.user = client.jellyfin.get_user()
|
||||
settings('username', self.user['Name'])
|
||||
user = client.jellyfin.get_user()
|
||||
settings('username', user['Name'])
|
||||
|
||||
if 'PrimaryImageTag' in self.user:
|
||||
if 'PrimaryImageTag' in user:
|
||||
server_address = client.auth.get_server_info(client.auth.server_id)['address']
|
||||
window('JellyfinUserImage', api.API(self.user, server_address).get_user_artwork(self.user['Id']))
|
||||
window('JellyfinUserImage', api.API(user, server_address).get_user_artwork(user['Id']))
|
||||
|
||||
def select_servers(self, state=None):
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ from __future__ import division, absolute_import, print_function, unicode_litera
|
|||
##################################################################################################
|
||||
|
||||
import os
|
||||
from typing import List
|
||||
|
||||
from kodi_six import xbmcgui, xbmcaddon
|
||||
from six import ensure_text
|
||||
|
@ -27,7 +28,7 @@ USER_IMAGE = 150
|
|||
|
||||
class ContextMenu(xbmcgui.WindowXMLDialog):
|
||||
|
||||
_options = []
|
||||
_options: List[str] = []
|
||||
selected_option = None
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import division, absolute_import, print_function, unicode_literals
|
||||
|
||||
from typing import Any, Dict, List
|
||||
|
||||
##################################################################################################
|
||||
|
||||
from six import iteritems
|
||||
|
@ -32,7 +34,7 @@ MANUAL_SERVER = 206
|
|||
class ServerConnect(xbmcgui.WindowXMLDialog):
|
||||
|
||||
user_image = None
|
||||
servers = []
|
||||
servers: List[Dict[str, Any]] = []
|
||||
|
||||
_selected_server = None
|
||||
_connect_login = False
|
||||
|
|
|
@ -5,6 +5,7 @@ from __future__ import division, absolute_import, print_function, unicode_litera
|
|||
|
||||
from contextlib import contextmanager
|
||||
import datetime
|
||||
from typing import Any, Dict
|
||||
|
||||
from kodi_six import xbmc
|
||||
|
||||
|
@ -29,7 +30,7 @@ class FullSync(object):
|
|||
sync.libraries()
|
||||
'''
|
||||
# Borg - multiple instances, shared state
|
||||
_shared_state = {}
|
||||
_shared_state: Dict[str, Any] = {}
|
||||
sync = None
|
||||
running = False
|
||||
screensaver = None
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import division, absolute_import, print_function, unicode_literals
|
||||
|
||||
from typing import Any, Dict
|
||||
|
||||
#################################################################################################
|
||||
|
||||
from ..helper import has_attribute, LazyLogger
|
||||
|
@ -43,16 +45,15 @@ class Jellyfin(object):
|
|||
'''
|
||||
|
||||
# Borg - multiple instances, shared state
|
||||
_shared_state = {}
|
||||
client = {}
|
||||
server_id = "default"
|
||||
_shared_state: Dict[str, Any] = {}
|
||||
client: Dict[str, JellyfinClient] = {}
|
||||
server_id: str = "default"
|
||||
|
||||
def __init__(self, server_id=None):
|
||||
self.__dict__ = self._shared_state
|
||||
self.server_id = server_id or "default"
|
||||
|
||||
def get_client(self):
|
||||
# type: () -> JellyfinClient
|
||||
def get_client(self) -> JellyfinClient:
|
||||
return self.client[self.server_id]
|
||||
|
||||
def close(self):
|
||||
|
@ -71,7 +72,7 @@ class Jellyfin(object):
|
|||
for client in cls.client:
|
||||
cls.client[client].stop()
|
||||
|
||||
cls.client = {}
|
||||
cls.client.clear()
|
||||
LOG.info("---[ STOPPED ALL JELLYFINCLIENTS ]---")
|
||||
|
||||
@classmethod
|
||||
|
|
|
@ -8,6 +8,7 @@ import socket
|
|||
from datetime import datetime
|
||||
from operator import itemgetter
|
||||
import traceback
|
||||
from typing import Optional
|
||||
|
||||
import urllib3
|
||||
|
||||
|
@ -31,8 +32,7 @@ CONNECTION_STATE = {
|
|||
|
||||
class ConnectionManager(object):
|
||||
|
||||
user = {}
|
||||
server_id = None
|
||||
server_id: Optional[str] = None
|
||||
|
||||
def __init__(self, client):
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ from ..helper import LazyLogger, settings
|
|||
# If numpy is installed, the websockets library tries to use it, and then
|
||||
# kodi hard crashes for reasons I don't even want to pretend to understand
|
||||
import sys # noqa: E402,I100
|
||||
sys.modules['numpy'] = None
|
||||
sys.modules['numpy'] = None # type: ignore [assignment]
|
||||
import websocket # noqa: E402,I201
|
||||
|
||||
##################################################################################################
|
||||
|
|
|
@ -6,6 +6,7 @@ from __future__ import division, absolute_import, print_function, unicode_litera
|
|||
import binascii
|
||||
import json
|
||||
import threading
|
||||
from typing import List
|
||||
|
||||
from kodi_six import xbmc
|
||||
|
||||
|
@ -27,7 +28,7 @@ LOG = LazyLogger(__name__)
|
|||
|
||||
class Monitor(xbmc.Monitor):
|
||||
|
||||
servers = []
|
||||
servers: List[str] = []
|
||||
sleep = False
|
||||
|
||||
def __init__(self):
|
||||
|
|
|
@ -5,6 +5,7 @@ from __future__ import division, absolute_import, print_function, unicode_litera
|
|||
|
||||
import json
|
||||
import os
|
||||
from typing import Any, Dict
|
||||
|
||||
from six import iteritems, ensure_text
|
||||
|
||||
|
@ -20,7 +21,7 @@ LOG = LazyLogger(__name__)
|
|||
class Objects(object):
|
||||
|
||||
# Borg - multiple instances, shared state
|
||||
_shared_state = {}
|
||||
_shared_state: Dict[str, Any] = {}
|
||||
|
||||
def __init__(self):
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ from __future__ import division, absolute_import, print_function, unicode_litera
|
|||
#################################################################################################
|
||||
|
||||
import os
|
||||
from typing import Dict
|
||||
|
||||
from kodi_six import xbmc, xbmcvfs
|
||||
|
||||
|
@ -22,7 +23,7 @@ LOG = LazyLogger(__name__)
|
|||
|
||||
class Player(xbmc.Player):
|
||||
|
||||
played = {}
|
||||
played: Dict[str, dict] = {}
|
||||
up_next = False
|
||||
|
||||
def __init__(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue