Skip to content

Commit

Permalink
Remove the transform field. (#12)
Browse files Browse the repository at this point in the history
* Remove the transform field.

* PEP8 pass.

* Pyflakes pass + add pyflakes make target.
  • Loading branch information
ssteinbach authored and jminor committed Sep 30, 2016
1 parent 0d38c71 commit e08b4d3
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 60 deletions.
4 changes: 4 additions & 0 deletions Makefile
Expand Up @@ -21,3 +21,7 @@ autopep8:
# run the codebase through pep8
pep8:
@find . -name "*.py" | xargs pep8

# run the codebase through pyflakes
pyflakes:
@find . -name "*.py" | grep -v "__init__.py" | xargs pyflakes
2 changes: 0 additions & 2 deletions opentimelineio/adapters/cmx_3600.py
Expand Up @@ -5,7 +5,6 @@

import os
import re
from warnings import warn

import opentimelineio as otio

Expand Down Expand Up @@ -53,7 +52,6 @@ def __init__(self, edl_string):

def _add_clip(self, line, comments):
comment_handler = CommentHandler(comments)
comment_data = comment_handler.handled
clip_handler = ClipHandler(line, comment_handler.handled)
if comment_handler.unhandled:
clip_handler.clip.metadata['cmx_3600'] = comment_handler.unhandled
Expand Down
19 changes: 2 additions & 17 deletions opentimelineio/core/composition.py
Expand Up @@ -5,10 +5,6 @@
import collections
import itertools

from .. import (
opentime,
)

from . import (
serializeable_object,
type_registry,
Expand All @@ -27,7 +23,6 @@ def __init__(
name=None,
children=None,
source_range=None,
transform=None,
metadata=None
):
item.Item.__init__(
Expand All @@ -43,21 +38,18 @@ def __init__(
else:
self.children = children

self.transform = transform

children = serializeable_object.serializeable_field("children")

@property
def composition_kind(self):
return self._composition_kind

def __str__(self):
return "{}({}, {}, {}, {}, {})".format(
return "{}({}, {}, {}, {})".format(
self._composition_kind,
str(self.name),
str(self.children),
str(self.source_range),
str(self.transform),
str(self.metadata)
)

Expand All @@ -67,27 +59,20 @@ def __repr__(self):
"name={}, "
"children={}, "
"source_range={}, "
"transform={}, "
"metadata={}"
")".format(
self._modname,
self._composition_kind,
repr(self.name),
repr(self.children),
repr(self.source_range),
repr(self.transform),
repr(self.metadata)
)
)

transform = serializeable_object.serializeable_field(
"transform",
opentime.TimeTransform
)
transform = serializeable_object.deprecated_field()

def each_clip(self, search_range=None):
if search_range is not None and self.transform is not None:
search_range = self.transform.applied_to(search_range)
return itertools.chain.from_iterable(
(
c.each_clip(search_range) for i, c in enumerate(self.children)
Expand Down
15 changes: 3 additions & 12 deletions opentimelineio/schema/clip.py
@@ -1,8 +1,5 @@
import copy

from .. import (
core,
opentime,
media_reference as mr,
exceptions
)
Expand All @@ -17,7 +14,6 @@ def __init__(
name=None,
media_reference=None,
source_range=None,
transform=None,
):
core.Item.__init__(
self,
Expand All @@ -32,12 +28,10 @@ def __init__(
media_reference = mr.MissingReference()
self.media_reference = media_reference

self.transform = transform

self.properties = {}

name = core.serializeable_field("name")
transform = core.serializeable_field("transform", opentime.TimeTransform)
transform = core.deprecated_field()
media_reference = core.serializeable_field(
"media_reference",
mr.MediaReference
Expand All @@ -56,24 +50,21 @@ def computed_duration(self):
)

def __str__(self):
return 'Clip("{}", {}, {}, {})'.format(
return 'Clip("{}", {}, {})'.format(
self.name,
self.media_reference,
self.transform,
self.source_range,
self.source_range
)

def __repr__(self):
return (
'otio.schema.Clip('
'name={}, '
'media_reference={}, '
'transform={}, '
'source_range={}'
')'.format(
repr(self.name),
repr(self.media_reference),
repr(self.transform),
repr(self.source_range),
)
)
Expand Down
2 changes: 0 additions & 2 deletions opentimelineio/schema/sequence.py
Expand Up @@ -23,7 +23,6 @@ def __init__(
name=None,
children=None,
source_range=None,
transform=None,
kind=SequenceKind.Video,
metadata=None,
):
Expand All @@ -32,7 +31,6 @@ def __init__(
name=name,
children=children,
source_range=source_range,
transform=transform,
metadata=metadata
)
self.kind = kind
Expand Down
5 changes: 2 additions & 3 deletions opentimelineio/schema/stack.py
Expand Up @@ -4,7 +4,8 @@

from .. import (
core,
opentime
opentime,
exceptions
)


Expand All @@ -19,15 +20,13 @@ def __init__(
name=None,
children=None,
source_range=None,
transform=None,
metadata=None
):
core.Composition.__init__(
self,
name=name,
children=children,
source_range=source_range,
transform=transform,
metadata=metadata
)

Expand Down
1 change: 0 additions & 1 deletion tests/baseline/empty_clip.json
Expand Up @@ -2,7 +2,6 @@
"OTIO_SCHEMA" : "Clip.1",
"metadata" : {},
"name" : "test_clip",
"transform" : null,
"source_range" : null,
"markers" : [],
"effects" : [],
Expand Down
3 changes: 1 addition & 2 deletions tests/baseline/empty_sequence.json
Expand Up @@ -9,6 +9,5 @@
"children" : [],
"markers" : [],
"effects" : [],
"kind" : "Video",
"transform" : null
"kind" : "Video"
}
3 changes: 1 addition & 2 deletions tests/baseline/empty_stack.json
Expand Up @@ -8,6 +8,5 @@
"source_range": null,
"children" : [],
"markers" : [],
"effects" : [],
"transform" : null
"effects" : []
}
9 changes: 2 additions & 7 deletions tests/test_clip.py
Expand Up @@ -11,7 +11,6 @@ def test_cons(self):
name = "test"
rt = otio.opentime.RationalTime(5, 24)
tr = otio.opentime.TimeRange(rt, rt)
tt = otio.opentime.TimeTransform(offset=otio.opentime.RationalTime())
mr = otio.media_reference.External(
available_range=otio.opentime.TimeRange(
rt,
Expand All @@ -24,13 +23,11 @@ def test_cons(self):
name=name,
media_reference=mr,
source_range=tr,
transform=tt,
# transition_in
# transition_out
)
self.assertEquals(cl.name, name)
self.assertEquals(cl.source_range, tr)
self.assertEquals(cl.transform, tt)
self.assertEquals(cl.media_reference, mr)
self.assertEquals(cl.source_range, tr)

Expand All @@ -47,14 +44,13 @@ def test_str(self):

self.assertMultiLineEqual(
str(cl),
'Clip("test_clip", MissingReference(), None, None)'
'Clip("test_clip", MissingReference(), None)'
)
self.assertMultiLineEqual(
repr(cl),
'otio.schema.Clip('
"name='test_clip', "
'media_reference=otio.media_reference.MissingReference(), '
'transform=None, '
'source_range=None'
')'
)
Expand All @@ -68,7 +64,7 @@ def test_str_with_filepath(self):
)
self.assertMultiLineEqual(
str(cl),
'Clip("test_clip", External("/var/tmp/foo.mov"), None, None)'
'Clip("test_clip", External("/var/tmp/foo.mov"), None)'
)
self.assertMultiLineEqual(
repr(cl),
Expand All @@ -77,7 +73,6 @@ def test_str_with_filepath(self):
"media_reference=otio.media_reference.External("
"target_url='/var/tmp/foo.mov'"
"), "
'transform=None, '
'source_range=None'
')'
)
Expand Down
4 changes: 0 additions & 4 deletions tests/test_composition.py
Expand Up @@ -43,7 +43,6 @@ def test_str(self):
str(st.name) + ", " +
str(st.children) + ", " +
str(st.source_range) + ", " +
str(st.transform) + ", " +
str(st.metadata) +
")"
)
Expand All @@ -56,7 +55,6 @@ def test_repr(self):
"name=" + repr(st.name) + ", " +
"children=" + repr(st.children) + ", " +
"source_range=" + repr(st.source_range) + ", " +
"transform=" + repr(st.transform) + ", " +
"metadata=" + repr(st.metadata) +
")"
)
Expand Down Expand Up @@ -129,7 +127,6 @@ def test_str(self):
str(sq.name) + ", " +
str(sq.children) + ", " +
str(sq.source_range) + ", " +
str(sq.transform) + ", " +
str(sq.metadata) +
")"
)
Expand All @@ -142,7 +139,6 @@ def test_repr(self):
"name=" + repr(sq.name) + ", " +
"children=" + repr(sq.children) + ", " +
"source_range=" + repr(sq.source_range) + ", " +
"transform=" + repr(sq.transform) + ", " +
"metadata=" + repr(sq.metadata) +
")"
)
Expand Down
8 changes: 0 additions & 8 deletions tests/test_timeline.py
Expand Up @@ -28,7 +28,6 @@ def test_range(self):
track = otio.schema.Sequence(name="test_track")
tl = otio.schema.Timeline("test_timeline", tracks=[track])
rt = otio.opentime.RationalTime(5, 24)
tt = otio.opentime.TimeTransform(offset=rt)
mr = otio.media_reference.External(
available_range=otio.opentime.range_from_start_end_time(
otio.opentime.RationalTime(5, 24),
Expand All @@ -41,19 +40,16 @@ def test_range(self):
name="test clip1",
media_reference=mr,
source_range=otio.opentime.TimeRange(duration=rt),
transform=tt,
)
cl2 = otio.schema.Clip(
name="test clip2",
media_reference=mr,
source_range=otio.opentime.TimeRange(duration=rt),
transform=tt,
)
cl3 = otio.schema.Clip(
name="test clip3",
media_reference=mr,
source_range=otio.opentime.TimeRange(duration=rt),
transform=tt,
)
tl.tracks[0].append(cl)
tl.tracks[0].extend([cl2, cl3])
Expand All @@ -64,7 +60,6 @@ def test_iterators(self):
track = otio.schema.Sequence(name="test_track")
tl = otio.schema.Timeline("test_timeline", tracks=[track])
rt = otio.opentime.RationalTime(5, 24)
tt = otio.opentime.TimeTransform(offset=rt)
mr = otio.media_reference.External(
available_range=otio.opentime.range_from_start_end_time(
otio.opentime.RationalTime(5, 24),
Expand All @@ -80,7 +75,6 @@ def test_iterators(self):
mr.available_range.start_time,
rt
),
transform=tt,
)
cl2 = otio.schema.Clip(
name="test clip2",
Expand All @@ -89,7 +83,6 @@ def test_iterators(self):
mr.available_range.start_time,
rt
),
transform=tt,
)
cl3 = otio.schema.Clip(
name="test clip3",
Expand All @@ -98,7 +91,6 @@ def test_iterators(self):
mr.available_range.start_time,
rt
),
transform=tt,
)
tl.tracks[0].append(cl)
tl.tracks[0].extend([cl2, cl3])
Expand Down

0 comments on commit e08b4d3

Please sign in to comment.