public inbox for dev@dpdk.org
 help / color / mirror / Atom feed
From: Andrew Bailey <abailey@iol.unh.edu>
To: luca.vizzarro@arm.com, probb@iol.unh.edu, dev@dpdk.org
Cc: dmarx@iol.unh.edu, Andrew Bailey <abailey@iol.unh.edu>
Subject: [PATCH v2 1/5] dts: add find float method to text parser
Date: Tue, 10 Feb 2026 14:34:44 -0500	[thread overview]
Message-ID: <20260210193448.69423-2-abailey@iol.unh.edu> (raw)
In-Reply-To: <20260210193448.69423-1-abailey@iol.unh.edu>

Currently, there is no way to gather floats from text using the parser.
Adding a new method to find floats will allow testsuites to utilize
valuable float values that are output from applications.

Signed-off-by: Andrew Bailey <abailey@iol.unh.edu>
---
 dts/framework/parser.py | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/dts/framework/parser.py b/dts/framework/parser.py
index 4170cdb1dd..3075c36857 100644
--- a/dts/framework/parser.py
+++ b/dts/framework/parser.py
@@ -220,6 +220,34 @@ def find_int(
 
         return TextParser.wrap(TextParser.find(pattern), partial(int, base=int_base))
 
+    @staticmethod
+    def find_float(
+        pattern: str | re.Pattern[str],
+        flags: re.RegexFlag = re.RegexFlag(0),
+    ) -> ParserFn:
+        """Makes a parser function that converts the match of :meth:`~find` to float.
+
+        This function is compatible only with a pattern containing one capturing group.
+
+        Args:
+            pattern: The regular expression pattern.
+            flags: The regular expression flags. Ignored if the given pattern is already compiled.
+
+        Raises:
+            InternalError: If the pattern does not have exactly one capturing group.
+
+        Returns:
+            ParserFn: A dictionary for the `dataclasses.field` metadata argument containing the
+                :meth:`~find` parser function wrapped by the float built-in.
+        """
+        if isinstance(pattern, str):
+            pattern = re.compile(pattern, flags)
+
+        if pattern.groups != 1:
+            raise InternalError("only one capturing group is allowed with this parser function")
+
+        return TextParser.wrap(TextParser.find(pattern), partial(float))
+
     """============ END PARSER FUNCTIONS ============"""
 
     @classmethod
-- 
2.50.1


  reply	other threads:[~2026-02-10 19:35 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-10 19:34 [PATCH v2 0/5] dts: add cryptodev testing support Andrew Bailey
2026-02-10 19:34 ` Andrew Bailey [this message]
2026-02-10 19:34 ` [PATCH v2 2/5] dts: add cryptodev package to DTS Andrew Bailey
2026-02-10 19:34 ` [PATCH v2 3/5] dts: add cryptodev throughput test suite Andrew Bailey
2026-02-10 19:34 ` [PATCH v2 4/5] dts: add crypto test decorator Andrew Bailey
2026-02-10 19:34 ` [PATCH v2 5/5] dts: automate VFIO-PCI modprobe in node setup Andrew Bailey
2026-02-13 19:35 ` [PATCH v3 0/5] dts: add cryptodev testing support Andrew Bailey
2026-02-13 19:35   ` [PATCH v3 1/5] dts: add find float method to text parser Andrew Bailey
2026-02-25 21:05     ` Patrick Robb
2026-02-13 19:35   ` [PATCH v3 2/5] dts: add cryptodev package to DTS Andrew Bailey
2026-02-25 21:06     ` Patrick Robb
2026-02-26 19:13       ` Andrew Bailey
2026-02-27 16:15     ` Patrick Robb
2026-02-13 19:35   ` [PATCH v3 3/5] dts: add cryptodev throughput test suite Andrew Bailey
2026-02-27 18:24     ` Patrick Robb
2026-02-27 19:43       ` Andrew Bailey
2026-02-13 19:35   ` [PATCH v3 4/5] dts: add crypto test decorator Andrew Bailey
2026-02-27 18:28     ` Patrick Robb
2026-02-27 19:18       ` Andrew Bailey
2026-02-13 19:35   ` [PATCH v3 5/5] dts: automate VFIO-PCI modprobe in node setup Andrew Bailey
2026-02-27 18:33     ` Patrick Robb
2026-03-02 18:54 ` [PATCH v4 0/5] dts: add cryptodev testing support Andrew Bailey
2026-03-02 18:54   ` [PATCH v4 1/5] dts: add find float method to text parser Andrew Bailey
2026-03-02 18:54   ` [PATCH v4 2/5] dts: automate VFIO-PCI modprobe in node setup Andrew Bailey
2026-03-02 18:54   ` [PATCH v4 3/5] dts: add cryptodev package to DTS Andrew Bailey
2026-03-02 18:54   ` [PATCH v4 4/5] dts: add cryptodev throughput test suite Andrew Bailey
2026-03-05 19:26     ` Patrick Robb
2026-03-05 20:20     ` Patrick Robb
2026-03-02 18:54   ` [PATCH v4 5/5] dts: add crypto test decorator Andrew Bailey
2026-03-06 16:40 ` [PATCH v5 0/5] dts: add cryptodev testing support Andrew Bailey
2026-03-06 16:40   ` [PATCH v5 1/5] dts: add find float method to text parser Andrew Bailey
2026-03-06 16:40   ` [PATCH v5 2/5] dts: automate VFIO-PCI modprobe in node setup Andrew Bailey
2026-03-06 16:40   ` [PATCH v5 3/5] dts: add cryptodev package to DTS Andrew Bailey
2026-03-09  1:26     ` Patrick Robb
2026-03-06 16:40   ` [PATCH v5 4/5] dts: add cryptodev throughput test suite Andrew Bailey
2026-03-06 16:40   ` [PATCH v5 5/5] dts: add crypto test decorator Andrew Bailey
2026-03-12 18:08     ` Thomas Monjalon
2026-03-12 18:48       ` Andrew Bailey
2026-03-12 18:55         ` Thomas Monjalon
2026-03-12 19:54       ` Patrick Robb
2026-03-12 20:29         ` Thomas Monjalon
     [not found] <20260122214424.322422-1-abailey@iol.unh.edu>
2026-02-10 18:06 ` [PATCH v2 0/5] *** dts: add cryptodev testing support *** Andrew Bailey
2026-02-10 18:06   ` [PATCH v2 1/5] dts: add find float method to text parser Andrew Bailey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260210193448.69423-2-abailey@iol.unh.edu \
    --to=abailey@iol.unh.edu \
    --cc=dev@dpdk.org \
    --cc=dmarx@iol.unh.edu \
    --cc=luca.vizzarro@arm.com \
    --cc=probb@iol.unh.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox