From: Andrew Bailey <abailey@iol.unh.edu>
To: luca.vizzarro@arm.com, probb@iol.unh.edu
Cc: dmarx@iol.unh.edu, dev@dpdk.org, Andrew Bailey <abailey@iol.unh.edu>
Subject: [PATCH v2 1/5] dts: add find float method to text parser
Date: Tue, 10 Feb 2026 13:06:41 -0500 [thread overview]
Message-ID: <20260210180645.65880-2-abailey@iol.unh.edu> (raw)
In-Reply-To: <20260210180645.65880-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
next prev parent reply other threads:[~2026-02-10 19:59 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260122214424.322422-1-abailey@iol.unh.edu>
2026-01-22 21:44 ` [PATCH v1 1/5] dts: add find float method to text parser Andrew Bailey
2026-01-23 16:32 ` Dean Marx
2026-01-22 21:44 ` [PATCH v1 2/5] dts: add cryptodev package to DTS Andrew Bailey
2026-01-23 16:36 ` Dean Marx
2026-01-22 21:44 ` [PATCH v1 3/5] dts: add cryptodev throughput test suite Andrew Bailey
2026-01-23 16:46 ` Dean Marx
2026-02-02 15:51 ` Andrew Bailey
2026-01-22 21:44 ` [PATCH v1 4/5] dts: add crypto test decorator Andrew Bailey
2026-01-23 16:54 ` Dean Marx
2026-01-22 21:44 ` [PATCH v1 5/5] dts: automate VFIO-PCI modprobe in node setup Andrew Bailey
2026-01-23 16:57 ` Dean Marx
2026-02-10 18:06 ` [PATCH v2 0/5] *** dts: add cryptodev testing support *** Andrew Bailey
2026-02-10 18:06 ` Andrew Bailey [this message]
2026-02-10 18:06 ` [PATCH v2 2/5] dts: add cryptodev package to DTS Andrew Bailey
2026-02-10 18:06 ` [PATCH v2 3/5] dts: add cryptodev throughput test suite Andrew Bailey
2026-02-10 18:06 ` [PATCH v2 4/5] dts: add crypto test decorator Andrew Bailey
2026-02-10 18:06 ` [PATCH v2 5/5] dts: automate VFIO-PCI modprobe in node setup Andrew Bailey
2026-02-10 19:38 ` [PATCH v2 0/5] *** dts: add cryptodev testing support *** Andrew Bailey
2026-02-10 19:34 [PATCH v2 0/5] dts: add cryptodev testing support Andrew Bailey
2026-02-10 19:34 ` [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=20260210180645.65880-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