MCPcopy Create free account
hub / github.com/numpy/numpy / substitute

Method substitute

tools/npy_tempita/__init__.py:170–193  ·  view source on GitHub ↗
(self, *args, **kw)

Source from the content-addressed store, hash-verified

168 hex(id(self))[2:], self.name)
169
170 def substitute(self, *args, **kw):
171 if args:
172 if kw:
173 raise TypeError(
174 "You can only give positional *or* keyword arguments")
175 if len(args) > 1:
176 raise TypeError(
177 "You can only give one positional argument")
178 if not hasattr(args[0], 'items'):
179 raise TypeError(
180 ("If you pass in a single argument, you must pass in a ",
181 "dict-like object (with a .items() method); you gave %r")
182 % (args[0],))
183 kw = args[0]
184 ns = kw
185 ns['__template_name__'] = self.name
186 if self.namespace:
187 ns.update(self.namespace)
188 result, defs, inherit = self._interpret(ns)
189 if not inherit:
190 inherit = self.default_inherit
191 if inherit:
192 result = self._interpret_inherit(result, defs, inherit, ns)
193 return result
194
195 def _interpret(self, ns):
196 # __traceback_hide__ = True

Callers 6

subFunction · 0.95
generate_meson_buildMethod · 0.95
_interpret_inheritMethod · 0.45
sub_htmlFunction · 0.45
fill_commandFunction · 0.45

Calls 3

_interpretMethod · 0.95
_interpret_inheritMethod · 0.95
updateMethod · 0.80

Tested by

no test coverage detected