summaryrefslogtreecommitdiff
path: root/sphinx/util/smartypants.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/util/smartypants.py')
-rw-r--r--sphinx/util/smartypants.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/sphinx/util/smartypants.py b/sphinx/util/smartypants.py
index 7450e07b8..47f8b59b2 100644
--- a/sphinx/util/smartypants.py
+++ b/sphinx/util/smartypants.py
@@ -26,14 +26,12 @@
"""
import re
+from typing import Generator, Iterable, Tuple
from docutils.utils import smartquotes
from sphinx.util.docutils import __version_info__ as docutils_version
-if False: # For type annotation
- from typing import Generator, Iterable, Tuple # NOQA
-
langquotes = {'af': '“”‘’',
'af-x-altquot': '„”‚’',
@@ -125,8 +123,7 @@ langquotes = {'af': '“”‘’',
}
-def educateQuotes(text, language='en'):
- # type: (str, str) -> str
+def educateQuotes(text: str, language: str = 'en') -> str:
"""
Parameter: - text string (unicode or bytes).
- language (`BCP 47` language tag.)
@@ -240,8 +237,10 @@ def educateQuotes(text, language='en'):
return text
-def educate_tokens(text_tokens, attr=smartquotes.default_smartypants_attr, language='en'):
- # type: (Iterable[Tuple[str, str]], str, str) -> Generator[str, None, None]
+def educate_tokens(text_tokens: Iterable[Tuple[str, str]],
+ attr: str = smartquotes.default_smartypants_attr,
+ language: str = 'en'
+ ) -> Generator[str, None, None]:
"""Return iterator that "educates" the items of `text_tokens`.
This is modified to intercept the ``attr='2'`` as it was used by the