fix typehinting
This commit is contained in:
parent
e712d295a5
commit
1c080720cf
@ -191,7 +191,7 @@ class BytecodeCache:
|
||||
return bucket
|
||||
|
||||
async def get_bucket_async(
|
||||
self, environment: Environment, name: str, filename: str | None, source: str
|
||||
self, environment: "Environment", name: str, filename: str | None, source: str
|
||||
) -> Bucket:
|
||||
"""Asynchronously return a cache bucket for the given template. All arguments are
|
||||
mandatory but filename may be `None`.
|
||||
|
||||
@ -1449,7 +1449,7 @@ class Template:
|
||||
enable_async: bool = False,
|
||||
) -> t.Any: # it returns a `Template`, but this breaks the sphinx build...
|
||||
env = get_spontaneous_environment(
|
||||
type(self.environment),
|
||||
cls.environment_class, # type: ignore
|
||||
block_start_string,
|
||||
block_end_string,
|
||||
variable_start_string,
|
||||
@ -1812,6 +1812,8 @@ class TemplateModule:
|
||||
name = repr(self.__name__)
|
||||
return f"<{type(self).__name__} {name}>"
|
||||
|
||||
class AsyncTemplate(Template):
|
||||
environment_class: type[Environment] = AsyncEnvironment
|
||||
|
||||
class TemplateExpression:
|
||||
"""The :meth:`jinja2.Environment.compile_expression` method returns an
|
||||
@ -1929,3 +1931,4 @@ class TemplateStream:
|
||||
# hook in default template class. if anyone reads this comment: ignore that
|
||||
# it's possible to use custom templates ;-)
|
||||
Environment.template_class = Template
|
||||
AsyncEnvironment.template_class = AsyncTemplate
|
||||
|
||||
Loading…
Reference in New Issue
Block a user