Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/jinja2/__init__.py: 85%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

41 statements  

1"""Jinja is a template engine written in pure Python. It provides a 

2non-XML syntax that supports inline expressions and an optional 

3sandboxed environment. 

4""" 

5 

6from __future__ import annotations 

7 

8import typing as t 

9 

10from .bccache import BytecodeCache as BytecodeCache 

11from .bccache import FileSystemBytecodeCache as FileSystemBytecodeCache 

12from .bccache import MemcachedBytecodeCache as MemcachedBytecodeCache 

13from .environment import Environment as Environment 

14from .environment import Template as Template 

15from .exceptions import TemplateAssertionError as TemplateAssertionError 

16from .exceptions import TemplateError as TemplateError 

17from .exceptions import TemplateNotFound as TemplateNotFound 

18from .exceptions import TemplateRuntimeError as TemplateRuntimeError 

19from .exceptions import TemplatesNotFound as TemplatesNotFound 

20from .exceptions import TemplateSyntaxError as TemplateSyntaxError 

21from .exceptions import UndefinedError as UndefinedError 

22from .loaders import BaseLoader as BaseLoader 

23from .loaders import ChoiceLoader as ChoiceLoader 

24from .loaders import DictLoader as DictLoader 

25from .loaders import FileSystemLoader as FileSystemLoader 

26from .loaders import FunctionLoader as FunctionLoader 

27from .loaders import ModuleLoader as ModuleLoader 

28from .loaders import PackageLoader as PackageLoader 

29from .loaders import PrefixLoader as PrefixLoader 

30from .runtime import ChainableUndefined as ChainableUndefined 

31from .runtime import DebugUndefined as DebugUndefined 

32from .runtime import make_logging_undefined as make_logging_undefined 

33from .runtime import StrictUndefined as StrictUndefined 

34from .runtime import Undefined as Undefined 

35from .utils import clear_caches as clear_caches 

36from .utils import is_undefined as is_undefined 

37from .utils import pass_context as pass_context 

38from .utils import pass_environment as pass_environment 

39from .utils import pass_eval_context as pass_eval_context 

40from .utils import select_autoescape as select_autoescape 

41 

42 

43def __getattr__(name: str) -> t.Any: 

44 if name == "__version__": 

45 import importlib.metadata 

46 import warnings 

47 

48 warnings.warn( 

49 "The `__version__` attribute is deprecated and will be removed in" 

50 " Jinja 3.3. Use feature detection or" 

51 ' `importlib.metadata.version("jinja2")` instead.', 

52 DeprecationWarning, 

53 stacklevel=2, 

54 ) 

55 return importlib.metadata.version("jinja2") 

56 

57 raise AttributeError(name)