Skip to content

Commit

Permalink
Fix linter warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Jean-Christophe Morin <[email protected]>
  • Loading branch information
JeanChristopheMorinPerso committed Mar 9, 2024
1 parent cf764ee commit d19d487
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 31 deletions.
24 changes: 12 additions & 12 deletions src/py-opentimelineio/opentimelineio/core/_core_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,53 +396,53 @@ def __copy__(self, *args, **kwargs):
raise ValueError("SerializableObjects may not be shallow copied.")


@add_method(AnyDictionary)
def to_dict(self):
@add_method(AnyDictionary) # noqa: F811
def to_dict(self): # noqa: F811
"""
Convert to a built-in dict. It will recursively convert all values
to their corresponding python built-in types.
"""
return json.loads(_otio._serialize_json_to_string(_value_to_any(self), {}, 0))


@add_method(AnyVector)
def to_list(self):
@add_method(AnyVector) # noqa: F811
def to_list(self): # noqa: F811
"""
Convert to a built-in list. It will recursively convert all values
to their corresponding python built-in types.
"""
return json.loads(_otio._serialize_json_to_string(_value_to_any(self), {}, 0))


@add_method(SerializableObject)
def to_dict(self):
@add_method(SerializableObject) # noqa: F811
def to_dict(self): # noqa: F811
"""
Convert to a built-in dict. It will recursively convert all values
to their corresponding python built-in types.
"""
return json.loads(_otio._serialize_json_to_string(_value_to_any(self), {}, 0))


@add_method(RationalTime)
def to_dict(self):
@add_method(RationalTime) # noqa: F811
def to_dict(self): # noqa: F811
"""
Convert to a built-in dict. It will recursively convert all values
to their corresponding python built-in types.
"""
return json.loads(_otio._serialize_json_to_string(_value_to_any(self), {}, 0))


@add_method(TimeRange)
def to_dict(self):
@add_method(TimeRange) # noqa: F811
def to_dict(self): # noqa: F811
"""
Convert to a built-in dict. It will recursively convert all values
to their corresponding python built-in types.
"""
return json.loads(_otio._serialize_json_to_string(_value_to_any(self), {}, 0))


@add_method(TimeTransform)
def to_dict(self):
@add_method(TimeTransform) # noqa: F811
def to_dict(self): # noqa: F811
"""
Convert to a built-in dict. It will recursively convert all values
to their corresponding python built-in types.
Expand Down
38 changes: 19 additions & 19 deletions tests/test_core_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,45 +252,45 @@ def test_SerializableObject(self):
so = opentimelineio.core.SerializableObjectWithMetadata(name="asd")
so.metadata["key1"] = opentimelineio.core.Composition()

d = so.to_dict()
self.assertTrue(isinstance(d, dict))
json.dumps(d)
converted = so.to_dict()
self.assertTrue(isinstance(converted, dict))
json.dumps(converted)

def test_AnyDictionary(self):
ad = opentimelineio._otio.AnyDictionary()
ad["my key"] = opentimelineio.core.Composable()

d = ad.to_dict()
self.assertTrue(isinstance(d, dict))
json.dumps(d)
converted = ad.to_dict()
self.assertTrue(isinstance(converted, dict))
json.dumps(converted)

def test_AnyVector(self):
av = opentimelineio._otio.AnyVector()
av.append(1)
av.append(opentimelineio._otio.AnyDictionary())

l = av.to_list()
self.assertTrue(isinstance(l, list))
self.assertEqual(l, [1, {}])
json.dumps(l)
converted = av.to_list()
self.assertTrue(isinstance(converted, list))
self.assertEqual(converted, [1, {}])
json.dumps(converted)

def test_RationalTime(self):
rt = opentimelineio.opentime.RationalTime()

d = rt.to_dict()
self.assertTrue(isinstance(d, dict))
json.dumps(d)
converted = rt.to_dict()
self.assertTrue(isinstance(converted, dict))
json.dumps(converted)

def test_TimeRange(self):
tr = opentimelineio.opentime.TimeRange()

d = tr.to_dict()
self.assertTrue(isinstance(d, dict))
json.dumps(d)
converted = tr.to_dict()
self.assertTrue(isinstance(converted, dict))
json.dumps(converted)

def test_TimeTransform(self):
tt = opentimelineio.opentime.TimeTransform()

d = tt.to_dict()
self.assertTrue(isinstance(d, dict))
json.dumps(d)
converted = tt.to_dict()
self.assertTrue(isinstance(converted, dict))
json.dumps(converted)

0 comments on commit d19d487

Please sign in to comment.