equal
deleted
inserted
replaced
200 yield r |
200 yield r |
201 return |
201 return |
202 startname = 'start_' + plural |
202 startname = 'start_' + plural |
203 if context.preload(startname): |
203 if context.preload(startname): |
204 yield context.process(startname, mapping) |
204 yield context.process(startname, mapping) |
205 vmapping = mapping.copy() |
|
206 def one(v, tag=name): |
205 def one(v, tag=name): |
|
206 vmapping = {} |
207 try: |
207 try: |
208 vmapping.update(v) |
208 vmapping.update(v) |
209 # Python 2 raises ValueError if the type of v is wrong. Python |
209 # Python 2 raises ValueError if the type of v is wrong. Python |
210 # 3 raises TypeError. |
210 # 3 raises TypeError. |
211 except (AttributeError, TypeError, ValueError): |
211 except (AttributeError, TypeError, ValueError): |
214 # bytes. Python 3 raises TypeError. |
214 # bytes. Python 3 raises TypeError. |
215 for a, b in v: |
215 for a, b in v: |
216 vmapping[a] = b |
216 vmapping[a] = b |
217 except (TypeError, ValueError): |
217 except (TypeError, ValueError): |
218 vmapping[name] = v |
218 vmapping[name] = v |
|
219 vmapping = context.overlaymap(mapping, vmapping) |
219 return context.process(tag, vmapping) |
220 return context.process(tag, vmapping) |
220 lastname = 'last_' + name |
221 lastname = 'last_' + name |
221 if context.preload(lastname): |
222 if context.preload(lastname): |
222 last = values.pop() |
223 last = values.pop() |
223 else: |
224 else: |
397 raise error.ParseError(_("keyword '%s' is not iterable") % sym) |
398 raise error.ParseError(_("keyword '%s' is not iterable") % sym) |
398 else: |
399 else: |
399 raise error.ParseError(_("%r is not iterable") % d) |
400 raise error.ParseError(_("%r is not iterable") % d) |
400 |
401 |
401 for i, v in enumerate(diter): |
402 for i, v in enumerate(diter): |
402 lm = mapping.copy() |
|
403 lm['index'] = i |
|
404 if isinstance(v, dict): |
403 if isinstance(v, dict): |
405 lm.update(v) |
404 lm = context.overlaymap(mapping, v) |
|
405 lm['index'] = i |
406 lm['originalnode'] = mapping.get('node') |
406 lm['originalnode'] = mapping.get('node') |
407 yield evalrawexp(context, lm, targ) |
407 yield evalrawexp(context, lm, targ) |
408 else: |
408 else: |
409 # v is not an iterable of dicts, this happen when 'key' |
409 # v is not an iterable of dicts, this happen when 'key' |
410 # has been fully expanded already and format is useless. |
410 # has been fully expanded already and format is useless. |
413 |
413 |
414 def runmember(context, mapping, data): |
414 def runmember(context, mapping, data): |
415 darg, memb = data |
415 darg, memb = data |
416 d = evalrawexp(context, mapping, darg) |
416 d = evalrawexp(context, mapping, darg) |
417 if util.safehasattr(d, 'tomap'): |
417 if util.safehasattr(d, 'tomap'): |
418 lm = mapping.copy() |
418 lm = context.overlaymap(mapping, d.tomap()) |
419 lm.update(d.tomap()) |
|
420 return runsymbol(context, lm, memb) |
419 return runsymbol(context, lm, memb) |
421 if util.safehasattr(d, 'get'): |
420 if util.safehasattr(d, 'get'): |
422 return getdictitem(d, memb) |
421 return getdictitem(d, memb) |
423 |
422 |
424 sym = findsymbolicname(darg) |
423 sym = findsymbolicname(darg) |