Skip to content

Commit

Permalink
Resolve DeprecationWarning: Testing an element's truth value will rai…
Browse files Browse the repository at this point in the history
…se an exception in future versions.

Signed-off-by: Evan Blaudy <[email protected]>
  • Loading branch information
EvanBldy committed Oct 28, 2023
1 parent a8222eb commit 2b14b9e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions contrib/opentimelineio_contrib/adapters/fcpx_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ def _add_asset(self, clip, compound_only=False):
format_element = self._find_or_create_format_from(clip)
asset = self._create_asset_element(clip, format_element)

if not compound_only and not self._asset_clip_by_name(clip.name):
if not compound_only and self._asset_clip_by_name(clip.name) is None:
self._create_asset_clip_element(
clip,
format_element,
Expand Down Expand Up @@ -919,7 +919,7 @@ def _audio_only(self, element):
return True
if element.tag == "asset-clip":
asset = self._asset_by_id(element.get("ref", None))
if asset and asset.get("hasVideo", "0") == "0":
if asset is not None and asset.get("hasVideo", "0") == "0":
return True
if element.tag == "ref-clip":
if element.get("srcEnable", "video") == "audio":
Expand Down Expand Up @@ -1018,7 +1018,7 @@ def _reference_from_id(self, asset_id, default_format):
)
asset_clip = self._assetclip_by_ref(asset_id)
metadata = {}
if asset_clip:
if asset_clip is not None:
metadata = self._create_metadta(asset_clip)
return otio.schema.ExternalReference(
target_url=asset.get("src"),
Expand Down
2 changes: 1 addition & 1 deletion src/py-opentimelineio/opentimelineio/adapters/fcp_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -1498,7 +1498,7 @@ def _build_file(media_reference, br_map):
# will not get recognized
# TODO: We should use a better method for this. Perhaps pre-walk the
# timeline and find all the track kinds this media is present in?
if not file_e.find("media"):
if file_e.find("media") is None:
file_media_e = _get_or_create_subelement(file_e, "media")

audio_exts = {'.wav', '.aac', '.mp3', '.aif', '.aiff', '.m4a'}
Expand Down

0 comments on commit 2b14b9e

Please sign in to comment.