(
self,
state: InstanceState[Any],
dict_: _InstanceDict,
value: Any,
initiator: Optional[AttributeEventToken],
passive: PassiveFlag = PASSIVE_OFF,
)
| 1880 | return adapter, collection |
| 1881 | |
| 1882 | def append( |
| 1883 | self, |
| 1884 | state: InstanceState[Any], |
| 1885 | dict_: _InstanceDict, |
| 1886 | value: Any, |
| 1887 | initiator: Optional[AttributeEventToken], |
| 1888 | passive: PassiveFlag = PASSIVE_OFF, |
| 1889 | ) -> None: |
| 1890 | collection = self.get_collection( |
| 1891 | state, dict_, user_data=None, passive=passive |
| 1892 | ) |
| 1893 | if collection is PASSIVE_NO_RESULT: |
| 1894 | value = self.fire_append_event( |
| 1895 | state, dict_, value, initiator, key=NO_KEY |
| 1896 | ) |
| 1897 | assert ( |
| 1898 | self.key not in dict_ |
| 1899 | ), "Collection was loaded during event handling." |
| 1900 | state._get_pending_mutation(self.key).append(value) |
| 1901 | else: |
| 1902 | if TYPE_CHECKING: |
| 1903 | assert isinstance(collection, CollectionAdapter) |
| 1904 | collection.append_with_event(value, initiator) |
| 1905 | |
| 1906 | def remove( |
| 1907 | self, |
nothing calls this directly
no test coverage detected