witty-crayon-22786
02/09/2022, 11:32 PMTarget
use the same field-access mechanism?witty-crayon-22786
02/09/2022, 11:32 PMhundreds-father-404
02/09/2022, 11:39 PMtarget.resolve
? That doesn't work with the Target API wanting you to say which field you're looking for, SingleSourceField
vs SourceField
vs PythonSourceField
You should declare it explicitly at your call site, not rely on whatever tgt.source
is set to imowitty-crayon-22786
02/09/2022, 11:40 PMhundreds-father-404
02/09/2022, 11:41 PMisinstance(tgt, PythonSourceTarget)
. Violates extensibility of creating custom targets - we don't want you to have to subclass PythonSourceTarget
when adding a new targethundreds-father-404
02/09/2022, 11:42 PMtgt
is. And that's the whole point of `FieldSet`: we don't care about the Target
class, only that it has the fields we wantwitty-crayon-22786
02/09/2022, 11:42 PMhundreds-father-404
02/09/2022, 11:44 PMblack/rules.py
without knowing that PythonSourceTarget
exists. We want to decouple target definitions from rule implementations because we can't predict what targets plugin authors will addwitty-crayon-22786
02/09/2022, 11:45 PMhas_field(Sources)
before doing the field lookup. but yea, makes sense.hundreds-father-404
02/09/2022, 11:46 PMhas_field()
. But then you have .get()
to considerwitty-crayon-22786
02/09/2022, 11:46 PMget
wouldn’t change i don’t think.witty-crayon-22786
02/09/2022, 11:46 PM