get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 134383,
    "url": "http://patches.dpdk.org/api/patches/134383/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20231115130959.39420-7-juraj.linkes@pantheon.tech/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20231115130959.39420-7-juraj.linkes@pantheon.tech>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20231115130959.39420-7-juraj.linkes@pantheon.tech",
    "date": "2023-11-15T13:09:44",
    "name": "[v7,06/21] dts: logger and utils docstring update",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "5e2971aa4a2ea9fb3d4851d59494776af02f00a1",
    "submitter": {
        "id": 1626,
        "url": "http://patches.dpdk.org/api/people/1626/?format=api",
        "name": "Juraj Linkeš",
        "email": "juraj.linkes@pantheon.tech"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20231115130959.39420-7-juraj.linkes@pantheon.tech/mbox/",
    "series": [
        {
            "id": 30302,
            "url": "http://patches.dpdk.org/api/series/30302/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=30302",
            "date": "2023-11-15T13:09:38",
            "name": "dts: docstrings update",
            "version": 7,
            "mbox": "http://patches.dpdk.org/series/30302/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/134383/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/134383/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 274E143339;\n\tWed, 15 Nov 2023 14:12:26 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 722CC40DF6;\n\tWed, 15 Nov 2023 14:12:04 +0100 (CET)",
            "from mail-ej1-f51.google.com (mail-ej1-f51.google.com\n [209.85.218.51]) by mails.dpdk.org (Postfix) with ESMTP id EF4BC40A77\n for <dev@dpdk.org>; Wed, 15 Nov 2023 14:11:57 +0100 (CET)",
            "by mail-ej1-f51.google.com with SMTP id\n a640c23a62f3a-9c3aec5f326so167011766b.1\n for <dev@dpdk.org>; Wed, 15 Nov 2023 05:11:57 -0800 (PST)",
            "from jlinkes-PT-Latitude-5530.pantheon.local\n (81.89.53.154.host.vnet.sk. [81.89.53.154])\n by smtp.gmail.com with ESMTPSA id\n tb16-20020a1709078b9000b009f2b7282387sm1011914ejc.46.2023.11.15.05.11.56\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 15 Nov 2023 05:11:56 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=pantheon.tech; s=google; t=1700053917; x=1700658717; darn=dpdk.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=4pYVcP09l1t5ff07XjovR/hMQPMd7GEFTrwDqd89mEA=;\n b=P0fHJuNP/M370pfbDk6LYZTw9shaEAbq/UxY/zL9yVm6nK9a7MF5dyjUX1GtfAz2ID\n ClsEz/TC20VGnQY3errUraF5sZ5vQy3tbaC+34cjj2lXm9oWi9X2msqgYMCQRYkCPgTn\n SEu0Vdjy7sGoGsW+lnsZHCUtr18t1xBQXGRgvB7KeNxrpHZtnNh91OCKHXFMupYPdg7K\n ZK19SYlBKiH616qodDdk+MegJijICEuk3ybQNRa+Z0pWNzsME/xcU12eOP6n7k+ZNdYs\n tz16P0JwMFjkfB5ZGYIaHywH/mzUHcHKqcE6oyZ505d9I2pY8fLXvJHl1rDLjsyzNdLQ\n wftw==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1700053917; x=1700658717;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n :subject:date:message-id:reply-to;\n bh=4pYVcP09l1t5ff07XjovR/hMQPMd7GEFTrwDqd89mEA=;\n b=SiUp7ifxlOewfcX6b4R7Uw4uAcIYi66mmpd/xIb8eei4Muc/fTIlcDb0xbah8nclj5\n hHLqUekeheTm/+uhgdWvMpPIe0QrgKUjr7dA2KZeqd0kiwGmW/W+LLAYUY99teTQWIrH\n 2sYMydFXRzeknmenUYH56PGmfGAXgUvawIL+/0wPq08xtvq8zFkn4/UOw2nMOdYoLMnE\n tH/dFscYDMgRBd/8+i6faCHVp5/X/EDLGZ3dQi4rEA3CefpM+wJS8IT37+Dsfamy0B9x\n MW7FOiUGYyW2JNjEZYXjkK47GWgb++TBotQws3xT04SnDU+uv/yIP1y8NjB/UP2a0uaf\n Yl1Q==",
        "X-Gm-Message-State": "AOJu0Yzs9QlWz/er4+ulVwGVsWrR9iPmE4IGxwjUbr6Vs/2KVeSEZkgY\n od+UUPhI1272CV1kozyFPSkdSXIAsnp7C/8PV5w1uQ==",
        "X-Google-Smtp-Source": "\n AGHT+IGCeGfckdkfVPRRBj6/5YmyuBek2GyLJiNyYhKUVf5tkLlEKjx5+UKQaTFqB+b+qZ2MA3GoJw==",
        "X-Received": "by 2002:a17:907:7204:b0:9b2:bdbb:f145 with SMTP id\n dr4-20020a170907720400b009b2bdbbf145mr5705081ejc.34.1700053917600;\n Wed, 15 Nov 2023 05:11:57 -0800 (PST)",
        "From": "=?utf-8?q?Juraj_Linke=C5=A1?= <juraj.linkes@pantheon.tech>",
        "To": "thomas@monjalon.net, Honnappa.Nagarahalli@arm.com, jspewock@iol.unh.edu,\n probb@iol.unh.edu, paul.szczepanek@arm.com, yoan.picchi@foss.arm.com",
        "Cc": "dev@dpdk.org, =?utf-8?q?Juraj_Linke=C5=A1?= <juraj.linkes@pantheon.tech>",
        "Subject": "[PATCH v7 06/21] dts: logger and utils docstring update",
        "Date": "Wed, 15 Nov 2023 14:09:44 +0100",
        "Message-Id": "<20231115130959.39420-7-juraj.linkes@pantheon.tech>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20231115130959.39420-1-juraj.linkes@pantheon.tech>",
        "References": "<20231108125324.191005-23-juraj.linkes@pantheon.tech>\n <20231115130959.39420-1-juraj.linkes@pantheon.tech>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "Format according to the Google format and PEP257, with slight\ndeviations.\n\nSigned-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>\n---\n dts/framework/logger.py | 72 ++++++++++++++++++++++-----------\n dts/framework/utils.py  | 88 +++++++++++++++++++++++++++++------------\n 2 files changed, 113 insertions(+), 47 deletions(-)",
    "diff": "diff --git a/dts/framework/logger.py b/dts/framework/logger.py\nindex bb2991e994..d3eb75a4e4 100644\n--- a/dts/framework/logger.py\n+++ b/dts/framework/logger.py\n@@ -3,9 +3,9 @@\n # Copyright(c) 2022-2023 PANTHEON.tech s.r.o.\n # Copyright(c) 2022-2023 University of New Hampshire\n \n-\"\"\"\n-DTS logger module with several log level. DTS framework and TestSuite logs\n-are saved in different log files.\n+\"\"\"DTS logger module.\n+\n+DTS framework and TestSuite logs are saved in different log files.\n \"\"\"\n \n import logging\n@@ -18,19 +18,21 @@\n stream_fmt = \"%(asctime)s - %(name)s - %(levelname)s - %(message)s\"\n \n \n-class LoggerDictType(TypedDict):\n-    logger: \"DTSLOG\"\n-    name: str\n-    node: str\n-\n+class DTSLOG(logging.LoggerAdapter):\n+    \"\"\"DTS logger adapter class for framework and testsuites.\n \n-# List for saving all using loggers\n-Loggers: list[LoggerDictType] = []\n+    The :option:`--verbose` command line argument and the :envvar:`DTS_VERBOSE` environment\n+    variable control the verbosity of output. If enabled, all messages will be emitted to the\n+    console.\n \n+    The :option:`--output` command line argument and the :envvar:`DTS_OUTPUT_DIR` environment\n+    variable modify the directory where the logs will be stored.\n \n-class DTSLOG(logging.LoggerAdapter):\n-    \"\"\"\n-    DTS log class for framework and testsuite.\n+    Attributes:\n+        node: The additional identifier. Currently unused.\n+        sh: The handler which emits logs to console.\n+        fh: The handler which emits logs to a file.\n+        verbose_fh: Just as fh, but logs with a different, more verbose, format.\n     \"\"\"\n \n     _logger: logging.Logger\n@@ -40,6 +42,15 @@ class DTSLOG(logging.LoggerAdapter):\n     verbose_fh: logging.FileHandler\n \n     def __init__(self, logger: logging.Logger, node: str = \"suite\"):\n+        \"\"\"Extend the constructor with additional handlers.\n+\n+        One handler logs to the console, the other one to a file, with either a regular or verbose\n+        format.\n+\n+        Args:\n+            logger: The logger from which to create the logger adapter.\n+            node: An additional identifier. Currently unused.\n+        \"\"\"\n         self._logger = logger\n         # 1 means log everything, this will be used by file handlers if their level\n         # is not set\n@@ -92,26 +103,43 @@ def __init__(self, logger: logging.Logger, node: str = \"suite\"):\n         super(DTSLOG, self).__init__(self._logger, dict(node=self.node))\n \n     def logger_exit(self) -> None:\n-        \"\"\"\n-        Remove stream handler and logfile handler.\n-        \"\"\"\n+        \"\"\"Remove the stream handler and the logfile handler.\"\"\"\n         for handler in (self.sh, self.fh, self.verbose_fh):\n             handler.flush()\n             self._logger.removeHandler(handler)\n \n \n+class _LoggerDictType(TypedDict):\n+    logger: DTSLOG\n+    name: str\n+    node: str\n+\n+\n+# List for saving all loggers in use\n+_Loggers: list[_LoggerDictType] = []\n+\n+\n def getLogger(name: str, node: str = \"suite\") -> DTSLOG:\n+    \"\"\"Get DTS logger adapter identified by name and node.\n+\n+    An existing logger will be return if one with the exact name and node already exists.\n+    A new one will be created and stored otherwise.\n+\n+    Args:\n+        name: The name of the logger.\n+        node: An additional identifier for the logger.\n+\n+    Returns:\n+        A logger uniquely identified by both name and node.\n     \"\"\"\n-    Get logger handler and if there's no handler for specified Node will create one.\n-    \"\"\"\n-    global Loggers\n+    global _Loggers\n     # return saved logger\n-    logger: LoggerDictType\n-    for logger in Loggers:\n+    logger: _LoggerDictType\n+    for logger in _Loggers:\n         if logger[\"name\"] == name and logger[\"node\"] == node:\n             return logger[\"logger\"]\n \n     # return new logger\n     dts_logger: DTSLOG = DTSLOG(logging.getLogger(name), node)\n-    Loggers.append({\"logger\": dts_logger, \"name\": name, \"node\": node})\n+    _Loggers.append({\"logger\": dts_logger, \"name\": name, \"node\": node})\n     return dts_logger\ndiff --git a/dts/framework/utils.py b/dts/framework/utils.py\nindex f0c916471c..5016e3be10 100644\n--- a/dts/framework/utils.py\n+++ b/dts/framework/utils.py\n@@ -3,6 +3,16 @@\n # Copyright(c) 2022-2023 PANTHEON.tech s.r.o.\n # Copyright(c) 2022-2023 University of New Hampshire\n \n+\"\"\"Various utility classes and functions.\n+\n+These are used in multiple modules across the framework. They're here because\n+they provide some non-specific functionality, greatly simplify imports or just don't\n+fit elsewhere.\n+\n+Attributes:\n+    REGEX_FOR_PCI_ADDRESS: The regex representing a PCI address, e.g. ``0000:00:08.0``.\n+\"\"\"\n+\n import atexit\n import json\n import os\n@@ -19,12 +29,20 @@\n \n \n def expand_range(range_str: str) -> list[int]:\n-    \"\"\"\n-    Process range string into a list of integers. There are two possible formats:\n-    n - a single integer\n-    n-m - a range of integers\n+    \"\"\"Process `range_str` into a list of integers.\n+\n+    There are two possible formats of `range_str`:\n+\n+        * ``n`` - a single integer,\n+        * ``n-m`` - a range of integers.\n \n-    The returned range includes both n and m. Empty string returns an empty list.\n+    The returned range includes both ``n`` and ``m``. Empty string returns an empty list.\n+\n+    Args:\n+        range_str: The range to expand.\n+\n+    Returns:\n+        All the numbers from the range.\n     \"\"\"\n     expanded_range: list[int] = []\n     if range_str:\n@@ -39,6 +57,14 @@ def expand_range(range_str: str) -> list[int]:\n \n \n def get_packet_summaries(packets: list[Packet]) -> str:\n+    \"\"\"Format a string summary from `packets`.\n+\n+    Args:\n+        packets: The packets to format.\n+\n+    Returns:\n+        The summary of `packets`.\n+    \"\"\"\n     if len(packets) == 1:\n         packet_summaries = packets[0].summary()\n     else:\n@@ -49,6 +75,8 @@ def get_packet_summaries(packets: list[Packet]) -> str:\n \n \n class StrEnum(Enum):\n+    \"\"\"Enum with members stored as strings.\"\"\"\n+\n     @staticmethod\n     def _generate_next_value_(\n         name: str, start: int, count: int, last_values: object\n@@ -56,22 +84,29 @@ def _generate_next_value_(\n         return name\n \n     def __str__(self) -> str:\n+        \"\"\"The string representation is the name of the member.\"\"\"\n         return self.name\n \n \n class MesonArgs(object):\n-    \"\"\"\n-    Aggregate the arguments needed to build DPDK:\n-    default_library: Default library type, Meson allows \"shared\", \"static\" and \"both\".\n-               Defaults to None, in which case the argument won't be used.\n-    Keyword arguments: The arguments found in meson_options.txt in root DPDK directory.\n-               Do not use -D with them, for example:\n-               meson_args = MesonArgs(enable_kmods=True).\n-    \"\"\"\n+    \"\"\"Aggregate the arguments needed to build DPDK.\"\"\"\n \n     _default_library: str\n \n     def __init__(self, default_library: str | None = None, **dpdk_args: str | bool):\n+        \"\"\"Initialize the meson arguments.\n+\n+        Args:\n+            default_library: The default library type, Meson supports ``shared``, ``static`` and\n+                ``both``. Defaults to :data:`None`, in which case the argument won't be used.\n+            dpdk_args: The arguments found in ``meson_options.txt`` in root DPDK directory.\n+                Do not use ``-D`` with them.\n+\n+        Example:\n+            ::\n+\n+                meson_args = MesonArgs(enable_kmods=True).\n+        \"\"\"\n         self._default_library = (\n             f\"--default-library={default_library}\" if default_library else \"\"\n         )\n@@ -83,6 +118,7 @@ def __init__(self, default_library: str | None = None, **dpdk_args: str | bool):\n         )\n \n     def __str__(self) -> str:\n+        \"\"\"The actual args.\"\"\"\n         return \" \".join(f\"{self._default_library} {self._dpdk_args}\".split())\n \n \n@@ -104,24 +140,14 @@ class _TarCompressionFormat(StrEnum):\n \n \n class DPDKGitTarball(object):\n-    \"\"\"Create a compressed tarball of DPDK from the repository.\n-\n-    The DPDK version is specified with git object git_ref.\n-    The tarball will be compressed with _TarCompressionFormat,\n-    which must be supported by the DTS execution environment.\n-    The resulting tarball will be put into output_dir.\n+    \"\"\"Compressed tarball of DPDK from the repository.\n \n-    The class supports the os.PathLike protocol,\n+    The class supports the :class:`os.PathLike` protocol,\n     which is used to get the Path of the tarball::\n \n         from pathlib import Path\n         tarball = DPDKGitTarball(\"HEAD\", \"output\")\n         tarball_path = Path(tarball)\n-\n-    Arguments:\n-        git_ref: A git commit ID, tag ID or tree ID.\n-        output_dir: The directory where to put the resulting tarball.\n-        tar_compression_format: The compression format to use.\n     \"\"\"\n \n     _git_ref: str\n@@ -136,6 +162,17 @@ def __init__(\n         output_dir: str,\n         tar_compression_format: _TarCompressionFormat = _TarCompressionFormat.xz,\n     ):\n+        \"\"\"Create the tarball during initialization.\n+\n+        The DPDK version is specified with `git_ref`. The tarball will be compressed with\n+        `tar_compression_format`, which must be supported by the DTS execution environment.\n+        The resulting tarball will be put into `output_dir`.\n+\n+        Args:\n+            git_ref: A git commit ID, tag ID or tree ID.\n+            output_dir: The directory where to put the resulting tarball.\n+            tar_compression_format: The compression format to use.\n+        \"\"\"\n         self._git_ref = git_ref\n         self._tar_compression_format = tar_compression_format\n \n@@ -204,4 +241,5 @@ def _delete_tarball(self) -> None:\n             os.remove(self._tarball_path)\n \n     def __fspath__(self) -> str:\n+        \"\"\"The os.PathLike protocol implementation.\"\"\"\n         return str(self._tarball_path)\n",
    "prefixes": [
        "v7",
        "06/21"
    ]
}