From d19d48708689a872297fe51ef7ee13e9ad28c6e8 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Morin Date: Fri, 8 Mar 2024 19:49:05 -0500 Subject: [PATCH] Fix linter warnings Signed-off-by: Jean-Christophe Morin --- .../opentimelineio/core/_core_utils.py | 24 ++++++------ tests/test_core_utils.py | 38 +++++++++---------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/py-opentimelineio/opentimelineio/core/_core_utils.py b/src/py-opentimelineio/opentimelineio/core/_core_utils.py index 548a33fac..2692bfab7 100644 --- a/src/py-opentimelineio/opentimelineio/core/_core_utils.py +++ b/src/py-opentimelineio/opentimelineio/core/_core_utils.py @@ -396,8 +396,8 @@ 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. @@ -405,8 +405,8 @@ def to_dict(self): 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. @@ -414,8 +414,8 @@ def to_list(self): 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. @@ -423,8 +423,8 @@ def to_dict(self): 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. @@ -432,8 +432,8 @@ def to_dict(self): 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. @@ -441,8 +441,8 @@ def to_dict(self): 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. diff --git a/tests/test_core_utils.py b/tests/test_core_utils.py index 017830a56..18bfc3bd6 100644 --- a/tests/test_core_utils.py +++ b/tests/test_core_utils.py @@ -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)