Skip to content

Commit

Permalink
Add default_value arg to slot_at.
Browse files Browse the repository at this point in the history
  • Loading branch information
markreidvfx committed Apr 21, 2024
1 parent 1fd39a7 commit 4656580
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/aaf2/mobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from .auid import AUID
from .components import SourceReference

sentinel = object()

@register_class
class Mob(core.AAFObject):
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit 4656580

Please sign in to comment.