Skip to content

Commit

Permalink
feat: iterate over collections (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
faradox committed Nov 30, 2023
1 parent c7b05d3 commit 576cd7e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/nendo/schema/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from concurrent.futures import ThreadPoolExecutor, as_completed
from datetime import datetime
from enum import Enum
from typing import Any, ClassVar, Dict, List, Optional, Tuple, Union
from typing import Any, ClassVar, Dict, Iterator, List, Optional, Tuple, Union

import librosa
import numpy as np
Expand Down Expand Up @@ -894,6 +894,9 @@ def __getitem__(self, index: int) -> NendoTrack:
"""Return the track at the specified index."""
return self.tracks()[index]

def __iter__(self) -> Iterator:
return iter(self.tracks())

def __len__(self):
"""Return the number of tracks in the collection."""
return len(self.tracks())
Expand Down

0 comments on commit 576cd7e

Please sign in to comment.