Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Aug 1, 2023
1 parent 2aaabf3 commit acbb0c8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
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)

Check notice

Code scanning / CodeQL

Unused local variable Note test

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


Expand Down

0 comments on commit acbb0c8

Please sign in to comment.