Inline MQTT paho imports (#29177)

* Inline MQTT paho imports

* Address comments

* Fix patch paths

* Move other imports inline

* Fix test
This commit is contained in:
Paulus Schoutsen 2019-12-02 11:32:02 -08:00 committed by GitHub
parent 1804c6edc5
commit ffaa0e572a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 17 deletions

View file

@ -4,8 +4,6 @@ import logging
import tempfile
import voluptuous as vol
from hbmqtt.broker import Broker, BrokerException
from passlib.apps import custom_app_context
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
import homeassistant.helpers.config_validation as cv
@ -37,6 +35,9 @@ def async_start(hass, password, server_config):
This method is a coroutine.
"""
# pylint: disable=import-outside-toplevel
from hbmqtt.broker import Broker, BrokerException
passwd = tempfile.NamedTemporaryFile()
gen_server_config, client_config = generate_config(hass, passwd, password)
@ -65,6 +66,9 @@ def async_start(hass, password, server_config):
def generate_config(hass, passwd, password):
"""Generate a configuration based on current Home Assistant instance."""
# pylint: disable=import-outside-toplevel
from passlib.apps import custom_app_context
config = {
"listeners": {
"default": {