Skip to content

Commit

Permalink
update darker/black
Browse files Browse the repository at this point in the history
  • Loading branch information
Carreau committed Oct 31, 2024
1 parent f42bfc8 commit d6a5f96
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
run: |
python -m pip install --upgrade pip
# when changing the versions please update CONTRIBUTING.md too
pip install --only-binary ':all:' darker==1.5.1 black==22.10.0
pip install --only-binary ':all:' darker==2.1.1 black==24.10.0
- name: Lint with darker
run: |
darker -r 60625f241f298b5039cb2debc365db38aa7bb522 --check --diff . || (
Expand Down
6 changes: 3 additions & 3 deletions IPython/core/completer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1362,9 +1362,9 @@ def filter_prefix_tuple(key):
# All checks passed!
return True

filtered_key_is_final: Dict[
Union[str, bytes, int, float], _DictKeyState
] = defaultdict(lambda: _DictKeyState.BASELINE)
filtered_key_is_final: Dict[Union[str, bytes, int, float], _DictKeyState] = (
defaultdict(lambda: _DictKeyState.BASELINE)
)

for k in keys:
# If at least one of the matches is not final, mark as undetermined.
Expand Down
15 changes: 6 additions & 9 deletions IPython/core/guarded_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,17 @@

@undoc
class HasGetItem(Protocol):
def __getitem__(self, key) -> None:
...
def __getitem__(self, key) -> None: ...


@undoc
class InstancesHaveGetItem(Protocol):
def __call__(self, *args, **kwargs) -> HasGetItem:
...
def __call__(self, *args, **kwargs) -> HasGetItem: ...


@undoc
class HasGetAttr(Protocol):
def __getattr__(self, key) -> None:
...
def __getattr__(self, key) -> None: ...


@undoc
Expand Down Expand Up @@ -329,9 +326,9 @@ class EvaluationContext(NamedTuple):
#: Global namespace
globals: dict
#: Evaluation policy identifier
evaluation: Literal[
"forbidden", "minimal", "limited", "unsafe", "dangerous"
] = "forbidden"
evaluation: Literal["forbidden", "minimal", "limited", "unsafe", "dangerous"] = (
"forbidden"
)
#: Whether the evaluation of code takes place inside of a subscript.
#: Useful for evaluating ``:-1, 'col'`` in ``df[:-1, 'col']``.
in_subscript: bool = False
Expand Down
1 change: 1 addition & 0 deletions IPython/core/inputsplitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
For more details, see the class docstrings below.
"""

from __future__ import annotations

from warnings import warn
Expand Down
3 changes: 1 addition & 2 deletions IPython/core/tests/test_formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,8 +535,7 @@ def test_custom_repr_namedtuple_partialmethod():
from functools import partialmethod
from typing import NamedTuple

class Foo(NamedTuple):
...
class Foo(NamedTuple): ...

Foo.__repr__ = partialmethod(lambda obj: "Hello World")
foo = Foo()
Expand Down
1 change: 1 addition & 0 deletions IPython/core/tests/test_inputtransformer2.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
more complex. See test_inputtransformer2_line for tests for line-based
transformations.
"""

import platform
import string
import sys
Expand Down
18 changes: 10 additions & 8 deletions IPython/core/tests/test_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,16 @@ def test_get_ipython_dir_8():
# test only when HOME directory actually writable
return

with patch.object(paths, "_writable_dir", lambda path: bool(path)), patch.object(
paths, "get_xdg_dir", return_value=None
), modified_env(
{
"IPYTHON_DIR": None,
"IPYTHONDIR": None,
"HOME": "/",
}
with (
patch.object(paths, "_writable_dir", lambda path: bool(path)),
patch.object(paths, "get_xdg_dir", return_value=None),
modified_env(
{
"IPYTHON_DIR": None,
"IPYTHONDIR": None,
"HOME": "/",
}
),
):
assert paths.get_ipython_dir() == "/.ipython"

Expand Down
1 change: 1 addition & 0 deletions IPython/external/qt_loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
This is used primarily by qt and qt_for_kernel, and shouldn't
be accessed directly from the outside
"""

import importlib.abc
import sys
import os
Expand Down
1 change: 1 addition & 0 deletions IPython/lib/clipboard.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
""" Utilities for accessing the platform's clipboard.
"""

import os
import subprocess

Expand Down
14 changes: 8 additions & 6 deletions IPython/terminal/interactiveshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,12 +586,14 @@ def _merge_shortcuts(self, user_shortcuts):
RuntimeBinding(
command,
keys=new_keys or old_keys,
filter=filter_from_string(new_filter)
if new_filter is not None
else (
old_filter
if old_filter is not None
else filter_from_string("always")
filter=(
filter_from_string(new_filter)
if new_filter is not None
else (
old_filter
if old_filter is not None
else filter_from_string("always")
)
),
)
)
Expand Down
1 change: 1 addition & 0 deletions IPython/terminal/shortcuts/auto_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
This will be bound to specific key press and filter modes,
like whether we are in edit mode, and whether the completer is open.
"""

import re
from prompt_toolkit.key_binding import KeyPressEvent

Expand Down

0 comments on commit d6a5f96

Please sign in to comment.