mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
More PyLint fixes
This commit is contained in:
parent
5023772b3e
commit
7ba9fb90f1
@ -7,11 +7,12 @@ For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/camera.foscam/
|
||||
"""
|
||||
import logging
|
||||
from homeassistant.helpers import validate_config
|
||||
from homeassistant.components.camera import DOMAIN
|
||||
from homeassistant.components.camera import Camera
|
||||
|
||||
import requests
|
||||
|
||||
from homeassistant.helpers import validate_config
|
||||
from homeassistant.components.camera import DOMAIN, Camera
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -8,6 +8,8 @@ https://home-assistant.io/components/media_player.itunes/
|
||||
"""
|
||||
import logging
|
||||
|
||||
import requests
|
||||
|
||||
from homeassistant.components.media_player import (
|
||||
MediaPlayerDevice, MEDIA_TYPE_MUSIC, MEDIA_TYPE_PLAYLIST, SUPPORT_PAUSE,
|
||||
SUPPORT_SEEK, SUPPORT_VOLUME_SET, SUPPORT_VOLUME_MUTE,
|
||||
@ -17,8 +19,6 @@ from homeassistant.components.media_player import (
|
||||
from homeassistant.const import (
|
||||
STATE_IDLE, STATE_PLAYING, STATE_PAUSED, STATE_OFF, STATE_ON)
|
||||
|
||||
import requests
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
SUPPORT_ITUNES = SUPPORT_PAUSE | SUPPORT_VOLUME_SET | SUPPORT_VOLUME_MUTE | \
|
||||
|
@ -15,11 +15,6 @@ from homeassistant.components.media_player import (
|
||||
from homeassistant.const import (
|
||||
STATE_IDLE, STATE_PLAYING, STATE_PAUSED, STATE_OFF)
|
||||
|
||||
try:
|
||||
import jsonrpc_requests
|
||||
except ImportError:
|
||||
jsonrpc_requests = None
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
REQUIREMENTS = ['jsonrpc-requests==0.1']
|
||||
|
||||
@ -31,11 +26,6 @@ SUPPORT_KODI = SUPPORT_PAUSE | SUPPORT_VOLUME_SET | SUPPORT_VOLUME_MUTE | \
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
""" Sets up the kodi platform. """
|
||||
|
||||
global jsonrpc_requests # pylint: disable=invalid-name
|
||||
if jsonrpc_requests is None:
|
||||
import jsonrpc_requests as jsonrpc_requests_
|
||||
jsonrpc_requests = jsonrpc_requests_
|
||||
|
||||
add_devices([
|
||||
KodiDevice(
|
||||
config.get('name', 'Kodi'),
|
||||
@ -60,6 +50,7 @@ class KodiDevice(MediaPlayerDevice):
|
||||
# pylint: disable=too-many-public-methods
|
||||
|
||||
def __init__(self, name, url, auth=None):
|
||||
import jsonrpc_requests
|
||||
self._name = name
|
||||
self._url = url
|
||||
self._server = jsonrpc_requests.Server(url, auth=auth)
|
||||
@ -77,6 +68,7 @@ class KodiDevice(MediaPlayerDevice):
|
||||
|
||||
def _get_players(self):
|
||||
""" Returns the active player objects or None """
|
||||
import jsonrpc_requests
|
||||
try:
|
||||
return self._server.Player.GetActivePlayers()
|
||||
except jsonrpc_requests.jsonrpc.TransportError:
|
||||
|
Loading…
x
Reference in New Issue
Block a user