Move imports in seven_segments component (#28096)

pull/28103/head
Diefferson Koderer Môro 2019-10-22 05:32:53 +00:00 committed by Paulus Schoutsen
parent 953f31dd55
commit f440259edc
1 changed files with 8 additions and 9 deletions

View File

@ -1,19 +1,21 @@
"""Optical character recognition processing of seven segments displays.""" """Optical character recognition processing of seven segments displays."""
import logging
import io import io
import logging
import os import os
import subprocess
from PIL import Image
import voluptuous as vol import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.core import split_entity_id
from homeassistant.components.image_processing import ( from homeassistant.components.image_processing import (
PLATFORM_SCHEMA,
ImageProcessingEntity,
CONF_SOURCE,
CONF_ENTITY_ID, CONF_ENTITY_ID,
CONF_NAME, CONF_NAME,
CONF_SOURCE,
PLATFORM_SCHEMA,
ImageProcessingEntity,
) )
from homeassistant.core import split_entity_id
import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -120,9 +122,6 @@ class ImageProcessingSsocr(ImageProcessingEntity):
def process_image(self, image): def process_image(self, image):
"""Process the image.""" """Process the image."""
from PIL import Image
import subprocess
stream = io.BytesIO(image) stream = io.BytesIO(image)
img = Image.open(stream) img = Image.open(stream)
img.save(self.filepath, "png") img.save(self.filepath, "png")