Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit adf9666

Browse files
committed
try to run darker
1 parent 846b462 commit adf9666

23 files changed

Lines changed: 52 additions & 50 deletions

IPython/core/completer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,9 +1538,9 @@ def filter_prefix_tuple(key):
15381538
# All checks passed!
15391539
return True
15401540

1541-
filtered_key_is_final: dict[Union[str, bytes, int, float], _DictKeyState] = (
1542-
defaultdict(lambda: _DictKeyState.BASELINE)
1543-
)
1541+
filtered_key_is_final: dict[
1542+
Union[str, bytes, int, float], _DictKeyState
1543+
] = defaultdict(lambda: _DictKeyState.BASELINE)
15441544

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

IPython/core/events.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ class EventManager:
3232
This API is experimental in IPython 2.0, and may be revised in future versions.
3333
"""
3434

35-
def __init__(self, shell: InteractiveShell, available_events: Iterable[str], print_on_error: bool = True) -> None:
35+
def __init__(
36+
self,
37+
shell: InteractiveShell,
38+
available_events: Iterable[str],
39+
print_on_error: bool = True,
40+
) -> None:
3641
"""Initialise the :class:`CallbackManager`.
3742
3843
Parameters
@@ -45,7 +50,9 @@ def __init__(self, shell: InteractiveShell, available_events: Iterable[str], pri
4550
A boolean flag to set whether the EventManager will print a warning which a event errors.
4651
"""
4752
self.shell = shell
48-
self.callbacks: dict[str, list[Callable[..., Any]]] = {n:[] for n in available_events}
53+
self.callbacks: dict[str, list[Callable[..., Any]]] = {
54+
n: [] for n in available_events
55+
}
4956
self.print_on_error = print_on_error
5057

5158
def register(self, event: str, function: Callable[..., Any]) -> None:

IPython/core/guarded_eval.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,20 @@
4141

4242
@undoc
4343
class HasGetItem(Protocol):
44-
def __getitem__(self, key) -> None: ...
44+
def __getitem__(self, key) -> None:
45+
...
4546

4647

4748
@undoc
4849
class InstancesHaveGetItem(Protocol):
49-
def __call__(self, *args, **kwargs) -> HasGetItem: ...
50+
def __call__(self, *args, **kwargs) -> HasGetItem:
51+
...
5052

5153

5254
@undoc
5355
class HasGetAttr(Protocol):
54-
def __getattr__(self, key) -> None: ...
56+
def __getattr__(self, key) -> None:
57+
...
5558

5659

5760
@undoc

IPython/core/interactiveshell.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3299,9 +3299,9 @@ def error_before_exec(value):
32993299
if store_history:
33003300
if self.history_manager:
33013301
# Store formatted traceback and error details
3302-
self.history_manager.exceptions[self.execution_count] = (
3303-
self._format_exception_for_storage(value)
3304-
)
3302+
self.history_manager.exceptions[
3303+
self.execution_count
3304+
] = self._format_exception_for_storage(value)
33053305
self.execution_count += 1
33063306
result.error_before_exec = value
33073307
self.last_execution_succeeded = False
@@ -3415,9 +3415,9 @@ def error_before_exec(value):
34153415
exec_count = self.execution_count
34163416
if result.error_in_exec:
34173417
# Store formatted traceback and error details
3418-
self.history_manager.exceptions[exec_count] = (
3419-
self._format_exception_for_storage(result.error_in_exec)
3420-
)
3418+
self.history_manager.exceptions[
3419+
exec_count
3420+
] = self._format_exception_for_storage(result.error_in_exec)
34213421

34223422
# Each cell is a *single* input, regardless of how many lines it has
34233423
self.execution_count += 1

IPython/core/oinspect.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,6 @@ def find_source_lines(obj):
385385

386386

387387
class Inspector(Configurable):
388-
389388
mime_hooks = traitlets.Dict(
390389
config=True,
391390
help="dictionary of mime to callable to add information into help mimebundle dict",

IPython/extensions/deduperreload/deduperreload_patching.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ def try_patch_readonly_attr(
8181
new_is_value: bool = False,
8282
offset: int = -1,
8383
) -> None:
84-
8584
old_value = getattr(old, field, NOT_FOUND)
8685
new_value = new if new_is_value else getattr(new, field, NOT_FOUND)
8786
if old_value is NOT_FOUND or new_value is NOT_FOUND:

IPython/lib/pretty.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ def pprint(obj, verbose=False, max_width=79, newline='\n', max_seq_length=MAX_SE
163163
sys.stdout.write(newline)
164164
sys.stdout.flush()
165165

166+
166167
class _PrettyPrinterBase:
167168

168169
@contextmanager

IPython/testing/decorators.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,5 @@ def onlyif_cmds_exist(*commands):
143143
for cmd in commands:
144144
reason = f"This test runs only if command '{cmd}' is installed"
145145
if not shutil.which(cmd):
146-
147146
return pytest.mark.skip(reason=reason)
148147
return null_deco

IPython/utils/PyColorize.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,14 @@ class Theme:
4242
extra_style: dict[_TokenType, str]
4343
symbols: Symbols
4444

45-
def __init__(self, name: str, base: str | None, extra_style: dict[_TokenType, str], *, symbols: Symbols | None = None) -> None:
45+
def __init__(
46+
self,
47+
name: str,
48+
base: str | None,
49+
extra_style: dict[_TokenType, str],
50+
*,
51+
symbols: Symbols | None = None,
52+
) -> None:
4653
self.name = name
4754
self.base = base
4855
self.extra_style = extra_style
@@ -63,7 +70,6 @@ class MyStyle(Style):
6370
return MyStyle
6471

6572
def format(self, stream: TokenStream) -> str:
66-
6773
return pygments.format(stream, self._formatter)
6874

6975
def make_arrow(self, width: int) -> str:
@@ -399,7 +405,7 @@ def __init__(self, out: Any = sys.stdout, *, theme_name: str | None = None) -> N
399405
self.out = out
400406
self.pos = 0
401407
self.lines = []
402-
self.raw = ''
408+
self.raw = ""
403409
if theme_name is not None:
404410
if theme_name in ["Linux", "LightBG", "Neutral", "NoColor"]:
405411
warnings.warn(
@@ -525,7 +531,9 @@ def format2(self, raw: str, out: Any = None) -> tuple[str | None, bool]:
525531
return (output, error)
526532
return (None, error)
527533

528-
def _inner_call_(self, toktype: int, toktext: str, start_pos: tuple[int, int]) -> str:
534+
def _inner_call_(
535+
self, toktype: int, toktext: str, start_pos: tuple[int, int]
536+
) -> str:
529537
"""like call but write to a temporary buffer"""
530538
srow, scol = start_pos
531539

@@ -557,6 +565,13 @@ def _inner_call_(self, toktype: int, toktext: str, start_pos: tuple[int, int]) -
557565
acc += theme_table[self.theme_name].format([(pyg_tok_type, toktext)])
558566
return acc
559567

560-
def __call__(self, toktype: int, toktext: str, start_pos: tuple[int, int], end_pos: tuple[int, int], line: str) -> None:
568+
def __call__(
569+
self,
570+
toktype: int,
571+
toktext: str,
572+
start_pos: tuple[int, int],
573+
end_pos: tuple[int, int],
574+
line: str,
575+
) -> None:
561576
"""Token handler, with syntax highlighting."""
562577
self.out.write(self._inner_call_(toktype, toktext, start_pos))

IPython/utils/data.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,4 @@ def uniq_stable(elems: Iterable[T]) -> list[T]:
4747

4848
def chop(seq: Sequence[T], size: int) -> list[Sequence[T]]:
4949
"""Chop a sequence into chunks of the given size."""
50-
return [seq[i:i+size] for i in range(0, len(seq), size)]
51-
52-
50+
return [seq[i : i + size] for i in range(0, len(seq), size)]

0 commit comments

Comments
 (0)