Skip to content
Snippets Groups Projects
Verified Commit 061a1db8 authored by Romain Deville's avatar Romain Deville
Browse files

:art: Improve plugins.py via black in tox

parent 4e46e9bf
No related branches found
No related tags found
No related merge requests found
Pipeline #9388 canceled with stages
...@@ -153,10 +153,14 @@ def add_external_to_nav( ...@@ -153,10 +153,14 @@ def add_external_to_nav(
repo_parent, repo_parent,
nav_parent[1:], nav_parent[1:],
) )
elif repo_dict["online_url"].startswith('/'): elif repo_dict["online_url"].startswith("/"):
nav.append({ nav.append(
repo_dict["nav_entry"]: repo_dict["online_url"].replace('/','../',1) {
}) repo_dict["nav_entry"]: repo_dict["online_url"].replace(
"/", "../", 1
)
}
)
else: else:
nav.append({repo_dict["nav_entry"]: repo_dict["online_url"]}) nav.append({repo_dict["nav_entry"]: repo_dict["online_url"]})
...@@ -406,9 +410,7 @@ def set_copyright(env: dict, git_repo: git.Repo) -> None: ...@@ -406,9 +410,7 @@ def set_copyright(env: dict, git_repo: git.Repo) -> None:
curr_year = time.strftime("%Y", time.localtime()) curr_year = time.strftime("%Y", time.localtime())
if first_year == curr_year: if first_year == curr_year:
env.variables[ env.variables["date_copyright"] = f"Copyright © {curr_year}"
"date_copyright"
] = f"Copyright © {curr_year}"
else: else:
env.variables[ env.variables[
"date_copyright" "date_copyright"
...@@ -419,7 +421,6 @@ def set_copyright(env: dict, git_repo: git.Repo) -> None: ...@@ -419,7 +421,6 @@ def set_copyright(env: dict, git_repo: git.Repo) -> None:
] = f"{env.variables['date_copyright']} {env.variables['copyright']}" ] = f"{env.variables['date_copyright']} {env.variables['copyright']}"
def set_repo_name(env: dict, repo_slug: str) -> None: def set_repo_name(env: dict, repo_slug: str) -> None:
"""Update content of the `repo_name` key in `env.conf`. """Update content of the `repo_name` key in `env.conf`.
...@@ -834,8 +835,8 @@ def update_version(env: dict) -> None: ...@@ -834,8 +835,8 @@ def update_version(env: dict) -> None:
minor = int(i_tag[1]) minor = int(i_tag[1])
patch = str() patch = str()
for i_remain_tag in i_tag[2:]: for i_remain_tag in i_tag[2:]:
if i_remain_tag and i_remain_tag not in ("","\n"): if i_remain_tag and i_remain_tag not in ("", "\n"):
i_remain_tag = i_remain_tag.replace("\n","") i_remain_tag = i_remain_tag.replace("\n", "")
if not patch: if not patch:
patch = f"{i_remain_tag}" patch = f"{i_remain_tag}"
else: else:
......
...@@ -153,10 +153,14 @@ def add_external_to_nav( ...@@ -153,10 +153,14 @@ def add_external_to_nav(
repo_parent, repo_parent,
nav_parent[1:], nav_parent[1:],
) )
elif repo_dict["online_url"].startswith('/'): elif repo_dict["online_url"].startswith("/"):
nav.append({ nav.append(
repo_dict["nav_entry"]: repo_dict["online_url"].replace('/','../',1) {
}) repo_dict["nav_entry"]: repo_dict["online_url"].replace(
"/", "../", 1
)
}
)
else: else:
nav.append({repo_dict["nav_entry"]: repo_dict["online_url"]}) nav.append({repo_dict["nav_entry"]: repo_dict["online_url"]})
...@@ -406,9 +410,7 @@ def set_copyright(env: dict, git_repo: git.Repo) -> None: ...@@ -406,9 +410,7 @@ def set_copyright(env: dict, git_repo: git.Repo) -> None:
curr_year = time.strftime("%Y", time.localtime()) curr_year = time.strftime("%Y", time.localtime())
if first_year == curr_year: if first_year == curr_year:
env.variables[ env.variables["date_copyright"] = f"Copyright © {curr_year}"
"date_copyright"
] = f"Copyright © {curr_year}"
else: else:
env.variables[ env.variables[
"date_copyright" "date_copyright"
...@@ -419,7 +421,6 @@ def set_copyright(env: dict, git_repo: git.Repo) -> None: ...@@ -419,7 +421,6 @@ def set_copyright(env: dict, git_repo: git.Repo) -> None:
] = f"{env.variables['date_copyright']} {env.variables['copyright']}" ] = f"{env.variables['date_copyright']} {env.variables['copyright']}"
def set_repo_name(env: dict, repo_slug: str) -> None: def set_repo_name(env: dict, repo_slug: str) -> None:
"""Update content of the `repo_name` key in `env.conf`. """Update content of the `repo_name` key in `env.conf`.
...@@ -834,8 +835,8 @@ def update_version(env: dict) -> None: ...@@ -834,8 +835,8 @@ def update_version(env: dict) -> None:
minor = int(i_tag[1]) minor = int(i_tag[1])
patch = str() patch = str()
for i_remain_tag in i_tag[2:]: for i_remain_tag in i_tag[2:]:
if i_remain_tag and i_remain_tag not in ("","\n"): if i_remain_tag and i_remain_tag not in ("", "\n"):
i_remain_tag = i_remain_tag.replace("\n","") i_remain_tag = i_remain_tag.replace("\n", "")
if not patch: if not patch:
patch = f"{i_remain_tag}" patch = f"{i_remain_tag}"
else: else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment