Show a patch.

GET /api/1.1/patches/23366/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 23366,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/23366/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/23366/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20250515120012.3127231-2-barnabas.pocze@ideasonboard.com>",
    "date": "2025-05-15T12:00:05",
    "name": "[RFC,v1,1/8] utils: codegen: ipc: Use `any()` instead of `len([]) > 0`",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "ffb14aaf366e60c5cda3f1f3fdfd7dec3dd07f15",
    "submitter": {
        "id": 216,
        "url": "https://patchwork.libcamera.org/api/1.1/people/216/?format=api",
        "name": "Barnabás Pőcze",
        "email": "barnabas.pocze@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/23366/mbox/",
    "series": [
        {
            "id": 5173,
            "url": "https://patchwork.libcamera.org/api/1.1/series/5173/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5173",
            "date": "2025-05-15T12:00:04",
            "name": "utils: codegen: ipc: Simplify deserialization",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/5173/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/23366/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/23366/checks/",
    "tags": {},
    "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 AAAEFC3220\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 15 May 2025 12:00:24 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C42D168D73;\n\tThu, 15 May 2025 14:00:21 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C4B5C68B6C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 15 May 2025 14:00:16 +0200 (CEST)",
            "from pb-laptop.local (185.221.142.248.nat.pool.zt.hu\n\t[185.221.142.248])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 878F189A;\n\tThu, 15 May 2025 13:59:59 +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=\"pPSNfBRO\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1747310399;\n\tbh=l7yybGVLafH1XWOnEm8igYUsDS7khbHK2rEVGgdAMBM=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=pPSNfBROxfU0GJ3vBFL50KJWyr12bBK8jiWVSnOTiob9U3JMVx339MrAqA7/VvQgN\n\tAuoFwgB/kuNcIMBxmFmO0WXwWS/JtTFtzYvsqEi9Gh5hq3zxFHNlep1AJUHEbtmv5e\n\tfHeRFTVifEtTcLf7m/eVHIJdJkS64SR3/E+QggS4=",
        "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Paul Elder <paul.elder@ideasonboard.com>",
        "Subject": "[RFC PATCH v1 1/8] utils: codegen: ipc: Use `any()` instead of\n\t`len([]) > 0`",
        "Date": "Thu, 15 May 2025 14:00:05 +0200",
        "Message-ID": "<20250515120012.3127231-2-barnabas.pocze@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.49.0",
        "In-Reply-To": "<20250515120012.3127231-1-barnabas.pocze@ideasonboard.com>",
        "References": "<20250515120012.3127231-1-barnabas.pocze@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "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>"
    },
    "content": "Use `any()` with a generator expression instead of constructing\na list and checking its length.\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n---\n .../ipc/generators/mojom_libcamera_generator.py    | 14 +++++++-------\n 1 file changed, 7 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/utils/codegen/ipc/generators/mojom_libcamera_generator.py b/utils/codegen/ipc/generators/mojom_libcamera_generator.py\nindex d9c620a05..eff29a5b8 100644\n--- a/utils/codegen/ipc/generators/mojom_libcamera_generator.py\n+++ b/utils/codegen/ipc/generators/mojom_libcamera_generator.py\n@@ -166,7 +166,7 @@ def MethodParamOutputs(method):\n     return method.response_parameters[1:]\n \n def MethodParamsHaveFd(parameters):\n-    return len([x for x in parameters if HasFd(x)]) > 0\n+    return any(x for x in parameters if HasFd(x))\n \n def MethodInputHasFd(method):\n     return MethodParamsHaveFd(method.parameters)\n@@ -465,9 +465,9 @@ class Generator(generator.Generator):\n             'cmd_event_enum_name': '_%sEventCmd' % self.module_name,\n             'consts': self.module.constants,\n             'enums': self.module.enums,\n-            'has_array': len([x for x in self.module.kinds.keys() if x[0] == 'a']) > 0,\n-            'has_map': len([x for x in self.module.kinds.keys() if x[0] == 'm']) > 0,\n-            'has_string': len([x for x in self.module.kinds.keys() if x[0] == 's']) > 0,\n+            'has_array': any(x for x in self.module.kinds.keys() if x[0] == 'a'),\n+            'has_map': any(x for x in self.module.kinds.keys() if x[0] == 'm'),\n+            'has_string': any(x for x in self.module.kinds.keys() if x[0] == 's'),\n             'has_namespace': self.module.mojom_namespace != '',\n             'interface_event': GetEventInterface(self.module.interfaces),\n             'interface_main': GetMainInterface(self.module.interfaces),\n@@ -485,9 +485,9 @@ class Generator(generator.Generator):\n         return {\n             'consts': self.module.constants,\n             'enums_gen_header': [x for x in self.module.enums if x.attributes is None or 'skipHeader' not in x.attributes],\n-            'has_array': len([x for x in self.module.kinds.keys() if x[0] == 'a']) > 0,\n-            'has_map': len([x for x in self.module.kinds.keys() if x[0] == 'm']) > 0,\n-            'has_string': len([x for x in self.module.kinds.keys() if x[0] == 's']) > 0,\n+            'has_array': any(x for x in self.module.kinds.keys() if x[0] == 'a'),\n+            'has_map': any(x for x in self.module.kinds.keys() if x[0] == 'm'),\n+            'has_string': any(x for x in self.module.kinds.keys() if x[0] == 's'),\n             'structs_gen_header': [x for x in self.module.structs if x.attributes is None or 'skipHeader' not in x.attributes],\n             'structs_gen_serializer': [x for x in self.module.structs if x.attributes is None or 'skipSerdes' not in x.attributes],\n         }\n",
    "prefixes": [
        "RFC",
        "v1",
        "1/8"
    ]
}