Skip to contentSkip to conversation

scripts/igt_doc: fix a deprecation warning

PATCH In review Michael J. Ruhl 2 participants 5 messages Jul 15, 2025 – Jul 17, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts/igt_doc: fix a deprecation warning

The regular expression usage has count as the third parameter, which results in this error message:

DeprecationWarning: 'count' is passed as positional argument

So the current usage incorrectly uses the flag value as a count.

Specify the parameter name to get the correct usage.

---
 scripts/igt_doc.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/igt_doc.py +1 -1
index fa2c2c7ca..3a37a9701 100755
@@ -37,7 +37,7 @@ class IgtTestList(TestList):
                 run_type = "other"
             else:
                 for driver in self.drivers:
-                    result = re.sub(r"^" + driver + r"[\W_]*", "", run_type, re.IGNORECASE)
+                    result = re.sub(r"^" + driver + r"[\W_]*", "", run_type, flags = re.IGNORECASE)
                     if result != run_type:
                         driver_set = set([driver])
                         run_type = result
Signature · 1 line
2.50.0
Reviewed-by on v1 1/1
#1 lore raw

Hi Michael,

Quoted 10 lines · Michael J. Ruhl

The regular expression usage has count as the third parameter, which results in this error message:

DeprecationWarning: 'count' is passed as positional argument

So the current usage incorrectly uses the flag value as a count.

Specify the parameter name to get the correct usage.

Quoted 20 lines
---
 scripts/igt_doc.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/igt_doc.py +1 -1
index fa2c2c7ca..3a37a9701 100755
@@ -37,7 +37,7 @@ class IgtTestList(TestList):
                 run_type = "other"
             else:
                 for driver in self.drivers:
-                    result = re.sub(r"^" + driver + r"[\W_]*", "", run_type, re.IGNORECASE)
+                    result = re.sub(r"^" + driver + r"[\W_]*", "", run_type, flags = re.IGNORECASE)
                     if result != run_type:
                         driver_set = set([driver])
                         run_type = result
Signature · 1 line
2.50.0
#2 lore raw
In reply to Michael J. Ruhl

Hi Michael,

Quoted 10 lines · Michael J. Ruhl

The regular expression usage has count as the third parameter, which results in this error message:

DeprecationWarning: 'count' is passed as positional argument

So the current usage incorrectly uses the flag value as a count.

Specify the parameter name to get the correct usage.

Thank you, I already merged it but please see one nit below.

Quoted 9 lines
---
 scripts/igt_doc.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/igt_doc.py +0 -0
index fa2c2c7ca..3a37a9701 100755

scripts/igt_doc.py class IgtTestList(TestList): · line 40

Quoted 5 lines
scripts/igt_doc.py +1 -1
@@ -37,7 +37,7 @@ class IgtTestList(TestList):
                 run_type = "other"
             else:
                 for driver in self.drivers:
-                    result = re.sub(r"^" + driver + r"[\W_]*", "", run_type, re.IGNORECASE)
+                    result = re.sub(r"^" + driver + r"[\W_]*", "", run_type, flags = re.IGNORECASE)

According to Python doc, there should be also count=0:

result = re.sub(r"^" + driver + r"[\W_]*", "", run_type, count = 0, flags = re.IGNORECASE)

Please see: https://docs.python.org/3/library/re.html#re.sub

Regards,
Kamil

Quoted 6 lines
scripts/igt_doc.py +0 -0
                     if result != run_type:
                         driver_set = set([driver])
                         run_type = result
Signature · 1 line
2.50.0
#3 lore raw
Quoted 38 lines

-----Original Message-----
From: Kamil Konieczny <[email protected]>
Sent: Wednesday, July 16, 2025 7:49 AM
To: Ruhl, Michael J <[email protected]>
Cc: [email protected]; De Marchi, Lucas <[email protected]>; Vivi, Rodrigo <[email protected]>
Subject: Re: [PATCH] scripts/igt_doc: fix a deprecation warning

Hi Michael,

Quoted 10 lines · Michael J. Ruhl

The regular expression usage has count as the third parameter, which results in this error message:

DeprecationWarning: 'count' is passed as positional argument

