texlive[71607] Build/source/texk/web2c/tests/fix-changefile-lines.py:

commits+ascherer at tug.org commits+ascherer at tug.org
Mon Jun 24 00:47:31 CEST 2024


Revision: 71607
          https://tug.org/svn/texlive?view=revision&revision=71607
Author:   ascherer
Date:     2024-06-24 00:47:31 +0200 (Mon, 24 Jun 2024)
Log Message:
-----------
Purge redundancy.

're.sub()' does the right thing: When the 'pattern' doesn't 'match', it
simply returns the (unmodified) string.

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/tests/fix-changefile-lines.py

Modified: trunk/Build/source/texk/web2c/tests/fix-changefile-lines.py
===================================================================
--- trunk/Build/source/texk/web2c/tests/fix-changefile-lines.py	2024-06-23 22:26:34 UTC (rev 71606)
+++ trunk/Build/source/texk/web2c/tests/fix-changefile-lines.py	2024-06-23 22:47:31 UTC (rev 71607)
@@ -195,9 +195,7 @@
             new_line = "@x"
 
             if opt_handler.part_b or opt_handler.section_b:
-                pattern = "\\[\\d+(\\.\\d+)?\\]"
-                if re.match(pattern, old_line):
-                    old_line = re.sub(pattern, "", old_line, 1).strip()
+                old_line = re.sub("\\[\\d+(\\.\\d+)?\\]", "", old_line, 1).strip()
                 new_line += " ["
                 if opt_handler.part_b:
                     new_line += f"{part}"
@@ -208,16 +206,12 @@
                 new_line += "]"
 
             if opt_handler.line_b:
-                pattern = "l\\.\\d+"
-                if re.match(pattern, old_line):
-                    old_line = re.sub(pattern, "", old_line, 1).strip()
+                old_line = re.sub("l\\.\\d+", "", old_line, 1).strip()
                 new_line += f" l.{line_number}"
 
             if opt_handler.text_b and old_line:
                 if opt_handler.hyphen_b:
-                    pattern = "-+"
-                    if re.match(pattern, old_line):
-                        old_line = re.sub(pattern, "", old_line, 1).strip()
+                    old_line = re.sub("-+", "", old_line, 1).strip()
                     new_line += " -"
                 new_line += f" {old_line}"
 



More information about the tex-live-commits mailing list.