Skip to content

Commit 73b8114

Browse files
committed
chore: Fix linting issues in docs/conf.py
1 parent d2b7244 commit 73b8114

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

docs/conf.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
# flake8: NOQA E5
1+
# flake8: NOQA: E501
2+
import contextlib
23
import inspect
34
import sys
45
import typing as t
5-
from os.path import dirname, relpath
6-
from pathlib import Path
6+
from os.path import relpath
7+
import pathlib
78

89
import tmuxp
910

@@ -12,7 +13,7 @@
1213

1314

1415
# Get the project root dir, which is the parent dir of this
15-
cwd = Path(__file__).parent
16+
cwd = pathlib.Path(__file__).parent
1617
project_root = cwd.parent
1718
src_root = project_root / "src"
1819

@@ -21,7 +22,7 @@
2122

2223
# package data
2324
about: t.Dict[str, str] = {}
24-
with open(src_root / "tmuxp" / "__about__.py") as fp:
25+
with (src_root / "tmuxp" / "__about__.py").open() as fp:
2526
exec(fp.read(), about)
2627

2728
extensions = [
@@ -228,7 +229,7 @@ def linkcode_resolve(domain, info): # NOQA: C901
228229
else:
229230
linespec = ""
230231

231-
fn = relpath(fn, start=dirname(tmuxp.__file__))
232+
fn = relpath(fn, start=pathlib.Path(tmuxp.__file__).parent)
232233

233234
if "dev" in about["__version__"]:
234235
return "{}/blob/master/{}/{}/{}{}".format(
@@ -252,11 +253,9 @@ def linkcode_resolve(domain, info): # NOQA: C901
252253
def remove_tabs_js(app: "Sphinx", exc: Exception) -> None:
253254
# Fix for sphinx-inline-tabs#18
254255
if app.builder.format == "html" and not exc:
255-
tabs_js = Path(app.builder.outdir) / "_static" / "tabs.js"
256-
try:
256+
tabs_js = pathlib.Path(app.builder.outdir) / "_static" / "tabs.js"
257+
with contextlib.suppress(FileNotFoundError):
257258
tabs_js.unlink() # When python 3.7 deprecated, use missing_ok=True
258-
except FileNotFoundError:
259-
pass
260259

261260

262261
def setup(app: "Sphinx") -> None:

0 commit comments

Comments
 (0)