PSSH: Merge some collapsible if statements

This commit is contained in:
rlaphoenix 2022-09-10 20:37:41 +01:00
parent 7436c60d00
commit f0df2f4490
1 changed files with 4 additions and 6 deletions

View File

@ -108,12 +108,10 @@ class PSSH:
flags: int = 0 flags: int = 0
) -> PSSH: ) -> PSSH:
"""Craft a new version 0 or 1 PSSH Box.""" """Craft a new version 0 or 1 PSSH Box."""
if key_ids is not None: if key_ids is not None and not isinstance(key_ids, list):
if not isinstance(key_ids, list):
raise TypeError(f"Expected key_ids to be a list not {key_ids!r}") raise TypeError(f"Expected key_ids to be a list not {key_ids!r}")
if init_data is not None: if init_data is not None and not isinstance(init_data, (WidevinePsshData, str, bytes)):
if not isinstance(init_data, (WidevinePsshData, str, bytes)):
raise TypeError(f"Expected init_data to be a {WidevinePsshData}, base64, or bytes, not {init_data!r}") raise TypeError(f"Expected init_data to be a {WidevinePsshData}, base64, or bytes, not {init_data!r}")
if not isinstance(version, int): if not isinstance(version, int):