[mousetrap/gnome3-wip: 139/240] PEP8 fixes



commit 0c15e1f3918cd3013e33c5a73502b55dd6032d63
Author: Kevin Brown <kbrown rediker com>
Date:   Mon Jun 23 20:49:31 2014 -0400

    PEP8 fixes
    
    This fixes the following detected issues:
        src/mousetrap/image.py:61:13: E126 continuation line over-indented for hanging indent
        src/mousetrap/image.py:62:13: E126 continuation line over-indented for hanging indent
        src/mousetrap/image.py:63:13: E126 continuation line over-indented for hanging indent
        src/mousetrap/image.py:64:13: E126 continuation line over-indented for hanging indent
        src/mousetrap/image.py:65:13: E126 continuation line over-indented for hanging indent
        src/mousetrap/image.py:66:13: E126 continuation line over-indented for hanging indent
        src/mousetrap/image.py:67:13: E126 continuation line over-indented for hanging indent
        src/mousetrap/image.py:68:13: E126 continuation line over-indented for hanging indent
        src/mousetrap/image.py:69:13: E126 continuation line over-indented for hanging indent
        src/mousetrap/image.py:70:13: E123 closing bracket does not match indentation of opening bracket's 
line
        src/mousetrap/vision.py:18:17: E126 continuation line over-indented for hanging indent
        src/mousetrap/vision.py:19:17: E126 continuation line over-indented for hanging indent
        src/mousetrap/vision.py:20:17: E123 closing bracket does not match indentation of opening bracket's 
line
        src/mousetrap/vision.py:54:5: E303 too many blank lines (2)
        src/mousetrap/vision.py:118:17: E126 continuation line over-indented for hanging indent
        src/mousetrap/vision.py:119:17: E126 continuation line over-indented for hanging indent
        src/mousetrap/vision.py:120:17: E126 continuation line over-indented for hanging indent
        src/mousetrap/vision.py:131:17: E126 continuation line over-indented for hanging indent
        src/mousetrap/vision.py:133:17: E123 closing bracket does not match indentation of opening bracket's 
line
        src/mousetrap/vision.py:143:17: E126 continuation line over-indented for hanging indent
        src/mousetrap/vision.py:144:17: E126 continuation line over-indented for hanging indent
        src/mousetrap/vision.py:145:17: E126 continuation line over-indented for hanging indent
        src/mousetrap/plugins/eyes.py:45:17: E126 continuation line over-indented for hanging indent
        src/mousetrap/plugins/eyes.py:65:17: E126 continuation line over-indented for hanging indent
        src/mousetrap/plugins/eyes.py:66:17: E126 continuation line over-indented for hanging indent
        src/mousetrap/plugins/eyes.py:69:17: E123 closing bracket does not match indentation of opening 
bracket's line
        src/mousetrap/plugins/eyes.py:71:17: E126 continuation line over-indented for hanging indent
        src/mousetrap/plugins/eyes.py:72:17: E126 continuation line over-indented for hanging indent
        src/mousetrap/plugins/eyes.py:75:17: E123 closing bracket does not match indentation of opening 
bracket's line
        src/mousetrap/plugins/eyes.py:77:17: E126 continuation line over-indented for hanging indent
        src/mousetrap/plugins/eyes.py:78:17: E126 continuation line over-indented for hanging indent
        src/mousetrap/plugins/eyes.py:81:17: E123 closing bracket does not match indentation of opening 
bracket's line
        src/mousetrap/plugins/nose.py:42:17: E126 continuation line over-indented for hanging indent
        src/mousetrap/plugins/nose.py:43:17: E126 continuation line over-indented for hanging indent
        src/mousetrap/plugins/nose.py:46:17: E123 closing bracket does not match indentation of opening 
bracket's line
        src/mousetrap/plugins/nose.py:48:17: E126 continuation line over-indented for hanging indent
        src/mousetrap/plugins/nose.py:49:17: E126 continuation line over-indented for hanging indent
        src/mousetrap/plugins/nose.py:52:17: E123 closing bracket does not match indentation of opening 
