Skip to content

Commit

Permalink
feat: Allow generators as array elements (#1074)
Browse files Browse the repository at this point in the history
  • Loading branch information
skinkie authored Sep 13, 2024
1 parent 9a0e785 commit cff2df1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tests/fixtures/wrapper/sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

obj = Wrapper(
alpha='ααα',
bravo=[
bravo=iter([
1,
2,
],
]),
charlie=[
Charlie(
value='δδδ',
Expand Down
3 changes: 2 additions & 1 deletion xsdata/utils/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Any,
Callable,
Dict,
Generator,
Iterable,
Iterator,
List,
Expand All @@ -20,7 +21,7 @@ def is_array(value: Any) -> bool:
if isinstance(value, tuple):
return not hasattr(value, "_fields")

return isinstance(value, (list, set, frozenset))
return isinstance(value, (list, set, frozenset, Generator))


def unique_sequence(items: Iterable[T], key: Optional[str] = None) -> List[T]:
Expand Down

0 comments on commit cff2df1

Please sign in to comment.