From 209f369eea22dc5b029968ff1211d34164328e76 Mon Sep 17 00:00:00 2001 From: M Bussonnier Date: Thu, 31 Oct 2024 20:10:50 +0100 Subject: [PATCH] formatting --- IPython/core/completer.py | 6 +++--- IPython/core/guarded_eval.py | 15 +++++++++------ IPython/core/tests/test_formatters.py | 3 ++- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/IPython/core/completer.py b/IPython/core/completer.py index 4873be6b19..e3351edc93 100644 --- a/IPython/core/completer.py +++ b/IPython/core/completer.py @@ -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. diff --git a/IPython/core/guarded_eval.py b/IPython/core/guarded_eval.py index 628fe2fbcc..39fe853f58 100644 --- a/IPython/core/guarded_eval.py +++ b/IPython/core/guarded_eval.py @@ -44,17 +44,20 @@ @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 @@ -326,9 +329,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/tests/test_formatters.py b/IPython/core/tests/test_formatters.py index 5f8eeda20a..cd8c83e555 100644 --- a/IPython/core/tests/test_formatters.py +++ b/IPython/core/tests/test_formatters.py @@ -535,7 +535,8 @@ 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()