1
- # flake8: noqa E501
1
+ # flake8: noqa: E501
2
2
import inspect
3
- import os
4
3
import sys
5
4
import typing as t
6
- from os .path import dirname , relpath
7
- from pathlib import Path
5
+ from os .path import relpath
6
+ import pathlib
8
7
9
8
import vcspull
10
9
11
10
if t .TYPE_CHECKING :
12
11
from sphinx .application import Sphinx
13
12
14
13
# Get the project root dir, which is the parent dir of this
15
- cwd = Path .cwd ()
14
+ cwd = pathlib . Path .cwd ()
16
15
project_root = cwd .parent
17
16
src_root = project_root / "src"
18
17
21
20
22
21
# package data
23
22
about : dict [str , str ] = {}
24
- with open (src_root / "vcspull" / "__about__.py" ) as fp :
23
+ with (src_root / "vcspull" / "__about__.py" ). open ( ) as fp :
25
24
exec (fp .read (), about )
26
25
27
26
extensions = [
139
138
ogp_desscription_length = about ["__description__" ]
140
139
ogp_site_name = about ["__title__" ]
141
140
142
- htmlhelp_basename = "%sdoc" % about [" __title__" ]
141
+ htmlhelp_basename = f" { about [' __title__' ] } doc"
143
142
144
143
latex_documents = [
145
144
(
146
145
"index" ,
147
- "{}.tex" . format ( about [" __package_name__" ]) ,
148
- "{} Documentation" . format ( about [" __title__" ]) ,
146
+ f" { about [' __package_name__' ] } .tex" ,
147
+ f" { about [' __title__' ] } Documentation" ,
149
148
about ["__author__" ],
150
149
"manual" ,
151
150
)
155
154
(
156
155
"index" ,
157
156
about ["__package_name__" ],
158
- "{} Documentation" . format ( about [" __title__" ]) ,
157
+ f" { about [' __title__' ] } Documentation" ,
159
158
about ["__author__" ],
160
159
1 ,
161
160
)
164
163
texinfo_documents = [
165
164
(
166
165
"index" ,
167
- "{}" . format ( about ["__package_name__" ]) ,
168
- "{} Documentation" . format ( about [" __title__" ]) ,
166
+ about ["__package_name__" ],
167
+ f" { about [' __title__' ] } Documentation" ,
169
168
about ["__author__" ],
170
169
about ["__package_name__" ],
171
170
about ["__description__" ],
@@ -234,7 +233,7 @@ def linkcode_resolve(
234
233
else :
235
234
linespec = ""
236
235
237
- fn = relpath (fn , start = dirname (vcspull .__file__ ))
236
+ fn = relpath (fn , start = pathlib . Path (vcspull .__file__ ). parent )
238
237
239
238
if "dev" in about ["__version__" ]:
240
239
return "{}/blob/master/{}/{}/{}{}" .format (
@@ -258,7 +257,7 @@ def linkcode_resolve(
258
257
def remove_tabs_js (app : "Sphinx" , exc : Exception ) -> None :
259
258
# Fix for sphinx-inline-tabs#18
260
259
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"
262
261
tabs_js .unlink (missing_ok = True )
263
262
264
263
0 commit comments