]> git.madduck.net Git - etc/vim.git/blobdiff - src/blib2to3/pgen2/literals.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:

Migrate mypy config to pyproject.toml (#3936)
[etc/vim.git] / src / blib2to3 / pgen2 / literals.py
index b5fe42851148e7fd6270ae728a0327f1523dd4b5..53c0b8ac2bbb2984a8b78d03261d8c7ebd0eb5ca 100644 (file)
@@ -4,11 +4,9 @@
 """Safely evaluate Python string literals without using eval()."""
 
 import re
+from typing import Dict, Match
 
-from typing import Dict, Match, Text
-
-
-simple_escapes: Dict[Text, Text] = {
+simple_escapes: Dict[str, str] = {
     "a": "\a",
     "b": "\b",
     "f": "\f",
@@ -22,7 +20,7 @@ simple_escapes: Dict[Text, Text] = {
 }
 
 
-def escape(m: Match[Text]) -> Text:
+def escape(m: Match[str]) -> str:
     all, tail = m.group(0, 1)
     assert all.startswith("\\")
     esc = simple_escapes.get(tail)
@@ -44,7 +42,7 @@ def escape(m: Match[Text]) -> Text:
     return chr(i)
 
 
-def evalString(s: Text) -> Text:
+def evalString(s: str) -> str:
     assert s.startswith("'") or s.startswith('"'), repr(s[:1])
     q = s[0]
     if s[:3] == q * 3: