Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move imports to top for gpmdp #29413

Merged
merged 1 commit into from
Dec 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 2 additions & 6 deletions homeassistant/components/gpmdp/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
import time

import voluptuous as vol
from websocket import _exceptions, create_connection

from homeassistant.components.media_player import MediaPlayerDevice, PLATFORM_SCHEMA
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
from homeassistant.components.media_player.const import (
MEDIA_TYPE_MUSIC,
SUPPORT_NEXT_TRACK,
Expand Down Expand Up @@ -65,8 +66,6 @@ def request_configuration(hass, config, url, add_entities_callback):
)

return
from websocket import create_connection

websocket = create_connection((url), timeout=1)
websocket.send(
json.dumps(
Expand All @@ -81,7 +80,6 @@ def request_configuration(hass, config, url, add_entities_callback):
def gpmdp_configuration_callback(callback_data):
"""Handle configuration changes."""
while True:
from websocket import _exceptions

try:
msg = json.loads(websocket.recv())
Expand Down Expand Up @@ -174,7 +172,6 @@ class GPMDP(MediaPlayerDevice):

def __init__(self, name, url, code):
"""Initialize the media player."""
from websocket import create_connection

self._connection = create_connection
self._url = url
Expand Down Expand Up @@ -210,7 +207,6 @@ def get_ws(self):

def send_gpmdp_msg(self, namespace, method, with_id=True):
"""Send ws messages to GPMDP and verify request id in response."""
from websocket import _exceptions

try:
websocket = self.get_ws()
Expand Down