Skip to content

Commit 950f8cb

Browse files
committed
Linting
1 parent 3c87a89 commit 950f8cb

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

ipykernel/iostream.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
import warnings
1515
from binascii import b2a_hex
1616
from collections import defaultdict, deque
17+
from collections.abc import Callable
1718
from io import StringIO, TextIOBase
1819
from threading import local
19-
from typing import Any, Callable, Optional
20+
from typing import Any
2021

2122
import zmq
2223
from jupyter_client.session import extract_header
@@ -70,7 +71,7 @@ def __init__(self, socket, pipe=False):
7071
self._event_pipes: dict[threading.Thread, Any] = {}
7172
self._event_pipe_gc_lock: threading.Lock = threading.Lock()
7273
self._event_pipe_gc_seconds: float = 10
73-
self._event_pipe_gc_task: Optional[asyncio.Task[Any]] = None
74+
self._event_pipe_gc_task: asyncio.Task[Any] | None = None
7475
self._setup_event_pipe()
7576
self.thread = threading.Thread(target=self._thread_main, name="IOPub")
7677
self.thread.daemon = True
@@ -359,7 +360,7 @@ class OutStream(TextIOBase):
359360
flush_interval = 0.2
360361
topic = None
361362
encoding = "UTF-8"
362-
_exc: Optional[Any] = None
363+
_exc: Any | None = None
363364

364365
def fileno(self):
365366
"""
@@ -658,7 +659,7 @@ def _flush(self):
658659
ident=self.topic,
659660
)
660661

661-
def write(self, string: str) -> Optional[int]: # type:ignore[override]
662+
def write(self, string: str) -> int | None: # type:ignore[override]
662663
"""Write to current stream after encoding if necessary
663664
664665
Returns

ipykernel/jsonutil.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def json_clean(obj): # pragma: no cover
156156
for k, v in obj.items():
157157
out[str(k)] = json_clean(v)
158158
return out
159-
if isinstance(obj, (datetime, date)):
159+
if isinstance(obj, datetime | date):
160160
return obj.strftime(ISO8601)
161161

162162
# we don't understand it, it's probably an unserializable object

tests/test_kernel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ def ensure_datetime(arg):
634634

635635
# Check messages are processed in order, one at a time, and of a sensible duration.
636636
previous_end = None
637-
for reply, sleep in zip(replies, sleeps):
637+
for reply, sleep in zip(replies, sleeps, strict=False):
638638
start = ensure_datetime(reply["metadata"]["started"])
639639
end = ensure_datetime(reply["header"]["date"])
640640

tests/test_subshells.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def test_run_concurrently_sequence(are_subshells, overlap, request):
164164
]
165165

166166
msgs = []
167-
for subshell_id, code in zip(subshell_ids, codes):
167+
for subshell_id, code in zip(subshell_ids, codes, strict=False):
168168
msg = kc.session.msg("execute_request", {"code": code})
169169
msg["header"]["subshell_id"] = subshell_id
170170
kc.shell_channel.send(msg)

0 commit comments

Comments
 (0)