@@ -771,7 +771,7 @@ def __init__(self, template_path: str) -> None:
771
771
super ().__init__ (template_string )
772
772
773
773
774
- _CACHE : "dict[int, Template| FileTemplate]" = {}
774
+ CACHED_TEMPLATES : "dict[int, Template| FileTemplate]" = {}
775
775
776
776
777
777
def render_string_iter (
@@ -803,13 +803,13 @@ def render_string_iter(
803
803
"""
804
804
key = hash (template_string )
805
805
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 )
808
808
809
809
template = Template (template_string )
810
810
811
811
if cache :
812
- _CACHE [key ] = template
812
+ CACHED_TEMPLATES [key ] = template
813
813
814
814
return template .render_iter (context or {}, chunk_size = chunk_size )
815
815
@@ -837,13 +837,13 @@ def render_string(
837
837
"""
838
838
key = hash (template_string )
839
839
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 {})
842
842
843
843
template = Template (template_string )
844
844
845
845
if cache :
846
- _CACHE [key ] = template
846
+ CACHED_TEMPLATES [key ] = template
847
847
848
848
return template .render (context or {})
849
849
@@ -877,13 +877,13 @@ def render_template_iter(
877
877
"""
878
878
key = hash (template_path )
879
879
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 )
882
882
883
883
template = FileTemplate (template_path )
884
884
885
885
if cache :
886
- _CACHE [key ] = template
886
+ CACHED_TEMPLATES [key ] = template
887
887
888
888
return template .render_iter (context or {}, chunk_size = chunk_size )
889
889
@@ -912,12 +912,12 @@ def render_template(
912
912
913
913
key = hash (template_path )
914
914
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 {})
917
917
918
918
template = FileTemplate (template_path )
919
919
920
920
if cache :
921
- _CACHE [key ] = template
921
+ CACHED_TEMPLATES [key ] = template
922
922
923
923
return template .render (context or {})
0 commit comments