There's no need to reconstruct the list of classes for each target. Reclass provides this information in rendered_target["classes"] already.
This commit removes the loop which reconstructs the list and replaces it by assigning rendered_target["classes"] to the target's classes field.
Side-note: the previous implementation also mangled the list, because Python implements += for lists as list concatenation, and (not so helpfully) treats strings as lists of characters when they appear in a context where a list is expected. To correctly construct the list of classes with the previous approach, the += should be replaced with append:
There's no need to reconstruct the list of classes for each target. Reclass provides this information in
rendered_target["classes"]
already.This commit removes the loop which reconstructs the list and replaces it by assigning
rendered_target["classes"]
to the target'sclasses
field.Side-note: the previous implementation also mangled the list, because Python implements
+=
for lists as list concatenation, and (not so helpfully) treats strings as lists of characters when they appear in a context where a list is expected. To correctly construct the list of classes with the previous approach, the+=
should be replaced with append:Docs and Tests