diff --git a/contrib/opentimelineio_contrib/adapters/aaf_adapter/aaf_writer.py b/contrib/opentimelineio_contrib/adapters/aaf_adapter/aaf_writer.py index 8946687aa..63e6749e3 100644 --- a/contrib/opentimelineio_contrib/adapters/aaf_adapter/aaf_writer.py +++ b/contrib/opentimelineio_contrib/adapters/aaf_adapter/aaf_writer.py @@ -147,7 +147,7 @@ def validate_metadata(timeline): all_checks = [__check(timeline, "duration().rate")] edit_rate = __check(timeline, "duration().rate").value - for child in timeline.each_child(): + for child in timeline.find_children(): checks = [] if _is_considered_gap(child): checks = [ @@ -227,7 +227,7 @@ def _generate_empty_mobid(clip): clip_mob_ids = {} - for otio_clip in input_otio.each_clip(): + for otio_clip in input_otio.find_clips(): if _is_considered_gap(otio_clip): continue for strategy in strategies: @@ -249,7 +249,7 @@ def _stackify_nested_groups(timeline): """ copied = copy.deepcopy(timeline) for track in copied.tracks: - for i, child in enumerate(track.each_child()): + for i, child in enumerate(track.find_children()): is_nested = isinstance(child, otio.schema.Track) is_parent_in_stack = isinstance(child.parent(), otio.schema.Stack) if is_nested and not is_parent_in_stack: @@ -282,7 +282,7 @@ def __init__(self, root_file_transcriber, otio_track): self.compositionmob = root_file_transcriber.compositionmob self.aaf_file = root_file_transcriber.aaf_file self.otio_track = otio_track - self.edit_rate = next(self.otio_track.each_child()).duration().rate + self.edit_rate = self.otio_track.find_children()[0].duration().rate self.timeline_mobslot, self.sequence = self._create_timeline_mobslot() self.timeline_mobslot.name = self.otio_track.name diff --git a/contrib/opentimelineio_contrib/adapters/advanced_authoring_format.py b/contrib/opentimelineio_contrib/adapters/advanced_authoring_format.py index 5695ee348..41feb2bbd 100644 --- a/contrib/opentimelineio_contrib/adapters/advanced_authoring_format.py +++ b/contrib/opentimelineio_contrib/adapters/advanced_authoring_format.py @@ -1208,11 +1208,11 @@ def _attach_markers(collection): """ # iterate all timeline objects - for timeline in collection.each_child(descended_from_type=otio.schema.Timeline): + for timeline in collection.find_children(descended_from_type=otio.schema.Timeline): tracks_map = {} # build track mapping - for track in timeline.each_child(descended_from_type=otio.schema.Track): + for track in timeline.find_children(descended_from_type=otio.schema.Track): metadata = track.metadata.get("AAF", {}) slot_id = metadata.get("SlotID") track_number = metadata.get("PhysicalTrackNumber") @@ -1222,7 +1222,8 @@ def _attach_markers(collection): tracks_map[(int(slot_id), int(track_number))] = track # iterate all tracks for their markers and attach them to the matching item - for current_track in timeline.each_child(descended_from_type=otio.schema.Track): + for current_track in timeline.find_children( + descended_from_type=otio.schema.Track): for marker in list(current_track.markers): metadata = marker.metadata.get("AAF", {}) slot_id = metadata.get("AttachedSlotID") diff --git a/contrib/opentimelineio_contrib/adapters/ale.py b/contrib/opentimelineio_contrib/adapters/ale.py index 07db37da6..972c989d4 100644 --- a/contrib/opentimelineio_contrib/adapters/ale.py +++ b/contrib/opentimelineio_contrib/adapters/ale.py @@ -252,7 +252,7 @@ def nextline(lines): def write_to_string(input_otio, columns=None, fps=None, video_format=None): # Get all the clips we're going to export - clips = list(input_otio.each_clip()) + clips = list(input_otio.find_clips()) result = "" diff --git a/contrib/opentimelineio_contrib/adapters/burnins.py b/contrib/opentimelineio_contrib/adapters/burnins.py index 748bb673f..56212753e 100644 --- a/contrib/opentimelineio_contrib/adapters/burnins.py +++ b/contrib/opentimelineio_contrib/adapters/burnins.py @@ -21,7 +21,7 @@ def build_burnins(input_otio): key = 'burnins' burnins = [] - for clip in input_otio.each_clip(): + for clip in input_otio.find_clips(): # per clip burnin data burnin_data = clip.media_reference.metadata.get(key) diff --git a/contrib/opentimelineio_contrib/adapters/fcpx_xml.py b/contrib/opentimelineio_contrib/adapters/fcpx_xml.py index f3d06d124..47f71e0da 100644 --- a/contrib/opentimelineio_contrib/adapters/fcpx_xml.py +++ b/contrib/opentimelineio_contrib/adapters/fcpx_xml.py @@ -140,7 +140,7 @@ def __init__(self, otio_timeline): self.timelines = [self.otio_timeline] else: self.timelines = list( - self.otio_timeline.each_child( + self.otio_timeline.find_children( descended_from_type=otio.schema.Timeline ) ) @@ -245,7 +245,7 @@ def _stack_to_sequence(self, stack, compound_clip=False): return sequence_element def _track_for_spine(self, track, lane_id, spine, compound): - for child in self._lanable_items(track.each_child()): + for child in self._lanable_items(track.find_children()): if self._item_in_compound_clip(child) and not compound: continue child_element = self._element_for_item( @@ -625,12 +625,12 @@ def _add_compound_clip(self, item): return media_element def _stacks(self): - return self.otio_timeline.each_child( + return self.otio_timeline.find_children( descended_from_type=otio.schema.Stack ) def _clips(self): - return self.otio_timeline.each_child( + return self.otio_timeline.find_children( descended_from_type=otio.schema.Clip ) diff --git a/contrib/opentimelineio_contrib/adapters/tests/test_aaf_adapter.py b/contrib/opentimelineio_contrib/adapters/tests/test_aaf_adapter.py index 29ab5ce25..88ec22c52 100644 --- a/contrib/opentimelineio_contrib/adapters/tests/test_aaf_adapter.py +++ b/contrib/opentimelineio_contrib/adapters/tests/test_aaf_adapter.py @@ -242,7 +242,7 @@ def test_aaf_read(self): self.assertEqual(len(timeline.audio_tracks()), 2) - clips = list(video_track.each_clip()) + clips = video_track.find_clips() self.assertEqual( [ @@ -322,7 +322,7 @@ def test_aaf_read_trims(self): ] ) - clips = list(video_track.each_clip()) + clips = video_track.find_clips() self.assertEqual( [item.name for item in video_track], @@ -426,7 +426,7 @@ def test_aaf_read_transitions(self): video_track = video_tracks[0] self.assertEqual(len(video_track), 12) - clips = list(video_track.each_clip()) + clips = video_track.find_clips() self.assertEqual(len(clips), 4) self.assertEqual( @@ -631,7 +631,7 @@ def test_aaf_flatten_tracks(self): t.name = "" t.metadata.pop("AAF", None) - for c in t.each_child(): + for c in t.find_children(): if hasattr(c, "media_reference") and c.media_reference: mr = c.media_reference mr.metadata.get("AAF", {}).pop('LastModified', None) @@ -642,7 +642,7 @@ def test_aaf_flatten_tracks(self): meta.pop('StartTime', None) # We don't care about Gap start times, only their duration matters - for g in t.each_child(descended_from_type=otio.schema.Gap): + for g in t.find_children(descended_from_type=otio.schema.Gap): dur = g.source_range.duration rate = g.source_range.start_time.rate g.source_range = otio.opentime.TimeRange( @@ -965,7 +965,7 @@ def test_aaf_sourcemob_usage(self): # `Usage_SubClip` value subclip_timeline = otio.adapters.read_from_file(SUBCLIP_PATH) subclip_usages = {"Subclip.BREATH": "Usage_SubClip"} - for clip in subclip_timeline.each_clip(): + for clip in subclip_timeline.find_clips(): self.assertEqual( clip.metadata.get("AAF", {}).get("SourceMobUsage"), subclip_usages[clip.name] @@ -980,7 +980,7 @@ def test_aaf_sourcemob_usage(self): "t-hawk (loop)-HD.mp4": "", "tech.fux (loop)-HD.mp4": "" } - for clip in simple_timeline.each_clip(): + for clip in simple_timeline.find_clips(): self.assertEqual( clip.metadata.get("AAF", {}).get("SourceMobUsage", ""), simple_usages[clip.name] @@ -1201,9 +1201,9 @@ def test_attach_markers(self): all_markers = {} for i, track in enumerate( - timeline.each_child(descended_from_type=otio.schema.Track) + timeline.find_children(descended_from_type=otio.schema.Track) ): - for item in track.each_child(): + for item in track.find_children(): markers = [ ( m.name, @@ -1220,7 +1220,7 @@ def test_attach_markers(self): def test_keyframed_properties(self): def get_expected_dict(timeline): expected = [] - for clip in timeline.each_child(descended_from_type=otio.schema.Clip): + for clip in timeline.find_children(descended_from_type=otio.schema.Clip): for effect in clip.effects: props = {} parameters = effect.metadata.get("AAF", {}).get("Parameters", {}) @@ -1566,7 +1566,7 @@ def test_aaf_writer_nometadata(self): def _target_url_fixup(timeline): # fixes up relative paths to be absolute to this test file test_dir = os.path.dirname(os.path.abspath(__file__)) - for clip in timeline.each_clip(): + for clip in timeline.find_clips(): target_url_str = clip.media_reference.target_url clip.media_reference.target_url = os.path.join(test_dir, target_url_str) @@ -1607,7 +1607,7 @@ def test_aaf_roundtrip_first_clip(self): def _target_url_fixup(timeline): # fixes up relative paths to be absolute to this test file test_dir = os.path.dirname(os.path.abspath(__file__)) - for clip in timeline.each_clip(): + for clip in timeline.find_clips(): target_url_str = clip.media_reference.target_url clip.media_reference.target_url = os.path.join(test_dir, target_url_str) @@ -1621,8 +1621,8 @@ def _target_url_fixup(timeline): def _verify_first_clip(self, original_timeline, aaf_path): timeline_from_aaf = otio.adapters.read_from_file(aaf_path) - original_clips = list(original_timeline.each_clip()) - aaf_clips = list(timeline_from_aaf.each_clip()) + original_clips = original_timeline.find_clips() + aaf_clips = timeline_from_aaf.find_clips() self.assertTrue(len(original_clips) > 0) self.assertEqual(len(aaf_clips), len(original_clips)) @@ -1717,10 +1717,11 @@ def _verify_aaf(self, aaf_path): sequence = opgroup.segments[0] self.assertTrue(isinstance(sequence, Sequence)) - self.assertEqual(len(list(otio_track.each_child(shallow_search=True))), - len(sequence.components)) + self.assertEqual( + len(otio_track.find_children(shallow_search=True)), + len(sequence.components)) for otio_child, aaf_component in zip( - otio_track.each_child(shallow_search=True), + otio_track.find_children(shallow_search=True), sequence.components): type_mapping = { otio.schema.Clip: aaf2.components.SourceClip, @@ -1738,7 +1739,7 @@ def _verify_aaf(self, aaf_path): if isinstance(aaf_component, aaf2.components.OperationGroup): nested_aaf_segments = aaf_component.segments for nested_otio_child, nested_aaf_segment in zip( - otio_child.each_child(), nested_aaf_segments): + otio_child.find_children(), nested_aaf_segments): self._is_otio_aaf_same(nested_otio_child, nested_aaf_segment) else: diff --git a/contrib/opentimelineio_contrib/adapters/tests/test_fcpx_adapter.py b/contrib/opentimelineio_contrib/adapters/tests/test_fcpx_adapter.py index 2af76dfc9..8eafbb58e 100644 --- a/contrib/opentimelineio_contrib/adapters/tests/test_fcpx_adapter.py +++ b/contrib/opentimelineio_contrib/adapters/tests/test_fcpx_adapter.py @@ -43,9 +43,8 @@ def __init__(self, *args, **kwargs): def test_library_roundtrip(self): container = otio.adapters.read_from_file(SAMPLE_LIBRARY_XML) - timeline = next( - container.each_child(descended_from_type=otio.schema.Timeline) - ) + timeline = container.find_children( + descended_from_type=otio.schema.Timeline)[0] self.assertIsNotNone(timeline) self.assertEqual(len(timeline.tracks), 4) @@ -81,9 +80,8 @@ def test_library_roundtrip(self): def test_event_roundtrip(self): container = otio.adapters.read_from_file(SAMPLE_EVENT_XML) - timeline = next( - container.each_child(descended_from_type=otio.schema.Timeline) - ) + timeline = container.find_children( + descended_from_type=otio.schema.Timeline)[0] self.assertIsNotNone(timeline) self.assertEqual(len(timeline.tracks), 4) diff --git a/examples/conform.cpp b/examples/conform.cpp index 2c9c75b7d..842f5f3bb 100644 --- a/examples/conform.cpp +++ b/examples/conform.cpp @@ -77,7 +77,7 @@ int conform_timeline( int count = 0; otio::ErrorStatus error_status; - const auto clips = timeline->clip_if(&error_status); + const auto clips = timeline->find_clips(&error_status); if (otio::is_error(error_status)) { examples::print_error(error_status); @@ -130,7 +130,7 @@ int main(int argc, char** argv) examples::print_error(error_status); exit(1); } - const auto clips = timeline->clip_if(&error_status); + const auto clips = timeline->find_clips(&error_status); if (otio::is_error(error_status)) { examples::print_error(error_status); diff --git a/examples/conform.py b/examples/conform.py index c3fa6da0c..4d7bb7dba 100755 --- a/examples/conform.py +++ b/examples/conform.py @@ -99,7 +99,7 @@ def _conform_timeline(timeline, folder): count = 0 - for clip in timeline.each_clip(): + for clip in timeline.find_clips(): # look for a media file that matches the clip's name new_path = _find_matching_media(clip.name, folder) @@ -128,7 +128,7 @@ def main(): print( "Saved {} with {} clips.".format( args.output, - len(list(timeline.each_clip())) + len(list(timeline.find_clips())) ) ) diff --git a/examples/summarize_timing.py b/examples/summarize_timing.py old mode 100644 new mode 100755 index faba3be19..d998ac656 --- a/examples/summarize_timing.py +++ b/examples/summarize_timing.py @@ -54,8 +54,8 @@ def _summarize_range(label, time_range): def _summarize_timeline(timeline): # Here we iterate over each video track, and then just the top-level # items in each track. If you want to traverse the whole nested structure - # then you can use: for item in timeline.each_child() - # or just clips via: for clip in timeline.each_clip() + # then you can use: for item in timeline.find_children() + # or just clips via: for clip in timeline.find_clips() # See also: https://opentimelineio.readthedocs.io/en/latest/tutorials/otio-timeline-structure.html # noqa for track in timeline.video_tracks(): print( diff --git a/src/opentimelineio/composition.h b/src/opentimelineio/composition.h index a6c865df6..9f19bf556 100644 --- a/src/opentimelineio/composition.h +++ b/src/opentimelineio/composition.h @@ -101,13 +101,13 @@ class Composition : public Item TimeRange const& search_range, ErrorStatus* error_status = nullptr) const; - // Return a vector of all objects that match the given template type. + // Find child objects that match the given template type. // // An optional search_time may be provided to limit the search. // - // If shallow_search is false, will recurse into children. + // The search is recursive unless shallow_search is set to true. template - std::vector> children_if( + std::vector> find_children( ErrorStatus* error_status = nullptr, optional search_range = nullopt, bool shallow_search = false) const; @@ -171,7 +171,7 @@ class Composition : public Item template inline std::vector> -Composition::children_if( +Composition::find_children( ErrorStatus* error_status, optional search_range, bool shallow_search) const @@ -217,7 +217,7 @@ Composition::children_if( } } - const auto valid_children = composition->children_if( + const auto valid_children = composition->find_children( error_status, search_range, shallow_search); diff --git a/src/opentimelineio/serializableCollection.cpp b/src/opentimelineio/serializableCollection.cpp index d1d9f662b..def0014e5 100644 --- a/src/opentimelineio/serializableCollection.cpp +++ b/src/opentimelineio/serializableCollection.cpp @@ -105,12 +105,12 @@ SerializableCollection::write_to(Writer& writer) const } std::vector> -SerializableCollection::clip_if( +SerializableCollection::find_clips( ErrorStatus* error_status, optional const& search_range, bool shallow_search) const { - return children_if(error_status, search_range, shallow_search); + return find_children(error_status, search_range, shallow_search); } }} // namespace opentimelineio::OPENTIMELINEIO_VERSION diff --git a/src/opentimelineio/serializableCollection.h b/src/opentimelineio/serializableCollection.h index e65bb8ee1..23cf7522c 100644 --- a/src/opentimelineio/serializableCollection.h +++ b/src/opentimelineio/serializableCollection.h @@ -52,23 +52,23 @@ class SerializableCollection : public SerializableObjectWithMetadata bool remove_child(int index, ErrorStatus* error_status = nullptr); - // Return a vector of clips. + // Find child clips. // // An optional search_range may be provided to limit the search. // - // If shallow_search is false, will recurse into children. - std::vector> clip_if( + // The search is recursive unless shallow_search is set to true. + std::vector> find_clips( ErrorStatus* error_status = nullptr, optional const& search_range = nullopt, bool shallow_search = false) const; - // Return a vector of all objects that match the given template type. + // Find child objects that match the given template type. // // An optional search_time may be provided to limit the search. // - // If shallow_search is false, will recurse into children. + // The search is recursive unless shallow_search is set to true. template - std::vector> children_if( + std::vector> find_children( ErrorStatus* error_status = nullptr, optional search_range = nullopt, bool shallow_search = false) const; @@ -85,7 +85,7 @@ class SerializableCollection : public SerializableObjectWithMetadata template inline std::vector> -SerializableCollection::children_if( +SerializableCollection::find_children( ErrorStatus* error_status, optional search_range, bool shallow_search) const @@ -107,7 +107,7 @@ SerializableCollection::children_if( dynamic_cast(child.value)) { const auto valid_children = - collection->children_if(error_status, search_range); + collection->find_children(error_status, search_range); if (is_error(error_status)) { return out; @@ -120,7 +120,7 @@ SerializableCollection::children_if( else if (auto composition = dynamic_cast(child.value)) { const auto valid_children = - composition->children_if(error_status, search_range); + composition->find_children(error_status, search_range); if (is_error(error_status)) { return out; @@ -133,7 +133,7 @@ SerializableCollection::children_if( else if (auto timeline = dynamic_cast(child.value)) { const auto valid_children = - timeline->children_if(error_status, search_range); + timeline->find_children(error_status, search_range); if (is_error(error_status)) { return out; diff --git a/src/opentimelineio/stack.cpp b/src/opentimelineio/stack.cpp index 767e88826..d79613ddc 100644 --- a/src/opentimelineio/stack.cpp +++ b/src/opentimelineio/stack.cpp @@ -114,12 +114,12 @@ Stack::available_range(ErrorStatus* error_status) const } std::vector> -Stack::clip_if( +Stack::find_clips( ErrorStatus* error_status, optional const& search_range, bool shallow_search) const { - return children_if(error_status, search_range, shallow_search); + return find_children(error_status, search_range, shallow_search); } optional @@ -127,7 +127,7 @@ Stack::available_image_bounds(ErrorStatus* error_status) const { optional box; bool found_first_child = false; - for (auto clip: children_if(error_status)) + for (auto clip: find_children(error_status)) { optional child_box; if (auto clip_box = clip->available_image_bounds(error_status)) diff --git a/src/opentimelineio/stack.h b/src/opentimelineio/stack.h index 87410adb1..58b4b33e4 100644 --- a/src/opentimelineio/stack.h +++ b/src/opentimelineio/stack.h @@ -43,10 +43,12 @@ class Stack : public Composition optional available_image_bounds(ErrorStatus* error_status) const; - // Return a vector of clips. + // Find child clips. // // An optional search_range may be provided to limit the search. - std::vector> clip_if( + // + // The search is recursive unless shallow_search is set to true. + std::vector> find_clips( ErrorStatus* error_status = nullptr, optional const& search_range = nullopt, bool shallow_search = false) const; diff --git a/src/opentimelineio/timeline.cpp b/src/opentimelineio/timeline.cpp index 6c9e9b2fc..0f1496c96 100644 --- a/src/opentimelineio/timeline.cpp +++ b/src/opentimelineio/timeline.cpp @@ -75,12 +75,12 @@ Timeline::audio_tracks() const } std::vector> -Timeline::clip_if( +Timeline::find_clips( ErrorStatus* error_status, optional const& search_range, bool shallow_search) const { - return _tracks.value->clip_if(error_status, search_range, shallow_search); + return _tracks.value->find_clips(error_status, search_range, shallow_search); } }} // namespace opentimelineio::OPENTIMELINEIO_VERSION diff --git a/src/opentimelineio/timeline.h b/src/opentimelineio/timeline.h index 7c90120fb..0d793abfd 100644 --- a/src/opentimelineio/timeline.h +++ b/src/opentimelineio/timeline.h @@ -62,21 +62,23 @@ class Timeline : public SerializableObjectWithMetadata std::vector audio_tracks() const; std::vector video_tracks() const; - // Return a vector of clips. + // Find child clips. // // An optional search_range may be provided to limit the search. - std::vector> clip_if( + // + // The search is recursive unless shallow_search is set to true. + std::vector> find_clips( ErrorStatus* error_status = nullptr, optional const& search_range = nullopt, bool shallow_search = false) const; - // Return a vector of all objects that match the given template type. + // Find child objects that match the given template type. // // An optional search_time may be provided to limit the search. // - // If shallow_search is false, will recurse into children. + // The search is recursive unless shallow_search is set to true. template - std::vector> children_if( + std::vector> find_children( ErrorStatus* error_status = nullptr, optional search_range = nullopt, bool shallow_search = false) const; @@ -100,12 +102,12 @@ class Timeline : public SerializableObjectWithMetadata template inline std::vector> -Timeline::children_if( +Timeline::find_children( ErrorStatus* error_status, optional search_range, bool shallow_search) const { - return _tracks.value->children_if( + return _tracks.value->find_children( error_status, search_range, shallow_search); diff --git a/src/opentimelineio/track.cpp b/src/opentimelineio/track.cpp index ef90f2ab6..1ca087eff 100644 --- a/src/opentimelineio/track.cpp +++ b/src/opentimelineio/track.cpp @@ -288,12 +288,12 @@ Track::range_of_all_children(ErrorStatus* error_status) const } std::vector> -Track::clip_if( +Track::find_clips( ErrorStatus* error_status, optional const& search_range, bool shallow_search) const { - return children_if(error_status, search_range, shallow_search); + return find_children(error_status, search_range, shallow_search); } optional diff --git a/src/opentimelineio/track.h b/src/opentimelineio/track.h index 443c75806..1ffd11ea1 100644 --- a/src/opentimelineio/track.h +++ b/src/opentimelineio/track.h @@ -68,12 +68,12 @@ class Track : public Composition optional available_image_bounds(ErrorStatus* error_status) const; - // Return a vector of clips. + // Find child clips. // // An optional search_range may be provided to limit the search. // - // If shallow_search is false, will recurse into compositions. - std::vector> clip_if( + // The search is recursive unless shallow_search is set to true. + std::vector> find_clips( ErrorStatus* error_status = nullptr, optional const& search_range = nullopt, bool shallow_search = false) const; diff --git a/src/py-opentimelineio/opentimelineio-bindings/otio_serializableObjects.cpp b/src/py-opentimelineio/opentimelineio-bindings/otio_serializableObjects.cpp index 7fdd9d061..e2821199c 100644 --- a/src/py-opentimelineio/opentimelineio-bindings/otio_serializableObjects.cpp +++ b/src/py-opentimelineio/opentimelineio-bindings/otio_serializableObjects.cpp @@ -60,10 +60,10 @@ namespace { } template - bool children_if(T* t, py::object descended_from_type, optional const& search_range, bool shallow_search, std::vector& l) { + bool find_children(T* t, py::object descended_from_type, optional const& search_range, bool shallow_search, std::vector& l) { if (descended_from_type.is(py::type::handle_of())) { - for (const auto& child : t->template children_if(ErrorStatusHandler(), search_range, shallow_search)) { + for (const auto& child : t->template find_children(ErrorStatusHandler(), search_range, shallow_search)) { l.push_back(child.value); } return true; @@ -72,30 +72,30 @@ namespace { } template - std::vector children_if(T* t, py::object descended_from_type, optional const& search_range, bool shallow_search = false) { + std::vector find_children(T* t, py::object descended_from_type, optional const& search_range, bool shallow_search = false) { std::vector l; - if (children_if(t, descended_from_type, search_range, shallow_search, l)) ; - else if (children_if(t, descended_from_type, search_range, shallow_search, l)) ; - else if (children_if(t, descended_from_type, search_range, shallow_search, l)) ; - else if (children_if(t, descended_from_type, search_range, shallow_search, l)) ; - else if (children_if(t, descended_from_type, search_range, shallow_search, l)) ; - else if (children_if(t, descended_from_type, search_range, shallow_search, l)) ; - else if (children_if(t, descended_from_type, search_range, shallow_search, l)) ; - else if (children_if(t, descended_from_type, search_range, shallow_search, l)) ; + if (find_children(t, descended_from_type, search_range, shallow_search, l)) ; + else if (find_children(t, descended_from_type, search_range, shallow_search, l)) ; + else if (find_children(t, descended_from_type, search_range, shallow_search, l)) ; + else if (find_children(t, descended_from_type, search_range, shallow_search, l)) ; + else if (find_children(t, descended_from_type, search_range, shallow_search, l)) ; + else if (find_children(t, descended_from_type, search_range, shallow_search, l)) ; + else if (find_children(t, descended_from_type, search_range, shallow_search, l)) ; + else if (find_children(t, descended_from_type, search_range, shallow_search, l)) ; else { - for (const auto& child : t->template children_if(ErrorStatusHandler(), search_range, shallow_search)) { + for (const auto& child : t->template find_children(ErrorStatusHandler(), search_range, shallow_search)) { l.push_back(child.value); } } return l; } - + template - std::vector clip_if(T* t, optional const& search_range, bool shallow_search = false) { + std::vector find_clips(T* t, optional const& search_range, bool shallow_search = false) { std::vector l; - for (const auto& child : t->clip_if(ErrorStatusHandler(), search_range, shallow_search)) { - l.push_back(child.value); + for (const auto& clip : t->find_clips(ErrorStatusHandler(), search_range, shallow_search)) { + l.push_back(clip.value); } return l; } @@ -290,11 +290,11 @@ A :class:`~SerializableCollection` is useful for serializing multiple timelines, .def("__iter__", [](SerializableCollection* c) { return new SerializableCollectionIterator(c); }) - .def("clip_if", [](SerializableCollection* t, optional const& search_range, bool shallow_search) { - return clip_if(t, search_range, shallow_search); + .def("find_clips", [](SerializableCollection* c, optional const& search_range, bool shallow_search) { + return find_clips(c, search_range, shallow_search); }, "search_range"_a = nullopt, "shallow_search"_a = false) - .def("children_if", [](SerializableCollection* t, py::object descended_from_type, optional const& search_range, bool shallow_search) { - return children_if(t, descended_from_type, search_range, shallow_search); + .def("find_children", [](SerializableCollection* c, py::object descended_from_type, optional const& search_range, bool shallow_search) { + return find_children(c, descended_from_type, search_range, shallow_search); }, "descended_from_type"_a = py::none(), "search_range"_a = nullopt, "shallow_search"_a = false); } @@ -499,8 +499,8 @@ Should be subclassed (for example by :class:`.Track` and :class:`.Stack`), not u } return l; }, "search_range"_a) - .def("children_if", [](Composition* t, py::object descended_from_type, optional const& search_range, bool shallow_search) { - return children_if(t, descended_from_type, search_range, shallow_search); + .def("find_children", [](Composition* c, py::object descended_from_type, optional const& search_range, bool shallow_search) { + return find_children(c, descended_from_type, search_range, shallow_search); }, "descended_from_type"_a = py::none(), "search_range"_a = nullopt, "shallow_search"_a = false) .def("handles_of_child", [](Composition* c, Composable* child) { auto result = c->handles_of_child(child, ErrorStatusHandler()); @@ -576,8 +576,8 @@ Should be subclassed (for example by :class:`.Track` and :class:`.Stack`), not u auto result = t->neighbors_of(item, ErrorStatusHandler(), policy); return py::make_tuple(py::cast(result.first.take_value()), py::cast(result.second.take_value())); }, "item"_a, "policy"_a = Track::NeighborGapPolicy::never) - .def("clip_if", [](Track* t, optional const& search_range, bool shallow_search) { - return clip_if(t, search_range, shallow_search); + .def("find_clips", [](Track* t, optional const& search_range, bool shallow_search) { + return find_clips(t, search_range, shallow_search); }, "search_range"_a = nullopt, "shallow_search"_a = false); py::class_(track_class, "Kind") @@ -611,8 +611,8 @@ Should be subclassed (for example by :class:`.Track` and :class:`.Stack`), not u "markers"_a = py::none(), "effects"_a = py::none(), py::arg_v("metadata"_a = py::none())) - .def("clip_if", [](Stack* t, optional const& search_range, bool shallow_search) { - return clip_if(t, search_range, shallow_search); + .def("find_clips", [](Stack* s, optional const& search_range, bool shallow_search) { + return find_clips(s, search_range, shallow_search); }, "search_range"_a = nullopt, "shallow_search"_a = false); py::class_>(m, "Timeline", py::dynamic_attr()) @@ -641,11 +641,11 @@ Should be subclassed (for example by :class:`.Track` and :class:`.Stack`), not u }) .def("video_tracks", &Timeline::video_tracks) .def("audio_tracks", &Timeline::audio_tracks) - .def("clip_if", [](Timeline* t, optional const& search_range, bool shallow_search) { - return clip_if(t, search_range, shallow_search); + .def("find_clips", [](Timeline* t, optional const& search_range, bool shallow_search) { + return find_clips(t, search_range, shallow_search); }, "search_range"_a = nullopt, "shallow_search"_a = false) - .def("children_if", [](Timeline* t, py::object descended_from_type, optional const& search_range, bool shallow_search) { - return children_if(t, descended_from_type, search_range, shallow_search); + .def("find_children", [](Timeline* t, py::object descended_from_type, optional const& search_range, bool shallow_search) { + return find_children(t, descended_from_type, search_range, shallow_search); }, "descended_from_type"_a = py::none(), "search_range"_a = nullopt, "shallow_search"_a = false); } diff --git a/src/py-opentimelineio/opentimelineio/adapters/adapter.py b/src/py-opentimelineio/opentimelineio/adapters/adapter.py index 95aa6ca66..d614b64a2 100644 --- a/src/py-opentimelineio/opentimelineio/adapters/adapter.py +++ b/src/py-opentimelineio/opentimelineio/adapters/adapter.py @@ -346,13 +346,13 @@ def _with_linked_media_references( if not read_otio or not media_linker.from_name(media_linker_name): return read_otio - # not every object the adapter reads has an "each_clip" method, so this + # not every object the adapter reads has an "find_clips" method, so this # skips objects without one. - clpfn = getattr(read_otio, "each_clip", None) + clpfn = getattr(read_otio, "find_clips", None) if clpfn is None: return read_otio - for cl in read_otio.each_clip(): + for cl in read_otio.find_clips(): new_mr = media_linker.linked_media_reference( cl, media_linker_name, diff --git a/src/py-opentimelineio/opentimelineio/adapters/file_bundle_utils.py b/src/py-opentimelineio/opentimelineio/adapters/file_bundle_utils.py index 76e5b1e6a..3cccff128 100644 --- a/src/py-opentimelineio/opentimelineio/adapters/file_bundle_utils.py +++ b/src/py-opentimelineio/opentimelineio/adapters/file_bundle_utils.py @@ -95,7 +95,7 @@ def _prepped_otio_for_bundle_and_manifest( invalid_files = set() # result_otio is manipulated in place - for cl in result_otio.each_clip(): + for cl in result_otio.find_clips(): if media_policy == MediaReferencePolicy.AllMissing: cl.media_reference = reference_cloned_and_missing( cl.media_reference, diff --git a/src/py-opentimelineio/opentimelineio/adapters/otiod.py b/src/py-opentimelineio/opentimelineio/adapters/otiod.py index 7bd46f582..77028dcd8 100644 --- a/src/py-opentimelineio/opentimelineio/adapters/otiod.py +++ b/src/py-opentimelineio/opentimelineio/adapters/otiod.py @@ -34,7 +34,7 @@ def read_from_file(filepath, absolute_media_reference_paths=False): if not absolute_media_reference_paths: return result - for cl in result.each_clip(): + for cl in result.find_clips(): try: source_fpath = cl.media_reference.target_url except AttributeError: diff --git a/src/py-opentimelineio/opentimelineio/algorithms/filter.py b/src/py-opentimelineio/opentimelineio/algorithms/filter.py index 2f294fc00..57243de2c 100644 --- a/src/py-opentimelineio/opentimelineio/algorithms/filter.py +++ b/src/py-opentimelineio/opentimelineio/algorithms/filter.py @@ -102,7 +102,7 @@ def fn(thing): if isinstance(mutable_object, schema.Timeline): header_list.append(mutable_object.tracks) - iter_list = header_list + list(mutable_object.each_child()) + iter_list = header_list + list(mutable_object.find_children()) for child in iter_list: if _safe_parent(child) is not None and _is_in(child.parent(), prune_list): @@ -236,7 +236,7 @@ def filtered_with_sequence_context( if isinstance(mutable_object, schema.Timeline): header_list.append(mutable_object.tracks) - iter_list = header_list + list(mutable_object.each_child()) + iter_list = header_list + list(mutable_object.find_children()) # expand to include prev, next when appropriate expanded_iter_list = [] diff --git a/src/py-opentimelineio/opentimelineio/algorithms/stack_algo.py b/src/py-opentimelineio/opentimelineio/algorithms/stack_algo.py index ab22b5b3e..687517595 100644 --- a/src/py-opentimelineio/opentimelineio/algorithms/stack_algo.py +++ b/src/py-opentimelineio/opentimelineio/algorithms/stack_algo.py @@ -37,7 +37,7 @@ def top_clip_at_time(in_stack, t): ) ) - # build a range to use the `each_child`method. + # build a range to use the `find_clips`method. search_range = opentime.TimeRange( start_time=t, # 0 duration so we are just sampling a point in time. @@ -49,9 +49,9 @@ def top_clip_at_time(in_stack, t): # walk through the children of the stack in reverse order. for track in reversed(in_stack): valid_results = [] - if hasattr(track, "each_child"): + if hasattr(track, "find_clips"): valid_results = list( - c for c in track.each_clip(search_range, shallow_search=True) + c for c in track.find_clips(search_range, shallow_search=True) if c.visible() ) diff --git a/src/py-opentimelineio/opentimelineio/console/otiostat.py b/src/py-opentimelineio/opentimelineio/console/otiostat.py index 5854b41d3..57f822f8c 100755 --- a/src/py-opentimelineio/opentimelineio/console/otiostat.py +++ b/src/py-opentimelineio/opentimelineio/console/otiostat.py @@ -90,7 +90,7 @@ def depth(parent): @stat_check("number of clips") def _num_clips(input): - return len(list(input.each_clip())) + return len(list(input.find_clips())) @stat_check("total duration") @@ -120,7 +120,7 @@ def _top_level_rate(input): @stat_check("clips with cdl data") def _clips_with_cdl_data(input): - return len(list(c for c in input.each_clip() if 'cdl' in c.metadata)) + return len(list(c for c in input.find_clips() if 'cdl' in c.metadata)) @stat_check("Tracks with non standard types") @@ -128,7 +128,7 @@ def _sequences_with_non_standard_types(input): return len( list( c - for c in input.each_child(descended_from_type=otio.schema.Track) + for c in input.find_children(descended_from_type=otio.schema.Track) if c.kind not in (otio.schema.TrackKind.__dict__) ) ) diff --git a/src/py-opentimelineio/opentimelineio/console/otiotool.py b/src/py-opentimelineio/opentimelineio/console/otiotool.py index 8a3ee8193..d809d3ead 100755 --- a/src/py-opentimelineio/opentimelineio/console/otiotool.py +++ b/src/py-opentimelineio/opentimelineio/console/otiotool.py @@ -598,7 +598,7 @@ def redact_timeline(timeline): timeline.name = f"{timeline.schema_name()} #{counter}" timeline.metadata.clear() - for child in [timeline.tracks] + list(timeline.each_child()): + for child in [timeline.tracks] + list(timeline.find_children()): counter = _counter(child.schema_name()) child.name = f"{child.schema_name()} #{counter}" child.metadata.clear() @@ -662,7 +662,7 @@ def _conform_path(p): print(f"ERROR: Cannot relink to '{path}': No such file or folder.") return - for clip in timeline.each_clip(): + for clip in timeline.find_clips(): url = name_to_url.get(clip.name) if url is not None: clip.media_reference = otio.schema.ExternalReference(target_url=url) @@ -680,7 +680,7 @@ def copy_media_to_folder(timeline, folder): # os.mkdir(folder) copied_files = set() - for clip in timeline.each_clip(): + for clip in timeline.find_clips(): media_reference = clip.media_reference has_actual_url = (media_reference and hasattr(media_reference, 'target_url') and @@ -730,7 +730,8 @@ def inspect_timelines(name_regex, timeline): """Print some detailed information about the item(s) in the timeline with names that match the given regular expression.""" print("TIMELINE:", timeline.name) - items_to_inspect = [_filter(item, [], name_regex) for item in timeline.each_child()] + items_to_inspect = [_filter(item, [], name_regex) + for item in timeline.find_children()] items_to_inspect = list(filter(None, items_to_inspect)) for item in items_to_inspect: print(f" ITEM: {item.name} ({type(item)})") @@ -771,7 +772,7 @@ def summarize_timeline(list_tracks, list_clips, list_media, verify_media, """Print a summary of a timeline, optionally listing the tracks, clips, media, and/or markers inside it.""" print("TIMELINE:", timeline.name) - for child in [timeline.tracks] + list(timeline.each_child()): + for child in [timeline.tracks] + list(timeline.find_children()): if isinstance(child, otio.schema.Track): if list_tracks: print(f"TRACK: {child.name} ({child.kind})") diff --git a/src/py-opentimelineio/opentimelineio/core/composition.py b/src/py-opentimelineio/opentimelineio/core/composition.py index a077728e5..3388f2216 100644 --- a/src/py-opentimelineio/opentimelineio/core/composition.py +++ b/src/py-opentimelineio/opentimelineio/core/composition.py @@ -33,27 +33,3 @@ def __repr__(self): repr(self.metadata) ) ) - - -@add_method(_otio.Composition) -def each_child( - self, - search_range=None, - descended_from_type=_otio.Composable, - shallow_search=False, -): - """ - Generator that returns each child contained in the composition in - the order in which it is found. - - .. deprecated:: 0.14.0 - Use :meth:`children_if` instead. - - :param TimeRange search_range: if specified, only children whose range overlaps with - the search range will be yielded. - :param type descended_from_type: if specified, only children who are a descendent - of the descended_from_type will be yielded. - :param bool shallow_search: if True, will only search children of self, not - and not recurse into children of children. - """ - yield from self.children_if(descended_from_type, search_range, shallow_search) diff --git a/src/py-opentimelineio/opentimelineio/schema/__init__.py b/src/py-opentimelineio/opentimelineio/schema/__init__.py index 47a4f5b59..c7fc31bfc 100644 --- a/src/py-opentimelineio/opentimelineio/schema/__init__.py +++ b/src/py-opentimelineio/opentimelineio/schema/__init__.py @@ -44,15 +44,11 @@ image_sequence_reference, marker, serializable_collection, - stack, timeline, - track, transition, v2d, ) -track.TrackKind = TrackKind - def timeline_from_clips(clips): """Convenience for making a single track timeline from a list of clips.""" diff --git a/src/py-opentimelineio/opentimelineio/schema/clip.py b/src/py-opentimelineio/opentimelineio/schema/clip.py index 36f22182c..c0de97158 100644 --- a/src/py-opentimelineio/opentimelineio/schema/clip.py +++ b/src/py-opentimelineio/opentimelineio/schema/clip.py @@ -33,5 +33,5 @@ def __repr__(self): @add_method(_otio.Clip) -def each_clip(self, search_range=None): +def find_clips(self, search_range=None): yield self diff --git a/src/py-opentimelineio/opentimelineio/schema/serializable_collection.py b/src/py-opentimelineio/opentimelineio/schema/serializable_collection.py index efdd5b2a1..eed270941 100644 --- a/src/py-opentimelineio/opentimelineio/schema/serializable_collection.py +++ b/src/py-opentimelineio/opentimelineio/schema/serializable_collection.py @@ -28,38 +28,3 @@ def __repr__(self): repr(self.metadata) ) ) - - -@add_method(_otio.SerializableCollection) -def each_child(self, search_range=None, descended_from_type=_otio.Composable, - shallow_search=False): - """ Generator that returns each child contained in the serializable - collection in the order in which it is found. - - .. deprecated:: 0.14.0 - Use :meth:`children_if` instead. - - :param TimeRange search_range: if specified, only children whose range overlaps - with the search range will be yielded. - :param type descended_from_type: if specified, only children who are a descendent - of the descended_from_type will be yielded. - :param bool shallow_search: if True, will only search children of self and not - recurse into children of children. - """ - yield from self.children_if(descended_from_type, search_range, shallow_search) - - -@add_method(_otio.SerializableCollection) -def each_clip(self, search_range=None, shallow_search=False): - """ Generator that returns each clip contained in the serializable - collection in the order in which it is found. - - .. deprecated:: 0.14.0 - Use :meth:`each_clip` instead. - - :param TimeRange search_range: if specified, only children whose range overlaps - with the search range will be yielded. - :param bool shallow_search: if True, will only search children of self and not - recurse into children of children. - """ - yield from self.clip_if(search_range, shallow_search) diff --git a/src/py-opentimelineio/opentimelineio/schema/stack.py b/src/py-opentimelineio/opentimelineio/schema/stack.py deleted file mode 100644 index d9cdea5d3..000000000 --- a/src/py-opentimelineio/opentimelineio/schema/stack.py +++ /dev/null @@ -1,21 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 -# Copyright Contributors to the OpenTimelineIO project - -from .. core._core_utils import add_method -from .. import _otio - - -@add_method(_otio.Stack) -def each_clip(self, search_range=None, shallow_search=False): - """Generator that returns each clip contained in the stack - in the order in which it is found. - - .. deprecated:: 0.14.0 - Use :meth:`clip_if` instead. - - :param TimeRange search_range: if specified, only children whose range overlaps - with the search range will be yielded. - :param bool shallow_search: if True, will only search children of self and not - recurse into children of children. - """ - yield from self.clip_if(search_range, shallow_search) diff --git a/src/py-opentimelineio/opentimelineio/schema/timeline.py b/src/py-opentimelineio/opentimelineio/schema/timeline.py index 5f27233d6..c6185910d 100644 --- a/src/py-opentimelineio/opentimelineio/schema/timeline.py +++ b/src/py-opentimelineio/opentimelineio/schema/timeline.py @@ -18,38 +18,3 @@ def __repr__(self): repr(self.tracks) ) ) - - -@add_method(_otio.Timeline) -def each_child(self, search_range=None, descended_from_type=_otio.Composable, - shallow_search=False): - """Generator that returns each child contained in the timeline - in the order in which it is found. - - .. deprecated:: 0.14.0 - Use :meth:`children_if` instead. - - :param TimeRange search_range: if specified, only children whose range overlaps - with the search range will be yielded. - :param type descended_from_type: if specified, only children who are a descendent - of the descended_from_type will be yielded. - :param bool shallow_search: if True, will only search children of self and not - recurse into children of children. - """ - yield from self.children_if(descended_from_type, search_range, shallow_search) - - -@add_method(_otio.Timeline) -def each_clip(self, search_range=None, shallow_search=False): - """Generator that returns each clip contained in the timeline - in the order in which it is found. - - .. deprecated:: 0.14.0 - Use :meth:`clip_if` instead. - - :param TimeRange search_range: if specified, only children whose range overlaps - with the search range will be yielded. - :param bool shallow_search: if True, will only search children of self and not - recurse into children of children. - """ - yield from self.clip_if(search_range, shallow_search) diff --git a/src/py-opentimelineio/opentimelineio/schema/track.py b/src/py-opentimelineio/opentimelineio/schema/track.py deleted file mode 100644 index 4f65b3bf3..000000000 --- a/src/py-opentimelineio/opentimelineio/schema/track.py +++ /dev/null @@ -1,21 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 -# Copyright Contributors to the OpenTimelineIO project - -from .. core._core_utils import add_method -from .. import _otio - - -@add_method(_otio.Track) -def each_clip(self, search_range=None, shallow_search=False): - """Generator that returns each clip contained in the track - in the order in which it is found. - - .. deprecated:: 0.14.0 - Use :meth:`clip_if` instead. - - :param TimeRange search_range: if specified, only children whose range overlaps with - the search range will be yielded. - :param bool shallow_search: if True, will only search children of self and not - recurse into children of children. - """ - yield from self.clip_if(search_range, shallow_search) diff --git a/tests/test_clip.py b/tests/test_clip.py index 8eef333ea..1cab19b18 100644 --- a/tests/test_clip.py +++ b/tests/test_clip.py @@ -36,9 +36,9 @@ def test_cons(self): decoded = otio.adapters.otio_json.read_from_string(encoded) self.assertIsOTIOEquivalentTo(cl, decoded) - def test_each_clip(self): + def test_find_clips(self): cl = otio.schema.Clip(name="test_clip") - self.assertEqual(list(cl.each_clip()), [cl]) + self.assertEqual(list(cl.find_clips()), [cl]) def test_str(self): cl = otio.schema.Clip(name="test_clip") diff --git a/tests/test_cmx_3600_adapter.py b/tests/test_cmx_3600_adapter.py index 1071c8175..b07346865 100755 --- a/tests/test_cmx_3600_adapter.py +++ b/tests/test_cmx_3600_adapter.py @@ -1316,7 +1316,7 @@ def test_enabled(self): self.assertMultiLineEqual(result, expected) # Disable first clip in the track - tl.tracks[0].children_if()[0].enabled = False + tl.tracks[0].find_children()[0].enabled = False result = otio.adapters.write_to_string(tl, adapter_name="cmx_3600") expected = r'''TITLE: enable_test diff --git a/tests/test_composition.py b/tests/test_composition.py index 4c11c4f9f..40d4e9f4b 100755 --- a/tests/test_composition.py +++ b/tests/test_composition.py @@ -30,9 +30,9 @@ def test_iterable(self): self.assertEqual([i for i in co], [it]) self.assertEqual(len(co), 1) - self.assertEqual(list(co.each_child()), [it]) + self.assertEqual(list(co.find_children()), [it]) self.assertEqual( - list(co.each_child(descended_from_type=otio.schema.Clip)), + list(co.find_children(descended_from_type=otio.schema.Clip)), [] ) @@ -124,7 +124,7 @@ def test_move_child(self): co2.append(it) self.assertIs(it.parent(), co2) - def test_each_child_recursion(self): + def test_find_children_recursion(self): tl = otio.schema.Timeline(name="TL") tr1 = otio.schema.Track(name="tr1") @@ -160,13 +160,13 @@ def test_each_child_recursion(self): self.assertEqual(2, len(st)) self.assertEqual(2, len(tr3)) - clips = list(tl.each_clip()) + clips = list(tl.find_clips()) self.assertListEqual( [c1, c2, c3, c4, c5, c6, c7, c8], clips ) - all_tracks = list(tl.each_child( + all_tracks = list(tl.find_children( descended_from_type=otio.schema.Track )) self.assertListEqual( @@ -174,7 +174,7 @@ def test_each_child_recursion(self): all_tracks ) - all_stacks = list(tl.each_child( + all_stacks = list(tl.find_children( descended_from_type=otio.schema.Stack )) self.assertListEqual( @@ -182,13 +182,13 @@ def test_each_child_recursion(self): all_stacks ) - all_children = list(tl.each_child()) + all_children = list(tl.find_children()) self.assertListEqual( [tr1, c1, c2, c3, tr2, c4, c5, st, c6, tr3, c7, c8], all_children ) - def test_each_child_options(self): + def test_find_children_options(self): tl = otio.schema.Timeline(name="tl") tr = otio.schema.Track(name="tr") tl.tracks.append(tr) @@ -229,7 +229,7 @@ def test_each_child_options(self): self.assertListEqual( [c1], list( - tr.each_child( + tr.find_children( search_range=otio.opentime.TimeRange( start_time=otio.opentime.RationalTime(value=0, rate=24), duration=otio.opentime.RationalTime(value=50, rate=24) @@ -240,7 +240,7 @@ def test_each_child_options(self): self.assertListEqual( [c2], list( - tr.each_child( + tr.find_children( search_range=otio.opentime.TimeRange( start_time=otio.opentime.RationalTime(value=50, rate=24), duration=otio.opentime.RationalTime(value=50, rate=24) @@ -251,7 +251,7 @@ def test_each_child_options(self): self.assertListEqual( [c1, c2], list( - tr.each_child( + tr.find_children( search_range=otio.opentime.TimeRange( start_time=otio.opentime.RationalTime(value=0, rate=24), duration=otio.opentime.RationalTime(value=100, rate=24) @@ -262,7 +262,7 @@ def test_each_child_options(self): self.assertListEqual( [c1, c2, st, c3], list( - tr.each_child( + tr.find_children( search_range=otio.opentime.TimeRange( start_time=otio.opentime.RationalTime(value=25, rate=24), duration=otio.opentime.RationalTime(value=100, rate=24) @@ -274,18 +274,18 @@ def test_each_child_options(self): # Test descended from type self.assertListEqual( [c1, c2, c3], - list(tl.each_child(descended_from_type=otio.schema.Clip)) + list(tl.find_children(descended_from_type=otio.schema.Clip)) ) self.assertListEqual( [st], - list(tl.each_child(descended_from_type=otio.schema.Stack)) + list(tl.find_children(descended_from_type=otio.schema.Stack)) ) # Test shallow search self.assertListEqual( [c1, c2], list( - tr.each_child( + tr.find_children( descended_from_type=otio.schema.Clip, shallow_search=True ) @@ -1369,11 +1369,11 @@ def test_range_nested(self): self.assertListEqual( [ outer_track.range_of_child(clip) - for clip in outer_track.each_clip() + for clip in outer_track.find_clips() ], [ long_track.range_of_child(clip) - for clip in long_track.each_clip() + for clip in long_track.find_clips() ] ) @@ -1456,7 +1456,7 @@ def test_transformed_time(self): self.assertEqual( list( - sq.each_clip( + sq.find_clips( otio.opentime.TimeRange( otio.opentime.RationalTime(-1, 24) ) @@ -1466,7 +1466,7 @@ def test_transformed_time(self): ) self.assertEqual( list( - sq.each_clip( + sq.find_clips( otio.opentime.TimeRange( otio.opentime.RationalTime(0, 24) ) @@ -1476,7 +1476,7 @@ def test_transformed_time(self): ) self.assertEqual( list( - sq.each_clip( + sq.find_clips( otio.opentime.TimeRange( otio.opentime.RationalTime(49, 24) ) @@ -1486,7 +1486,7 @@ def test_transformed_time(self): ) self.assertEqual( list( - sq.each_clip( + sq.find_clips( otio.opentime.TimeRange( otio.opentime.RationalTime(50, 24) ) @@ -1496,7 +1496,7 @@ def test_transformed_time(self): ) self.assertEqual( list( - sq.each_clip( + sq.find_clips( otio.opentime.TimeRange( otio.opentime.RationalTime(99, 24) ) @@ -1506,7 +1506,7 @@ def test_transformed_time(self): ) self.assertEqual( list( - sq.each_clip( + sq.find_clips( otio.opentime.TimeRange( otio.opentime.RationalTime(100, 24) ) @@ -1516,7 +1516,7 @@ def test_transformed_time(self): ) self.assertEqual( list( - sq.each_clip( + sq.find_clips( otio.opentime.TimeRange( otio.opentime.RationalTime(149, 24) ) @@ -1526,7 +1526,7 @@ def test_transformed_time(self): ) self.assertEqual( list( - sq.each_clip( + sq.find_clips( otio.opentime.TimeRange( otio.opentime.RationalTime(150, 24) ) @@ -1693,7 +1693,7 @@ def test_track_range_of_all_children(self): mp = tr.range_of_all_children() # fetch all the valid children that should be in the map - vc = list(tr.each_clip()) + vc = list(tr.find_clips()) self.assertEqual(mp[vc[0]].start_time.value, 0) self.assertEqual(mp[vc[1]].start_time, mp[vc[0]].duration) @@ -1757,7 +1757,7 @@ def test_iterating_over_dupes(self): # test recursive iteration previous = None - for item in track.each_clip(): + for item in track.find_clips(): self.assertEqual( track.range_of_child(item), item.range_in_parent() @@ -1787,7 +1787,7 @@ def test_iterating_over_dupes(self): # compare recursive to iteration by index previous = None - for i, item in enumerate(track.each_clip()): + for i, item in enumerate(track.find_clips()): self.assertEqual( track.range_of_child(item), track.range_of_child_at_index(i) @@ -2105,13 +2105,13 @@ def test_child_at_time_with_children(self): "got {}".format(playhead, expected_val, measured_val) ) - # then test each_child + # then test find_clips search_range = otio.opentime.TimeRange( otio.opentime.RationalTime(frame, 24), # with a 0 duration, should have the same result as above ) - item = list(sq.each_clip(search_range))[0] + item = list(sq.find_clips(search_range))[0] mediaframe = sq.transformed_time(playhead, item) measured_val = (item.name, otio.opentime.to_frames(mediaframe, 24)) diff --git a/tests/test_fcp7_xml_adapter.py b/tests/test_fcp7_xml_adapter.py index 4139e3469..b355ace78 100644 --- a/tests/test_fcp7_xml_adapter.py +++ b/tests/test_fcp7_xml_adapter.py @@ -1166,12 +1166,12 @@ def test_roundtrip_mem2disk2mem(self): }, ) - v0 = schema.Track(kind=schema.track.TrackKind.Video) - v1 = schema.Track(kind=schema.track.TrackKind.Video) + v0 = schema.Track(kind=schema.TrackKind.Video) + v1 = schema.Track(kind=schema.TrackKind.Video) timeline.tracks.extend([v0, v1]) - a0 = schema.Track(kind=schema.track.TrackKind.Audio) + a0 = schema.Track(kind=schema.TrackKind.Audio) timeline.tracks.append(a0) @@ -1310,7 +1310,7 @@ def test_roundtrip_mem2disk2mem(self): # serialization (things like unique ids minted by the adapter) # Since we seeded metadata for the generator, keep that metadata del new_timeline.metadata["fcp_xml"] - for child in new_timeline.tracks.each_child(): + for child in new_timeline.tracks.find_children(): try: del child.metadata["fcp_xml"] except KeyError: @@ -1356,7 +1356,7 @@ def scrub_displayformat(md_dict): except AttributeError: pass - for child in timeline.tracks.each_child(): + for child in timeline.tracks.find_children(): scrub_displayformat(child.metadata) try: scrub_displayformat(child.media_reference.metadata) @@ -1386,7 +1386,7 @@ def test_hiero_flavored_xml(self): self.assertTrue(len(timeline.tracks), 1) self.assertTrue(timeline.tracks[0].name == 'Video 1') - clips = [c for c in timeline.tracks[0].each_clip()] + clips = [c for c in timeline.tracks[0].find_clips()] self.assertTrue(len(clips), 2) self.assertTrue(clips[0].name == 'A160C005_171213_R0MN') diff --git a/tests/test_item.py b/tests/test_item.py index 8717f3892..1df96245e 100755 --- a/tests/test_item.py +++ b/tests/test_item.py @@ -437,7 +437,7 @@ def test_visible_range(self): self.maxDiff = None self.assertListEqual( ["A", "B", "C", "D"], - [item.name for item in timeline.each_clip()] + [item.name for item in timeline.find_clips()] ) self.assertListEqual( [ @@ -482,7 +482,7 @@ def test_visible_range(self): ) ), ], - [item.trimmed_range() for item in timeline.each_clip()] + [item.trimmed_range() for item in timeline.find_clips()] ) self.assertListEqual( @@ -528,7 +528,7 @@ def test_visible_range(self): ) ), ], - [item.visible_range() for item in timeline.each_clip()] + [item.visible_range() for item in timeline.find_clips()] ) diff --git a/tests/test_otiod.py b/tests/test_otiod.py index b03eb1faa..f62253c91 100644 --- a/tests/test_otiod.py +++ b/tests/test_otiod.py @@ -42,7 +42,7 @@ def setUp(self): # convert to contrived local reference last_rel = False - for cl in tl.each_clip(): + for cl in tl.find_clips(): # vary the relative and absolute paths, make sure that both work next_rel = ( MEDIA_EXAMPLE_PATH_URL_REL if last_rel else MEDIA_EXAMPLE_PATH_URL_ABS @@ -65,7 +65,7 @@ def test_file_bundle_manifest_missing_reference(self): ) self.assertEqual(manifest, {}) - for cl in result_otio.each_clip(): + for cl in result_otio.find_clips(): self.assertIsInstance( cl.media_reference, otio.schema.MissingReference, @@ -112,14 +112,14 @@ def test_round_trip(self): tmp_path, ) - for cl in result.each_clip(): + for cl in result.find_clips(): self.assertNotEqual( cl.media_reference.target_url, MEDIA_EXAMPLE_PATH_URL_REL ) # conform media references in input to what they should be in the output - for cl in self.tl.each_clip(): + for cl in self.tl.find_clips(): # construct an absolute file path to the result cl.media_reference.target_url = ( otio.url_utils.url_from_filepath( @@ -149,7 +149,7 @@ def test_round_trip_all_missing_references(self): absolute_media_reference_paths=True ) - for cl in result.each_clip(): + for cl in result.find_clips(): self.assertIsInstance( cl.media_reference, otio.schema.MissingReference @@ -166,14 +166,14 @@ def test_round_trip_absolute_paths(self): absolute_media_reference_paths=True ) - for cl in result.each_clip(): + for cl in result.find_clips(): self.assertNotEqual( cl.media_reference.target_url, MEDIA_EXAMPLE_PATH_URL_REL ) # conform media references in input to what they should be in the output - for cl in self.tl.each_clip(): + for cl in self.tl.find_clips(): # should be only field that changed cl.media_reference.target_url = ( otio.url_utils.url_from_filepath( diff --git a/tests/test_otioz.py b/tests/test_otioz.py index 02f0e2961..09ed409e8 100644 --- a/tests/test_otioz.py +++ b/tests/test_otioz.py @@ -43,7 +43,7 @@ def setUp(self): # convert to contrived local reference last_rel = False - for cl in tl.each_clip(): + for cl in tl.find_clips(): # vary the relative and absolute paths, make sure that both work next_rel = ( MEDIA_EXAMPLE_PATH_URL_REL @@ -74,7 +74,7 @@ def test_not_a_file_error(self): tmp_path = tempfile.mkstemp(suffix=".otioz", text=False)[1] with tempfile.NamedTemporaryFile() as bogusfile: fname = bogusfile.name - for cl in self.tl.each_clip(): + for cl in self.tl.find_clips(): # write with a non-file schema cl.media_reference = otio.schema.ExternalReference( target_url=f"http://{fname}" @@ -82,7 +82,7 @@ def test_not_a_file_error(self): with self.assertRaises(otio.exceptions.OTIOError): otio.adapters.write_to_file(self.tl, tmp_path, dryrun=True) - for cl in self.tl.each_clip(): + for cl in self.tl.find_clips(): cl.media_reference = otio.schema.ExternalReference( target_url=otio.url_utils.url_from_filepath(fname) ) @@ -92,7 +92,7 @@ def test_not_a_file_error(self): tempdir = tempfile.mkdtemp() fname = tempdir shutil.rmtree(tempdir) - for cl in self.tl.each_clip(): + for cl in self.tl.find_clips(): cl.media_reference = otio.schema.ExternalReference(target_url=fname) def test_colliding_basename(self): @@ -105,7 +105,7 @@ def test_colliding_basename(self): MEDIA_EXAMPLE_PATH_ABS, new_path ) - list(self.tl.each_clip())[0].media_reference.target_url = ( + list(self.tl.find_clips())[0].media_reference.target_url = ( otio.url_utils.url_from_filepath(new_path) ) @@ -126,7 +126,7 @@ def test_round_trip(self): result = otio.adapters.read_from_file(tmp_path) - for cl in result.each_clip(): + for cl in result.find_clips(): self.assertNotIn( cl.media_reference.target_url, [MEDIA_EXAMPLE_PATH_URL_ABS, MEDIA_EXAMPLE_PATH_URL_REL] @@ -142,7 +142,7 @@ def test_round_trip(self): ) # conform media references in input to what they should be in the output - for cl in self.tl.each_clip(): + for cl in self.tl.find_clips(): # should be only field that changed cl.media_reference.target_url = "media/{}".format( os.path.basename(cl.media_reference.target_url) @@ -163,14 +163,14 @@ def test_round_trip_with_extraction(self): ) # make sure that all the references are ExternalReference - for cl in result.each_clip(): + for cl in result.find_clips(): self.assertIsInstance( cl.media_reference, otio.schema.ExternalReference ) # conform media references in input to what they should be in the output - for cl in self.tl.each_clip(): + for cl in self.tl.find_clips(): # should be only field that changed cl.media_reference.target_url = "media/{}".format( os.path.basename(cl.media_reference.target_url) @@ -238,7 +238,7 @@ def test_round_trip_with_extraction_no_media(self): ) # conform media references in input to what they should be in the output - for cl in result.each_clip(): + for cl in result.find_clips(): # should be all MissingReferences self.assertIsInstance( cl.media_reference, diff --git a/tests/test_serializableCollection.cpp b/tests/test_serializableCollection.cpp index 831ce0c4f..1956b28e2 100644 --- a/tests/test_serializableCollection.cpp +++ b/tests/test_serializableCollection.cpp @@ -19,7 +19,7 @@ main(int argc, char** argv) Tests tests; tests.add_test( - "test_children_if", [] { + "test_find_children", [] { using namespace otio; otio::SerializableObject::Retainer cl = new otio::Clip(); @@ -33,12 +33,12 @@ main(int argc, char** argv) sc = new otio::SerializableCollection(); sc->insert_child(0, tl); opentimelineio::v1_0::ErrorStatus err; - auto result = sc->children_if(&err, {}, false); + auto result = sc->find_children(&err, {}, false); assertEqual(result.size(), 1); assertEqual(result[0].value, cl.value); }); tests.add_test( - "test_children_if_search_range", [] { + "test_find_children_search_range", [] { using namespace otio; const TimeRange range(RationalTime(0.0, 24.0), RationalTime(24.0, 24.0)); otio::SerializableObject::Retainer cl0 = @@ -62,12 +62,12 @@ main(int argc, char** argv) sc = new otio::SerializableCollection(); sc->insert_child(0, tl); opentimelineio::v1_0::ErrorStatus err; - auto result = sc->children_if(&err, range); + auto result = sc->find_children(&err, range); assertEqual(result.size(), 1); assertEqual(result[0].value, cl0.value); }); tests.add_test( - "test_children_if_shallow_search", [] { + "test_find_children_shallow_search", [] { using namespace otio; otio::SerializableObject::Retainer cl = new otio::Clip(); @@ -81,9 +81,9 @@ main(int argc, char** argv) sc = new otio::SerializableCollection(); sc->insert_child(0, tl); opentimelineio::v1_0::ErrorStatus err; - auto result = sc->children_if(&err, nullopt, true); + auto result = sc->find_children(&err, nullopt, true); assertEqual(result.size(), 0); - result = sc->children_if(&err, nullopt, false); + result = sc->find_children(&err, nullopt, false); assertEqual(result.size(), 1); assertEqual(result[0].value, cl.value); }); diff --git a/tests/test_serializable_collection.py b/tests/test_serializable_collection.py index e6a99ae15..4be752d30 100644 --- a/tests/test_serializable_collection.py +++ b/tests/test_serializable_collection.py @@ -37,7 +37,7 @@ def test_iterable(self): children=[self.sc] ) - self.assertEqual(len(list(sc.each_clip())), 1) + self.assertEqual(len(list(sc.find_clips())), 1) # test deleting an item tmp = self.sc[0] @@ -74,7 +74,7 @@ def test_repr(self): ")" ) - def test_children_if(self): + def test_find_children(self): cl = otio.schema.Clip() tr = otio.schema.Track() tr.append(cl) @@ -82,11 +82,11 @@ def test_children_if(self): tl.tracks.append(tr) sc = otio.schema.SerializableCollection() sc.append(tl) - result = sc.children_if(otio.schema.Clip) + result = sc.find_children(otio.schema.Clip) self.assertEqual(len(result), 1) self.assertEqual(result[0], cl) - def test_children_if_search_range(self): + def test_find_children_search_range(self): range = otio.opentime.TimeRange( otio.opentime.RationalTime(0.0, 24.0), otio.opentime.RationalTime(24.0, 24.0)) @@ -104,11 +104,11 @@ def test_children_if_search_range(self): tl.tracks.append(tr) sc = otio.schema.SerializableCollection() sc.append(tl) - result = sc.children_if(otio.schema.Clip, range) + result = sc.find_children(otio.schema.Clip, range) self.assertEqual(len(result), 1) self.assertEqual(result[0], cl0) - def test_children_if_shallow_search(self): + def test_find_children_shallow_search(self): cl = otio.schema.Clip() tr = otio.schema.Track() tr.append(cl) @@ -116,9 +116,9 @@ def test_children_if_shallow_search(self): tl.tracks.append(tr) sc = otio.schema.SerializableCollection() sc.append(tl) - result = sc.children_if(otio.schema.Clip, shallow_search=True) + result = sc.find_children(otio.schema.Clip, shallow_search=True) self.assertEqual(len(result), 0) - result = sc.children_if(otio.schema.Clip, shallow_search=False) + result = sc.find_children(otio.schema.Clip, shallow_search=False) self.assertEqual(len(result), 1) self.assertEqual(result[0], cl) diff --git a/tests/test_timeline.cpp b/tests/test_timeline.cpp index ac9970f2e..b8022a530 100644 --- a/tests/test_timeline.cpp +++ b/tests/test_timeline.cpp @@ -18,7 +18,7 @@ main(int argc, char** argv) Tests tests; tests.add_test( - "test_children_if", [] { + "test_find_children", [] { using namespace otio; otio::SerializableObject::Retainer cl = new otio::Clip(); @@ -29,12 +29,12 @@ main(int argc, char** argv) new otio::Timeline(); tl->tracks()->append_child(tr); opentimelineio::v1_0::ErrorStatus err; - auto result = tl->children_if(&err); + auto result = tl->find_children(&err); assertEqual(result.size(), 1); assertEqual(result[0].value, cl.value); }); tests.add_test( - "test_children_if_search_range", [] { + "test_find_children_search_range", [] { using namespace otio; const TimeRange range(RationalTime(0.0, 24.0), RationalTime(24.0, 24.0)); otio::SerializableObject::Retainer cl0 = @@ -55,12 +55,12 @@ main(int argc, char** argv) new otio::Timeline(); tl->tracks()->append_child(tr); opentimelineio::v1_0::ErrorStatus err; - auto result = tl->children_if(&err, range); + auto result = tl->find_children(&err, range); assertEqual(result.size(), 1); assertEqual(result[0].value, cl0.value); }); tests.add_test( - "test_children_if_shallow_search", [] { + "test_find_children_shallow_search", [] { using namespace otio; otio::SerializableObject::Retainer cl = new otio::Clip(); @@ -71,9 +71,9 @@ main(int argc, char** argv) new otio::Timeline(); tl->tracks()->append_child(tr); opentimelineio::v1_0::ErrorStatus err; - auto result = tl->children_if(&err, nullopt, true); + auto result = tl->find_children(&err, nullopt, true); assertEqual(result.size(), 0); - result = tl->children_if(&err, nullopt, false); + result = tl->find_children(&err, nullopt, false); assertEqual(result.size(), 1); assertEqual(result[0].value, cl.value); }); diff --git a/tests/test_timeline.py b/tests/test_timeline.py index 77c2f00e7..e50eb8b05 100755 --- a/tests/test_timeline.py +++ b/tests/test_timeline.py @@ -392,27 +392,27 @@ def test_iterators(self): ) tl.tracks[0].append(cl) tl.tracks[0].extend([cl2, cl3]) - self.assertEqual([cl, cl2, cl3], list(tl.each_clip())) + self.assertEqual([cl, cl2, cl3], list(tl.find_clips())) rt_start = otio.opentime.RationalTime(0, 24) rt_end = otio.opentime.RationalTime(1, 24) search_range = otio.opentime.TimeRange(rt_start, rt_end) - self.assertEqual([cl], list(tl.each_clip(search_range))) + self.assertEqual([cl], list(tl.find_clips(search_range))) # check to see if full range works search_range = tl.tracks.trimmed_range() - self.assertEqual([cl, cl2, cl3], list(tl.each_clip(search_range))) + self.assertEqual([cl, cl2, cl3], list(tl.find_clips(search_range))) # just one clip search_range = cl2.range_in_parent() - self.assertEqual([cl2], list(tl.each_clip(search_range))) + self.assertEqual([cl2], list(tl.find_clips(search_range))) # the last two clips search_range = otio.opentime.TimeRange( start_time=cl2.range_in_parent().start_time, duration=cl2.trimmed_range().duration + rt_end ) - self.assertEqual([cl2, cl3], list(tl.each_clip(search_range))) + self.assertEqual([cl2, cl3], list(tl.find_clips(search_range))) # no clips search_range = otio.opentime.TimeRange( @@ -422,7 +422,7 @@ def test_iterators(self): ), duration=rt_end ) - self.assertEqual([], list(tl.each_clip(search_range))) + self.assertEqual([], list(tl.find_clips(search_range))) def test_str(self): self.maxDiff = None @@ -541,17 +541,17 @@ def test_tracks_set_null_tracks(self): self.assertEqual(len(tl.video_tracks()), 0) self.assertTrue(isinstance(tl.tracks, otio.schema.Stack)) - def test_children_if(self): + def test_find_children(self): cl = otio.schema.Clip() tr = otio.schema.Track() tr.append(cl) tl = otio.schema.Timeline() tl.tracks.append(tr) - result = tl.children_if(otio.schema.Clip) + result = tl.find_children(otio.schema.Clip) self.assertEqual(len(result), 1) self.assertEqual(result[0], cl) - def test_children_if_search_range(self): + def test_find_children_search_range(self): range = otio.opentime.TimeRange( otio.opentime.RationalTime(0.0, 24.0), otio.opentime.RationalTime(24.0, 24.0)) @@ -567,19 +567,19 @@ def test_children_if_search_range(self): tr.append(cl2) tl = otio.schema.Timeline() tl.tracks.append(tr) - result = tl.children_if(otio.schema.Clip, range) + result = tl.find_children(otio.schema.Clip, range) self.assertEqual(len(result), 1) self.assertEqual(result[0], cl0) - def test_children_if_shallow_search(self): + def test_find_children_shallow_search(self): cl = otio.schema.Clip() tr = otio.schema.Track() tr.append(cl) tl = otio.schema.Timeline() tl.tracks.append(tr) - result = tl.children_if(otio.schema.Clip, shallow_search=True) + result = tl.find_children(otio.schema.Clip, shallow_search=True) self.assertEqual(len(result), 0) - result = tl.children_if(otio.schema.Clip, shallow_search=False) + result = tl.find_children(otio.schema.Clip, shallow_search=False) self.assertEqual(len(result), 1) self.assertEqual(result[0], cl) diff --git a/tests/test_track.cpp b/tests/test_track.cpp index d66fcbfb5..96ae06145 100644 --- a/tests/test_track.cpp +++ b/tests/test_track.cpp @@ -18,7 +18,7 @@ main(int argc, char** argv) Tests tests; tests.add_test( - "test_children_if", [] { + "test_find_children", [] { using namespace otio; otio::SerializableObject::Retainer cl = new otio::Clip(); @@ -26,12 +26,12 @@ main(int argc, char** argv) new otio::Track(); tr->append_child(cl); opentimelineio::v1_0::ErrorStatus err; - auto result = tr->children_if(&err); + auto result = tr->find_children(&err); assertEqual(result.size(), 1); assertEqual(result[0].value, cl.value); }); tests.add_test( - "test_children_if_search_range", [] { + "test_find_children_search_range", [] { using namespace otio; const TimeRange range(RationalTime(0.0, 24.0), RationalTime(24.0, 24.0)); otio::SerializableObject::Retainer cl0 = @@ -49,34 +49,34 @@ main(int argc, char** argv) tr->append_child(cl1); tr->append_child(cl2); opentimelineio::v1_0::ErrorStatus err; - auto result = tr->children_if( + auto result = tr->find_children( &err, TimeRange(RationalTime(0.0, 24.0), RationalTime(24.0, 24.0))); assertEqual(result.size(), 1); assertEqual(result[0].value, cl0.value); - result = tr->children_if( + result = tr->find_children( &err, TimeRange(RationalTime(24.0, 24.0), RationalTime(24.0, 24.0))); assertEqual(result.size(), 1); assertEqual(result[0].value, cl1.value); - result = tr->children_if( + result = tr->find_children( &err, TimeRange(RationalTime(48.0, 24.0), RationalTime(24.0, 24.0))); assertEqual(result.size(), 1); assertEqual(result[0].value, cl2.value); - result = tr->children_if( + result = tr->find_children( &err, TimeRange(RationalTime(0.0, 24.0), RationalTime(48.0, 24.0))); assertEqual(result.size(), 2); assertEqual(result[0].value, cl0.value); assertEqual(result[1].value, cl1.value); - result = tr->children_if( + result = tr->find_children( &err, TimeRange(RationalTime(24.0, 24.0), RationalTime(48.0, 24.0))); assertEqual(result.size(), 2); assertEqual(result[0].value, cl1.value); assertEqual(result[1].value, cl2.value); - result = tr->children_if( + result = tr->find_children( &err, TimeRange(RationalTime(0.0, 24.0), RationalTime(72.0, 24.0))); assertEqual(result.size(), 3); @@ -85,7 +85,7 @@ main(int argc, char** argv) assertEqual(result[2].value, cl2.value); }); tests.add_test( - "test_children_if_shallow_search", [] { + "test_find_children_shallow_search", [] { using namespace otio; otio::SerializableObject::Retainer cl0 = new otio::Clip(); @@ -99,10 +99,10 @@ main(int argc, char** argv) tr->append_child(cl0); tr->append_child(st); opentimelineio::v1_0::ErrorStatus err; - auto result = tr->children_if(&err, nullopt, true); + auto result = tr->find_children(&err, nullopt, true); assertEqual(result.size(), 1); assertEqual(result[0].value, cl0.value); - result = tr->children_if(&err, nullopt, false); + result = tr->find_children(&err, nullopt, false); assertEqual(result.size(), 2); assertEqual(result[0].value, cl0.value); assertEqual(result[1].value, cl1.value); diff --git a/tests/test_track.py b/tests/test_track.py index 6c2d765ff..fb2caccc7 100644 --- a/tests/test_track.py +++ b/tests/test_track.py @@ -10,15 +10,15 @@ class TrackTests(unittest.TestCase, otio_test_utils.OTIOAssertions): - def test_children_if(self): + def test_find_children(self): cl = otio.schema.Clip() tr = otio.schema.Track() tr.append(cl) - result = tr.children_if(otio.schema.Clip) + result = tr.find_children(otio.schema.Clip) self.assertEqual(len(result), 1) self.assertEqual(result[0], cl) - def test_children_if_search_range(self): + def test_find_children_search_range(self): range = otio.opentime.TimeRange( otio.opentime.RationalTime(0.0, 24.0), otio.opentime.RationalTime(24.0, 24.0)) @@ -32,11 +32,11 @@ def test_children_if_search_range(self): tr.append(cl0) tr.append(cl1) tr.append(cl2) - result = tr.children_if(otio.schema.Clip, range) + result = tr.find_children(otio.schema.Clip, range) self.assertEqual(len(result), 1) self.assertEqual(result[0], cl0) - def test_children_if_shallow_search(self): + def test_find_children_shallow_search(self): cl0 = otio.schema.Clip() cl1 = otio.schema.Clip() st = otio.schema.Stack() @@ -44,10 +44,10 @@ def test_children_if_shallow_search(self): tr = otio.schema.Track() tr.append(cl0) tr.append(st) - result = tr.children_if(otio.schema.Clip, shallow_search=True) + result = tr.find_children(otio.schema.Clip, shallow_search=True) self.assertEqual(len(result), 1) self.assertEqual(result[0], cl0) - result = tr.children_if(otio.schema.Clip, shallow_search=False) + result = tr.find_children(otio.schema.Clip, shallow_search=False) self.assertEqual(len(result), 2) self.assertEqual(result[0], cl0) self.assertEqual(result[1], cl1)