Skip to content

Commit b1c3792

Browse files
committed
Updated constructors and reprs to better match expectations
Signed-off-by: Eric Reinecke <ereinecke@netflix.com>
1 parent 3dce4a6 commit b1c3792

4 files changed

Lines changed: 22 additions & 15 deletions

File tree

src/py-opentimelineio/opentimelineio-bindings/otio_serializableObjects.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -803,13 +803,11 @@ static void define_stream_effects(py::module m) {
803803
"Use this to select a stereo view, specific audio channels, etc. "
804804
"The item will expose these streams downstream with the same naming.")
805805
.def(py::init([](std::string name,
806-
std::string effect_name,
807806
std::vector<std::string> output_streams,
808807
py::object metadata) {
809-
return new StreamSelector(name, effect_name, output_streams,
808+
return new StreamSelector(name, "StreamSelector", output_streams,
810809
py_to_any_dictionary(metadata)); }),
811810
py::arg_v("name"_a = std::string()),
812-
"effect_name"_a = std::string(),
813811
"output_streams"_a = std::vector<std::string>(),
814812
py::arg_v("metadata"_a = py::none()))
815813
.def_property("output_streams",
@@ -827,13 +825,11 @@ static void define_stream_effects(py::module m) {
827825
"well-known StreamInfo.Identifier value -- for example, to expose the "
828826
"left eye of a stereo source as the conventional monocular stream.")
829827
.def(py::init([](std::string name,
830-
std::string effect_name,
831828
StreamMapper::StreamMap stream_map,
832829
py::object metadata) {
833-
return new StreamMapper(name, effect_name, stream_map,
830+
return new StreamMapper(name, "StreamMapper", stream_map,
834831
py_to_any_dictionary(metadata)); }),
835832
py::arg_v("name"_a = std::string()),
836-
"effect_name"_a = std::string(),
837833
"stream_map"_a = StreamMapper::StreamMap(),
838834
py::arg_v("metadata"_a = py::none()))
839835
.def_property("stream_map",

src/py-opentimelineio/opentimelineio/schema/stream_mapper.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,25 @@
77

88
@add_method(_otio.StreamMapper)
99
def __str__(self):
10-
return "StreamMapper({})".format(str(self.name))
10+
return (
11+
"StreamMapper("
12+
"{}, "
13+
"{}"
14+
")".format(
15+
str(self.name),
16+
str(self.stream_map),
17+
)
18+
)
1119

1220

1321
@add_method(_otio.StreamMapper)
1422
def __repr__(self):
15-
return "otio.schema.StreamMapper(name={})".format(repr(self.name))
23+
return (
24+
"otio.schema.StreamMapper("
25+
"name={}, "
26+
"stream_map={}"
27+
")".format(
28+
repr(self.name),
29+
repr(self.stream_map),
30+
)
31+
)

src/py-opentimelineio/opentimelineio/schema/stream_selector.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@ def __str__(self):
1010
return (
1111
"StreamSelector("
1212
"{}, "
13-
"{}, "
1413
"{}"
1514
")".format(
1615
str(self.name),
17-
str(self.effect_name),
1816
str(self.output_streams),
1917
)
2018
)
@@ -25,11 +23,9 @@ def __repr__(self):
2523
return (
2624
"otio.schema.StreamSelector("
2725
"name={}, "
28-
"effect_name={}, "
2926
"output_streams={}"
3027
")".format(
3128
repr(self.name),
32-
repr(self.effect_name),
3329
repr(self.output_streams),
3430
)
3531
)

tests/test_stream_mapping.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,12 @@ class TestStreamSelector(unittest.TestCase):
159159
def test_create_default(self):
160160
sel = otio.schema.StreamSelector()
161161
self.assertEqual(sel.name, "")
162-
self.assertEqual(sel.effect_name, "")
162+
self.assertEqual(sel.effect_name, "StreamSelector")
163163
self.assertEqual(sel.output_streams, [])
164164

165165
def test_create_with_streams(self):
166166
sel = otio.schema.StreamSelector(
167167
name="stereo_select",
168-
effect_name="StreamSelector",
169168
output_streams=[
170169
StreamInfo.Identifier.stereo_left,
171170
StreamInfo.Identifier.stereo_right,
@@ -420,7 +419,7 @@ def test_use_as_clip_effect(self):
420419
self.assertEqual(len(restored.effects), 1)
421420
mapper = restored.effects[0]
422421
self.assertIsInstance(mapper, otio.schema.StreamMapper)
423-
self.assertEqual(mapper.name, "A very bad stereo downmix")
422+
self.assertEqual(mapper.name, "a very bad stereo downmix")
424423
self.assertEqual(
425424
mapper.stream_map[StreamInfo.Identifier.stereo_left],
426425
StreamInfo.Identifier.surround_left_front

0 commit comments

Comments
 (0)