55import sphinx .util .logging
66
77
8- DOMAIN = ' packaging.python.org'
8+ DOMAIN = " packaging.python.org"
99
1010
1111logger = sphinx .util .logging .getLogger (__name__ )
@@ -35,14 +35,14 @@ def resolve_local_html_link(app: sphinx.application.Sphinx, url_path: str) -> st
3535 for entry in app .config .html_extra_path :
3636 candidate = (app .confdir / entry / url_path ).resolve ()
3737 if candidate .is_dir ():
38- candidate = candidate / ' index.html'
38+ candidate = candidate / " index.html"
3939 if candidate .exists ():
4040 return os .fspath (candidate )
4141 # Convert html path to source path
42- url_path = url_path .removesuffix ('/' ) # Normalize
43- if url_path .endswith (' .html' ):
44- document = url_path .removesuffix (' .html' )
45- elif (candidate := f' { url_path } /index' ) in app .project .docnames :
42+ url_path = url_path .removesuffix ("/" ) # Normalize
43+ if url_path .endswith (" .html" ):
44+ document = url_path .removesuffix (" .html" )
45+ elif (candidate := f" { url_path } /index" ) in app .project .docnames :
4646 document = candidate
4747 else :
4848 document = url_path
@@ -55,22 +55,22 @@ def rewrite_local_uri(app: sphinx.application.Sphinx, uri: str) -> str:
5555 """
5656 local_uri = uri
5757 parsed = urllib .parse .urlparse (uri )
58- if parsed .hostname == DOMAIN and parsed .path .startswith (' /en/latest/' ):
59- document = parsed .path .removeprefix (' /en/latest/' )
58+ if parsed .hostname == DOMAIN and parsed .path .startswith (" /en/latest/" ):
59+ document = parsed .path .removeprefix (" /en/latest/" )
6060 local_uri = resolve_local_html_link (app , document )
6161 logger .verbose (
62- f' { uri !s} is a remote URL that points to local sources, '
63- ' replacing it with a local URL in linkcheck to take new changes '
64- ' into account (pass -vv for more info)'
62+ f" { uri !s} is a remote URL that points to local sources, "
63+ " replacing it with a local URL in linkcheck to take new changes "
64+ " into account (pass -vv for more info)"
6565 )
66- logger .debug (f' Replacing linkcheck URL { uri !r} with { local_uri !r} ' )
66+ logger .debug (f" Replacing linkcheck URL { uri !r} with { local_uri !r} " )
6767 return local_uri
6868
6969
7070def setup (app : sphinx .application .Sphinx ) -> dict [str , bool ]:
71- app .connect (' linkcheck-process-uri' , rewrite_local_uri )
71+ app .connect (" linkcheck-process-uri" , rewrite_local_uri )
7272
7373 return {
74- ' parallel_read_safe' : True ,
75- ' parallel_write_safe' : True ,
74+ " parallel_read_safe" : True ,
75+ " parallel_write_safe" : True ,
7676 }
0 commit comments