MCPcopy
hub / github.com/pallets/jinja / store

Method store

src/jinja2/idtracking.py:97–113  ·  view source on GitHub ↗
(self, name: str)

Source from the content-addressed store, hash-verified

95 return rv
96
97 def store(self, name: str) -> None:
98 self.stores.add(name)
99
100 # If we have not see the name referenced yet, we need to figure
101 # out what to set it to.
102 if name not in self.refs:
103 # If there is a parent scope we check if the name has a
104 # reference there. If it does it means we might have to alias
105 # to a variable there.
106 if self.parent is not None:
107 outer_ref = self.parent.find_ref(name)
108 if outer_ref is not None:
109 self._define_ref(name, load=(VAR_LOAD_ALIAS, outer_ref))
110 return
111
112 # Otherwise we can just set it to undefined.
113 self._define_ref(name, load=(VAR_LOAD_UNDEFINED, None))
114
115 def declare_parameter(self, name: str) -> str:
116 self.stores.add(name)

Callers 4

visit_NameMethod · 0.80
visit_MacroMethod · 0.80
visit_ImportMethod · 0.80
visit_FromImportMethod · 0.80

Calls 2

_define_refMethod · 0.95
find_refMethod · 0.80

Tested by

no test coverage detected