MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / remove

Method remove

lib/sqlalchemy/orm/attributes.py:1906–1926  ·  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

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,

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