Enable pylint import-outside-toplevel (#33631)
This commit is contained in:
parent
9dfcae3dc2
commit
b9b1cee403
23 changed files with 47 additions and 23 deletions
|
@ -92,7 +92,9 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"
|
||||
# These imports shouldn't be moved to the top, because they depend on code from the model_dir.
|
||||
# (The model_dir is created during the manual setup process. See integration docs.)
|
||||
import tensorflow as tf
|
||||
import tensorflow as tf # pylint: disable=import-outside-toplevel
|
||||
|
||||
# pylint: disable=import-outside-toplevel
|
||||
from object_detection.utils import label_map_util
|
||||
except ImportError:
|
||||
_LOGGER.error(
|
||||
|
@ -104,7 +106,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
|
||||
try:
|
||||
# Display warning that PIL will be used if no OpenCV is found.
|
||||
import cv2 # noqa: F401 pylint: disable=unused-import
|
||||
import cv2 # noqa: F401 pylint: disable=unused-import, import-outside-toplevel
|
||||
except ImportError:
|
||||
_LOGGER.warning(
|
||||
"No OpenCV library found. TensorFlow will process image with "
|
||||
|
@ -281,7 +283,7 @@ class TensorFlowImageProcessor(ImageProcessingEntity):
|
|||
"""Process the image."""
|
||||
|
||||
try:
|
||||
import cv2 # pylint: disable=import-error
|
||||
import cv2 # pylint: disable=import-error, import-outside-toplevel
|
||||
|
||||
img = cv2.imdecode(np.asarray(bytearray(image)), cv2.IMREAD_UNCHANGED)
|
||||
inp = img[:, :, [2, 1, 0]] # BGR->RGB
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue