@@ -784,22 +784,21 @@ def _combine_property(self, other, name, allow_duplicates=True):
784
784
new_prop .update (other_prop )
785
785
return new_prop
786
786
else :
787
- # NEW: Handle cases where self_prop is not a list or dict
788
- import numpy as np
787
+ # handle cases where self_prop is not a list or dict
789
788
790
- # Handle numpy arrays specially
789
+ # handle numpy arrays specifically
791
790
if isinstance (self_prop , np .ndarray ) and isinstance (other_prop , np .ndarray ):
792
791
if np .array_equal (self_prop , other_prop ):
793
792
return self_prop
794
793
else :
795
- # Convert to list for combination when arrays are different
794
+ # convert to list for combination when arrays are different
796
795
return (
797
796
list (self_prop ) + [x for x in other_prop if x not in self_prop ]
798
797
if not allow_duplicates
799
798
else list (self_prop ) + list (other_prop )
800
799
)
801
800
elif isinstance (self_prop , np .ndarray ) or isinstance (other_prop , np .ndarray ):
802
- # One is array, one is not - convert to list
801
+ # one is array, one is not - convert to list
803
802
self_list = (
804
803
list (self_prop )
805
804
if isinstance (self_prop , np .ndarray )
@@ -826,7 +825,8 @@ def _combine_property(self, other, name, allow_duplicates=True):
826
825
elif self_prop is not None and other_prop is None :
827
826
return self_prop
828
827
else :
829
- # Different non-None values - this might indicate a problem
828
+ # different non-None values - this might indicate a problem
829
+ # for cases where user intent is unclear
830
830
raise ValueError (
831
831
f"Cannot combine property '{ name } ': component values are different "
832
832
f"({ self_prop } vs { other_prop } ) and cannot be automatically combined"
0 commit comments