Update docstrings (#7630)

This commit is contained in:
Fabian Affolter 2017-05-17 10:10:35 +02:00 committed by GitHub
parent 3b69de8a1a
commit 0e9728d94a
6 changed files with 26 additions and 27 deletions

View file

@ -1,7 +1,7 @@
"""
Support for the demo image processing.
For more details about this component, please refer to the documentation at
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/demo/
"""
from homeassistant.components.image_processing import ATTR_CONFIDENCE
@ -12,7 +12,7 @@ from homeassistant.components.image_processing.microsoft_face_identify import (
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Set up the demo image_processing platform."""
"""Set up the demo image processing platform."""
add_devices([
DemoImageProcessingAlpr('camera.demo_camera', "Demo Alpr"),
DemoImageProcessingFace(
@ -21,10 +21,10 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
class DemoImageProcessingAlpr(ImageProcessingAlprEntity):
"""Demo alpr image processing entity."""
"""Demo ALPR image processing entity."""
def __init__(self, camera_entity, name):
"""Initialize demo alpr."""
"""Initialize demo ALPR image processing entity."""
super().__init__()
self._name = name
@ -61,7 +61,7 @@ class DemoImageProcessingFace(ImageProcessingFaceEntity):
"""Demo face identify image processing entity."""
def __init__(self, camera_entity, name):
"""Initialize demo alpr."""
"""Initialize demo face image processing entity."""
super().__init__()
self._name = name

View file

@ -1,7 +1,7 @@
"""
Component that will help set the dlib face detect processing.
Component that will help set the Dlib face detect processing.
For more details about this component, please refer to the documentation at
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/image_processing.dlib_face_detect/
"""
import logging
@ -21,7 +21,7 @@ _LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Set up the Microsoft Face detection platform."""
"""Set up the Dlib Face detection platform."""
entities = []
for camera in config[CONF_SOURCE]:
entities.append(DlibFaceDetectEntity(
@ -35,7 +35,7 @@ class DlibFaceDetectEntity(ImageProcessingFaceEntity):
"""Dlib Face API entity for identify."""
def __init__(self, camera_entity, name=None):
"""Initialize Dlib."""
"""Initialize Dlib face entity."""
super().__init__()
self._camera = camera_entity
@ -62,7 +62,7 @@ class DlibFaceDetectEntity(ImageProcessingFaceEntity):
import face_recognition
fak_file = io.BytesIO(image)
fak_file.name = "snapshot.jpg"
fak_file.name = 'snapshot.jpg'
fak_file.seek(0)
image = face_recognition.load_image_file(fak_file)

View file

@ -1,7 +1,7 @@
"""
Component that will help set the dlib face detect processing.
Component that will help set the Dlib face detect processing.
For more details about this component, please refer to the documentation at
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/image_processing.dlib_face_identify/
"""
import logging
@ -29,7 +29,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Set up the Microsoft Face detection platform."""
"""Set up the Dlib Face detection platform."""
entities = []
for camera in config[CONF_SOURCE]:
entities.append(DlibFaceIdentifyEntity(
@ -43,7 +43,7 @@ class DlibFaceIdentifyEntity(ImageProcessingFaceEntity):
"""Dlib Face API entity for identify."""
def __init__(self, camera_entity, faces, name=None):
"""Initialize Dlib."""
"""Initialize Dlib face identify entry."""
# pylint: disable=import-error
import face_recognition
super().__init__()
@ -77,7 +77,7 @@ class DlibFaceIdentifyEntity(ImageProcessingFaceEntity):
import face_recognition
fak_file = io.BytesIO(image)
fak_file.name = "snapshot.jpg"
fak_file.name = 'snapshot.jpg'
fak_file.seek(0)
image = face_recognition.load_image_file(fak_file)

View file

@ -1,7 +1,7 @@
"""
Component that will help set the microsoft face detect processing.
Component that will help set the Microsoft face detect processing.
For more details about this component, please refer to the documentation at
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/image_processing.microsoft_face_detect/
"""
import asyncio

View file

@ -1,5 +1,5 @@
"""
Component that will help set the microsoft face for verify processing.
Component that will help set the Microsoft face for verify processing.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/image_processing.microsoft_face_identify/
@ -62,8 +62,8 @@ class ImageProcessingFaceEntity(ImageProcessingEntity):
def __init__(self):
"""Initialize base face identify/verify entity."""
self.faces = [] # last scan data
self.total_faces = 0 # face count
self.faces = []
self.total_faces = 0
@property
def state(self):
@ -71,11 +71,11 @@ class ImageProcessingFaceEntity(ImageProcessingEntity):
confidence = 0
state = STATE_UNKNOWN
# no confidence support
# No confidence support
if not self.confidence:
return self.total_faces
# search high confidence
# Search high confidence
for face in self.faces:
if ATTR_CONFIDENCE not in face:
continue
@ -128,7 +128,7 @@ class ImageProcessingFaceEntity(ImageProcessingEntity):
This method must be run in the event loop.
"""
# send events
# Send events
for face in faces:
if ATTR_CONFIDENCE in face and self.confidence:
if face[ATTR_CONFIDENCE] < self.confidence:
@ -139,7 +139,7 @@ class ImageProcessingFaceEntity(ImageProcessingEntity):
self.hass.bus.async_fire, EVENT_DETECT_FACE, face
)
# update entity store
# Update entity store
self.faces = faces
self.total_faces = total
@ -200,7 +200,7 @@ class MicrosoftFaceIdentifyEntity(ImageProcessingFaceEntity):
_LOGGER.error("Can't process image on Microsoft face: %s", err)
return
# parse data
# Parse data
knwon_faces = []
total = 0
for face in detect:
@ -220,5 +220,4 @@ class MicrosoftFaceIdentifyEntity(ImageProcessingFaceEntity):
ATTR_CONFIDENCE: data['confidence'] * 100,
})
# process data
self.async_process_faces(knwon_faces, total)

View file

@ -1,7 +1,7 @@
"""
Component that performs OpenCV classification on images.
For more details about this component, please refer to the documentation at
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/image_processing.opencv/
"""
from datetime import timedelta