Skip to content

Commit 91f89bd

Browse files
committed
fixup! Convert type comments to annotations
1 parent 2dc7771 commit 91f89bd

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

sphinxcontrib/serializinghtml/__init__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
from __future__ import annotations
1010

11+
import os
1112
import pickle
1213
import types
1314
from os import path
@@ -42,10 +43,10 @@ class SerializingHTMLBuilder(StandaloneHTMLBuilder):
4243
implementation: Any = None
4344
implementation_dumps_unicode = False
4445
#: additional arguments for dump()
45-
additional_dump_args = ()
46+
additional_dump_args: tuple = ()
4647

4748
#: the filename for the global context file
48-
globalcontext_filename: str | None = None
49+
globalcontext_filename: str = ''
4950

5051
supported_image_types = ['image/svg+xml', 'image/png',
5152
'image/gif', 'image/jpeg']
@@ -69,7 +70,7 @@ def get_target_uri(self, docname: str, typ: str | None = None) -> str:
6970
return docname[:-5] # up to sep
7071
return docname + SEP
7172

72-
def dump_context(self, context: dict, filename: str) -> None:
73+
def dump_context(self, context: dict, filename: str | os.PathLike[str]) -> None:
7374
if self.implementation_dumps_unicode:
7475
with open(filename, 'w', encoding='utf-8') as ft:
7576
self.implementation.dump(context, ft, *self.additional_dump_args)
@@ -109,7 +110,7 @@ def handle_page(self, pagename: str, ctx: dict, templatename: str = 'page.html',
109110

110111
def handle_finish(self) -> None:
111112
# dump the global context
112-
outfilename = path.join(self.outdir, self.globalcontext_filename)
113+
outfilename = self.outdir / self.globalcontext_filename
113114
self.dump_context(self.globalcontext, outfilename)
114115

115116
# super here to dump the search index

0 commit comments

Comments
 (0)