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

[pre-commit.ci] pre-commit autoupdate #406

Merged
merged 2 commits into from
Aug 1, 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
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.23.2
rev: 0.23.3
hooks:
- id: check-github-workflows

Expand All @@ -31,12 +31,12 @@ repos:
[mdformat-gfm, mdformat-frontmatter, mdformat-footnote]

- repo: https://github.com/psf/black
rev: 23.3.0
rev: 23.7.0
hooks:
- id: black

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.276
rev: v0.0.281
hooks:
- id: ruff
args: ["--fix"]
8 changes: 2 additions & 6 deletions jupyterlab_server/listings_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ def fetch_listings(logger):
blocked_extensions = []
for blocked_extensions_uri in ListingsHandler.blocked_extensions_uris:
logger.info(
"Fetching blocked_extensions from {}".format(
ListingsHandler.blocked_extensions_uris
)
f"Fetching blocked_extensions from {ListingsHandler.blocked_extensions_uris}"
)
r = requests.request(
"GET", blocked_extensions_uri, **ListingsHandler.listings_request_opts
Expand All @@ -37,9 +35,7 @@ def fetch_listings(logger):
allowed_extensions = []
for allowed_extensions_uri in ListingsHandler.allowed_extensions_uris:
logger.info(
"Fetching allowed_extensions from {}".format(
ListingsHandler.allowed_extensions_uris
)
f"Fetching allowed_extensions from {ListingsHandler.allowed_extensions_uris}"
)
r = requests.request(
"GET", allowed_extensions_uri, **ListingsHandler.listings_request_opts
Expand Down
2 changes: 1 addition & 1 deletion jupyterlab_server/themes_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def replacer(m):
"""Replace the matched relative url with the mangled url."""
group = m.group()
# Get the part that matched
part = [g for g in m.groups() if g][0]
part = next(g for g in m.groups() if g)

# Ignore urls that start with `/` or have a protocol like `http`.
parsed = urlparse(part)
Expand Down
5 changes: 1 addition & 4 deletions jupyterlab_server/workspaces_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,7 @@ def save(self, space_name: str, raw: str) -> Path:
metadata_id = metadata_id if metadata_id.startswith("/") else "/" + metadata_id
metadata_id = urllib.parse.unquote(metadata_id)
if metadata_id != "/" + space_name:
message = "Workspace metadata ID mismatch: expected {!r} got {!r}".format(
space_name,
metadata_id,
)
message = f"Workspace metadata ID mismatch: expected {space_name!r} got {metadata_id!r}"
raise ValueError(message)

slug = slugify(space_name)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_settings_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@

# Checks there is only the 'id' key in each item
assert all(
(len(item.keys()) == 1 and list(item.keys())[0] == 'id') for item in response["settings"]
(len(item.keys()) == 1 and next(iter(item.keys())) == 'id') for item in response["settings"]
)


Expand Down Expand Up @@ -177,7 +177,7 @@
validate_request(r)
data = json.loads(r.body.decode())
listing = data["settings"]
list_data = [item for item in listing if item["id"] == id][0]
list_data = next(item for item in listing if item["id"] == id)

Check notice

Code scanning / CodeQL

Unused local variable Note test

Variable list_data is not used.
# TODO(@echarles) Check this...


Expand Down
Loading