Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#928)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: David Brochart <[email protected]>
Co-authored-by: Steven Silvester <[email protected]>
  • Loading branch information
3 people authored Feb 7, 2023
1 parent 5a12a38 commit 19dbf1b
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 22 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.19.2
rev: 0.21.0
hooks:
- id: check-github-workflows

Expand All @@ -30,12 +30,12 @@ repos:
- id: mdformat

- repo: https://github.com/psf/black
rev: 22.12.0
rev: 23.1.0
hooks:
- id: black

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.236
rev: v0.0.243
hooks:
- id: ruff
args: ["--fix"]
2 changes: 1 addition & 1 deletion jupyter_client/localinterfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def _load_ips_ip():
addrs = []
for line in lines:
blocks = line.lower().split()
if (len(blocks) >= 2) and (blocks[0] == "inet"): # noqa
if (len(blocks) >= 2) and (blocks[0] == "inet"):
addrs.append(blocks[1].split("/")[0])
_populate_from_list(addrs)

Expand Down
1 change: 0 additions & 1 deletion jupyter_client/multikernelmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,6 @@ def new_kernel_id(self, **kwargs: t.Any) -> str:


class AsyncMultiKernelManager(MultiKernelManager):

kernel_manager_class = DottedObjectName(
"jupyter_client.ioloop.AsyncIOLoopKernelManager",
config=True,
Expand Down
2 changes: 1 addition & 1 deletion jupyter_client/provisioning/local_provisioner.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def _tolerate_no_process(os_error: OSError) -> None:
# In Windows, we will get an Access Denied error if the process
# has already terminated. Ignore it.
if sys.platform == 'win32':
if os_error.winerror != 5: # noqa
if os_error.winerror != 5:
raise
# On Unix, we may get an ESRCH error (or ProcessLookupError instance) if
# the process has already terminated. Ignore it.
Expand Down
2 changes: 1 addition & 1 deletion jupyter_client/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ def send(
else:
try:
# check to see if buf supports the buffer protocol.
view = memoryview(buf) # type:ignore[assignment]
view = memoryview(buf)
except TypeError as e:
emsg = "Buffer objects must support the buffer protocol."
raise TypeError(emsg) from e
Expand Down
1 change: 1 addition & 0 deletions jupyter_client/ssh/forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def handle(self):

def forward_tunnel(local_port, remote_host, remote_port, transport):
"""Forward an ssh tunnel."""

# this is a little convoluted, but lets me configure things for the Handler
# object. (SocketServer doesn't give Handlers any way to access the outer
# server normally.)
Expand Down
1 change: 1 addition & 0 deletions jupyter_client/win_interrupt.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def create_interrupt_event():
this handle and use it with ``send_interrupt`` to interrupt the child
process.
"""

# Create a security attributes struct that permits inheritance of the
# handle by new processes.
# FIXME: We can clean up this mess by requiring pywin32 for IPython.
Expand Down
9 changes: 6 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ test = "mypy --install-types --non-interactive {args:.}"

[tool.hatch.envs.lint]
dependencies = [
"black[jupyter]==22.12.0",
"black[jupyter]==23.1.0",
"mdformat>0.7",
"ruff==0.0.236",
"ruff==0.0.243",
]
[tool.hatch.envs.lint.scripts]
style = [
Expand Down Expand Up @@ -196,7 +196,6 @@ select = [
"N",
"PLC",
"PLE",
"PLR",
"PLW",
"Q",
"RUF",
Expand Down Expand Up @@ -239,6 +238,10 @@ ignore = [
"N806",
# SIM105 Use `contextlib.suppress(ValueError)` instead of try-except-pass
"SIM105",
# SIM108 [*] Use ternary operator
"SIM108",
# S110 `try`-`except`-`pass` detected, consider logging the exception
"S110",
]
unfixable = [
# Don't touch print statements
Expand Down
2 changes: 0 additions & 2 deletions tests/test_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,15 +247,13 @@ def test_mixin_cleanup_random_ports():

@pytest.mark.parametrize("file_exists, km_matches", param_values)
def test_reconcile_connection_info(file_exists, km_matches):

expected_info = sample_info
mismatched_info = sample_info.copy()
mismatched_info["key"] = b"def456"
mismatched_info["shell_port"] = expected_info["shell_port"] + 42
mismatched_info["control_port"] = expected_info["control_port"] + 42

with TemporaryDirectory() as connection_dir:

cf = os.path.join(connection_dir, "kernel.json")
km = KernelManager()
km.connection_file = cf
Expand Down
2 changes: 0 additions & 2 deletions tests/test_kernelmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ def test_get_connect_info(self, km):

@pytest.mark.skipif(sys.platform == "win32", reason="Windows doesn't support signals")
async def test_signal_kernel_subprocesses(self, install_kernel, jp_start_kernel):

km, kc = await jp_start_kernel("signaltest")

async def execute(cmd):
Expand Down Expand Up @@ -448,7 +447,6 @@ async def test_get_connect_info(self, async_km):
@pytest.mark.timeout(10)
@pytest.mark.skipif(sys.platform == "win32", reason="Windows doesn't support signals")
async def test_signal_kernel_subprocesses(self, install_kernel, jp_start_kernel):

km, kc = await jp_start_kernel("signaltest")

async def execute(cmd):
Expand Down
2 changes: 0 additions & 2 deletions tests/test_provisioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,13 @@


class SubclassedTestProvisioner(LocalProvisioner): # type:ignore

config_var_1: int = Int(config=True) # type:ignore
config_var_2: str = Unicode(config=True) # type:ignore

pass


class CustomTestProvisioner(KernelProvisionerBase): # type:ignore

process = None
pid = None
pgid = None
Expand Down
4 changes: 0 additions & 4 deletions tests/test_restarter.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ def cb():
assert km.is_alive()

finally:

km.shutdown_kernel(now=True)
assert km.context.closed

Expand Down Expand Up @@ -183,7 +182,6 @@ def on_death():
assert cbs == N_restarts

finally:

km.shutdown_kernel(now=True)
assert km.context.closed

Expand Down Expand Up @@ -239,7 +237,6 @@ def cb():
assert await km.is_alive()

finally:

await km.shutdown_kernel(now=True)
assert km.context.closed

Expand Down Expand Up @@ -284,6 +281,5 @@ def on_death():
assert cbs == N_restarts

finally:

await km.shutdown_kernel(now=True)
assert km.context.closed
2 changes: 0 additions & 2 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,13 @@ def shutdown_all(self, now=False):


class SyncMKMSubclass(MKMSubclass, MultiKernelManager):

_superclass = MultiKernelManager

def _kernel_manager_class_default(self):
return "tests.utils.SyncKMSubclass"


class AsyncMKMSubclass(MKMSubclass, AsyncMultiKernelManager):

_superclass = AsyncMultiKernelManager

def _kernel_manager_class_default(self):
Expand Down

0 comments on commit 19dbf1b

Please sign in to comment.