Streamline typing and implementation of SPARQL processor by cthoyt · Pull Request #2301 · RDFLib/rdflib (original) (raw)

While the current function signature is problematic due to its use of mutable data structures in argument defaults, One problem with changing this is, plugins that implement this as it stands could break if they now receive valid values according to the new function signature, as they don't expect None as a value.

We need to figure out a way to upgrade our plugin interfaces, I think the right approach is to create ProcessorV2, but we need to also consider what other changes we want to introduce before that.

I think it is best to change this back to what it was, though the rest of the PR seems good and quite helpful.

initBindings: Optional[Mapping["str", "Identifier"]] = None, # noqa: N803
initNs: Optional[Mapping[str, Any]] = None, # noqa: N803
initBindings: Mapping["str", "Identifier"] = {}, # noqa: N803
initNs: Mapping[str, Any] = {}, # noqa: N803