1- # flake8: noqa E501
1+ # flake8: noqa: E501
22import inspect
3- import os
43import sys
54import typing as t
6- from os .path import dirname , relpath
7- from pathlib import Path
5+ from os .path import relpath
6+ import pathlib
87
98import vcspull
109
1110if t .TYPE_CHECKING :
1211 from sphinx .application import Sphinx
1312
1413# Get the project root dir, which is the parent dir of this
15- cwd = Path .cwd ()
14+ cwd = pathlib . Path .cwd ()
1615project_root = cwd .parent
1716src_root = project_root / "src"
1817
2120
2221# package data
2322about : dict [str , str ] = {}
24- with open (src_root / "vcspull" / "__about__.py" ) as fp :
23+ with (src_root / "vcspull" / "__about__.py" ). open ( ) as fp :
2524 exec (fp .read (), about )
2625
2726extensions = [
139138ogp_desscription_length = about ["__description__" ]
140139ogp_site_name = about ["__title__" ]
141140
142- htmlhelp_basename = "%sdoc" % about [" __title__" ]
141+ htmlhelp_basename = f" { about [' __title__' ] } doc"
143142
144143latex_documents = [
145144 (
146145 "index" ,
147- "{}.tex" . format ( about [" __package_name__" ]) ,
148- "{} Documentation" . format ( about [" __title__" ]) ,
146+ f" { about [' __package_name__' ] } .tex" ,
147+ f" { about [' __title__' ] } Documentation" ,
149148 about ["__author__" ],
150149 "manual" ,
151150 )
155154 (
156155 "index" ,
157156 about ["__package_name__" ],
158- "{} Documentation" . format ( about [" __title__" ]) ,
157+ f" { about [' __title__' ] } Documentation" ,
159158 about ["__author__" ],
160159 1 ,
161160 )
164163texinfo_documents = [
165164 (
166165 "index" ,
167- "{}" . format ( about ["__package_name__" ]) ,
168- "{} Documentation" . format ( about [" __title__" ]) ,
166+ about ["__package_name__" ],
167+ f" { about [' __title__' ] } Documentation" ,
169168 about ["__author__" ],
170169 about ["__package_name__" ],
171170 about ["__description__" ],
@@ -234,7 +233,7 @@ def linkcode_resolve(
234233 else :
235234 linespec = ""
236235
237- fn = relpath (fn , start = dirname (vcspull .__file__ ))
236+ fn = relpath (fn , start = pathlib . Path (vcspull .__file__ ). parent )
238237
239238 if "dev" in about ["__version__" ]:
240239 return "{}/blob/master/{}/{}/{}{}" .format (
@@ -258,7 +257,7 @@ def linkcode_resolve(
258257def remove_tabs_js (app : "Sphinx" , exc : Exception ) -> None :
259258 # Fix for sphinx-inline-tabs#18
260259 if app .builder .format == "html" and not exc :
261- tabs_js = Path (app .builder .outdir ) / "_static" / "tabs.js"
260+ tabs_js = pathlib . Path (app .builder .outdir ) / "_static" / "tabs.js"
262261 tabs_js .unlink (missing_ok = True )
263262
264263
0 commit comments