Skip to content

Commit

Permalink
update darker/black (ipython#14567)
Browse files Browse the repository at this point in the history
  • Loading branch information
Carreau authored Nov 3, 2024
2 parents ac9ed9c + 020e036 commit 39c7d0e
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 25 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
4 changes: 3 additions & 1 deletion IPython/core/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
"""Being removed
"""


class LazyEvaluate(object):
"""This is used for formatting strings with values that need to be updated
at that time, such as the current time or working directory."""

def __init__(self, func, *args, **kwargs):
self.func = func
self.args = args
Expand All @@ -16,6 +18,6 @@ def __call__(self, **kwargs):

def __str__(self):
return str(self())

def __format__(self, format_spec):
return format(self(), format_spec)
4 changes: 2 additions & 2 deletions IPython/core/tests/nonascii2.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# coding: iso-8859-5
# (Unlikely to be the default encoding for most testers.)
# БЖџрстуфхцчшщъыьэюя <- Cyrillic characters
'Ўт№Ф'
# ±¶ÿàáâãäåæçèéêëìíîï <- Cyrillic characters
"®âðÄ"
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
4 changes: 2 additions & 2 deletions IPython/lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
Extra capabilities for IPython
"""

#-----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# Copyright (C) 2008-2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
4 changes: 2 additions & 2 deletions IPython/testing/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# encoding: utf-8
__docformat__ = "restructuredtext en"
#-------------------------------------------------------------------------------
# -------------------------------------------------------------------------------
# Copyright (C) 2005 Fernando Perez <[email protected]>
# Brian E Granger <[email protected]>
# Benjamin Ragan-Kelley <[email protected]>
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-------------------------------------------------------------------------------
# -------------------------------------------------------------------------------
4 changes: 3 additions & 1 deletion IPython/utils/_process_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def system(cmd):
# Start up process:
reg = System.Diagnostics.Process.Start(psi)


def getoutput(cmd):
"""
getoutput(cmd) should work in a cli environment on Mac OSX, Linux,
Expand All @@ -53,6 +54,7 @@ def getoutput(cmd):
error = myError.ReadToEnd()
return output


def check_pid(pid):
"""
Check if a process with the given PID (pid) exists
Expand All @@ -66,4 +68,4 @@ def check_pid(pid):
return True
except System.ArgumentException:
# process with given pid isn't running
return False
return False
4 changes: 2 additions & 2 deletions IPython/utils/dir2.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def dir2(obj):
# TypeError: dir(obj) does not return a list
words = set()

if safe_hasattr(obj, '__class__'):
if safe_hasattr(obj, "__class__"):
words |= set(dir(obj.__class__))

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

Expand Down

0 comments on commit 39c7d0e

Please sign in to comment.