Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 17, 2024
1 parent 82c53cc commit f28457f
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 10 deletions.
3 changes: 2 additions & 1 deletion jupyter_server/auth/authorizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
# Distributed under the terms of the Modified BSD License.
from __future__ import annotations

from typing import TYPE_CHECKING, Awaitable
from collections.abc import Awaitable
from typing import TYPE_CHECKING

from traitlets import Instance
from traitlets.config import LoggingConfigurable
Expand Down
3 changes: 2 additions & 1 deletion jupyter_server/base/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
import re
import types
import warnings
from collections.abc import Awaitable, Coroutine, Sequence
from http.client import responses
from logging import Logger
from typing import TYPE_CHECKING, Any, Awaitable, Coroutine, Sequence, cast
from typing import TYPE_CHECKING, Any, cast
from urllib.parse import urlparse

import prometheus_client
Expand Down
2 changes: 1 addition & 1 deletion jupyter_server/files/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import mimetypes
from base64 import decodebytes
from typing import Awaitable
from collections.abc import Awaitable

from jupyter_core.utils import ensure_async
from tornado import web
Expand Down
2 changes: 1 addition & 1 deletion tests/auth/test_authorizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import asyncio
import json
import os
from typing import Awaitable
from collections.abc import Awaitable

import pytest
from jupyter_client.kernelspec import NATIVE_KERNEL_NAME
Expand Down
3 changes: 2 additions & 1 deletion tests/services/api/test_api.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
from typing import Awaitable, Dict, List
from collections.abc import Awaitable
from typing import Dict, List
from unittest import mock

import pytest
Expand Down
7 changes: 4 additions & 3 deletions tests/services/contents/test_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -983,9 +983,10 @@ async def test_nb_validation(jp_contents_manager):
# successful methods and ensure that calls to the aliased "validate_nb" are
# zero. Note that since patching side-effects the validation error case, we'll
# skip call-count assertions for that portion of the test.
with patch("nbformat.validate") as mock_validate, patch(
"jupyter_server.services.contents.manager.validate_nb"
) as mock_validate_nb:
with (
patch("nbformat.validate") as mock_validate,
patch("jupyter_server.services.contents.manager.validate_nb") as mock_validate_nb,
):
# Valid notebook, save, then get
model = await ensure_async(cm.save(model, path))
assert "message" not in model
Expand Down
5 changes: 3 additions & 2 deletions tests/test_serverapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,9 @@ async def test_generate_config(tmp_path, jp_configurable_serverapp):

def test_server_password(tmp_path, jp_configurable_serverapp):
password = "secret"
with patch.dict("os.environ", {"JUPYTER_CONFIG_DIR": str(tmp_path)}), patch.object(
getpass, "getpass", return_value=password
with (
patch.dict("os.environ", {"JUPYTER_CONFIG_DIR": str(tmp_path)}),
patch.object(getpass, "getpass", return_value=password),
):
app = JupyterPasswordApp(log_level=logging.ERROR)
app.initialize([])
Expand Down

0 comments on commit f28457f

Please sign in to comment.