From 0e9728d94aa1bdc7da946ae4d817e874db88cad2 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Wed, 17 May 2017 10:10:35 +0200 Subject: [PATCH] Update docstrings (#7630) --- .../components/image_processing/demo.py | 10 +++++----- .../image_processing/dlib_face_detect.py | 10 +++++----- .../image_processing/dlib_face_identify.py | 10 +++++----- .../image_processing/microsoft_face_detect.py | 4 ++-- .../image_processing/microsoft_face_identify.py | 17 ++++++++--------- .../components/image_processing/opencv.py | 2 +- 6 files changed, 26 insertions(+), 27 deletions(-) diff --git a/homeassistant/components/image_processing/demo.py b/homeassistant/components/image_processing/demo.py index a7f4ad5e3d6..788d12520f5 100644 --- a/homeassistant/components/image_processing/demo.py +++ b/homeassistant/components/image_processing/demo.py @@ -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 diff --git a/homeassistant/components/image_processing/dlib_face_detect.py b/homeassistant/components/image_processing/dlib_face_detect.py index 5877535d3e0..3308edf53b5 100644 --- a/homeassistant/components/image_processing/dlib_face_detect.py +++ b/homeassistant/components/image_processing/dlib_face_detect.py @@ -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) diff --git a/homeassistant/components/image_processing/dlib_face_identify.py b/homeassistant/components/image_processing/dlib_face_identify.py index a0f50796a9f..8baa7ac7ec3 100644 --- a/homeassistant/components/image_processing/dlib_face_identify.py +++ b/homeassistant/components/image_processing/dlib_face_identify.py @@ -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) diff --git a/homeassistant/components/image_processing/microsoft_face_detect.py b/homeassistant/components/image_processing/microsoft_face_detect.py index 5c4daec1067..40aac61914b 100644 --- a/homeassistant/components/image_processing/microsoft_face_detect.py +++ b/homeassistant/components/image_processing/microsoft_face_detect.py @@ -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 diff --git a/homeassistant/components/image_processing/microsoft_face_identify.py b/homeassistant/components/image_processing/microsoft_face_identify.py index a645aef2fcb..0cdd1675274 100644 --- a/homeassistant/components/image_processing/microsoft_face_identify.py +++ b/homeassistant/components/image_processing/microsoft_face_identify.py @@ -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) diff --git a/homeassistant/components/image_processing/opencv.py b/homeassistant/components/image_processing/opencv.py index e8dd1c8dcb6..e6cdd0fcef9 100644 --- a/homeassistant/components/image_processing/opencv.py +++ b/homeassistant/components/image_processing/opencv.py @@ -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