[{"id":19153,"web_url":"https://patchwork.libcamera.org/comment/19153/","msgid":"<f62539e4-0f3d-452e-fe9a-fc3603a58123@ideasonboard.com>","date":"2021-08-27T16:05:53","subject":"Re: [libcamera-devel] [PATCH] utils: checkstyle.py: Use\n\tsingle-quoted strings when possible","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"On 27/08/2021 16:43, Laurent Pinchart wrote:\n> checkstyle.py uses single-quoted strings in most locations already.\n> There are a few locations where this wouldn't be convenient (when the\n> string itself contains a single quote, which would then require\n> escaping), but there are also a few other locations where double quotes\n> are used when single quotes would work fine. Change those to standardize\n> on single-quoted strings.\n\nI wonder if pycodestyle can enforce this?\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  utils/checkstyle.py | 12 ++++++------\n>  1 file changed, 6 insertions(+), 6 deletions(-)\n> \n> diff --git a/utils/checkstyle.py b/utils/checkstyle.py\n> index ececb46eaacc..835f2a9fcd71 100755\n> --- a/utils/checkstyle.py\n> +++ b/utils/checkstyle.py\n> @@ -239,7 +239,7 @@ class StagedChanges(Commit):\n>      def _parse(self):\n>          ret = subprocess.run(['git', 'diff', '--staged', '--name-status'],\n>                               stdout=subprocess.PIPE).stdout.decode('utf-8')\n> -        self._title = \"Staged changes\"\n> +        self._title = 'Staged changes'\n>          self._files = [CommitFile(f) for f in ret.splitlines()]\n>  \n>      def get_diff(self, top_level, filename):\n> @@ -476,7 +476,7 @@ class Pep8Checker(StyleChecker):\n>              ret = subprocess.run(['pycodestyle', '--ignore=E501', '-'],\n>                                   input=data, stdout=subprocess.PIPE)\n>          except FileNotFoundError:\n> -            issues.append(StyleIssue(0, None, \"Please install pycodestyle to validate python additions\"))\n> +            issues.append(StyleIssue(0, None, 'Please install pycodestyle to validate python additions'))\n>              return issues\n>  \n>          results = ret.stdout.decode('utf-8').splitlines()\n> @@ -509,7 +509,7 @@ class ShellChecker(StyleChecker):\n>              ret = subprocess.run(['shellcheck', '-Cnever', '-'],\n>                                   input=data, stdout=subprocess.PIPE)\n>          except FileNotFoundError:\n> -            issues.append(StyleIssue(0, None, \"Please install shellcheck to validate shell script additions\"))\n> +            issues.append(StyleIssue(0, None, 'Please install shellcheck to validate shell script additions'))\n>              return issues\n>  \n>          results = ret.stdout.decode('utf-8').splitlines()\n> @@ -774,10 +774,10 @@ def check_style(top_level, commit):\n>          issues += check_file(top_level, commit, f)\n>  \n>      if issues == 0:\n> -        print(\"No issue detected\")\n> +        print('No issue detected')\n>      else:\n>          print('---')\n> -        print(\"%u potential %s detected, please review\" %\n> +        print('%u potential %s detected, please review' %\n>                (issues, 'issue' if issues == 1 else 'issues'))\n>  \n>      return issues\n> @@ -833,7 +833,7 @@ def main(argv):\n>      for command, mandatory in dependencies.items():\n>          found = shutil.which(command)\n>          if mandatory and not found:\n> -            print(\"Executable %s not found\" % command)\n> +            print('Executable %s not found' % command)\n>              return 1\n>  \n>          dependencies[command] = found\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 873CCBD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 27 Aug 2021 16:05:58 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 479B76891F;\n\tFri, 27 Aug 2021 18:05:58 +0200 (CEST)","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 0D75D60256\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 27 Aug 2021 18:05:57 +0200 (CEST)","from [192.168.0.20]\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A638952F;\n\tFri, 27 Aug 2021 18:05:56 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"NIvzOIwZ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1630080356;\n\tbh=vzz6AwUy7GGFj6DoETbakF8ZN2m+LpwYbDiiR1UPC1s=;\n\th=Subject:To:References:From:Date:In-Reply-To:From;\n\tb=NIvzOIwZR9rvwtgX4el9V9LSEVmckQc0gzRCfp5eTo8WVt8+rIar0k/NMqlgXyIvQ\n\t8fs3DnzoXq9GH/oROwiNV5X2Dik1a17Guwq01C+OStAIOA0ak/1eXlGo5EGryvR69U\n\tQv8H5EQ6g0pKLfGIdxrtbVpN2yY7sBF3HpAxSfdI=","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20210827154309.16367-1-laurent.pinchart@ideasonboard.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<f62539e4-0f3d-452e-fe9a-fc3603a58123@ideasonboard.com>","Date":"Fri, 27 Aug 2021 17:05:53 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.11.0","MIME-Version":"1.0","In-Reply-To":"<20210827154309.16367-1-laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-GB","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH] utils: checkstyle.py: Use\n\tsingle-quoted strings when possible","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":19166,"web_url":"https://patchwork.libcamera.org/comment/19166/","msgid":"<557cd9a1-2edb-d9e3-251c-8e163dcb053b@ideasonboard.com>","date":"2021-08-30T10:22:36","subject":"Re: [libcamera-devel] [PATCH] utils: checkstyle.py: Use\n\tsingle-quoted strings when possible","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hi Laurent,\n\nOn 8/27/21 9:13 PM, Laurent Pinchart wrote:\n> checkstyle.py uses single-quoted strings in most locations already.\n> There are a few locations where this wouldn't be convenient (when the\n> string itself contains a single quote, which would then require\n> escaping), but there are also a few other locations where double quotes\n> are used when single quotes would work fine. Change those to standardize\n> on single-quoted strings.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n\n> ---\n>   utils/checkstyle.py | 12 ++++++------\n>   1 file changed, 6 insertions(+), 6 deletions(-)\n>\n> diff --git a/utils/checkstyle.py b/utils/checkstyle.py\n> index ececb46eaacc..835f2a9fcd71 100755\n> --- a/utils/checkstyle.py\n> +++ b/utils/checkstyle.py\n> @@ -239,7 +239,7 @@ class StagedChanges(Commit):\n>       def _parse(self):\n>           ret = subprocess.run(['git', 'diff', '--staged', '--name-status'],\n>                                stdout=subprocess.PIPE).stdout.decode('utf-8')\n> -        self._title = \"Staged changes\"\n> +        self._title = 'Staged changes'\n>           self._files = [CommitFile(f) for f in ret.splitlines()]\n>   \n>       def get_diff(self, top_level, filename):\n> @@ -476,7 +476,7 @@ class Pep8Checker(StyleChecker):\n>               ret = subprocess.run(['pycodestyle', '--ignore=E501', '-'],\n>                                    input=data, stdout=subprocess.PIPE)\n>           except FileNotFoundError:\n> -            issues.append(StyleIssue(0, None, \"Please install pycodestyle to validate python additions\"))\n> +            issues.append(StyleIssue(0, None, 'Please install pycodestyle to validate python additions'))\n>               return issues\n>   \n>           results = ret.stdout.decode('utf-8').splitlines()\n> @@ -509,7 +509,7 @@ class ShellChecker(StyleChecker):\n>               ret = subprocess.run(['shellcheck', '-Cnever', '-'],\n>                                    input=data, stdout=subprocess.PIPE)\n>           except FileNotFoundError:\n> -            issues.append(StyleIssue(0, None, \"Please install shellcheck to validate shell script additions\"))\n> +            issues.append(StyleIssue(0, None, 'Please install shellcheck to validate shell script additions'))\n>               return issues\n>   \n>           results = ret.stdout.decode('utf-8').splitlines()\n> @@ -774,10 +774,10 @@ def check_style(top_level, commit):\n>           issues += check_file(top_level, commit, f)\n>   \n>       if issues == 0:\n> -        print(\"No issue detected\")\n> +        print('No issue detected')\n>       else:\n>           print('---')\n> -        print(\"%u potential %s detected, please review\" %\n> +        print('%u potential %s detected, please review' %\n>                 (issues, 'issue' if issues == 1 else 'issues'))\n>   \n>       return issues\n> @@ -833,7 +833,7 @@ def main(argv):\n>       for command, mandatory in dependencies.items():\n>           found = shutil.which(command)\n>           if mandatory and not found:\n> -            print(\"Executable %s not found\" % command)\n> +            print('Executable %s not found' % command)\n>               return 1\n>   \n>           dependencies[command] = found","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 5C8B2BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 30 Aug 2021 10:22:44 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B4F726916A;\n\tMon, 30 Aug 2021 12:22:43 +0200 (CEST)","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 BA93060258\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 30 Aug 2021 12:22:41 +0200 (CEST)","from [192.168.1.104] (unknown [103.251.226.0])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C33F85A7;\n\tMon, 30 Aug 2021 12:22:40 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"pu5by7BL\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1630318961;\n\tbh=NbykIPut72JhKsdRyEzudWuOQaUlZEu0cQItuhDGNoA=;\n\th=Subject:To:References:From:Date:In-Reply-To:From;\n\tb=pu5by7BLwBjH3ReN/sYkitfOMkhTPGV1Ghh44ikx83Vk5KPUk6jO/OSxKFsvfzRSE\n\tFNHOg0D/3itf8AA4okgtX9PQfI1AN2Ans8dy2Knx1ojKnqjCDp+mxovRJ/mBEHT29J\n\tooXyEV/gYgH/JhEk8yUa6t2npUWHPAKPRXEe7d+k=","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20210827154309.16367-1-laurent.pinchart@ideasonboard.com>","From":"Umang Jain <umang.jain@ideasonboard.com>","Message-ID":"<557cd9a1-2edb-d9e3-251c-8e163dcb053b@ideasonboard.com>","Date":"Mon, 30 Aug 2021 15:52:36 +0530","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.10.2","MIME-Version":"1.0","In-Reply-To":"<20210827154309.16367-1-laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Transfer-Encoding":"8bit","Content-Language":"en-US","Subject":"Re: [libcamera-devel] [PATCH] utils: checkstyle.py: Use\n\tsingle-quoted strings when possible","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]