(
self,
state: InstanceState[Any],
dict_: _InstanceDict,
value: Any,
initiator: Optional[AttributeEventToken],
passive: PassiveFlag = PASSIVE_OFF,
)
| 1904 | collection.append_with_event(value, initiator) |
| 1905 | |
| 1906 | def remove( |
| 1907 | self, |
| 1908 | state: InstanceState[Any], |
| 1909 | dict_: _InstanceDict, |
| 1910 | value: Any, |
| 1911 | initiator: Optional[AttributeEventToken], |
| 1912 | passive: PassiveFlag = PASSIVE_OFF, |
| 1913 | ) -> None: |
| 1914 | collection = self.get_collection( |
| 1915 | state, state.dict, user_data=None, passive=passive |
| 1916 | ) |
| 1917 | if collection is PASSIVE_NO_RESULT: |
| 1918 | self.fire_remove_event(state, dict_, value, initiator, key=NO_KEY) |
| 1919 | assert ( |
| 1920 | self.key not in dict_ |
| 1921 | ), "Collection was loaded during event handling." |
| 1922 | state._get_pending_mutation(self.key).remove(value) |
| 1923 | else: |
| 1924 | if TYPE_CHECKING: |
| 1925 | assert isinstance(collection, CollectionAdapter) |
| 1926 | collection.remove_with_event(value, initiator) |
| 1927 | |
| 1928 | def pop( |
| 1929 | self, |
no test coverage detected