(self, *args, **kw)
| 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 |
no test coverage detected