| 983 | |
| 984 | @classmethod |
| 985 | def safe_merge(cls, other: "Options") -> Any: |
| 986 | d = other._state_dict() |
| 987 | |
| 988 | # only support a merge with another object of our class |
| 989 | # and which does not have attrs that we don't. otherwise |
| 990 | # we risk having state that might not be part of our cache |
| 991 | # key strategy |
| 992 | |
| 993 | if ( |
| 994 | cls is not other.__class__ |
| 995 | and other._cache_attrs |
| 996 | and set(other._cache_attrs).difference(cls._cache_attrs) |
| 997 | ): |
| 998 | raise TypeError( |
| 999 | "other element %r is not empty, is not of type %s, " |
| 1000 | "and contains attributes not covered here %r" |
| 1001 | % ( |
| 1002 | other, |
| 1003 | cls, |
| 1004 | set(other._cache_attrs).difference(cls._cache_attrs), |
| 1005 | ) |
| 1006 | ) |
| 1007 | return cls + d |
| 1008 | |
| 1009 | @classmethod |
| 1010 | def from_execution_options( |