Skip to content

Commit

Permalink
Merge pull request jupyterhub#2408 from consideRatio/pr/f-strings
Browse files Browse the repository at this point in the history
Use f-strings instead of the % pattern
  • Loading branch information
manics authored Sep 27, 2021
2 parents 50d911d + 7ce8dd6 commit f3783cd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,15 +222,15 @@ def parse_schema(d, md=[], depth=0, pre=""):
depth += 1
# Create markdown headers for each schema level
for key, val in d["properties"].items():
md.append("(schema_%s)=" % (pre + key))
md.append("#" * (depth + 1) + " " + pre + key)
md.append(f"(schema_{pre}{key})=")
md.append("#" * (depth + 1) + f" {pre}{key}")
md.append("")
if "description" in val:
for ln in val["description"].split("\n"):
md.append(ln)
md.append("")

parse_schema(val, md, depth, pre + f"{key}.")
parse_schema(val, md, depth, f"{pre}{key}.")
depth -= 1
return md

Expand Down
12 changes: 6 additions & 6 deletions jupyterhub/files/hub/jupyterhub_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def camelCaseify(s):
pass
else:
raise ValueError(
"Unrecognized value for matchNodePurpose: %r" % match_node_purpose
f"Unrecognized value for matchNodePurpose: {match_node_purpose}"
)

# Combine the common tolerations for user pods with singleuser tolerations
Expand Down Expand Up @@ -347,15 +347,15 @@ def camelCaseify(s):

cull_timeout = get_config("cull.timeout")
if cull_timeout:
cull_cmd.append("--timeout=%s" % cull_timeout)
cull_cmd.append(f"--timeout={cull_timeout}")

cull_every = get_config("cull.every")
if cull_every:
cull_cmd.append("--cull-every=%s" % cull_every)
cull_cmd.append(f"--cull-every={cull_every}")

cull_concurrency = get_config("cull.concurrency")
if cull_concurrency:
cull_cmd.append("--concurrency=%s" % cull_concurrency)
cull_cmd.append(f"--concurrency={cull_concurrency}")

if get_config("cull.users"):
cull_cmd.append("--cull-users")
Expand All @@ -366,7 +366,7 @@ def camelCaseify(s):

cull_max_age = get_config("cull.maxAge")
if cull_max_age:
cull_cmd.append("--max-age=%s" % cull_max_age)
cull_cmd.append(f"--max-age={cull_max_age}")

c.JupyterHub.services.append(
{
Expand Down Expand Up @@ -459,5 +459,5 @@ def camelCaseify(s):

# execute hub.extraConfig entries
for key, config_py in sorted(get_config("hub.extraConfig", {}).items()):
print("Loading extra config: %s" % key)
print(f"Loading extra config: {key}")
exec(config_py)

0 comments on commit f3783cd

Please sign in to comment.