(self, state: InstanceState[Any], dict_: _InstanceDict)
| 1231 | self._remove_token = AttributeEventToken(self, OP_REMOVE) |
| 1232 | |
| 1233 | def delete(self, state: InstanceState[Any], dict_: _InstanceDict) -> None: |
| 1234 | if self.dispatch._active_history: |
| 1235 | old = self.get(state, dict_, PASSIVE_RETURN_NO_VALUE) |
| 1236 | else: |
| 1237 | old = dict_.get(self.key, NO_VALUE) |
| 1238 | |
| 1239 | if self.dispatch.remove: |
| 1240 | self.fire_remove_event(state, dict_, old, self._remove_token) |
| 1241 | state._modified_event(dict_, self, old) |
| 1242 | |
| 1243 | existing = dict_.pop(self.key, NO_VALUE) |
| 1244 | if ( |
| 1245 | existing is NO_VALUE |
| 1246 | and old is NO_VALUE |
| 1247 | and not state.expired |
| 1248 | and self.key not in state.expired_attributes |
| 1249 | ): |
| 1250 | raise AttributeError("%s object does not have a value" % self) |
| 1251 | |
| 1252 | def get_history( |
| 1253 | self, |
nothing calls this directly
no test coverage detected