|
174 | 174 |
|
175 | 175 | # Authors |
176 | 176 | # ======= |
177 | | -# |
| 177 | +# |
178 | 178 | # - John D Hunter: original author. |
179 | 179 | # - Fernando Perez: refactoring, documentation, cleanups, port to 0.11. |
180 | 180 | # - VáclavŠmilauer <eudoxos-AT-arcig.cz>: Prompt generalizations. |
|
196 | 196 | import warnings |
197 | 197 | import shutil |
198 | 198 | from io import StringIO |
| 199 | +from typing import Any, Dict, Set |
199 | 200 |
|
200 | 201 | # Third-party |
201 | 202 | from docutils.parsers.rst import directives |
@@ -425,7 +426,7 @@ def process_image(self, decorator): |
425 | 426 | source_dir = self.source_dir |
426 | 427 | saveargs = decorator.split(' ') |
427 | 428 | filename = saveargs[1] |
428 | | - # insert relative path to image file in source |
| 429 | + # insert relative path to image file in source |
429 | 430 | # as absolute path for Sphinx |
430 | 431 | # sphinx expects a posix path, even on Windows |
431 | 432 | path = pathlib.Path(savefig_dir, filename) |
@@ -901,21 +902,22 @@ def custom_doctest(self, decorator, input_lines, found, submitted): |
901 | 902 |
|
902 | 903 | class IPythonDirective(Directive): |
903 | 904 |
|
904 | | - has_content = True |
905 | | - required_arguments = 0 |
906 | | - optional_arguments = 4 # python, suppress, verbatim, doctest |
907 | | - final_argumuent_whitespace = True |
908 | | - option_spec = { 'python': directives.unchanged, |
909 | | - 'suppress' : directives.flag, |
910 | | - 'verbatim' : directives.flag, |
911 | | - 'doctest' : directives.flag, |
912 | | - 'okexcept': directives.flag, |
913 | | - 'okwarning': directives.flag |
914 | | - } |
| 905 | + has_content: bool = True |
| 906 | + required_arguments: int = 0 |
| 907 | + optional_arguments: int = 4 # python, suppress, verbatim, doctest |
| 908 | + final_argumuent_whitespace: bool = True |
| 909 | + option_spec: Dict[str, Any] = { |
| 910 | + "python": directives.unchanged, |
| 911 | + "suppress": directives.flag, |
| 912 | + "verbatim": directives.flag, |
| 913 | + "doctest": directives.flag, |
| 914 | + "okexcept": directives.flag, |
| 915 | + "okwarning": directives.flag, |
| 916 | + } |
915 | 917 |
|
916 | 918 | shell = None |
917 | 919 |
|
918 | | - seen_docs = set() |
| 920 | + seen_docs: Set = set() |
919 | 921 |
|
920 | 922 | def get_config_options(self): |
921 | 923 | # contains sphinx configuration variables |
|
0 commit comments