summaryrefslogtreecommitdiff
path: root/sphinx/highlighting.py
diff options
context:
space:
mode:
authordanieleades <33452915+danieleades@users.noreply.github.com>2022-07-18 22:08:16 +0100
committerGitHub <noreply@github.com>2022-07-18 22:08:16 +0100
commita504ac6100a577cbda1bedf80d69636603ee287c (patch)
tree0aa79585440486bdb109f7238f8f5c992dad0d99 /sphinx/highlighting.py
parenta340427ba4d208193d539cb7e8401be23d75547e (diff)
downloadsphinx-git-a504ac6100a577cbda1bedf80d69636603ee287c.tar.gz
Improve static typing strictness (#10569)
Diffstat (limited to 'sphinx/highlighting.py')
-rw-r--r--sphinx/highlighting.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/sphinx/highlighting.py b/sphinx/highlighting.py
index 62f10f7a1..bb020850f 100644
--- a/sphinx/highlighting.py
+++ b/sphinx/highlighting.py
@@ -2,7 +2,7 @@
from functools import partial
from importlib import import_module
-from typing import Any, Dict
+from typing import Any, Dict, Optional
from packaging import version
from pygments import __version__ as pygmentsversion
@@ -99,7 +99,7 @@ class PygmentsBridge:
latex_formatter = LatexFormatter
def __init__(self, dest: str = 'html', stylename: str = 'sphinx',
- latex_engine: str = None) -> None:
+ latex_engine: Optional[str] = None) -> None:
self.dest = dest
self.latex_engine = latex_engine
@@ -126,7 +126,7 @@ class PygmentsBridge:
kwargs.update(self.formatter_args)
return self.formatter(**kwargs)
- def get_lexer(self, source: str, lang: str, opts: Dict = None,
+ def get_lexer(self, source: str, lang: str, opts: Optional[Dict] = None,
force: bool = False, location: Any = None) -> Lexer:
if not opts:
opts = {}
@@ -165,7 +165,7 @@ class PygmentsBridge:
return lexer
- def highlight_block(self, source: str, lang: str, opts: Dict = None,
+ def highlight_block(self, source: str, lang: str, opts: Optional[Dict] = None,
force: bool = False, location: Any = None, **kwargs: Any) -> str:
if not isinstance(source, str):
source = source.decode()