MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / remove

Method remove

lib/sqlalchemy/orm/attributes.py:1882–1902  ·  view source on GitHub ↗
(
        self,
        state: InstanceState[Any],
        dict_: _InstanceDict,
        value: Any,
        initiator: Optional[AttributeEventToken],
        passive: PassiveFlag = PASSIVE_OFF,
    )

Source from the content-addressed store, hash-verified

1880 collection.append_with_event(value, initiator)
1881
1882 def remove(
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, state.dict, user_data=None, passive=passive
1892 )
1893 if collection is PASSIVE_NO_RESULT:
1894 self.fire_remove_event(state, dict_, value, initiator, key=NO_KEY)
1895 assert (
1896 self.key not in dict_
1897 ), "Collection was loaded during event handling."
1898 state._get_pending_mutation(self.key).remove(value)
1899 else:
1900 if TYPE_CHECKING:
1901 assert isinstance(collection, CollectionAdapter)
1902 collection.remove_with_event(value, initiator)
1903
1904 def pop(
1905 self,

Callers 1

popMethod · 0.95

Calls 5

get_collectionMethod · 0.95
fire_remove_eventMethod · 0.95
_get_pending_mutationMethod · 0.80
remove_with_eventMethod · 0.80
removeMethod · 0.45

Tested by

no test coverage detected