Play nice with pickle.
(self, state)
| 2635 | ) |
| 2636 | |
| 2637 | def __setstate__(self, state): |
| 2638 | """ |
| 2639 | Play nice with pickle. |
| 2640 | """ |
| 2641 | if len(state) < len(self.__slots__): |
| 2642 | # Pre-26.1.0 pickle without alias_is_default -- infer it |
| 2643 | # heuristically. |
| 2644 | state_dict = dict(zip(self.__slots__, state)) |
| 2645 | alias_is_default = state_dict.get( |
| 2646 | "alias" |
| 2647 | ) is None or state_dict.get("alias") == _default_init_alias_for( |
| 2648 | state_dict["name"] |
| 2649 | ) |
| 2650 | state = (*state, alias_is_default) |
| 2651 | |
| 2652 | self._setattrs(zip(self.__slots__, state)) |
| 2653 | |
| 2654 | def _setattrs(self, name_values_pairs): |
| 2655 | bound_setattr = _OBJ_SETATTR.__get__(self) |
nothing calls this directly
no test coverage detected