summaryrefslogtreecommitdiff
path: root/sphinx/util/jsdump.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2017-02-08 14:31:59 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2017-02-08 18:38:42 +0900
commit6fa0262802a09050e09445c9fd630c69b5ad1204 (patch)
treea2ad8f7849540d1b027e0b99d9913394b23c58d8 /sphinx/util/jsdump.py
parent81eb101e9f8fcee1c439ee0dd501d135eced01c6 (diff)
downloadsphinx-git-6fa0262802a09050e09445c9fd630c69b5ad1204.tar.gz
Fix mypy violations
Diffstat (limited to 'sphinx/util/jsdump.py')
-rw-r--r--sphinx/util/jsdump.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/sphinx/util/jsdump.py b/sphinx/util/jsdump.py
index 7c60a1b70..592a4565f 100644
--- a/sphinx/util/jsdump.py
+++ b/sphinx/util/jsdump.py
@@ -18,7 +18,7 @@ from sphinx.util.pycompat import u
if False:
# For type annotation
- from typing import Any, IO, Union # NOQA
+ from typing import Any, IO, Match, Union # NOQA
_str_re = re.compile(r'"(\\\\|\\"|[^"])*"')
_int_re = re.compile(r'\d+')
@@ -43,6 +43,7 @@ ESCAPED = re.compile(r'\\u.{4}|\\.')
def encode_string(s):
# type: (str) -> str
def replace(match):
+ # type: (Match) -> unicode
s = match.group(0)
try:
return ESCAPE_DICT[s]
@@ -56,7 +57,7 @@ def encode_string(s):
s1 = 0xd800 | ((n >> 10) & 0x3ff)
s2 = 0xdc00 | (n & 0x3ff)
return '\\u%04x\\u%04x' % (s1, s2)
- return '"' + str(ESCAPE_ASCII.sub(replace, s)) + '"'
+ return '"' + str(ESCAPE_ASCII.sub(replace, s)) + '"' # type: ignore
def decode_string(s):