Skip to content

Commit

Permalink
fix truthy/falsey checks
Browse files Browse the repository at this point in the history
  • Loading branch information
ploeber committed Dec 19, 2024
1 parent e2a82d1 commit e1016b7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions assemblyai/transcriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ def wait_for_completion(

self.transcripts = transcripts

if return_failures:
if return_failures is True:
return failures
return None

Expand Down Expand Up @@ -774,9 +774,9 @@ def wait_for_completion(
Args:
return_failures: Whether to return a list of errors for transcripts that failed due to HTTP errors.
"""
if return_failures:
if return_failures is True:
failures = self._impl.wait_for_completion(return_failures=return_failures)
if not failures:
if failures is None:
raise ValueError("return_failures was set but failures object is None")
return self, failures

Expand Down Expand Up @@ -922,23 +922,23 @@ def transcribe_group(
except types.TranscriptError as e:
failures.append(e)

if poll and return_failures:
if poll is True and return_failures is True:
res = transcript_group.wait_for_completion(return_failures=return_failures)
if not isinstance(res, tuple):
raise ValueError(
"return_failures is set but did not receive failures object"
"return_failures was set but did not receive failures object"
)
transcript_group, completion_failures = res
failures.extend(completion_failures)
elif poll:
res = transcript_group.wait_for_completion(return_failures=return_failures)
if not isinstance(res, TranscriptGroup):
raise ValueError(
"return_failures is not set but did receive failures object"
"return_failures was not set but did receive failures object"
)
transcript_group = res

if return_failures:
if return_failures is True:
return transcript_group, failures
else:
return transcript_group
Expand Down

0 comments on commit e1016b7

Please sign in to comment.