From 46565803e36e764c41a05e5db0f10fbdedd03dd1 Mon Sep 17 00:00:00 2001 From: Mark Reid Date: Sat, 20 Apr 2024 20:59:12 -0700 Subject: [PATCH] Add default_value arg to slot_at. --- src/aaf2/mobs.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/aaf2/mobs.py b/src/aaf2/mobs.py index 8eb33cd..16e7bf1 100644 --- a/src/aaf2/mobs.py +++ b/src/aaf2/mobs.py @@ -19,6 +19,7 @@ from .auid import AUID from .components import SourceReference +sentinel = object() @register_class class Mob(core.AAFObject): @@ -80,11 +81,13 @@ def comments(self): def slots(self): return self['Slots'] - def slot_at(self, slot_id): + def slot_at(self, slot_id, default_value=sentinel): for slot in self.slots: if slot.slot_id == slot_id: return slot - raise IndexError("No SlotID: %s" % str(slot_id)) + if default_value is sentinel: + raise IndexError("No SlotID: %s" % str(slot_id)) + return default_value def create_timeline_slot(self, edit_rate, slot_id=None): slots = [slot.slot_id for slot in self.slots]