Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ruff docstring-code-format #1377

Merged
merged 3 commits into from
Dec 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.27.2
rev: 0.27.3
hooks:
- id: check-github-workflows

Expand All @@ -38,12 +38,6 @@ repos:
- id: prettier
types_or: [yaml, html, json]

- repo: https://github.com/adamchainz/blacken-docs
rev: "1.16.0"
hooks:
- id: blacken-docs
additional_dependencies: [black==23.7.0]

- repo: https://github.com/codespell-project/codespell
rev: "v2.2.6"
hooks:
Expand All @@ -67,7 +61,7 @@ repos:
["traitlets>=5.13", "jupyter_core>=5.5", "jupyter_client>=8.5"]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.6
rev: v0.1.8
hooks:
- id: ruff
types_or: [python, jupyter]
Expand Down
3 changes: 3 additions & 0 deletions examples/simple/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ source = "nodejs"
[tool.hatch.build.targets.wheel.shared-data]
"etc/jupyter/jupyter_server_config.d" = "etc/jupyter/jupyter_server_config.d"

[tool.hatch.build.targets.wheel]
packages = ["simple_ext1", "simple_ext2", "simple_ext11"]

[tool.hatch.build.hooks.jupyter-builder]
dependencies = [
"hatch-jupyter-builder>=0.8.2",
Expand Down
11 changes: 5 additions & 6 deletions jupyter_server/auth/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def passwd(passphrase=None, algorithm="argon2"):

Examples
--------
>>> passwd('mypassword') # doctest: +ELLIPSIS
>>> passwd("mypassword") # doctest: +ELLIPSIS
'argon2:...'

"""
Expand Down Expand Up @@ -93,15 +93,14 @@ def passwd_check(hashed_passphrase, passphrase):

Examples
--------
>>> myhash = passwd('mypassword')
>>> passwd_check(myhash, 'mypassword')
>>> myhash = passwd("mypassword")
>>> passwd_check(myhash, "mypassword")
True

>>> passwd_check(myhash, 'otherpassword')
>>> passwd_check(myhash, "otherpassword")
False

>>> passwd_check('sha1:0e112c3ddfce:a68df677475c2b47b6e86d0467eec97ac5f4b85a',
... 'mypassword')
>>> passwd_check("sha1:0e112c3ddfce:a68df677475c2b47b6e86d0467eec97ac5f4b85a", "mypassword")
True
"""
if hashed_passphrase.startswith("argon2:"):
Expand Down
4 changes: 2 additions & 2 deletions jupyter_server/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,11 @@ def filefind(filename: str, path_dirs: Sequence[str] | str | None = None) -> str
path dirs is given, the filename is tested as is, after running through
:func:`expandvars` and :func:`expanduser`. Thus a simple call::

filefind('myfile.txt')
filefind("myfile.txt")

will find the file in the current working dir, but::

filefind('~/myfile.txt')
filefind("~/myfile.txt")

Will find the file in the users home directory. This function does not
automatically try any paths, such as the cwd or the user's home directory.
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ optional-editable-build = true
[tool.ruff]
line-length = 100

[tool.ruff.format]
docstring-code-format = true

[tool.ruff.lint]
select = [
"B", # flake8-bugbear
Expand Down Expand Up @@ -295,4 +298,4 @@ exclude = ["docs", "test"]
ignore = ["W002"]

[tool.repo-review]
ignore = ["GH102"]
ignore = ["GH102", "PC111"]
Loading