Skip to content

Commit 39c7d0e

Browse files
authored
update darker/black (ipython#14567)
2 parents ac9ed9c + 020e036 commit 39c7d0e

File tree

10 files changed

+25
-25
lines changed

10 files changed

+25
-25
lines changed

.github/workflows/python-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
run: |
3030
python -m pip install --upgrade pip
3131
# 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
3333
- name: Lint with darker
3434
run: |
3535
darker -r 60625f241f298b5039cb2debc365db38aa7bb522 --check --diff . || (

IPython/core/completer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,9 +1362,9 @@ def filter_prefix_tuple(key):
13621362
# All checks passed!
13631363
return True
13641364

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+
)
13681368

13691369
for k in keys:
13701370
# If at least one of the matches is not final, mark as undetermined.

IPython/core/guarded_eval.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,17 @@
4444

4545
@undoc
4646
class HasGetItem(Protocol):
47-
def __getitem__(self, key) -> None:
48-
...
47+
def __getitem__(self, key) -> None: ...
4948

5049

5150
@undoc
5251
class InstancesHaveGetItem(Protocol):
53-
def __call__(self, *args, **kwargs) -> HasGetItem:
54-
...
52+
def __call__(self, *args, **kwargs) -> HasGetItem: ...
5553

5654

5755
@undoc
5856
class HasGetAttr(Protocol):
59-
def __getattr__(self, key) -> None:
60-
...
57+
def __getattr__(self, key) -> None: ...
6158

6259

6360
@undoc
@@ -329,9 +326,9 @@ class EvaluationContext(NamedTuple):
329326
#: Global namespace
330327
globals: dict
331328
#: 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+
)
335332
#: Whether the evaluation of code takes place inside of a subscript.
336333
#: Useful for evaluating ``:-1, 'col'`` in ``df[:-1, 'col']``.
337334
in_subscript: bool = False

IPython/core/prompts.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
"""Being removed
33
"""
44

5+
56
class LazyEvaluate(object):
67
"""This is used for formatting strings with values that need to be updated
78
at that time, such as the current time or working directory."""
9+
810
def __init__(self, func, *args, **kwargs):
911
self.func = func
1012
self.args = args
@@ -16,6 +18,6 @@ def __call__(self, **kwargs):
1618

1719
def __str__(self):
1820
return str(self())
19-
21+
2022
def __format__(self, format_spec):
2123
return format(self(), format_spec)

IPython/core/tests/nonascii2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# coding: iso-8859-5
22
# (Unlikely to be the default encoding for most testers.)
3-
# БЖџрстуфхцчшщъыьэюя <- Cyrillic characters
4-
'Ўт№Ф'
3+
# ±¶ÿàáâãäåæçèéêëìíîï <- Cyrillic characters
4+
"®âðÄ"

IPython/core/tests/test_formatters.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,8 +535,7 @@ def test_custom_repr_namedtuple_partialmethod():
535535
from functools import partialmethod
536536
from typing import NamedTuple
537537

538-
class Foo(NamedTuple):
539-
...
538+
class Foo(NamedTuple): ...
540539

541540
Foo.__repr__ = partialmethod(lambda obj: "Hello World")
542541
foo = Foo()

IPython/lib/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
Extra capabilities for IPython
44
"""
55

6-
#-----------------------------------------------------------------------------
6+
# -----------------------------------------------------------------------------
77
# Copyright (C) 2008-2011 The IPython Development Team
88
#
99
# Distributed under the terms of the BSD License. The full license is in
1010
# the file COPYING, distributed as part of this software.
11-
#-----------------------------------------------------------------------------
11+
# -----------------------------------------------------------------------------

IPython/testing/tests/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# encoding: utf-8
22
__docformat__ = "restructuredtext en"
3-
#-------------------------------------------------------------------------------
3+
# -------------------------------------------------------------------------------
44
# Copyright (C) 2005 Fernando Perez <[email protected]>
55
# Brian E Granger <[email protected]>
66
# Benjamin Ragan-Kelley <[email protected]>
77
#
88
# Distributed under the terms of the BSD License. The full license is in
99
# the file COPYING, distributed as part of this software.
10-
#-------------------------------------------------------------------------------
10+
# -------------------------------------------------------------------------------

IPython/utils/_process_cli.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def system(cmd):
3535
# Start up process:
3636
reg = System.Diagnostics.Process.Start(psi)
3737

38+
3839
def getoutput(cmd):
3940
"""
4041
getoutput(cmd) should work in a cli environment on Mac OSX, Linux,
@@ -53,6 +54,7 @@ def getoutput(cmd):
5354
error = myError.ReadToEnd()
5455
return output
5556

57+
5658
def check_pid(pid):
5759
"""
5860
Check if a process with the given PID (pid) exists
@@ -66,4 +68,4 @@ def check_pid(pid):
6668
return True
6769
except System.ArgumentException:
6870
# process with given pid isn't running
69-
return False
71+
return False

IPython/utils/dir2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def dir2(obj):
4141
# TypeError: dir(obj) does not return a list
4242
words = set()
4343

44-
if safe_hasattr(obj, '__class__'):
44+
if safe_hasattr(obj, "__class__"):
4545
words |= set(dir(obj.__class__))
4646

4747
# filter out non-string attributes which may be stuffed by dir() calls
@@ -62,7 +62,7 @@ def get_real_method(obj, name):
6262
Returns the method or None.
6363
"""
6464
try:
65-
canary = getattr(obj, '_ipython_canary_method_should_not_exist_', None)
65+
canary = getattr(obj, "_ipython_canary_method_should_not_exist_", None)
6666
except Exception:
6767
return None
6868

0 commit comments

Comments
 (0)