Skip to content

Commit 83ab7d0

Browse files
authored
Use sp-repo-review (#1146)
1 parent c24b252 commit 83ab7d0

Some content is hidden

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

41 files changed

+133
-61
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ jobs:
8181
steps:
8282
- uses: actions/checkout@v4
8383
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
84-
- name: Run Linters
85-
run: |
84+
- name: Run Linters
85+
run: |
8686
hatch run typing:test
8787
hatch run lint:style
8888
pipx run interrogate -vv .

.pre-commit-config.yaml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
ci:
22
autoupdate_schedule: monthly
3+
autoupdate_commit_msg: "chore: update pre-commit hooks"
34

45
repos:
56
- repo: https://github.com/pre-commit/pre-commit-hooks
@@ -29,14 +30,47 @@ repos:
2930
rev: 0.7.17
3031
hooks:
3132
- id: mdformat
33+
additional_dependencies:
34+
[mdformat-gfm, mdformat-frontmatter, mdformat-footnote]
3235

33-
- repo: https://github.com/psf/black
36+
- repo: https://github.com/pre-commit/mirrors-prettier
37+
rev: "v3.0.2"
38+
hooks:
39+
- id: prettier
40+
types_or: [yaml, html, json]
41+
42+
- repo: https://github.com/adamchainz/blacken-docs
43+
rev: "1.16.0"
44+
hooks:
45+
- id: blacken-docs
46+
additional_dependencies: [black==23.7.0]
47+
48+
- repo: https://github.com/psf/black-pre-commit-mirror
3449
rev: 23.7.0
3550
hooks:
3651
- id: black
3752

53+
- repo: https://github.com/codespell-project/codespell
54+
rev: "v2.2.5"
55+
hooks:
56+
- id: codespell
57+
args: ["-L", "sur,nd"]
58+
59+
- repo: https://github.com/pre-commit/pygrep-hooks
60+
rev: "v1.10.0"
61+
hooks:
62+
- id: rst-backticks
63+
- id: rst-directive-colons
64+
- id: rst-inline-touching-normal
65+
3866
- repo: https://github.com/astral-sh/ruff-pre-commit
3967
rev: v0.0.287
4068
hooks:
4169
- id: ruff
42-
args: ["--fix"]
70+
args: ["--fix", "--show-fixes"]
71+
72+
- repo: https://github.com/scientific-python/cookie
73+
rev: "2023.08.23"
74+
hooks:
75+
- id: sp-repo-review
76+
additional_dependencies: ["repo-review[cli]"]

examples/embedding/inprocess_qtconsole.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def init_asyncio_patch():
1919
asyncio implementation on Windows
2020
Pick the older SelectorEventLoopPolicy on Windows
2121
if the known-incompatible default policy is in use.
22-
do this as early as possible to make it a low priority and overrideable
22+
do this as early as possible to make it a low priority and overridable
2323
ref: https://github.com/tornadoweb/tornado/issues/2608
2424
FIXME: if/when tornado supports the defaults in asyncio,
2525
remove and bump tornado requirement for py38

examples/embedding/inprocess_terminal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def init_asyncio_patch():
1919
asyncio implementation on Windows
2020
Pick the older SelectorEventLoopPolicy on Windows
2121
if the known-incompatible default policy is in use.
22-
do this as early as possible to make it a low priority and overrideable
22+
do this as early as possible to make it a low priority and overridable
2323
ref: https://github.com/tornadoweb/tornado/issues/2608
2424
FIXME: if/when tornado supports the defaults in asyncio,
2525
remove and bump tornado requirement for py38

ipykernel/debugger.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
raise e
4141

4242

43-
# Required for backwards compatiblity
43+
# Required for backwards compatibility
4444
ROUTING_ID = getattr(zmq, "ROUTING_ID", None) or zmq.IDENTITY
4545

4646

@@ -644,7 +644,7 @@ async def richInspectVariables(self, message):
644644
repr_data = {}
645645
repr_metadata = {}
646646
if not self.stopped_threads:
647-
# The code did not hit a breakpoint, we use the intepreter
647+
# The code did not hit a breakpoint, we use the interpreter
648648
# to get the rich representation of the variable
649649
result = get_ipython().user_expressions({var_name: var_name})[var_name]
650650
if result.get("status", "error") == "ok":

ipykernel/eventloops.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ async def close_loop():
429429
close_loop()
430430

431431
elif not loop.is_closed():
432-
loop.run_until_complete(close_loop) # type:ignore
432+
loop.run_until_complete(close_loop) # type:ignore[arg-type]
433433
loop.close()
434434

435435

@@ -566,8 +566,12 @@ def enable_gui(gui, kernel=None):
566566
make_qt_app_for_kernel(gui, kernel)
567567

568568
loop = loop_map[gui]
569-
if loop and kernel.eventloop is not None and kernel.eventloop is not loop:
570-
msg = "Cannot activate multiple GUI eventloops"
569+
if (
570+
loop
571+
and kernel.eventloop is not None
572+
and kernel.eventloop is not loop # type:ignore[unreachable]
573+
):
574+
msg = "Cannot activate multiple GUI eventloops" # type:ignore[unreachable]
571575
raise RuntimeError(msg)
572576
kernel.eventloop = loop
573577
# We set `eventloop`; the function the user chose is executed in `Kernel.enter_eventloop`, thus

ipykernel/inprocess/channels.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class InProcessChannel:
1818
proxy_methods: List[object] = []
1919

2020
def __init__(self, client=None):
21-
"""Initialze the channel."""
21+
"""Initialize the channel."""
2222
super().__init__()
2323
self.client = client
2424
self._is_alive = False

ipykernel/inprocess/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def _dispatch_to_kernel(self, msg):
193193
dispatch_shell = run_sync(kernel.dispatch_shell)
194194
dispatch_shell(msg_parts)
195195
else:
196-
loop = asyncio.get_event_loop()
196+
loop = asyncio.get_event_loop() # type:ignore[unreachable]
197197
loop.run_until_complete(kernel.dispatch_shell(msg_parts))
198198
idents, reply_msg = self.session.recv(stream, copy=False)
199199
self.shell_channel.call_handlers_later(reply_msg)

ipykernel/inprocess/ipkernel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def _input_request(self, prompt, ident, parent, password=False):
111111
# Await a response.
112112
while self.raw_input_str is None:
113113
frontend.stdin_channel.process_events()
114-
return self.raw_input_str
114+
return self.raw_input_str # type:ignore[unreachable]
115115

116116
# -------------------------------------------------------------------------
117117
# Protected interface

ipykernel/iostream.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def _start_event_gc():
9393
if self._event_pipe_gc_task is not None:
9494
# cancel gc task to avoid pending task warnings
9595
async def _cancel():
96-
self._event_pipe_gc_task.cancel() # type:ignore
96+
self._event_pipe_gc_task.cancel() # type:ignore[union-attr]
9797

9898
if not self._stopped:
9999
self.io_loop.run_sync(_cancel)
@@ -373,7 +373,7 @@ def fileno(self):
373373

374374
def _watch_pipe_fd(self):
375375
"""
376-
We've redirected standards steams 0 and 1 into a pipe.
376+
We've redirected standards streams 0 and 1 into a pipe.
377377
378378
We need to watch in a thread and redirect them to the right places.
379379
@@ -424,7 +424,7 @@ def __init__(
424424
that will swap the give file descriptor for a pipe, read from the
425425
pipe, and insert this into the current Stream.
426426
isatty : bool (default, False)
427-
Indication of whether this stream has termimal capabilities (e.g. can handle colors)
427+
Indication of whether this stream has terminal capabilities (e.g. can handle colors)
428428
429429
"""
430430
if pipe is not None:
@@ -634,7 +634,7 @@ def write(self, string: str) -> Optional[int]: # type:ignore[override]
634634
"""
635635

636636
if not isinstance(string, str):
637-
msg = f"write() argument must be str, not {type(string)}"
637+
msg = f"write() argument must be str, not {type(string)}" # type:ignore[unreachable]
638638
raise TypeError(msg)
639639

640640
if self.echo is not None:

0 commit comments

Comments
 (0)