Skip to content

Commit

Permalink
Check type inside Sequence and Iterators
Browse files Browse the repository at this point in the history
  • Loading branch information
bdg221 committed Oct 30, 2024
1 parent 3c7b027 commit 7c4a60f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mitiq/executor/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,12 @@ def evaluate(
# check returned type
manual_return_type = None
if len(all_results) > 0:

Check warning on line 210 in mitiq/executor/executor.py

View check run for this annotation

Codecov / codecov/patch

mitiq/executor/executor.py#L210

Added line #L210 was not covered by tests
manual_return_type = type(all_results[0])
if isinstance(all_results[0], Sequence):
manual_return_type = type(all_results[0][0])
elif isinstance(all_results[0], Iterable):
manual_return_type = type(next(iter(all_results[0])))
else:
manual_return_type = type(all_results[0])

# Parse the results.
if manual_return_type in FloatLike:
Expand Down

0 comments on commit 7c4a60f

Please sign in to comment.