Enable automatic formatting for `sphinx/ext/githubpages.py`

This commit is contained in:
Adam Turner 2024-12-20 20:21:01 +00:00
parent bc53ab75c8
commit 13d25d96bf
2 changed files with 2 additions and 3 deletions

View File

@ -415,7 +415,6 @@ exclude = [
"sphinx/domains/python/_object.py",
"sphinx/domains/rst.py",
"sphinx/domains/std/__init__.py",
"sphinx/ext/githubpages.py",
"sphinx/ext/graphviz.py",
"sphinx/ext/ifconfig.py",
"sphinx/ext/imgconverter.py",

View File

@ -43,8 +43,8 @@ def create_nojekyll_and_cname(app: Sphinx, env: BuildEnvironment) -> None:
domain = _get_domain_from_url(app.config.html_baseurl)
# Filter out GitHub Pages domains, as they do not require CNAME files.
if domain and not domain.endswith(".github.io"):
with open(cname_path, 'w', encoding="utf-8") as f:
if domain and not domain.endswith('.github.io'):
with open(cname_path, 'w', encoding='utf-8') as f:
# NOTE: don't write a trailing newline. The `CNAME` file that's
# auto-generated by the GitHub UI doesn't have one.
f.write(domain)