@@ -771,7 +771,7 @@ def __init__(self, template_path: str) -> None:
771771 super ().__init__ (template_string )
772772
773773
774- _CACHE : "dict[int, Template| FileTemplate]" = {}
774+ CACHED_TEMPLATES : "dict[int, Template| FileTemplate]" = {}
775775
776776
777777def render_string_iter (
@@ -803,13 +803,13 @@ def render_string_iter(
803803 """
804804 key = hash (template_string )
805805
806- if cache and key in _CACHE :
807- return _CACHE [key ].render_iter (context or {}, chunk_size = chunk_size )
806+ if cache and key in CACHED_TEMPLATES :
807+ return CACHED_TEMPLATES [key ].render_iter (context or {}, chunk_size = chunk_size )
808808
809809 template = Template (template_string )
810810
811811 if cache :
812- _CACHE [key ] = template
812+ CACHED_TEMPLATES [key ] = template
813813
814814 return template .render_iter (context or {}, chunk_size = chunk_size )
815815
@@ -837,13 +837,13 @@ def render_string(
837837 """
838838 key = hash (template_string )
839839
840- if cache and key in _CACHE :
841- return _CACHE [key ].render (context or {})
840+ if cache and key in CACHED_TEMPLATES :
841+ return CACHED_TEMPLATES [key ].render (context or {})
842842
843843 template = Template (template_string )
844844
845845 if cache :
846- _CACHE [key ] = template
846+ CACHED_TEMPLATES [key ] = template
847847
848848 return template .render (context or {})
849849
@@ -877,13 +877,13 @@ def render_template_iter(
877877 """
878878 key = hash (template_path )
879879
880- if cache and key in _CACHE :
881- return _CACHE [key ].render_iter (context or {}, chunk_size = chunk_size )
880+ if cache and key in CACHED_TEMPLATES :
881+ return CACHED_TEMPLATES [key ].render_iter (context or {}, chunk_size = chunk_size )
882882
883883 template = FileTemplate (template_path )
884884
885885 if cache :
886- _CACHE [key ] = template
886+ CACHED_TEMPLATES [key ] = template
887887
888888 return template .render_iter (context or {}, chunk_size = chunk_size )
889889
@@ -912,12 +912,12 @@ def render_template(
912912
913913 key = hash (template_path )
914914
915- if cache and key in _CACHE :
916- return _CACHE [key ].render (context or {})
915+ if cache and key in CACHED_TEMPLATES :
916+ return CACHED_TEMPLATES [key ].render (context or {})
917917
918918 template = FileTemplate (template_path )
919919
920920 if cache :
921- _CACHE [key ] = template
921+ CACHED_TEMPLATES [key ] = template
922922
923923 return template .render (context or {})
0 commit comments