{"id":3769,"url":"https://patchwork.libcamera.org/api/patches/3769/?format=json","web_url":"https://patchwork.libcamera.org/patch/3769/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20200512000322.11753-16-laurent.pinchart@ideasonboard.com>","date":"2020-05-12T00:03:13","name":"[libcamera-devel,15/24] utils: raspberrypi: ctt: Fix pycodestyle E711 and E712","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"68cd0c9995df45c75a34c48bdc23b1d8e5a3c4e2","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/3769/mbox/","series":[{"id":897,"url":"https://patchwork.libcamera.org/api/series/897/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=897","date":"2020-05-12T00:02:58","name":"utils: raspberrypi: ctt: Comply with pycodestyle","version":1,"mbox":"https://patchwork.libcamera.org/series/897/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/3769/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/3769/checks/","tags":{},"headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C53F060DFF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 12 May 2020 02:03:41 +0200 (CEST)","from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8FC1911F3;\n\tTue, 12 May 2020 02:03:40 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"DwfIzeZ9\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1589241821;\n\tbh=F/fY9K9F6nwFGE9kNSsCFFWxjlgTAsj6Aqo1FYCQKc4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=DwfIzeZ9Y0H+AbmK9YxSx9tN8z9GOr6h+I9X12panLVcbmcIezY/rUP12gwCpfzlp\n\tjV5eN4og3UnC/vUzeQQwAEguycGbZwqWzTzq6BIFImOS7AAavOwv6YNeUw/WrUYp3O\n\tyJDKOqxwPcjf6To4Jft9CV1uJPjaB7i7TZstk2DM=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 12 May 2020 03:03:13 +0300","Message-Id":"<20200512000322.11753-16-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.26.2","In-Reply-To":"<20200512000322.11753-1-laurent.pinchart@ideasonboard.com>","References":"<20200512000322.11753-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 15/24] utils: raspberrypi: ctt: Fix\n\tpycodestyle E711 and E712","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Tue, 12 May 2020 00:03:42 -0000"},"content":"E711 comparison to None should be 'if cond is None:'\nE711 comparison to None should be 'if cond is not None:'\nE712 comparison to False should be 'if cond is False:' or 'if not cond:'\nE712 comparison to True should be 'if cond is True:' or 'if cond:'\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n utils/raspberrypi/ctt/ctt.py                 | 18 +++++++++---------\n utils/raspberrypi/ctt/ctt_awb.py             |  4 ++--\n utils/raspberrypi/ctt/ctt_ccm.py             |  2 +-\n utils/raspberrypi/ctt/ctt_image_load.py      |  4 ++--\n utils/raspberrypi/ctt/ctt_macbeth_locator.py |  2 +-\n utils/raspberrypi/ctt/ctt_tools.py           |  4 ++--\n 6 files changed, 17 insertions(+), 17 deletions(-)","diff":"diff --git a/utils/raspberrypi/ctt/ctt.py b/utils/raspberrypi/ctt/ctt.py\nindex f4cf37a03611..6a17e7898730 100755\n--- a/utils/raspberrypi/ctt/ctt.py\n+++ b/utils/raspberrypi/ctt/ctt.py\n@@ -534,17 +534,17 @@ class Camera:\n         self.log_new_sec('User Arguments', cal=False)\n         self.log += '\\nJson file output: ' + json_output\n         self.log += '\\nCalibration images directory: ' + directory\n-        if config == None:\n+        if config is None:\n             self.log += '\\nNo configuration file input... using default options'\n-        elif config == False:\n+        elif config is False:\n             self.log += '\\nWARNING: Invalid configuration file path...'\n             self.log += ' using default options'\n-        elif config == True:\n+        elif config is True:\n             self.log += '\\nWARNING: Invalid syntax in configuration file...'\n             self.log += ' using default options'\n         else:\n             self.log += '\\nConfiguration file: ' + config\n-        if log_output == None:\n+        if log_output is None:\n             self.log += '\\nNo log file path input... using default: ctt_log.txt'\n         else:\n             self.log += '\\nLog file output: ' + log_output\n@@ -555,7 +555,7 @@ class Camera:\n     write log file\n     \"\"\"\n     def write_log(self, filename):\n-        if filename == None:\n+        if filename is None:\n             filename = 'ctt_log.txt'\n         self.log += '\\n' + self.log_separator\n         with open(filename, 'w') as logfile:\n@@ -604,7 +604,7 @@ class Camera:\n                     \"\"\"\n                 check that image colour temperature has been successfuly obtained\n                 \"\"\"\n-                elif col != None:\n+                elif col is not None:\n                     \"\"\"\n                     if successful, append to list and continue to next image\n                     \"\"\"\n@@ -627,7 +627,7 @@ class Camera:\n                 if image isn't an alsc correction then it must have a lux and a\n                 colour temperature value to be useful\n                 \"\"\"\n-                if lux == None:\n+                if lux is None:\n                     print('DISCARDED')\n                     self.log += '\\nWARNING: Error reading lux value'\n                     self.log += '\\nImage discarded!'\n@@ -707,7 +707,7 @@ def run_ctt(json_output, directory, config, log_output):\n     \"\"\"\n     if json_output[-5:] != '.json':\n         raise ArgError('\\n\\nError: Output must be a json file!')\n-    if config != None:\n+    if config is not None:\n         \"\"\"\n         check if config file is actually a json\n         \"\"\"\n@@ -790,7 +790,7 @@ def run_ctt(json_output, directory, config, log_output):\n         Cam.write_json()\n         Cam.write_log(log_output)\n         print('\\nCalibrations written to: '+json_output)\n-        if log_output == None:\n+        if log_output is None:\n             log_output = 'ctt_log.txt'\n         print('Log file written to: '+log_output)\n         pass\ndiff --git a/utils/raspberrypi/ctt/ctt_awb.py b/utils/raspberrypi/ctt/ctt_awb.py\nindex 9b30115f53f4..c269b67a12c0 100644\n--- a/utils/raspberrypi/ctt/ctt_awb.py\n+++ b/utils/raspberrypi/ctt/ctt_awb.py\n@@ -17,7 +17,7 @@ def awb(Cam, cal_cr_list, cal_cb_list, plot):\n     \"\"\"\n     condense alsc calibration tables into one dictionary\n     \"\"\"\n-    if cal_cr_list == None:\n+    if cal_cr_list is None:\n         colour_cals = None\n     else:\n         colour_cals = {}\n@@ -315,7 +315,7 @@ def get_alsc_patches(Img, colour_cals, grey=True):\n         b_patchs = patches[3] - Img.blacklevel_16\n         g_patchs = (patches[1]+patches[2])/2 - Img.blacklevel_16\n \n-    if colour_cals == None:\n+    if colour_cals is None:\n         return r_patchs, b_patchs, g_patchs\n     \"\"\"\n     find where image colour fits in alsc colour calibration tables\ndiff --git a/utils/raspberrypi/ctt/ctt_ccm.py b/utils/raspberrypi/ctt/ctt_ccm.py\nindex adc4d290ae7e..21be4d6fb1b1 100644\n--- a/utils/raspberrypi/ctt/ctt_ccm.py\n+++ b/utils/raspberrypi/ctt/ctt_ccm.py\n@@ -64,7 +64,7 @@ def ccm(Cam, cal_cr_list, cal_cb_list):\n     reformat alsc correction tables or set colour_cals to None if alsc is\n     deactivated\n     \"\"\"\n-    if cal_cr_list == None:\n+    if cal_cr_list is None:\n         colour_cals = None\n     else:\n         colour_cals = {}\ndiff --git a/utils/raspberrypi/ctt/ctt_image_load.py b/utils/raspberrypi/ctt/ctt_image_load.py\nindex 38026c7a93c0..787307508ba5 100644\n--- a/utils/raspberrypi/ctt/ctt_image_load.py\n+++ b/utils/raspberrypi/ctt/ctt_image_load.py\n@@ -232,7 +232,7 @@ def brcm_load_image(Cam, im_str):\n     \"\"\"\n     return error if problem reading file\n     \"\"\"\n-    if f == None:\n+    if f is None:\n         print('\\nERROR:\\nProblem reading file')\n         Cam.log += '\\nWARNING: Problem readin file'\n         return 0\n@@ -376,7 +376,7 @@ def load_image(Cam, im_str, mac_config=None, show=False, mac=True, show_meta=Fal\n             \"\"\"\n             if no macbeth found return error\n             \"\"\"\n-            if macbeth == None:\n+            if macbeth is None:\n                 print('\\nERROR: No macbeth chart found')\n                 return 0\n             mac_cen_coords = macbeth[1]\ndiff --git a/utils/raspberrypi/ctt/ctt_macbeth_locator.py b/utils/raspberrypi/ctt/ctt_macbeth_locator.py\nindex 94bbf580db84..05d1bd437001 100644\n--- a/utils/raspberrypi/ctt/ctt_macbeth_locator.py\n+++ b/utils/raspberrypi/ctt/ctt_macbeth_locator.py\n@@ -258,7 +258,7 @@ def find_macbeth(Cam, img, mac_config=(0, 0)):\n     \"\"\"\n     extract data from coords_fit and plot on original image\n     \"\"\"\n-    if show and coords_fit != None:\n+    if show and coords_fit is not None:\n         copy = img.copy()\n         verts = coords_fit[0][0]\n         cents = coords_fit[1][0]\ndiff --git a/utils/raspberrypi/ctt/ctt_tools.py b/utils/raspberrypi/ctt/ctt_tools.py\nindex e5871b60d6a2..27080de08cec 100644\n--- a/utils/raspberrypi/ctt/ctt_tools.py\n+++ b/utils/raspberrypi/ctt/ctt_tools.py\n@@ -62,9 +62,9 @@ def parse_input():\n     directory = get_config(args_dict, '-i', None, 'string')\n     config = get_config(args_dict, '-c', None, 'string')\n     log_path = get_config(args_dict, '-l', None, 'string')\n-    if directory == None:\n+    if directory is None:\n         raise ArgError('\\n\\nERROR! No input directory given.')\n-    if json_output == None:\n+    if json_output is None:\n         raise ArgError('\\n\\nERROR! No output json given.')\n     return json_output, directory, config, log_path\n \"\"\"\n","prefixes":["libcamera-devel","15/24"]}