##// END OF EJS Templates
update darker/black
M Bussonnier -
Show More
@@ -29,7 +29,7 b' jobs:'
29 run: |
29 run: |
30 python -m pip install --upgrade pip
30 python -m pip install --upgrade pip
31 # when changing the versions please update CONTRIBUTING.md too
31 # when changing the versions please update CONTRIBUTING.md too
32 pip install --only-binary ':all:' darker==1.5.1 black==22.10.0
32 pip install --only-binary ':all:' darker==2.1.1 black==24.10.0
33 - name: Lint with darker
33 - name: Lint with darker
34 run: |
34 run: |
35 darker -r 60625f241f298b5039cb2debc365db38aa7bb522 --check --diff . || (
35 darker -r 60625f241f298b5039cb2debc365db38aa7bb522 --check --diff . || (
@@ -1362,9 +1362,9 b' def match_dict_keys('
1362 # All checks passed!
1362 # All checks passed!
1363 return True
1363 return True
1364
1364
1365 filtered_key_is_final: Dict[
1365 filtered_key_is_final: Dict[Union[str, bytes, int, float], _DictKeyState] = (
1366 Union[str, bytes, int, float], _DictKeyState
1366 defaultdict(lambda: _DictKeyState.BASELINE)
1367 ] = defaultdict(lambda: _DictKeyState.BASELINE)
1367 )
1368
1368
1369 for k in keys:
1369 for k in keys:
1370 # If at least one of the matches is not final, mark as undetermined.
1370 # If at least one of the matches is not final, mark as undetermined.
@@ -44,20 +44,17 b' else:'
44
44
45 @undoc
45 @undoc
46 class HasGetItem(Protocol):
46 class HasGetItem(Protocol):
47 def __getitem__(self, key) -> None:
47 def __getitem__(self, key) -> None: ...
48 ...
49
48
50
49
51 @undoc
50 @undoc
52 class InstancesHaveGetItem(Protocol):
51 class InstancesHaveGetItem(Protocol):
53 def __call__(self, *args, **kwargs) -> HasGetItem:
52 def __call__(self, *args, **kwargs) -> HasGetItem: ...
54 ...
55
53
56
54
57 @undoc
55 @undoc
58 class HasGetAttr(Protocol):
56 class HasGetAttr(Protocol):
59 def __getattr__(self, key) -> None:
57 def __getattr__(self, key) -> None: ...
60 ...
61
58
62
59
63 @undoc
60 @undoc
@@ -329,9 +326,9 b' class EvaluationContext(NamedTuple):'
329 #: Global namespace
326 #: Global namespace
330 globals: dict
327 globals: dict
331 #: Evaluation policy identifier
328 #: Evaluation policy identifier
332 evaluation: Literal[
329 evaluation: Literal["forbidden", "minimal", "limited", "unsafe", "dangerous"] = (
333 "forbidden", "minimal", "limited", "unsafe", "dangerous"
330 "forbidden"
334 ] = "forbidden"
331 )
335 #: Whether the evaluation of code takes place inside of a subscript.
332 #: Whether the evaluation of code takes place inside of a subscript.
336 #: Useful for evaluating ``:-1, 'col'`` in ``df[:-1, 'col']``.
333 #: Useful for evaluating ``:-1, 'col'`` in ``df[:-1, 'col']``.
337 in_subscript: bool = False
334 in_subscript: bool = False
@@ -15,6 +15,7 b' 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
@@ -535,8 +535,7 b' def test_custom_repr_namedtuple_partialmethod():'
535 from functools import partialmethod
535 from functools import partialmethod
536 from typing import NamedTuple
536 from typing import NamedTuple
537
537
538 class Foo(NamedTuple):
538 class Foo(NamedTuple): ...
539 ...
540
539
541 Foo.__repr__ = partialmethod(lambda obj: "Hello World")
540 Foo.__repr__ = partialmethod(lambda obj: "Hello World")
542 foo = Foo()
541 foo = Foo()
@@ -4,6 +4,7 b' 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 b' 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 {
166 modified_env(
167 "IPYTHON_DIR": None,
167 {
168 "IPYTHONDIR": None,
168 "IPYTHON_DIR": None,
169 "HOME": "/",
169 "IPYTHONDIR": None,
170 }
170 "HOME": "/",
171 }
172 ),
171 ):
173 ):
172 assert paths.get_ipython_dir() == "/.ipython"
174 assert paths.get_ipython_dir() == "/.ipython"
173
175
@@ -8,6 +8,7 b' 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 b''
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
@@ -586,12 +586,14 b' class TerminalInteractiveShell(InteractiveShell):'
586 RuntimeBinding(
586 RuntimeBinding(
587 command,
587 command,
588 keys=new_keys or old_keys,
588 keys=new_keys or old_keys,
589 filter=filter_from_string(new_filter)
589 filter=(
590 if new_filter is not None
590 filter_from_string(new_filter)
591 else (
591 if new_filter is not None
592 old_filter
592 else (
593 if old_filter is not None
593 old_filter
594 else filter_from_string("always")
594 if old_filter is not None
595 else filter_from_string("always")
596 )
595 ),
597 ),
596 )
598 )
597 )
599 )
@@ -4,6 +4,7 b' 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