Skip to content

Commit 5430920

Browse files
authored
MNT Simplify inefficient regex (scikit-learn#31603)
1 parent bde701d commit 5430920

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sklearn/tests/test_min_dependencies_readme.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ def test_min_dependencies_readme():
3232
# sklearn/_min_dependencies.py
3333

3434
pattern = re.compile(
35-
r"(\.\. \|)"
36-
r"(([A-Za-z]+\-?)+)"
37-
r"(MinVersion\| replace::)"
35+
r"\.\. \|"
36+
r"([A-Za-z-]+)"
37+
r"MinVersion\| replace::"
3838
r"( [0-9]+\.[0-9]+(\.[0-9]+)?)"
3939
)
4040

@@ -53,7 +53,7 @@ def test_min_dependencies_readme():
5353
if not matched:
5454
continue
5555

56-
package, version = matched.group(2), matched.group(5)
56+
package, version = matched.group(0), matched.group(1)
5757
package = package.lower()
5858

5959
if package in dependent_packages:

0 commit comments

Comments
 (0)