Skip to content

Commit 214b83a

Browse files
chore: update pre-commit hooks (#1541)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Ian Thomas <ianthomas23@gmail.com>
1 parent f53affa commit 214b83a

20 files changed

Lines changed: 47 additions & 29 deletions

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ repos:
2222
- id: trailing-whitespace
2323

2424
- repo: https://github.com/python-jsonschema/check-jsonschema
25-
rev: 0.37.4
25+
rev: 0.38.0
2626
hooks:
2727
- id: check-github-workflows
2828

@@ -95,7 +95,7 @@ repos:
9595
- id: rst-inline-touching-normal
9696

9797
- repo: https://github.com/astral-sh/ruff-pre-commit
98-
rev: v0.15.22
98+
rev: v0.16.2
9999
hooks:
100100
- id: ruff-check
101101
types_or: [python, jupyter]

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
here = Path(__file__).parent.resolve()
7777
version_py = Path(here) / os.pardir / "ipykernel" / "_version.py"
7878
with open(version_py) as f:
79-
exec(compile(f.read(), version_py, "exec"), version_ns)
79+
exec(compile(f.read(), version_py, "exec"), version_ns) # noqa: S102
8080

8181
# The short X.Y version.
8282
version = "%i.%i" % version_ns["version_info"][:2]

ipykernel/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
kernel_protocol_version_info,
55
version_info,
66
)
7-
from .connect import * # noqa: F403
7+
from .connect import *

ipykernel/compiler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def murmur2_x86(data, seed):
4646
return h
4747

4848

49-
convert_to_long_pathname = lambda filename: filename # noqa: E731
49+
convert_to_long_pathname = lambda filename: filename
5050

5151
if sys.platform == "win32":
5252
try:
@@ -66,7 +66,7 @@ def _convert_to_long_pathname(filename):
6666

6767
# test that it works so if there are any issues we fail just once here
6868
_convert_to_long_pathname(__file__)
69-
except Exception:
69+
except Exception: # noqa: S110
7070
pass
7171
else:
7272
convert_to_long_pathname = _convert_to_long_pathname

ipykernel/connect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def connect_qtconsole(
116116

117117
cf = _find_connection_file(connection_file)
118118

119-
cmd = ";".join(["from qtconsole import qtconsoleapp", "qtconsoleapp.main()"])
119+
cmd = "from qtconsole import qtconsoleapp; qtconsoleapp.main()"
120120

121121
kwargs: dict[str, Any] = {}
122122
# Launch the Qt console in a separate session & process group, so

ipykernel/debugger.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
if e.__class__.__name__ == "DebuggerInitializationError":
4040
_is_debugpy_available = False
4141
else:
42-
raise e
42+
raise
4343

4444
if t.TYPE_CHECKING:
4545
from IPython.core.interactiveshell import InteractiveShell
@@ -470,7 +470,7 @@ async def dumpCell(self, message):
470470
code = message["arguments"]["code"]
471471
file_name = get_file_name(code)
472472

473-
with open(file_name, "w", encoding="utf-8") as f:
473+
with open(file_name, "w", encoding="utf-8") as f: # noqa: ASYNC230
474474
f.write(code)
475475

476476
return {
@@ -500,7 +500,7 @@ async def source(self, message):
500500
reply = {"type": "response", "request_seq": message["seq"], "command": message["command"]}
501501
source_path = message["arguments"]["source"]["path"]
502502
if Path(source_path).is_file():
503-
with open(source_path, encoding="utf-8") as f:
503+
with open(source_path, encoding="utf-8") as f: # noqa: ASYNC230
504504
reply["success"] = True
505505
reply["body"] = {"content": f.read()}
506506
else:

ipykernel/eventloops.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def wake(self):
207207
try:
208208
if self.shell_stream.flush(limit=1):
209209
self.kernel.app.ExitMainLoop()
210-
except Exception:
210+
except Exception: # noqa: S110
211211
pass
212212

213213
def on_timer(self, event):
@@ -409,7 +409,7 @@ def handle_int(etype, value, tb):
409409
if shell_stream.flush(limit=1):
410410
# events to process, return control to kernel
411411
return
412-
except BaseException:
412+
except BaseException: # noqa: TRY203
413413
raise
414414
except KeyboardInterrupt:
415415
# Ctrl-C shouldn't crash the kernel

ipykernel/gui/gtk3embed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
gi.require_version("Gdk", "3.0")
2020
gi.require_version("Gtk", "3.0")
21-
from gi.repository import GObject, Gtk # noqa: E402
21+
from gi.repository import GObject, Gtk
2222

2323
warnings.warn(
2424
"The Gtk3 event loop for ipykernel is deprecated", category=DeprecationWarning, stacklevel=2

ipykernel/inprocess/ipkernel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def _input_request(self, prompt, ident, parent, password=False):
107107
frontend.stdin_channel.call_handlers(msg)
108108
break
109109
else:
110-
logging.error("No frontend found for raw_input request")
110+
logging.error("No frontend found for raw_input request") # noqa: LOG015
111111
return ""
112112

113113
# Await a response.

ipykernel/iostream.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ def stop(self):
318318
# close *all* event pipes, created in any thread
319319
# event pipes can only be used from other threads while self.thread.is_alive()
320320
# so after thread.join, this should be safe
321-
for _thread, event_pipe in self._event_pipes.items():
321+
for event_pipe in self._event_pipes.values():
322322
event_pipe.close()
323323

324324
def close(self):

0 commit comments

Comments
 (0)