Skip to content

Commit 2c4d075

Browse files
committed
Improve docstrings in _combine_property
1 parent ca4de56 commit 2c4d075

File tree

1 file changed

+6
-6
lines changed
  • pymc_extras/statespace/models/structural

1 file changed

+6
-6
lines changed

pymc_extras/statespace/models/structural/core.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -784,22 +784,21 @@ def _combine_property(self, other, name, allow_duplicates=True):
784784
new_prop.update(other_prop)
785785
return new_prop
786786
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
789788

790-
# Handle numpy arrays specially
789+
# handle numpy arrays specifically
791790
if isinstance(self_prop, np.ndarray) and isinstance(other_prop, np.ndarray):
792791
if np.array_equal(self_prop, other_prop):
793792
return self_prop
794793
else:
795-
# Convert to list for combination when arrays are different
794+
# convert to list for combination when arrays are different
796795
return (
797796
list(self_prop) + [x for x in other_prop if x not in self_prop]
798797
if not allow_duplicates
799798
else list(self_prop) + list(other_prop)
800799
)
801800
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
803802
self_list = (
804803
list(self_prop)
805804
if isinstance(self_prop, np.ndarray)
@@ -826,7 +825,8 @@ def _combine_property(self, other, name, allow_duplicates=True):
826825
elif self_prop is not None and other_prop is None:
827826
return self_prop
828827
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
830830
raise ValueError(
831831
f"Cannot combine property '{name}': component values are different "
832832
f"({self_prop} vs {other_prop}) and cannot be automatically combined"

0 commit comments

Comments
 (0)