Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#406)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] authored Aug 1, 2023
1 parent ab8019e commit b3e9bc1
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 16 deletions.
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 @@ async def test_listing_ids(jp_fetch, labserverapp):

# 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 @@ async def test_patch(jp_fetch, labserverapp):
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)
# TODO(@echarles) Check this...


Expand Down

0 comments on commit b3e9bc1

Please sign in to comment.