Move imports in raspihats component (#28088)

* Move imports in raspihats component

* Comment require

* Disable pylint for import-error

* Revert move imports

* Remove unnecessary pylint disable error

* Update homeassistant/components/raspihats/__init__.py

Co-Authored-By: cgtobi <cgtobi@users.noreply.github.com>

* Apply suggestions from code review

Co-Authored-By: cgtobi <cgtobi@users.noreply.github.com>
This commit is contained in:
Diefferson Koderer Môroandcgtobi authored and Paulus Schoutsen committed 2019-10-23 08:53:05 -07:00
1 parent 14be60e5bf
commit 4d8539e151
1 file changed
+15 -5
+15 -5
View File
@@ -120,7 +120,9 @@ class I2CHatsManager(threading.Thread):
with self._lock:
i2c_hat = self._i2c_hats.get(address)
if i2c_hat is None:
# pylint: disable=import-error,no-name-in-module
# This is a Pi module and can't be installed in CI without
# breaking the build.
# pylint: disable=import-outside-toplevel,import-error
import raspihats.i2c_hats as module
constructor = getattr(module, board)
@@ -138,7 +140,9 @@ class I2CHatsManager(threading.Thread):
def run(self):
"""Keep alive for I2C-HATs."""
# pylint: disable=import-error,no-name-in-module
# This is a Pi module and can't be installed in CI without
# breaking the build.
# pylint: disable=import-outside-toplevel,import-error
from raspihats.i2c_hats import ResponseException
_LOGGER.info(log_message(self, "starting"))
@@ -199,7 +203,9 @@ class I2CHatsManager(threading.Thread):
def read_di(self, address, channel):
"""Read a value from a I2C-HAT digital input."""
# pylint: disable=import-error,no-name-in-module
# This is a Pi module and can't be installed in CI without
# breaking the build.
# pylint: disable=import-outside-toplevel,import-error
from raspihats.i2c_hats import ResponseException
with self._lock:
@@ -212,7 +218,9 @@ class I2CHatsManager(threading.Thread):
def write_dq(self, address, channel, value):
"""Write a value to a I2C-HAT digital output."""
# pylint: disable=import-error,no-name-in-module
# This is a Pi module and can't be installed in CI without
# breaking the build.
# pylint: disable=import-outside-toplevel,import-error
from raspihats.i2c_hats import ResponseException
with self._lock:
@@ -224,7 +232,9 @@ class I2CHatsManager(threading.Thread):
def read_dq(self, address, channel):
"""Read a value from a I2C-HAT digital output."""
# pylint: disable=import-error,no-name-in-module
# This is a Pi module and can't be installed in CI without
# breaking the build.
# pylint: disable=import-outside-toplevel,import-error
from raspihats.i2c_hats import ResponseException
with self._lock: