Expire a state if persistent, else expunge if pending
(
self, state: InstanceState[Any], autoflush: Optional[bool] = None
)
| 3394 | self._conditional_expire(st_) |
| 3395 | |
| 3396 | def _conditional_expire( |
| 3397 | self, state: InstanceState[Any], autoflush: Optional[bool] = None |
| 3398 | ) -> None: |
| 3399 | """Expire a state if persistent, else expunge if pending""" |
| 3400 | |
| 3401 | if state.key: |
| 3402 | state._expire(state.dict, self.identity_map._modified) |
| 3403 | elif state in self._new: |
| 3404 | self._new.pop(state) |
| 3405 | state._detach(self) |
| 3406 | |
| 3407 | def expunge(self, instance: object) -> None: |
| 3408 | """Remove the `instance` from this ``Session``. |
no test coverage detected