Skip to content

Commit 5d6b47f

Browse files
committed
fix all pre-commit issues
1 parent 93064d8 commit 5d6b47f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+143
-88
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ repos:
2525
hooks:
2626
- id: check-github-workflows
2727

28-
- repo: https://github.com/executablebooks/mdformat
28+
- repo: https://github.com/hukkin/mdformat
2929
rev: 0.7.22
3030
hooks:
3131
- id: mdformat
@@ -42,7 +42,7 @@ repos:
4242
- id: mypy
4343
files: jupyter_client
4444
stages: [manual]
45-
args: ["--install-types", "--non-interactive", "--python-version=3.9"]
45+
args: ["--install-types", "--non-interactive"]
4646
additional_dependencies:
4747
["traitlets>=5.13", "ipykernel>=6.26", "jupyter_core>=5.3.2"]
4848

@@ -68,7 +68,7 @@ repos:
6868
- repo: https://github.com/astral-sh/ruff-pre-commit
6969
rev: v0.14.0
7070
hooks:
71-
- id: ruff
71+
- id: ruff-check
7272
types_or: [python, jupyter]
7373
args: ["--fix", "--show-fixes"]
7474
- id: ruff-format

CHANGELOG.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -516,16 +516,16 @@ No merged PRs
516516

517517
### Maintenance and upkeep improvements
518518

