diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 786d00b..1c75572 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -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 . || ( diff --git a/IPython/core/completer.py b/IPython/core/completer.py index e3351ed..4873be6 100644 --- a/IPython/core/completer.py +++ b/IPython/core/completer.py @@ -1362,9 +1362,9 @@ def match_dict_keys( # 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. diff --git a/IPython/core/guarded_eval.py b/IPython/core/guarded_eval.py index 39fe853..628fe2f 100644 --- a/IPython/core/guarded_eval.py +++ b/IPython/core/guarded_eval.py @@ -44,20 +44,17 @@ else: @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 @@ -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 diff --git a/IPython/core/prompts.py b/IPython/core/prompts.py index 7fd218d..105ff17 100644 --- a/IPython/core/prompts.py +++ b/IPython/core/prompts.py @@ -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 @@ -16,6 +18,6 @@ class LazyEvaluate(object): def __str__(self): return str(self()) - + def __format__(self, format_spec): return format(self(), format_spec) diff --git a/IPython/core/tests/nonascii2.py b/IPython/core/tests/nonascii2.py index a1afce4..b87ceb0 100644 --- a/IPython/core/tests/nonascii2.py +++ b/IPython/core/tests/nonascii2.py @@ -1,4 +1,4 @@ # coding: iso-8859-5 # (Unlikely to be the default encoding for most testers.) -# БЖџрстуфхцчшщъыьэюя <- Cyrillic characters -'Ўт№Ф' +# <- Cyrillic characters +"" diff --git a/IPython/core/tests/test_formatters.py b/IPython/core/tests/test_formatters.py index cd8c83e..5f8eeda 100644 --- a/IPython/core/tests/test_formatters.py +++ b/IPython/core/tests/test_formatters.py @@ -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() diff --git a/IPython/lib/__init__.py b/IPython/lib/__init__.py index 94b8ade..cf8ccb0 100644 --- a/IPython/lib/__init__.py +++ b/IPython/lib/__init__.py @@ -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. -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- diff --git a/IPython/testing/tests/__init__.py b/IPython/testing/tests/__init__.py index f751f68..042eb92 100644 --- a/IPython/testing/tests/__init__.py +++ b/IPython/testing/tests/__init__.py @@ -1,10 +1,10 @@ # encoding: utf-8 __docformat__ = "restructuredtext en" -#------------------------------------------------------------------------------- +# ------------------------------------------------------------------------------- # Copyright (C) 2005 Fernando Perez # Brian E Granger # Benjamin Ragan-Kelley # # Distributed under the terms of the BSD License. The full license is in # the file COPYING, distributed as part of this software. -#------------------------------------------------------------------------------- +# ------------------------------------------------------------------------------- diff --git a/IPython/utils/_process_cli.py b/IPython/utils/_process_cli.py index 86e918a..e303202 100644 --- a/IPython/utils/_process_cli.py +++ b/IPython/utils/_process_cli.py @@ -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, @@ -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 @@ -66,4 +68,4 @@ def check_pid(pid): return True except System.ArgumentException: # process with given pid isn't running - return False + return False diff --git a/IPython/utils/dir2.py b/IPython/utils/dir2.py index 9f19b2d..5dc699a 100644 --- a/IPython/utils/dir2.py +++ b/IPython/utils/dir2.py @@ -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 @@ -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