File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -604,7 +604,8 @@ def build_arg_list( # noqa: PLR0912
604
604
605
605
def is_nonstr_iter (value : Any ) -> bool :
606
606
"""
607
- Check if the value is iterable (e.g., list, tuple, array) but not a string.
607
+ Check if the value is iterable (e.g., list, tuple, array) but not a string or a 0-D
608
+ array.
608
609
609
610
Parameters
610
611
----------
@@ -633,8 +634,14 @@ def is_nonstr_iter(value: Any) -> bool:
633
634
True
634
635
>>> is_nonstr_iter(np.array(["abc", "def", "ghi"]))
635
636
True
637
+ >>> is_nonstr_iter(np.array(42))
638
+ False
636
639
"""
637
- return isinstance (value , Iterable ) and not isinstance (value , str )
640
+ return (
641
+ isinstance (value , Iterable )
642
+ and not isinstance (value , str )
643
+ and not (hasattr (value , "ndim" ) and value .ndim == 0 )
644
+ )
638
645
639
646
640
647
def launch_external_viewer (fname : PathLike , waiting : float = 0 ) -> None :
You can’t perform that action at this time.
0 commit comments