Use pylint disable-next in MQTT (#66758)

This commit is contained in:
Erik Montnemery 2022-02-17 20:12:12 +01:00 committed by GitHub
parent 9d5dc2ce24
commit 750b48dcaf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 12 deletions

View file

@ -895,7 +895,7 @@ class MQTT:
async def async_connect(self) -> None:
"""Connect to the host. Does not process messages yet."""
# pylint: disable=import-outside-toplevel
# pylint: disable-next=import-outside-toplevel
import paho.mqtt.client as mqtt
result: int | None = None
@ -1000,7 +1000,7 @@ class MQTT:
Resubscribe to all topics we were subscribed to and publish birth
message.
"""
# pylint: disable=import-outside-toplevel
# pylint: disable-next=import-outside-toplevel
import paho.mqtt.client as mqtt
if result_code != mqtt.CONNACK_ACCEPTED:
@ -1159,7 +1159,7 @@ class MQTT:
def _raise_on_error(result_code: int | None) -> None:
"""Raise error if error result."""
# pylint: disable=import-outside-toplevel
# pylint: disable-next=import-outside-toplevel
import paho.mqtt.client as mqtt
if result_code is not None and result_code != 0:
@ -1169,7 +1169,7 @@ def _raise_on_error(result_code: int | None) -> None:
def _matcher_for_topic(subscription: str) -> Any:
# pylint: disable=import-outside-toplevel
# pylint: disable-next=import-outside-toplevel
from paho.mqtt.matcher import MQTTMatcher
matcher = MQTTMatcher()

View file

@ -313,7 +313,7 @@ class MQTTOptionsFlowHandler(config_entries.OptionsFlow):
def try_connection(broker, port, username, password, protocol="3.1"):
"""Test if we can connect to an MQTT broker."""
# pylint: disable=import-outside-toplevel
# pylint: disable-next=import-outside-toplevel
import paho.mqtt.client as mqtt
if protocol == "3.1":

View file

@ -228,13 +228,13 @@ async def async_start( # noqa: C901
if config_entries_key not in hass.data[CONFIG_ENTRY_IS_SETUP]:
if component == "device_automation":
# Local import to avoid circular dependencies
# pylint: disable=import-outside-toplevel
# pylint: disable-next=import-outside-toplevel
from . import device_automation
await device_automation.async_setup_entry(hass, config_entry)
elif component == "tag":
# Local import to avoid circular dependencies
# pylint: disable=import-outside-toplevel
# pylint: disable-next=import-outside-toplevel
from . import tag
await tag.async_setup_entry(hass, config_entry)

View file

@ -420,10 +420,7 @@ class MqttAvailability(Entity):
CONF_AVAILABILITY_TEMPLATE: avail.get(CONF_VALUE_TEMPLATE),
}
for (
topic, # pylint: disable=unused-variable
avail_topic_conf,
) in self._avail_topics.items():
for avail_topic_conf in self._avail_topics.values():
avail_topic_conf[CONF_AVAILABILITY_TEMPLATE] = MqttValueTemplate(
avail_topic_conf[CONF_AVAILABILITY_TEMPLATE],
entity=self,
@ -502,7 +499,7 @@ class MqttAvailability(Entity):
async def cleanup_device_registry(hass, device_id):
"""Remove device registry entry if there are no remaining entities or triggers."""
# Local import to avoid circular dependencies
# pylint: disable=import-outside-toplevel
# pylint: disable-next=import-outside-toplevel
from . import device_trigger, tag
device_registry = dr.async_get(hass)