HomePhabricator

Extract statement functions for templates

Tags
None
Referenced Files
None
Subscribers
None

Description

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.)

Details

Provenance
LucasWerkmeisterAuthored on Sep 12 2021, 6:37 PM
Parents
R2362:f2c0dd64d0fd: Add two missing 'datatype' in test template
Branches
Unknown
Tags
Unknown
ChangeId
None