bracket's line
        src/mousetrap/plugins/nose.py:58:17: E126 continuation line over-indented for hanging indent
        src/mousetrap/plugins/nose.py:59:17: E126 continuation line over-indented for hanging indent
        src/mousetrap/plugins/nose.py:60:17: E123 closing bracket does not match indentation of opening 
bracket's line

 src/mousetrap/config.py       |    8 ++++----
 src/mousetrap/image.py        |   20 ++++++++++----------
 src/mousetrap/plugins/eyes.py |   32 ++++++++++++++++----------------
 src/mousetrap/plugins/nose.py |   26 +++++++++++++-------------
 src/mousetrap/vision.py       |   27 ++++++++++++++-------------
 5 files changed, 57 insertions(+), 56 deletions(-)
---
diff --git a/src/mousetrap/config.py b/src/mousetrap/config.py
index 80c9a86..579eea7 100644
--- a/src/mousetrap/config.py
+++ b/src/mousetrap/config.py
@@ -6,10 +6,10 @@ from copy import deepcopy
 
 class Config(dict):
     SEARCH_PATH = [
-            dirname(__file__) + '/' + 'config_default.yaml',
-            expanduser('~') + '/.mousetrap.yaml',
-            getcwd() + '/mousetrap.yaml'
-            ]
+        dirname(__file__) + '/' + 'config_default.yaml',
+        expanduser('~') + '/.mousetrap.yaml',
+        getcwd() + '/mousetrap.yaml',
+    ]
 
     def __init__(self):
         for path in self.SEARCH_PATH:
diff --git a/src/mousetrap/image.py b/src/mousetrap/image.py
index f1c5ae4..d837a15 100644
--- a/src/mousetrap/image.py
+++ b/src/mousetrap/image.py
@@ -58,13 +58,13 @@ def _cvimage_to_pixbuf(cvimage):
     destroy_fn_data = None
 
     return GdkPixbuf.Pixbuf.new_from_data(
-            data,
-            colorspace, # FIXME: Need to handle grayscale.
-            has_alpha_channel,
-            _GDK_PIXBUF_BIT_PER_SAMPLE,
-            width,
-            height,
-            row_stride,
-            destroy_fn,
-            destroy_fn_data
-            )
+        data,
+        colorspace, # FIXME: Need to handle grayscale.
+        has_alpha_channel,
+        _GDK_PIXBUF_BIT_PER_SAMPLE,
+        width,
+        height,
+        row_stride,
+        destroy_fn,
+        destroy_fn_data,
+    )
diff --git a/src/mousetrap/plugins/eyes.py b/src/mousetrap/plugins/eyes.py
index 2d2b7ab..f90be27 100644
--- a/src/mousetrap/plugins/eyes.py
+++ b/src/mousetrap/plugins/eyes.py
@@ -42,7 +42,7 @@ class ClosedDetector(object):
         self._max_samples = config[self]['max_samples']
         self._min_fraction_to_be_closed = config[self]['min_fraction_to_be_closed']
         self._min_misses_to_be_closed = int(
-                self._min_fraction_to_be_closed * self._max_samples)
+            self._min_fraction_to_be_closed * self._max_samples)
         self._left_locator = LeftEyeLocator(config)
         self._detection_history = History(config, self._max_samples)
 
@@ -62,23 +62,23 @@ class LeftEyeLocator(object):
     def __init__(self, config):
         self._config = config
         self._face_detector = FeatureDetector(
-                config,
-                "face",
-                scale_factor=config[self]['face_detector']['scale_factor'],
-                min_neighbors=config[self]['face_detector']['min_neighbors']
-                )
+            config,
+            "face",
+            scale_factor=config[self]['face_detector']['scale_factor'],
+            min_neighbors=config[self]['face_detector']['min_neighbors'],
+        )
         self._open_eye_detector = FeatureDetector(
-                config,
-                "open_eye",
-                scale_factor=config[self]['open_eye_detector']['scale_factor'],
-                min_neighbors=config[self]['open_eye_detector']['min_neighbors']
-                )
+            config,
+            "open_eye",
+            scale_factor=config[self]['open_eye_detector']['scale_factor'],
+            min_neighbors=config[self]['open_eye_detector']['min_neighbors'],
+        )
         self._left_eye_detector = FeatureDetector(
-                config,
-                "left_eye",
-                scale_factor=config[self]['left_eye_detector']['scale_factor'],
-                min_neighbors=config[self]['left_eye_detector']['min_neighbors']
-                )
+            config,
+            "left_eye",
+            scale_factor=config[self]['left_eye_detector']['scale_factor'],
+            min_neighbors=config[self]['left_eye_detector']['min_neighbors'],
+        )
 
     def locate(self, image):
         face = None
