Extract statement functions for templates
The statements field in templates is very flexible, but that flexibility
is barely used: most statements are a single statement, and all the
statements have only a main snak, normal rank, with no qualifiers or
references. This block effectively got copy+pasted around between the
templates anyways, so let’s just extract two functions to reduce all of
the duplication here.
I tested that this introduces no difference with the following commands:
git show f2c0dd64d0:templates.py > templates_old.py python -c 'import templates; import templates_old; print(templates.templates == templates_old.templates)'
(For debugging the differences I used pytest, which prints a rich diff
between the two values, though it’s a bit inconvenient – not rich enough
with -v and way too verbose with -vv.)