Show More
@@ -1362,9 +1362,9 def match_dict_keys( | |||
|
1362 | 1362 | # All checks passed! |
|
1363 | 1363 | return True |
|
1364 | 1364 | |
|
1365 | filtered_key_is_final: Dict[ | |
|
1366 | Union[str, bytes, int, float], _DictKeyState | |
|
1367 | ] = defaultdict(lambda: _DictKeyState.BASELINE) | |
|
1365 | filtered_key_is_final: Dict[Union[str, bytes, int, float], _DictKeyState] = ( | |
|
1366 | defaultdict(lambda: _DictKeyState.BASELINE) | |
|
1367 | ) | |
|
1368 | 1368 | |
|
1369 | 1369 | for k in keys: |
|
1370 | 1370 | # If at least one of the matches is not final, mark as undetermined. |
@@ -44,20 +44,17 else: | |||
|
44 | 44 | |
|
45 | 45 | @undoc |
|
46 | 46 | class HasGetItem(Protocol): |
|
47 | def __getitem__(self, key) -> None: | |
|
48 | ... | |
|
47 | def __getitem__(self, key) -> None: ... | |
|
49 | 48 | |
|
50 | 49 | |
|
51 | 50 | @undoc |
|
52 | 51 | class InstancesHaveGetItem(Protocol): |
|
53 | def __call__(self, *args, **kwargs) -> HasGetItem: | |
|
54 | ... | |
|
52 | def __call__(self, *args, **kwargs) -> HasGetItem: ... | |
|
55 | 53 | |
|
56 | 54 | |
|
57 | 55 | @undoc |
|
58 | 56 | class HasGetAttr(Protocol): |
|
59 | def __getattr__(self, key) -> None: | |
|
60 | ... | |
|
57 | def __getattr__(self, key) -> None: ... | |
|
61 | 58 | |
|
62 | 59 | |
|
63 | 60 | @undoc |
@@ -329,9 +326,9 class EvaluationContext(NamedTuple): | |||
|
329 | 326 | #: Global namespace |
|
330 | 327 | globals: dict |
|
331 | 328 | #: Evaluation policy identifier |
|
332 | evaluation: Literal[ | |
|
333 | "forbidden", "minimal", "limited", "unsafe", "dangerous" | |
|
334 | ] = "forbidden" | |
|
329 | evaluation: Literal["forbidden", "minimal", "limited", "unsafe", "dangerous"] = ( | |
|
330 | "forbidden" | |
|
331 | ) | |
|
335 | 332 | #: Whether the evaluation of code takes place inside of a subscript. |
|
336 | 333 | #: Useful for evaluating ``:-1, 'col'`` in ``df[:-1, 'col']``. |
|
337 | 334 | in_subscript: bool = False |
@@ -15,6 +15,7 and stores the results. | |||
|
15 | 15 | |
|
16 | 16 | For more details, see the class docstrings below. |
|
17 | 17 | """ |
|
18 | ||
|
18 | 19 | from __future__ import annotations |
|
19 | 20 | |
|
20 | 21 | from warnings import warn |
@@ -535,8 +535,7 def test_custom_repr_namedtuple_partialmethod(): | |||
|
535 | 535 | from functools import partialmethod |
|
536 | 536 | from typing import NamedTuple |
|
537 | 537 | |
|
538 | class Foo(NamedTuple): | |
|
539 | ... | |
|
538 | class Foo(NamedTuple): ... | |
|
540 | 539 | |
|
541 | 540 | Foo.__repr__ = partialmethod(lambda obj: "Hello World") |
|
542 | 541 | foo = Foo() |
@@ -4,6 +4,7 Line-based transformers are the simpler ones; token-based transformers are | |||
|
4 | 4 | more complex. See test_inputtransformer2_line for tests for line-based |
|
5 | 5 | transformations. |
|
6 | 6 | """ |
|
7 | ||
|
7 | 8 | import platform |
|
8 | 9 | import string |
|
9 | 10 | import sys |
@@ -160,14 +160,16 def test_get_ipython_dir_8(): | |||
|
160 | 160 | # test only when HOME directory actually writable |
|
161 | 161 | return |
|
162 | 162 | |
|
163 | with patch.object(paths, "_writable_dir", lambda path: bool(path)), patch.object( | |
|
164 | paths, "get_xdg_dir", return_value=None | |
|
165 | ), modified_env( | |
|
163 | with ( | |
|
164 | patch.object(paths, "_writable_dir", lambda path: bool(path)), | |
|
165 | patch.object(paths, "get_xdg_dir", return_value=None), | |
|
166 | modified_env( | |
|
166 | 167 | { |
|
167 | 168 | "IPYTHON_DIR": None, |
|
168 | 169 | "IPYTHONDIR": None, |
|
169 | 170 | "HOME": "/", |
|
170 | 171 | } |
|
172 | ), | |
|
171 | 173 | ): |
|
172 | 174 | assert paths.get_ipython_dir() == "/.ipython" |
|
173 | 175 |
@@ -8,6 +8,7 bindings, which is unstable and likely to crash | |||
|
8 | 8 | This is used primarily by qt and qt_for_kernel, and shouldn't |
|
9 | 9 | be accessed directly from the outside |
|
10 | 10 | """ |
|
11 | ||
|
11 | 12 | import importlib.abc |
|
12 | 13 | import sys |
|
13 | 14 | import os |
@@ -1,5 +1,6 | |||
|
1 | 1 | """ Utilities for accessing the platform's clipboard. |
|
2 | 2 | """ |
|
3 | ||
|
3 | 4 | import os |
|
4 | 5 | import subprocess |
|
5 | 6 |
@@ -906,12 +906,13 class IPythonDirective(Directive): | |||
|
906 | 906 | required_arguments: int = 0 |
|
907 | 907 | optional_arguments: int = 4 # python, suppress, verbatim, doctest |
|
908 | 908 | final_argumuent_whitespace: bool = True |
|
909 |
option_spec: Dict[str, Any] = { |
|
|
910 | 'suppress' : directives.flag, | |
|
911 |
|
|
|
912 |
|
|
|
913 |
|
|
|
914 |
|
|
|
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, | |
|
915 | 916 | } |
|
916 | 917 | |
|
917 | 918 | shell = None |
@@ -586,12 +586,14 class TerminalInteractiveShell(InteractiveShell): | |||
|
586 | 586 | RuntimeBinding( |
|
587 | 587 | command, |
|
588 | 588 | keys=new_keys or old_keys, |
|
589 |
filter= |
|
|
589 | filter=( | |
|
590 | filter_from_string(new_filter) | |
|
590 | 591 | if new_filter is not None |
|
591 | 592 | else ( |
|
592 | 593 | old_filter |
|
593 | 594 | if old_filter is not None |
|
594 | 595 | else filter_from_string("always") |
|
596 | ) | |
|
595 | 597 | ), |
|
596 | 598 | ) |
|
597 | 599 | ) |
General Comments 0
You need to be logged in to leave comments.
Login now