So the current usage incorrectly uses the flag value as a count.

Specify the parameter name to get the correct usage.

Thank you, I already merged it but please see one nit below.

scripts/igt_doc.py class IgtTestList(TestList): · line 40

Quoted 13 lines
---
 scripts/igt_doc.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/igt_doc.py +0 -1
index fa2c2c7ca..3a37a9701 100755
@@ -37,7 +37,7 @@ class IgtTestList(TestList):
                 run_type = "other"
             else:
                 for driver in self.drivers:
-                    result = re.sub(r"^" + driver + r"[\W_]*", "", run_type,

re.IGNORECASE)

scripts/igt_doc.py class IgtTestList(TestList): · line 40

Quoted 1 line
scripts/igt_doc.py +1 -0
+                    result = re.sub(r"^" + driver + r"[\W_]*", "", run_type, flags =
Quoted 8 lines

re.IGNORECASE)

According to Python doc, there should be also count=0:

result = re.sub(r"^" + driver + r"[\W_]*", "", run_type, count = 0, flags = re.IGNORECASE)

Please see: https://docs.python.org/3/library/re.html#re.sub

Hi Kamil,

My understanding was that that indicated that the default value of count/flags if they where not explicitly set.... Looking at the examples, I see they are setting flags, but not count.

I can provide an update with count = 0, but it is not clear to me that that is required.

Thoughts?

Mike

Quoted 9 lines

Regards,
Kamil

Quoted 6 lines
scripts/igt_doc.py +0 -1
                     if result != run_type:
                         driver_set = set([driver])
                         run_type = result
--

2.50.0

#4 lore raw

Hi Ruhl,,

Quoted 49 lines · Michael J
Quoted 38 lines

-----Original Message-----
From: Kamil Konieczny <[email protected]>
Sent: Wednesday, July 16, 2025 7:49 AM
To: Ruhl, Michael J <[email protected]>
Cc: [email protected]; De Marchi, Lucas <[email protected]>; Vivi, Rodrigo <[email protected]>
Subject: Re: [PATCH] scripts/igt_doc: fix a deprecation warning

Hi Michael,

Quoted 10 lines · Michael J. Ruhl

The regular expression usage has count as the third parameter, which results in this error message:

DeprecationWarning: 'count' is passed as positional argument

So the current usage incorrectly uses the flag value as a count.

Specify the parameter name to get the correct usage.

Thank you, I already merged it but please see one nit below.

scripts/igt_doc.py class IgtTestList(TestList): · line 40

Quoted 13 lines
---
 scripts/igt_doc.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/igt_doc.py +0 -1
index fa2c2c7ca..3a37a9701 100755
@@ -37,7 +37,7 @@ class IgtTestList(TestList):
                 run_type = "other"
             else:
                 for driver in self.drivers:
-                    result = re.sub(r"^" + driver + r"[\W_]*", "", run_type,

re.IGNORECASE)

scripts/igt_doc.py class IgtTestList(TestList): · line 40

Quoted 1 line
scripts/igt_doc.py +1 -0
+                    result = re.sub(r"^" + driver + r"[\W_]*", "", run_type, flags =
Quoted 8 lines

re.IGNORECASE)

According to Python doc, there should be also count=0:

result = re.sub(r"^" + driver + r"[\W_]*", "", run_type, count = 0, flags = re.IGNORECASE)

Please see: https://docs.python.org/3/library/re.html#re.sub

Hi Kamil,

Quoted 7 lines

My understanding was that that indicated that the default value of count/flags if they where not explicitly set.... Looking at the examples, I see they are setting flags, but not count.

I can provide an update with count = 0, but it is not clear to me that that is required.

Thoughts?

I am not python programmer, not sure if that AI suggestion is true.

After second reading of examples from above link I see there is exactly same code you wrote, no count and flags only, so imho no need for more changes.

Regards,
Kamil

Quoted 12 lines

Mike

Quoted 9 lines

Regards,
Kamil

Quoted 6 lines
scripts/igt_doc.py +0 -1
                     if result != run_type:
                         driver_set = set([driver])
                         run_type = result
--

2.50.0