aries-cloudagent-python
aries-cloudagent-python copied to clipboard
Issue Credential v2 and Present Proof v2 format handling is difficult to follow
As an ACA-Py maintainer, following the logic of the format handlers, especially the selection of a format handler for a given input, is extremely difficult (for me at least) to follow. Lines like:
cred_ex_record = await cred_manager.create_proposal(
connection_id=connection_id,
auto_remove=auto_remove,
comment=comment,
cred_preview=cred_preview,
trace=trace_msg,
fmt2filter={
V20CredFormat.Format.get(fmt_api): filt_by_fmt
for (fmt_api, filt_by_fmt) in filt_spec.items()
}, # <--- this list comprehension
)
Are just too dense for me to parse with reasonable effort. Normally, I'd just peel this apart and get over it but this is a consistent enough issue that I think it is worth addressing, if only for the sake of maintainability in the future.
No shade on the original authors -- I think this code is probably more intuitive in a TypeScript context -- but in the context of Python and ACA-Py, this methodology stands out.