Skip to content

Fix unhashable type error

Jonathan Howard requested to merge 302-unhashable-type-error-fix into dev

Checklist

  • documentation is changed or added in ./docs
  • unit tests updated to test changes

Description

Context

Merging SBOMs was failing when using certain CycloneDX models missing a __hash__ method.

Intent

  • Use CycloneDXBaseModel as super class for AffectVersion model in order to inherit its __hash__ method
  • Add __hash__ methods to various model classes
  • Update hoppr.utils.dedup_list function to accept and return a generic type bound to typing.Hashable
    • This should help mypy raise errors if attempting to write code that calls dedup_list with a list of objects that don't implement the __hash__ method

Closes #302 (closed)

Merge request reports