Move imports in asterisk_mbox component (#27807)

This commit is contained in:
bouni 2019-10-18 02:08:58 +02:00 committed by Paulus Schoutsen
parent bb80d9bd16
commit 3cf7983e00
2 changed files with 8 additions and 7 deletions

View File

@ -1,6 +1,12 @@
"""Support for Asterisk Voicemail interface.""" """Support for Asterisk Voicemail interface."""
import logging import logging
from asterisk_mbox import Client as asteriskClient
from asterisk_mbox.commands import (
CMD_MESSAGE_CDR,
CMD_MESSAGE_CDR_AVAILABLE,
CMD_MESSAGE_LIST,
)
import voluptuous as vol import voluptuous as vol
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT
@ -51,7 +57,6 @@ class AsteriskData:
def __init__(self, hass, host, port, password, config): def __init__(self, hass, host, port, password, config):
"""Init the Asterisk data object.""" """Init the Asterisk data object."""
from asterisk_mbox import Client as asteriskClient
self.hass = hass self.hass = hass
self.config = config self.config = config
@ -76,11 +81,6 @@ class AsteriskData:
@callback @callback
def handle_data(self, command, msg): def handle_data(self, command, msg):
"""Handle changes to the mailbox.""" """Handle changes to the mailbox."""
from asterisk_mbox.commands import (
CMD_MESSAGE_LIST,
CMD_MESSAGE_CDR_AVAILABLE,
CMD_MESSAGE_CDR,
)
if command == CMD_MESSAGE_LIST: if command == CMD_MESSAGE_LIST:
_LOGGER.debug("AsteriskVM sent updated message list: Len %d", len(msg)) _LOGGER.debug("AsteriskVM sent updated message list: Len %d", len(msg))

View File

@ -1,6 +1,8 @@
"""Support for the Asterisk Voicemail interface.""" """Support for the Asterisk Voicemail interface."""
import logging import logging
from asterisk_mbox import ServerError
from homeassistant.components.mailbox import CONTENT_TYPE_MPEG, Mailbox, StreamError from homeassistant.components.mailbox import CONTENT_TYPE_MPEG, Mailbox, StreamError
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
@ -50,7 +52,6 @@ class AsteriskMailbox(Mailbox):
async def async_get_media(self, msgid): async def async_get_media(self, msgid):
"""Return the media blob for the msgid.""" """Return the media blob for the msgid."""
from asterisk_mbox import ServerError
client = self.hass.data[ASTERISK_DOMAIN].client client = self.hass.data[ASTERISK_DOMAIN].client
try: try: