open-research / sumatra

http://neuralensemble.org/sumatra/
BSD 2-Clause "Simplified" License
127 stars 48 forks source link

Enh: Make RecordDifference more robust #402

Open alcrene opened 7 months ago

alcrene commented 7 months ago

This fixes a corner case in records.py::RecordDifference.

In cases where record parameters are malformed, they may not load correctly as a dict, and then rec.parameters.pop raises AttributeError. One may still want to compare the record to another however – for example, to identify differences with a record where parameters are not malformed. Adding a hasattr guard helps with this corner case, and as far as I can tell has no downsides.