diff --git a/sphinx/jinja2glue.py b/sphinx/jinja2glue.py index 0df58b52d4f..5436900db12 100644 --- a/sphinx/jinja2glue.py +++ b/sphinx/jinja2glue.py @@ -118,7 +118,7 @@ class SphinxFileSystemLoader(FileSystemLoader): def get_source( self, environment: Environment, template: str - ) -> tuple[str, str, Callable]: + ) -> tuple[str, str, Callable[[], bool]]: for searchpath in self.searchpath: filename = path.join(searchpath, template) f = open_if_exists(filename) @@ -224,7 +224,7 @@ def _newest_template_mtime_name(self) -> tuple[float, str]: def get_source( self, environment: Environment, template: str - ) -> tuple[str, str, Callable]: + ) -> tuple[str, str, Callable[[], bool]]: loaders = self.loaders # exclamation mark starts search from theme if template.startswith('!'): diff --git a/sphinx/util/template.py b/sphinx/util/template.py index 2b38e3a8678..1cfc287a821 100644 --- a/sphinx/util/template.py +++ b/sphinx/util/template.py @@ -124,7 +124,11 @@ def __init__(self, confdir: str | os.PathLike[str], self.loaders.append(loader) self.sysloaders.append(loader) - def get_source(self, environment: Environment, template: str) -> tuple[str, str, Callable]: + def get_source( + self, + environment: Environment, + template: str, + ) -> tuple[str, str, Callable[[], bool]]: if template.startswith('!'): # search a template from ``system_templates_paths`` loaders = self.sysloaders