diff --git a/src/mousetrap/plugins/nose.py b/src/mousetrap/plugins/nose.py
index d7d92b9..d087bf8 100644
--- a/src/mousetrap/plugins/nose.py
+++ b/src/mousetrap/plugins/nose.py
@@ -39,22 +39,22 @@ class NoseLocator(object):
     def __init__(self, config):
         self._config = config
         self._face_detector = FeatureDetector(
-                config,
-                'face',
-                scale_factor=config[self]['face_detector']['scale_factor'],
-                min_neighbors=config[self]['face_detector']['min_neighbors']
-                )
+            config,
+            'face',
+            scale_factor=config[self]['face_detector']['scale_factor'],
+            min_neighbors=config[self]['face_detector']['min_neighbors'],
+        )
         self._nose_detector = FeatureDetector(
-                config,
-                'nose',
-                scale_factor=config[self]['nose_detector']['scale_factor'],
-                min_neighbors=config[self]['nose_detector']['min_neighbors']
-                )
+            config,
+            'nose',
+            scale_factor=config[self]['nose_detector']['scale_factor'],
+            min_neighbors=config[self]['nose_detector']['min_neighbors'],
+        )
 
     def locate(self, image):
         face = self._face_detector.detect(image)
         nose = self._nose_detector.detect(face['image'])
         return (
-                face['x'] + nose['center']['x'],
-                face['y'] + nose['center']['y'],
-                )
+            face['x'] + nose['center']['x'],
+            face['y'] + nose['center']['y'],
+        )
diff --git a/src/mousetrap/vision.py b/src/mousetrap/vision.py
index 16f95b7..f62be17 100644
--- a/src/mousetrap/vision.py
+++ b/src/mousetrap/vision.py
@@ -15,9 +15,9 @@ class Camera(object):
         self._config = config
         self._device = self._new_capture_device(config['camera']['device_index'])
         self.set_dimensions(
-                config['camera']['width'],
-                config['camera']['height']
-                )
+            config['camera']['width'],
+            config['camera']['height'],
+        )
 
     @classmethod
     def _new_capture_device(cls, device_index):
@@ -50,7 +50,6 @@ class HaarLoader(object):
         self._haar_files = config['haar_files']
         self._haar_cache = {}
 
-
     def from_name(self, name):
         if not name in self._haar_files:
             raise HaarNameError(name)
@@ -115,9 +114,10 @@ class FeatureDetector(object):
 
     def _detect_plural(self):
         self._plural = self._cascade.detectMultiScale(
-                self._image.to_cv_grayscale(),
-                self._scale_factor,
-                self._min_neighbors)
+            self._image.to_cv_grayscale(),
+            self._scale_factor,
+            self._min_neighbors,
+        )
 
     def _exit_if_none_detected(self):
         if len(self._plural) == 0:
@@ -128,9 +128,9 @@ class FeatureDetector(object):
 
     def _calculate_center(self):
         self._single["center"] = {
-                "x": (self._single["x"] + self._single["width"]) / 2,
-                "y": (self._single["y"] + self._single["height"]) / 2,
-                }
+            "x": (self._single["x"] + self._single["width"]) / 2,
+            "y": (self._single["y"] + self._single["height"]) / 2,
+        }
 
     def _extract_image(self):
         single = self._single
@@ -140,9 +140,10 @@ class FeatureDetector(object):
         to_x = single['x'] + single['width']
         image_cv_grayscale = self._image.to_cv_grayscale()
         single["image"] = Image(
-                self._config,
-                image_cv_grayscale[from_y:to_y, from_x:to_x],
-                is_grayscale=True)
+            self._config,
+            image_cv_grayscale[from_y:to_y, from_x:to_x],
+            is_grayscale=True.
+        )
 
 
 class FeatureNotFoundException(Exception):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]