Skip to content

Commit f137916

Browse files
authored
Use hatch fmt command (#1424)
1 parent 547f7a2 commit f137916

Some content is hidden

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

58 files changed

+152
-211
lines changed

.github/workflows/python-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ jobs:
8282
- name: Run Linters
8383
run: |
8484
hatch -v run typing:test
85-
hatch -v run lint:build
85+
hatch fmt
8686
pipx run interrogate -v .
8787
pipx run doc8 --max-line-length=200 --ignore-path=docs/source/other/full-config.rst
8888
npm install -g eslint

docs/source/conf.py

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

6767
# General information about the project.
6868
project = "Jupyter Server"
69-
copyright = "2020, Jupyter Team, https://jupyter.org"
69+
copyright = "2020, Jupyter Team, https://jupyter.org" # noqa: A001
7070
author = "The Jupyter Team"
7171

7272
# ghissue config

examples/simple/tests/test_handlers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import pytest
44

55

6-
@pytest.fixture()
6+
@pytest.fixture
77
def jp_server_auth_resources(jp_server_auth_core_resources):
88
"""The server auth resources."""
99
for url_regex in [
@@ -13,7 +13,7 @@ def jp_server_auth_resources(jp_server_auth_core_resources):
1313
return jp_server_auth_core_resources
1414

1515

16-
@pytest.fixture()
16+
@pytest.fixture
1717
def jp_server_config(jp_template_dir, jp_server_authorizer):
1818
"""The server config."""
1919
return {

jupyter_server/_sysinfo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def pkg_commit_hash(pkg_path):
4242
if p.exists(p.join(cur_path, ".git")):
4343
try:
4444
proc = subprocess.Popen(
45-
["git", "rev-parse", "--short", "HEAD"],
45+
["git", "rev-parse", "--short", "HEAD"], # noqa: S607
4646
stdout=subprocess.PIPE,
4747
stderr=subprocess.PIPE,
4848
cwd=pkg_path,

jupyter_server/_tz.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
ZERO = timedelta(0)
1515

1616

17-
class tzUTC(tzinfo):
17+
class tzUTC(tzinfo): # noqa: N801
1818
"""tzinfo object for UTC (zero offset)"""
1919

2020
def utcoffset(self, d: datetime | None) -> timedelta:

jupyter_server/auth/authorizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def is_authorized(
6666
bool
6767
True if user authorized to make request; False, otherwise
6868
"""
69-
raise NotImplementedError()
69+
raise NotImplementedError
7070

7171

7272
class AllowAllAuthorizer(Authorizer):

jupyter_server/auth/security.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ def passwd(passphrase=None, algorithm="argon2"):
6868
)
6969
h_ph = ph.hash(passphrase)
7070

71-
return ":".join((algorithm, h_ph))
71+
return f"{algorithm}:{h_ph}"
7272

7373
h = hashlib.new(algorithm)
7474
salt = ("%0" + str(salt_len) + "x") % random.getrandbits(4 * salt_len)
7575
h.update(passphrase.encode("utf-8") + salt.encode("ascii"))
7676

77-
return ":".join((algorithm, salt, h.hexdigest()))
77+
return f"{algorithm}:{salt}:{h.hexdigest()}"
7878

7979

8080
def passwd_check(hashed_passphrase, passphrase):

jupyter_server/auth/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,4 +166,4 @@ def get_anonymous_username() -> str:
166166
Get a random user-name based on the moons of Jupyter.
167167
This function returns names like "Anonymous Io" or "Anonymous Metis".
168168
"""
169-
return moons_of_jupyter[random.randint(0, len(moons_of_jupyter) - 1)]
169+
return moons_of_jupyter[random.randint(0, len(moons_of_jupyter) - 1)] # noqa: S311

jupyter_server/base/call_context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def get(cls, name: str) -> Any:
4444

4545
if name in name_value_map:
4646
return name_value_map[name]
47-
return None # TODO - should this raise `LookupError` (or a custom error derived from said)
47+
return None # TODO: should this raise `LookupError` (or a custom error derived from said)
4848

4949
@classmethod
5050
def set(cls, name: str, value: Any) -> None:

jupyter_server/base/handlers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import prometheus_client
2222
from jinja2 import TemplateNotFound
2323
from jupyter_core.paths import is_hidden
24-
from jupyter_events import EventLogger
2524
from tornado import web
2625
from tornado.log import app_log
2726
from traitlets.config import Application
@@ -45,6 +44,7 @@
4544

4645
if TYPE_CHECKING:
4746
from jupyter_client.kernelspec import KernelSpecManager
47+
from jupyter_events import EventLogger
4848
from jupyter_server_terminals.terminalmanager import TerminalManager
4949
from tornado.concurrent import Future
5050

@@ -785,7 +785,7 @@ def get_login_url(self) -> str:
785785

786786
@property
787787
def content_security_policy(self) -> str:
788-
csp = "; ".join(
788+
csp = "; ".join( # noqa: FLY002
789789
[
790790
super().content_security_policy,
791791
"default-src 'none'",

0 commit comments

Comments
 (0)