Skip to content

Commit b3e9bc1

Browse files
[pre-commit.ci] pre-commit autoupdate (#406)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent ab8019e commit b3e9bc1

File tree

5 files changed

+9
-16
lines changed

5 files changed

+9
-16
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ repos:
1919
- id: trailing-whitespace
2020

2121
- repo: https://github.com/python-jsonschema/check-jsonschema
22-
rev: 0.23.2
22+
rev: 0.23.3
2323
hooks:
2424
- id: check-github-workflows
2525

@@ -31,12 +31,12 @@ repos:
3131
[mdformat-gfm, mdformat-frontmatter, mdformat-footnote]
3232

3333
- repo: https://github.com/psf/black
34-
rev: 23.3.0
34+
rev: 23.7.0
3535
hooks:
3636
- id: black
3737

3838
- repo: https://github.com/astral-sh/ruff-pre-commit
39-
rev: v0.0.276
39+
rev: v0.0.281
4040
hooks:
4141
- id: ruff
4242
args: ["--fix"]

jupyterlab_server/listings_handler.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ def fetch_listings(logger):
2222
blocked_extensions = []
2323
for blocked_extensions_uri in ListingsHandler.blocked_extensions_uris:
2424
logger.info(
25-
"Fetching blocked_extensions from {}".format(
26-
ListingsHandler.blocked_extensions_uris
27-
)
25+
f"Fetching blocked_extensions from {ListingsHandler.blocked_extensions_uris}"
2826
)
2927
r = requests.request(
3028
"GET", blocked_extensions_uri, **ListingsHandler.listings_request_opts
@@ -37,9 +35,7 @@ def fetch_listings(logger):
3735
allowed_extensions = []
3836
for allowed_extensions_uri in ListingsHandler.allowed_extensions_uris:
3937
logger.info(
40-
"Fetching allowed_extensions from {}".format(
41-
ListingsHandler.allowed_extensions_uris
42-
)
38+
f"Fetching allowed_extensions from {ListingsHandler.allowed_extensions_uris}"
4339
)
4440
r = requests.request(
4541
"GET", allowed_extensions_uri, **ListingsHandler.listings_request_opts

jupyterlab_server/themes_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def replacer(m):
8282
"""Replace the matched relative url with the mangled url."""
8383
group = m.group()
8484
# Get the part that matched
85-
part = [g for g in m.groups() if g][0]
85+
part = next(g for g in m.groups() if g)
8686

8787
# Ignore urls that start with `/` or have a protocol like `http`.
8888
parsed = urlparse(part)

jupyterlab_server/workspaces_handler.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,7 @@ def save(self, space_name: str, raw: str) -> Path:
150150
metadata_id = metadata_id if metadata_id.startswith("/") else "/" + metadata_id
151151
metadata_id = urllib.parse.unquote(metadata_id)
152152
if metadata_id != "/" + space_name:
153-
message = "Workspace metadata ID mismatch: expected {!r} got {!r}".format(
154-
space_name,
155-
metadata_id,
156-
)
153+
message = f"Workspace metadata ID mismatch: expected {space_name!r} got {metadata_id!r}"
157154
raise ValueError(message)
158155

159156
slug = slugify(space_name)

tests/test_settings_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ async def test_listing_ids(jp_fetch, labserverapp):
124124

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

130130

@@ -177,7 +177,7 @@ async def test_patch(jp_fetch, labserverapp):
177177
validate_request(r)
178178
data = json.loads(r.body.decode())
179179
listing = data["settings"]
180-
list_data = [item for item in listing if item["id"] == id][0]
180+
list_data = next(item for item in listing if item["id"] == id)
181181
# TODO(@echarles) Check this...
182182

183183

0 commit comments

Comments
 (0)