mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
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:
parent
14be60e5bf
commit
4d8539e151
@ -120,7 +120,9 @@ class I2CHatsManager(threading.Thread):
|
|||||||
with self._lock:
|
with self._lock:
|
||||||
i2c_hat = self._i2c_hats.get(address)
|
i2c_hat = self._i2c_hats.get(address)
|
||||||
if i2c_hat is None:
|
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
|
import raspihats.i2c_hats as module
|
||||||
|
|
||||||
constructor = getattr(module, board)
|
constructor = getattr(module, board)
|
||||||
@ -138,7 +140,9 @@ class I2CHatsManager(threading.Thread):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""Keep alive for I2C-HATs."""
|
"""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
|
from raspihats.i2c_hats import ResponseException
|
||||||
|
|
||||||
_LOGGER.info(log_message(self, "starting"))
|
_LOGGER.info(log_message(self, "starting"))
|
||||||
@ -199,7 +203,9 @@ class I2CHatsManager(threading.Thread):
|
|||||||
|
|
||||||
def read_di(self, address, channel):
|
def read_di(self, address, channel):
|
||||||
"""Read a value from a I2C-HAT digital input."""
|
"""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
|
from raspihats.i2c_hats import ResponseException
|
||||||
|
|
||||||
with self._lock:
|
with self._lock:
|
||||||
@ -212,7 +218,9 @@ class I2CHatsManager(threading.Thread):
|
|||||||
|
|
||||||
def write_dq(self, address, channel, value):
|
def write_dq(self, address, channel, value):
|
||||||
"""Write a value to a I2C-HAT digital output."""
|
"""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
|
from raspihats.i2c_hats import ResponseException
|
||||||
|
|
||||||
with self._lock:
|
with self._lock:
|
||||||
@ -224,7 +232,9 @@ class I2CHatsManager(threading.Thread):
|
|||||||
|
|
||||||
def read_dq(self, address, channel):
|
def read_dq(self, address, channel):
|
||||||
"""Read a value from a I2C-HAT digital output."""
|
"""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
|
from raspihats.i2c_hats import ResponseException
|
||||||
|
|
||||||
with self._lock:
|
with self._lock:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user