Show More
@@ -15,6 +15,7 and stores the results. | |||||
15 |
|
15 | |||
16 | For more details, see the class docstrings below. |
|
16 | For more details, see the class docstrings below. | |
17 | """ |
|
17 | """ | |
|
18 | ||||
18 | from __future__ import annotations |
|
19 | from __future__ import annotations | |
19 |
|
20 | |||
20 | from warnings import warn |
|
21 | from warnings import warn |
@@ -4,6 +4,7 Line-based transformers are the simpler ones; token-based transformers are | |||||
4 | more complex. See test_inputtransformer2_line for tests for line-based |
|
4 | more complex. See test_inputtransformer2_line for tests for line-based | |
5 | transformations. |
|
5 | transformations. | |
6 | """ |
|
6 | """ | |
|
7 | ||||
7 | import platform |
|
8 | import platform | |
8 | import string |
|
9 | import string | |
9 | import sys |
|
10 | import sys |
@@ -160,14 +160,16 def test_get_ipython_dir_8(): | |||||
160 | # test only when HOME directory actually writable |
|
160 | # test only when HOME directory actually writable | |
161 | return |
|
161 | return | |
162 |
|
162 | |||
163 | with patch.object(paths, "_writable_dir", lambda path: bool(path)), patch.object( |
|
163 | with ( | |
164 | paths, "get_xdg_dir", return_value=None |
|
164 | patch.object(paths, "_writable_dir", lambda path: bool(path)), | |
165 | ), modified_env( |
|
165 | patch.object(paths, "get_xdg_dir", return_value=None), | |
|
166 | modified_env( | |||
166 | { |
|
167 | { | |
167 | "IPYTHON_DIR": None, |
|
168 | "IPYTHON_DIR": None, | |
168 | "IPYTHONDIR": None, |
|
169 | "IPYTHONDIR": None, | |
169 | "HOME": "/", |
|
170 | "HOME": "/", | |
170 | } |
|
171 | } | |
|
172 | ), | |||
171 | ): |
|
173 | ): | |
172 | assert paths.get_ipython_dir() == "/.ipython" |
|
174 | assert paths.get_ipython_dir() == "/.ipython" | |
173 |
|
175 |
@@ -8,6 +8,7 bindings, which is unstable and likely to crash | |||||
8 | This is used primarily by qt and qt_for_kernel, and shouldn't |
|
8 | This is used primarily by qt and qt_for_kernel, and shouldn't | |
9 | be accessed directly from the outside |
|
9 | be accessed directly from the outside | |
10 | """ |
|
10 | """ | |
|
11 | ||||
11 | import importlib.abc |
|
12 | import importlib.abc | |
12 | import sys |
|
13 | import sys | |
13 | import os |
|
14 | import os |
@@ -1,5 +1,6 | |||||
1 | """ Utilities for accessing the platform's clipboard. |
|
1 | """ Utilities for accessing the platform's clipboard. | |
2 | """ |
|
2 | """ | |
|
3 | ||||
3 | import os |
|
4 | import os | |
4 | import subprocess |
|
5 | import subprocess | |
5 |
|
6 |
@@ -107,7 +107,7 def float_doctest(sphinx_shell, args, input_lines, found, submitted): | |||||
107 | try: |
|
107 | try: | |
108 | rtol = float(args[2]) |
|
108 | rtol = float(args[2]) | |
109 | atol = float(args[3]) |
|
109 | atol = float(args[3]) | |
110 |
except IndexError |
|
110 | except IndexError: | |
111 | e = ("Both `rtol` and `atol` must be specified " |
|
111 | e = ("Both `rtol` and `atol` must be specified " | |
112 | "if either are specified: {0}".format(args)) |
|
112 | "if either are specified: {0}".format(args)) | |
113 | raise IndexError(e) from e |
|
113 | raise IndexError(e) from e |
@@ -196,6 +196,7 import ast | |||||
196 | import warnings |
|
196 | import warnings | |
197 | import shutil |
|
197 | import shutil | |
198 | from io import StringIO |
|
198 | from io import StringIO | |
|
199 | from typing import Any, Dict, Set | |||
199 |
|
200 | |||
200 | # Third-party |
|
201 | # Third-party | |
201 | from docutils.parsers.rst import directives |
|
202 | from docutils.parsers.rst import directives | |
@@ -901,21 +902,22 class EmbeddedSphinxShell(object): | |||||
901 |
|
902 | |||
902 | class IPythonDirective(Directive): |
|
903 | class IPythonDirective(Directive): | |
903 |
|
904 | |||
904 | has_content = True |
|
905 | has_content: bool = True | |
905 | required_arguments = 0 |
|
906 | required_arguments: int = 0 | |
906 | optional_arguments = 4 # python, suppress, verbatim, doctest |
|
907 | optional_arguments: int = 4 # python, suppress, verbatim, doctest | |
907 | final_argumuent_whitespace = True |
|
908 | final_argumuent_whitespace: bool = True | |
908 | option_spec = { 'python': directives.unchanged, |
|
909 | option_spec: Dict[str, Any] = { | |
909 | 'suppress' : directives.flag, |
|
910 | "python": directives.unchanged, | |
910 |
|
|
911 | "suppress": directives.flag, | |
911 |
|
|
912 | "verbatim": directives.flag, | |
912 |
|
|
913 | "doctest": directives.flag, | |
913 |
|
|
914 | "okexcept": directives.flag, | |
|
915 | "okwarning": directives.flag, | |||
914 | } |
|
916 | } | |
915 |
|
917 | |||
916 | shell = None |
|
918 | shell = None | |
917 |
|
919 | |||
918 | seen_docs = set() |
|
920 | seen_docs: Set = set() | |
919 |
|
921 | |||
920 | def get_config_options(self): |
|
922 | def get_config_options(self): | |
921 | # contains sphinx configuration variables |
|
923 | # contains sphinx configuration variables |
@@ -4,6 +4,7 Utilities function for keybinding with prompt toolkit. | |||||
4 | This will be bound to specific key press and filter modes, |
|
4 | This will be bound to specific key press and filter modes, | |
5 | like whether we are in edit mode, and whether the completer is open. |
|
5 | like whether we are in edit mode, and whether the completer is open. | |
6 | """ |
|
6 | """ | |
|
7 | ||||
7 | import re |
|
8 | import re | |
8 | from prompt_toolkit.key_binding import KeyPressEvent |
|
9 | from prompt_toolkit.key_binding import KeyPressEvent | |
9 |
|
10 |
General Comments 0
You need to be logged in to leave comments.
Login now