Skip to content

Commit

Permalink
reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
Carreau committed Oct 27, 2024
1 parent c8d9469 commit 912098e
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 36 deletions.
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
17 changes: 9 additions & 8 deletions IPython/sphinxext/ipython_directive.py
Original file line number Diff line number Diff line change
Expand Up @@ -904,15 +904,16 @@ class IPythonDirective(Directive):

has_content: bool = True
required_arguments: int = 0
optional_arguments: int = 4 # python, suppress, verbatim, doctest
optional_arguments: int = 4 # python, suppress, verbatim, doctest
final_argumuent_whitespace: bool = True
option_spec: Dict[str, Any] = { 'python': directives.unchanged,
'suppress' : directives.flag,
'verbatim' : directives.flag,
'doctest' : directives.flag,
'okexcept': directives.flag,
'okwarning': directives.flag
}
option_spec: Dict[str, Any] = {
"python": directives.unchanged,
"suppress": directives.flag,
"verbatim": directives.flag,
"doctest": directives.flag,
"okexcept": directives.flag,
"okwarning": directives.flag,
}

shell = None

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 912098e

Please sign in to comment.