]> git.madduck.net Git - etc/vim.git/blobdiff - src/blib2to3/pgen2/conv.py

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Improve performance by skipping unnecessary normalisation (#3751)
[etc/vim.git] / src / blib2to3 / pgen2 / conv.py
index 78165217a1b0ebb777c522a56a480c51278aa53f..04eccfa1d4b6ac10b3d264b8fff0b494b8849549 100644 (file)
@@ -29,7 +29,7 @@ without having to invoke the Python pgen C program.
 """
 
 # Python imports
-import regex as re
+import re
 
 # Local imports
 from pgen2 import grammar, token
@@ -63,7 +63,7 @@ class Converter(grammar.Grammar):
         try:
             f = open(filename)
         except OSError as err:
-            print("Can't open %s: %s" % (filename, err))
+            print(f"Can't open {filename}: {err}")
             return False
         self.symbol2number = {}
         self.number2symbol = {}
@@ -72,7 +72,7 @@ class Converter(grammar.Grammar):
             lineno += 1
             mo = re.match(r"^#define\s+(\w+)\s+(\d+)$", line)
             if not mo and line.strip():
-                print("%s(%s): can't parse %s" % (filename, lineno, line.strip()))
+                print(f"{filename}({lineno}): can't parse {line.strip()}")
             else:
                 symbol, number = mo.groups()
                 number = int(number)
@@ -113,7 +113,7 @@ class Converter(grammar.Grammar):
         try:
             f = open(filename)
         except OSError as err:
-            print("Can't open %s: %s" % (filename, err))
+            print(f"Can't open {filename}: {err}")
             return False
         # The code below essentially uses f's iterator-ness!
         lineno = 0