519-
- \[pre-commit.ci\] pre-commit autoupdate [#824](https://github.com/jupyter/jupyter_client/pull/824) ([@pre-commit-ci](https://github.com/pre-commit-ci))
520-
- \[pre-commit.ci\] pre-commit autoupdate [#821](https://github.com/jupyter/jupyter_client/pull/821) ([@pre-commit-ci](https://github.com/pre-commit-ci))
521-
- \[pre-commit.ci\] pre-commit autoupdate [#820](https://github.com/jupyter/jupyter_client/pull/820) ([@pre-commit-ci](https://github.com/pre-commit-ci))
522-
- \[pre-commit.ci\] pre-commit autoupdate [#818](https://github.com/jupyter/jupyter_client/pull/818) ([@pre-commit-ci](https://github.com/pre-commit-ci))
523-
- \[pre-commit.ci\] pre-commit autoupdate [#816](https://github.com/jupyter/jupyter_client/pull/816) ([@pre-commit-ci](https://github.com/pre-commit-ci))
524-
- \[pre-commit.ci\] pre-commit autoupdate [#815](https://github.com/jupyter/jupyter_client/pull/815) ([@pre-commit-ci](https://github.com/pre-commit-ci))
525-
- \[pre-commit.ci\] pre-commit autoupdate [#812](https://github.com/jupyter/jupyter_client/pull/812) ([@pre-commit-ci](https://github.com/pre-commit-ci))
526-
- \[pre-commit.ci\] pre-commit autoupdate [#810](https://github.com/jupyter/jupyter_client/pull/810) ([@pre-commit-ci](https://github.com/pre-commit-ci))
527-
- \[pre-commit.ci\] pre-commit autoupdate [#809](https://github.com/jupyter/jupyter_client/pull/809) ([@pre-commit-ci](https://github.com/pre-commit-ci))
528-
- \[pre-commit.ci\] pre-commit autoupdate [#807](https://github.com/jupyter/jupyter_client/pull/807) ([@pre-commit-ci](https://github.com/pre-commit-ci))
519+
- [pre-commit.ci] pre-commit autoupdate [#824](https://github.com/jupyter/jupyter_client/pull/824) ([@pre-commit-ci](https://github.com/pre-commit-ci))
520+
- [pre-commit.ci] pre-commit autoupdate [#821](https://github.com/jupyter/jupyter_client/pull/821) ([@pre-commit-ci](https://github.com/pre-commit-ci))
521+
- [pre-commit.ci] pre-commit autoupdate [#820](https://github.com/jupyter/jupyter_client/pull/820) ([@pre-commit-ci](https://github.com/pre-commit-ci))
522+
- [pre-commit.ci] pre-commit autoupdate [#818](https://github.com/jupyter/jupyter_client/pull/818) ([@pre-commit-ci](https://github.com/pre-commit-ci))
523+
- [pre-commit.ci] pre-commit autoupdate [#816](https://github.com/jupyter/jupyter_client/pull/816) ([@pre-commit-ci](https://github.com/pre-commit-ci))
524+
- [pre-commit.ci] pre-commit autoupdate [#815](https://github.com/jupyter/jupyter_client/pull/815) ([@pre-commit-ci](https://github.com/pre-commit-ci))
525+
- [pre-commit.ci] pre-commit autoupdate [#812](https://github.com/jupyter/jupyter_client/pull/812) ([@pre-commit-ci](https://github.com/pre-commit-ci))
526+
- [pre-commit.ci] pre-commit autoupdate [#810](https://github.com/jupyter/jupyter_client/pull/810) ([@pre-commit-ci](https://github.com/pre-commit-ci))
527+
- [pre-commit.ci] pre-commit autoupdate [#809](https://github.com/jupyter/jupyter_client/pull/809) ([@pre-commit-ci](https://github.com/pre-commit-ci))
528+
- [pre-commit.ci] pre-commit autoupdate [#807](https://github.com/jupyter/jupyter_client/pull/807) ([@pre-commit-ci](https://github.com/pre-commit-ci))
529529

530530
### Contributors to this release
531531

@@ -544,7 +544,7 @@ No merged PRs
544544
### Maintenance and upkeep improvements
545545

546546
- Fix sphinx 5.0 support [#804](https://github.com/jupyter/jupyter_client/pull/804) ([@blink1073](https://github.com/blink1073))
547-
- \[pre-commit.ci\] pre-commit autoupdate [#799](https://github.com/jupyter/jupyter_client/pull/799) ([@pre-commit-ci](https://github.com/pre-commit-ci))
547+
- [pre-commit.ci] pre-commit autoupdate [#799](https://github.com/jupyter/jupyter_client/pull/799) ([@pre-commit-ci](https://github.com/pre-commit-ci))
548548

549549
### Contributors to this release
550550

@@ -576,9 +576,9 @@ No merged PRs
576576

577577
### Maintenance and upkeep improvements
578578

579-
- \[pre-commit.ci\] pre-commit autoupdate [#792](https://github.com/jupyter/jupyter_client/pull/792) ([@pre-commit-ci](https://github.com/pre-commit-ci))
579+
- [pre-commit.ci] pre-commit autoupdate [#792](https://github.com/jupyter/jupyter_client/pull/792) ([@pre-commit-ci](https://github.com/pre-commit-ci))
580580
- Use hatch backend [#789](https://github.com/jupyter/jupyter_client/pull/789) ([@blink1073](https://github.com/blink1073))
581-
- \[pre-commit.ci\] pre-commit autoupdate [#788](https://github.com/jupyter/jupyter_client/pull/788) ([@pre-commit-ci](https://github.com/pre-commit-ci))
581+
- [pre-commit.ci] pre-commit autoupdate [#788](https://github.com/jupyter/jupyter_client/pull/788) ([@pre-commit-ci](https://github.com/pre-commit-ci))
582582
- Use flit build backend [#781](https://github.com/jupyter/jupyter_client/pull/781) ([@blink1073](https://github.com/blink1073))
583583

584584
### Contributors to this release
@@ -599,7 +599,7 @@ No merged PRs
599599
### Maintenance and upkeep improvements
600600

601601
- Allow bot PRs to be automatically labeled [#784](https://github.com/jupyter/jupyter_client/pull/784) ([@blink1073](https://github.com/blink1073))
602-
- \[pre-commit.ci\] pre-commit autoupdate [#783](https://github.com/jupyter/jupyter_client/pull/783) ([@pre-commit-ci](https://github.com/pre-commit-ci))
602+
- [pre-commit.ci] pre-commit autoupdate [#783](https://github.com/jupyter/jupyter_client/pull/783) ([@pre-commit-ci](https://github.com/pre-commit-ci))
603603

604604
### Contributors to this release
605605

@@ -617,8 +617,8 @@ No merged PRs
617617

618618
### Maintenance and upkeep improvements
619619

620-
- \[pre-commit.ci\] pre-commit autoupdate [#773](https://github.com/jupyter/jupyter_client/pull/773) ([@pre-commit-ci](https://github.com/pre-commit-ci))
621-
- \[pre-commit.ci\] pre-commit autoupdate [#770](https://github.com/jupyter/jupyter_client/pull/770) ([@pre-commit-ci](https://github.com/pre-commit-ci))
620+
- [pre-commit.ci] pre-commit autoupdate [#773](https://github.com/jupyter/jupyter_client/pull/773) ([@pre-commit-ci](https://github.com/pre-commit-ci))
621+
- [pre-commit.ci] pre-commit autoupdate [#770](https://github.com/jupyter/jupyter_client/pull/770) ([@pre-commit-ci](https://github.com/pre-commit-ci))
622622
- Improve mypy config [#769](https://github.com/jupyter/jupyter_client/pull/769) ([@blink1073](https://github.com/blink1073))
623623
- Clean up pre-commit [#768](https://github.com/jupyter/jupyter_client/pull/768) ([@blink1073](https://github.com/blink1073))
624624

@@ -635,7 +635,7 @@ No merged PRs
635635
### Maintenance and upkeep improvements
636636

637637
- Include py.typed file [#766](https://github.com/jupyter/jupyter_client/pull/766) ([@blink1073](https://github.com/blink1073))
638-
- \[pre-commit.ci\] pre-commit autoupdate [#765](https://github.com/jupyter/jupyter_client/pull/765) ([@pre-commit-ci](https://github.com/pre-commit-ci))
638+
- [pre-commit.ci] pre-commit autoupdate [#765](https://github.com/jupyter/jupyter_client/pull/765) ([@pre-commit-ci](https://github.com/pre-commit-ci))
639639
- More Cleanup [#764](https://github.com/jupyter/jupyter_client/pull/764) ([@blink1073](https://github.com/blink1073))
640640

641641
### Contributors to this release
@@ -713,7 +713,7 @@ No merged PRs
713713

714714
### Documentation improvements
715715

716-
- \[DOC\] improve kernel provisioner doc [#730](https://github.com/jupyter/jupyter_client/pull/730) ([@abzymeinsjtu](https://github.com/abzymeinsjtu))
716+
- [DOC] improve kernel provisioner doc [#730](https://github.com/jupyter/jupyter_client/pull/730) ([@abzymeinsjtu](https://github.com/abzymeinsjtu))
717717
- add changelog for message spec [#525](https://github.com/jupyter/jupyter_client/pull/525) ([@minrk](https://github.com/minrk))
718718

719719
### Contributors to this release

jupyter_client/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Client-side implementations of the Jupyter protocol"""
2+
23
from ._version import __version__, protocol_version, protocol_version_info, version_info
34
from .asynchronous import AsyncKernelClient
45
from .blocking import BlockingKernelClient

jupyter_client/_version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""The version information for jupyter client."""
2+
23
import re
34
from typing import Union
45

jupyter_client/adapter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Adapters for Jupyter msg spec versions."""
2+
23
# Copyright (c) Jupyter Development Team.
34
# Distributed under the terms of the Modified BSD License.
45
import json
@@ -194,7 +195,7 @@ def object_info_request(self, msg: dict[str, Any]) -> dict[str, Any]:
194195
content = msg["content"]
195196
code = content["code"]
196197
cursor_pos = content["cursor_pos"]
197-
line, _ = code_to_line(code, cursor_pos)
198+
_line, _ = code_to_line(code, cursor_pos)
198199

199200
new_content = msg["content"] = {}
200201
new_content["oname"] = extract_oname_v4(code, cursor_pos)

jupyter_client/asynchronous/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Implements an async kernel client"""
2+
23
# Copyright (c) Jupyter Development Team.
34
# Distributed under the terms of the Modified BSD License.
45
from __future__ import annotations

jupyter_client/blocking/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
Useful for test suites and blocking terminal interfaces.
44
"""
5+
56
# Copyright (c) Jupyter Development Team.
67
# Distributed under the terms of the Modified BSD License.
78
from __future__ import annotations

jupyter_client/channels.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Base classes to manage a Client's interaction with a running kernel"""
2+
23
# Copyright (c) Jupyter Development Team.
34
# Distributed under the terms of the Modified BSD License.
45
import asyncio
@@ -51,8 +52,8 @@ class HBChannel(Thread):
5152

5253
def __init__(
5354
self,
54-
context: t.Optional[zmq.Context] = None,
55-
session: t.Optional[Session] = None,
55+
context: zmq.Context | None = None,
56+
session: Session | None = None,
5657
address: t.Union[t.Tuple[str, int], str] = "",
5758
) -> None:
5859
"""Create the heartbeat monitor thread.
@@ -211,16 +212,16 @@ def __init__(self, socket: zmq.Socket, session: Session, loop: t.Any = None) ->
211212
"""
212213
super().__init__()
213214

214-
self.socket: t.Optional[zmq.Socket] = socket
215+
self.socket: zmq.Socket | None = socket
215216
self.session = session
216217

217218
def _recv(self, **kwargs: t.Any) -> t.Dict[str, t.Any]:
218219
assert self.socket is not None
219220
msg = self.socket.recv_multipart(**kwargs)
220-
ident, smsg = self.session.feed_identities(msg)
221+
_ident, smsg = self.session.feed_identities(msg)
221222
return self.session.deserialize(smsg)
222223

223-
def get_msg(self, timeout: t.Optional[float] = None) -> t.Dict[str, t.Any]:
224+
def get_msg(self, timeout: float | None = None) -> t.Dict[str, t.Any]:
224225
"""Gets a message if there is one that is ready."""
225226
assert self.socket is not None
226227
timeout_ms = None if timeout is None else int(timeout * 1000) # seconds to ms
@@ -300,7 +301,7 @@ async def _recv(self, **kwargs: t.Any) -> t.Dict[str, t.Any]: # type:ignore[ove
300301
return self.session.deserialize(smsg)
301302

302303
async def get_msg( # type:ignore[override]
303-
self, timeout: t.Optional[float] = None
304+
self, timeout: float | None = None
304305
) -> t.Dict[str, t.Any]:
305306
"""Gets a message if there is one that is ready."""
306307
assert self.socket is not None

jupyter_client/channelsabc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Abstract base classes for kernel client channels"""
2+
23
# Copyright (c) Jupyter Development Team.
34
# Distributed under the terms of the Modified BSD License.
45
import abc

jupyter_client/client.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Base class to manage the interaction with a running kernel"""
2+
23
# Copyright (c) Jupyter Development Team.
34
# Distributed under the terms of the Modified BSD License.
45
import asyncio
@@ -154,7 +155,7 @@ async def _async_get_control_msg(self, *args: t.Any, **kwargs: t.Any) -> t.Dict[
154155
"""Get a message from the control channel"""
155156
return await ensure_async(self.control_channel.get_msg(*args, **kwargs))
156157

157-
async def _async_wait_for_ready(self, timeout: t.Optional[float] = None) -> None:
158+
async def _async_wait_for_ready(self, timeout: float | None = None) -> None:
158159
"""Waits for a response when a client is blocked
159160
160161
- Sets future time for timeout
@@ -214,7 +215,7 @@ async def _async_wait_for_ready(self, timeout: t.Optional[float] = None) -> None
214215
break
215216

216217
async def _async_recv_reply(
217-
self, msg_id: str, timeout: t.Optional[float] = None, channel: str = "shell"
218+
self, msg_id: str, timeout: float | None = None, channel: str = "shell"
218219
) -> t.Dict[str, t.Any]:
219220
"""Receive and return the reply for a given request"""
220221
if timeout is not None:
@@ -426,12 +427,12 @@ async def _async_execute_interactive(
426427
code: str,
427428
silent: bool = False,
428429
store_history: bool = True,
429-
user_expressions: t.Optional[t.Dict[str, t.Any]] = None,
430-
allow_stdin: t.Optional[bool] = None,
430+
user_expressions: t.Dict[str, t.Any] | None = None,
431+
allow_stdin: bool | None = None,
431432
stop_on_error: bool = True,
432-
timeout: t.Optional[float] = None,
433-
output_hook: t.Optional[t.Callable] = None,
434-
stdin_hook: t.Optional[t.Callable] = None,
433+
timeout: float | None = None,
434+
output_hook: t.Callable | None = None,
435+
stdin_hook: t.Callable | None = None,
435436
) -> t.Dict[str, t.Any]:
436437
"""Execute code in the kernel interactively
437438
@@ -582,8 +583,8 @@ def execute(
582583
code: str,
583584
silent: bool = False,
584585
store_history: bool = True,
585-
user_expressions: t.Optional[t.Dict[str, t.Any]] = None,
586-
allow_stdin: t.Optional[bool] = None,
586+
user_expressions: t.Dict[str, t.Any] | None = None,
587+
allow_stdin: bool | None = None,
587588
stop_on_error: bool = True,
588589
) -> str:
589590
"""Execute code in the kernel.
@@ -644,7 +645,7 @@ def execute(
644645
self.shell_channel.send(msg)
645646
return msg["header"]["msg_id"]
646647

647-
def complete(self, code: str, cursor_pos: t.Optional[int] = None) -> str:
648+
def complete(self, code: str, cursor_pos: int | None = None) -> str:
648649
"""Tab complete text in the kernel's namespace.
649650
650651
Parameters
@@ -667,7 +668,7 @@ def complete(self, code: str, cursor_pos: t.Optional[int] = None) -> str:
667668
self.shell_channel.send(msg)
668669
return msg["header"]["msg_id"]
669670

670-
def inspect(self, code: str, cursor_pos: t.Optional[int] = None, detail_level: int = 0) -> str:
671+
def inspect(self, code: str, cursor_pos: int | None = None, detail_level: int = 0) -> str:
671672
"""Get metadata information about an object in the kernel's namespace.
672673
673674
It is up to the kernel to determine the appropriate object to inspect.
@@ -755,7 +756,7 @@ def kernel_info(self) -> str:
755756
self.shell_channel.send(msg)
756757
return msg["header"]["msg_id"]
757758

758-
def comm_info(self, target_name: t.Optional[str] = None) -> str:
759+
def comm_info(self, target_name: str | None = None) -> str:
759760
"""Request comm info
760761
761762
Returns

0 commit comments

Comments
 (0)