avid.common.artefact.ArtefactCollection
- class avid.common.artefact.ArtefactCollection(initial_artefacts=None)
Bases:
object- __init__(initial_artefacts=None)
Methods
__init__([initial_artefacts])add_artefact(artefact[, replace_if_exists])Adds an artefact to the collection.
collection_is_similar(other)Checks if the passed container containes simelar artefacts then self.
copy()extend(artefacts[, replace_if_exists])find_similar(artefact)Finds an artefact in the collection that is similar to the given artefact.
first()Return the first artefact in the collection or None if empty.
identical_artefact_exists(artefact)Checks if the identical (so all, not only the identity relevant properties, are the same) artefact to the given artefact exists in the collection.
last()Return the last artefact in the collection or None if empty.
remove_artefact(artefact)Removes the artefact from the collection if it exists.
similar_artefact_exists(artefact)Checks if an artefact similar to the given artefact exists in the collection.
- add_artefact(artefact, replace_if_exists=True)
Adds an artefact to the collection. If an artefact with the same hash exists: - Replaces it if replace_if_exists is True. - Raises a ValueError otherwise. Returns the replaced artefact. If no artefact was replaced it returns None.
- collection_is_similar(other)
Checks if the passed container containes simelar artefacts then self. Order of artefects is not relevant for equality.
- find_similar(artefact)
Finds an artefact in the collection that is similar to the given artefact. Returns the artefact if found, or None if no match exists.
- first()
Return the first artefact in the collection or None if empty.
- identical_artefact_exists(artefact)
Checks if the identical (so all, not only the identity relevant properties, are the same) artefact to the given artefact exists in the collection.
- last()
Return the last artefact in the collection or None if empty.
- remove_artefact(artefact)
Removes the artefact from the collection if it exists.
- similar_artefact_exists(artefact)
Checks if an artefact similar to the given artefact exists in the collection.