mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Use more specific type for get_source callable return value (#12855)
This commit is contained in:
parent
d347149f55
commit
04381789db
@ -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 @@ class BuiltinTemplateLoader(TemplateBridge, BaseLoader):
|
||||
|
||||
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('!'):
|
||||
|
@ -124,7 +124,11 @@ class SphinxTemplateLoader(BaseLoader):
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user