Add an `object_type` attribute to model classes
With the current move to using swh.model objects as much as possible, we no longer need to also pass the object type as argument. See eg. the JournalWriter.write_additions() for example:
def write_additions(self, obj_type, values) -> None:
in which values
is expected to be an iterable of model objects of object_type
type.
In order to prevent the usage of is_instance
everywhere, a simple solution is to add an attribute to swh.model.model
classes (typically `.object_type') as Final attributes.
This idea has been proposed in !112 (closed), however, the current implementation is stuck because of the way lazy-loading capable Content are implemented (subclassing the Content
model class).
Migrated from T2422 (view on Phabricator)